Skip to content

Drive Google provider adapters (Gemini, Vertex) from declarative specs - #7153

Merged
lpcox merged 3 commits into
mainfrom
copilot/duplicate-google-provider-adapter
Aug 9, 2026
Merged

Drive Google provider adapters (Gemini, Vertex) from declarative specs#7153
lpcox merged 3 commits into
mainfrom
copilot/duplicate-google-provider-adapter

Conversation

Copilot AI commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

providers/gemini.js and providers/vertex.js were near-identical wrappers around createGoogleApiKeyAdapter(), each hand-repeating port, target, paths, health service name, and two error message strings. Any new Google-family provider would copy the same boilerplate, with drift risk on the strings that are actually derivable.

Changes

  • New providers/google-provider-specs.jsGOOGLE_PROVIDER_SPECS table with one entry per provider: name, label, port, envConstants, defaultTarget, validationPath, modelsPath, and an optional transformRequestUrl hook (used only by Gemini to strip ?key=).

  • providers/google-adapter.js — adds createGoogleProviderAdapter(providerKey, env, deps), which resolves the spec and derives the previously duplicated strings from it:

    • healthServiceNameawf-api-proxy-${name}
    • unconfiguredErrorMessage${label} proxy not configured (no ${KEY_ENV})...
    • healthErrorMessage${KEY_ENV} not configured in api-proxy sidecar

    Unknown keys throw. createGoogleApiKeyAdapter() is unchanged and still exported.

  • providers/gemini.js / providers/vertex.js — reduced to one-line delegations; module boundaries and exported factory names are preserved, so providers/index.js and existing callers are untouched.

  • providers/google-adapter.test.js — covers message/port/target derivation for both providers, transform presence vs. absence, modelsPath: null yielding no models fetch config, and x-goog-api-key auth headers.

  • docs/authentication-architecture.md — file-reference row updated for the new module.

Adding another Google-backed provider is now a spec entry plus a trivial wrapper:

function createVertexAdapter(env, deps = {}) {
  return createGoogleProviderAdapter('vertex', env, deps);
}

Behavior is intended to be byte-identical: adapter name, port, isEnabled(), the 503 unconfigured body, the /health body, reflection info, models fetch config, and URL-transform presence were compared before and after.

Notes for reviewers

  • The label field ('Gemini', 'Vertex AI') exists solely to reproduce the existing error copy exactly rather than deriving it from name.
  • transformRequestUrl is spread conditionally so Vertex keeps transformRequestUrl === undefined rather than gaining a no-op identity function — providers/index.js documents that property as optional.

Copilot AI changed the title [WIP] Refactor Google provider adapter wrappers to eliminate duplicate code Drive Google provider adapters (Gemini, Vertex) from declarative specs Aug 9, 2026
Copilot AI requested a review from lpcox August 9, 2026 16:07
@lpcox
lpcox marked this pull request as ready for review August 9, 2026 16:32
Copilot AI balanced review requested due to automatic review settings August 9, 2026 16:32

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Refactors Gemini and Vertex adapters to use shared declarative provider specifications while preserving behavior.

Changes:

  • Adds centralized Google provider specifications and factory logic.
  • Simplifies Gemini and Vertex wrappers.
  • Adds behavior tests and updates architecture documentation.
Show a summary per file
File Description
docs/authentication-architecture.md Documents the specification module.
containers/api-proxy/providers/vertex.js Delegates Vertex creation to the shared factory.
containers/api-proxy/providers/google-provider-specs.js Defines Gemini and Vertex specifications.
containers/api-proxy/providers/google-adapter.test.js Tests derived configuration and behavior.
containers/api-proxy/providers/google-adapter.js Builds adapters from provider specifications.
containers/api-proxy/providers/gemini.js Delegates Gemini creation to the shared factory.

Review details

Tip

Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

  • Files reviewed: 6/6 changed files
  • Comments generated: 1
  • Review effort level: Balanced

Comment thread containers/api-proxy/providers/google-provider-specs.js Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@github-actions

github-actions Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

✅ Copilot review passed with no inline comments.

@copilot Add the ready-for-aw label to this PR to trigger agentic CI smoke tests.

@github-actions

github-actions Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Documentation Preview

Documentation build failed for this PR. View logs.

Built from commit 9ab36f3

@github-actions

github-actions Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

✅ Coverage Check Passed

Overall Coverage

Metric Base PR Delta
Lines 94.09% 94.11% 📈 +0.02%
Statements 93.06% 93.09% 📈 +0.03%
Functions 94.47% 94.47% ➡️ +0.00%
Branches 86.27% 86.29% 📈 +0.02%
📁 Per-file Coverage Changes (1 files)
File Lines (Before → After) Statements (Before → After)
src/log-directory-setup.ts 96.2% → 100.0% (+3.78%) 96.3% → 100.0% (+3.71%)

Coverage comparison generated by scripts/ci/compare-coverage.ts

@github-actions

github-actions Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

📡 Smoke OTel Tracing completed. All tracing scenarios validated. ✅

📡 OTel tracing validated by Smoke OTel Tracing

@github-actions

github-actions Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

📰 VERDICT: Smoke Copilot has concluded. All systems operational. This is a developing story. 🎤

📰 BREAKING: Report filed by Smoke Copilot

@github-actions

github-actions Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

📰 VERDICT: Smoke Docker Sbx has concluded. All systems operational. This is a developing story. 🎤

📰 BREAKING: Report filed by Smoke Docker Sbx

@github-actions

github-actions Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Contribution Check completed successfully!

PR #7153 appears to follow CONTRIBUTING.md: the change is well-contained, adds unit tests for the new declarative provider-spec path, and updates the architecture docs. No missing guideline items requiring a review comment were found.

Generated by Contribution Check for #7153

@github-actions

github-actions Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Smoke Copilot BYOK AOAI (Entra) reports failed. AOAI BYOK (Entra) mode investigation needed...

🪪 BYOK (AOAI Entra) report filed by Smoke Copilot BYOK AOAI (Entra)

@github-actions

github-actions Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

🛡️ Smoke Copilot Network Isolation reports failed while checking network isolation. Investigate the egress model.

EGRESS_RESULT allow=pass deny=pass. Allowed domain (api.github.com) reachable HTTP 200; blocked domain (example.com) denied via proxy 403. Overall: PASS. No PR context detected (empty trigger event), so comment/label skipped per instructions.

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • example.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "example.com"

See Network Configuration for more information.

🛡️ Egress verdict from Smoke Copilot Network Isolation

@github-actions

github-actions Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Build Test Suite completed successfully!

Generated by Build Test Suite for #7153

@github-actions

github-actions Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Smoke Claude passed

Generated by Smoke Claude for #7153

@github-actions

github-actions Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Chroot tests passed! Smoke Chroot - All security and functionality tests succeeded.

Tested by Smoke Chroot

@github-actions

github-actions Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Smoke Copilot BYOK completed. Copilot BYOK mode operational. 🔓

🔑 BYOK report filed by Smoke Copilot BYOK

@github-actions

github-actions Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Security Guard completed successfully!

Security review of PR #7153: No security issues found. Changes refactor Google provider adapter configuration by centralizing specs into a declarative object. All existing security controls (authentication, URL transformation, port assignments, target domains) are preserved. Input validation is actually strengthened with a runtime provider key check. No egress, capability, or firewall changes.

Generated by Security Guard for #7153

@github-actions

github-actions Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Smoke Copilot BYOK AOAI (api-key) reports failed. AOAI BYOK (api-key) mode investigation needed...

🔑 BYOK (AOAI api-key) report filed by Smoke Copilot BYOK AOAI (api-key)

@github-actions

github-actions Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

🔌 Smoke Services — All services reachable! ✅

🔌 Service connectivity validated by Smoke Services

@github-actions

github-actions Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Smoke Gemini completed. All facets verified. 💎

Smoke test completed with FAIL status. Connectivity and MCP titles were restricted.

💎 Faceted by Smoke Gemini

@github-actions

github-actions Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

✨ The prophecy is fulfilled... Smoke Codex has completed its mystical journey. The stars align. 🌟

Warning

Firewall blocked 5 domains

The following domains were blocked by the firewall during workflow execution:

  • msfeed12.pkgs.visualstudio.com
  • msfeed17.pkgs.visualstudio.com
  • msfeed2.pkgs.visualstudio.com
  • msfeed25.pkgs.visualstudio.com
  • registry.npmjs.org

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "msfeed12.pkgs.visualstudio.com"
    - "msfeed17.pkgs.visualstudio.com"
    - "msfeed2.pkgs.visualstudio.com"
    - "msfeed25.pkgs.visualstudio.com"
    - "registry.npmjs.org"

See Network Configuration for more information.

🔮 The oracle has spoken through Smoke Codex

@github-actions

github-actions Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Smoke Test: Claude Engine Validation

Check Status
API ✅ PASS
GH CLI ✅ PASS
File ✅ PASS

Overall result: PASS

Generated by Smoke Claude for #7153 · haiku45 · 54.9 AIC · ⊞ 3.6K ·
Add label ready-for-aw to run again

@github-actions

github-actions Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Smoke Test: Copilot BYOK (Direct) Mode

Running in direct BYOK mode (COPILOT_PROVIDER_API_KEY) via api-proxy → api.githubcopilot.com

Overall: PASS

cc @lpcox

🔑 BYOK report filed by Smoke Copilot BYOK
Add label ready-for-aw to run again

@github-actions

github-actions Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Smoke Test: Copilot Engine@lpcox

Overall: PASS

📰 BREAKING: Report filed by Smoke Copilot
Add label ready-for-aw to run again

@github-actions

github-actions Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Smoke Test: API Proxy OTEL Tracing — all scenarios passed

  • ✅ Scenario 1 (Module Loading): otel.js loads correctly, exports startRequestSpan, setTokenAttributes, setBudgetAttributes, endSpan, endSpanError, shutdown, isEnabled.
  • ✅ Scenario 2 (Test Suite): otel.test.js, otel-fanout.test.js, otel-workload-identity.test.js — 68/68 tests passed.
  • ✅ Scenario 3 (Env Var Forwarding): env-passthrough.ts forwards GITHUB_AW_OTEL_TRACE_ID/GITHUB_AW_OTEL_PARENT_SPAN_ID to agent; api-proxy-env-config.ts forwards OTLP endpoint/headers + trace context to api-proxy.
  • ✅ Scenario 4 (Token Tracker Integration): onUsage callback confirmed in token-tracker-http.js (wired via proxy-request.js/upstream-token.js) as the OTEL hook point.
  • ✅ Scenario 5 (OTEL Diagnostics): module and span-attribute plumbing verified functional; no live upstream traffic in this smoke test, so no exported spans to inspect (expected).

Overall: PASS.

📡 OTel tracing validated by Smoke OTel Tracing
Add label ready-for-aw to run again

@github-actions

github-actions Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Smoke Test Results

Overall Status: FAIL

💎 Faceted by Smoke Gemini
Add label ready-for-aw to run again

@github-actions

github-actions Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Smoke Test: Services Connectivity

  • Redis PING: ❌ (Temporary failure in name resolution)
  • PostgreSQL pg_isready: ❌ (no response)
  • PostgreSQL SELECT 1: ❌ (could not translate host name)

Overall: FAILhost.docker.internal DNS resolution failed inside the AWF sandbox.

🔌 Service connectivity validated by Smoke Services
Add label ready-for-aw to run again

@github-actions

github-actions Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

🏗️ Build Test Suite Results

Ecosystem Project Build/Install Tests Status
Bun elysia 1/1 passed ✅ PASS
Bun hono 1/1 passed ✅ PASS
C++ fmt N/A ✅ PASS
C++ json N/A ✅ PASS
Deno oak N/A 1/1 passed ✅ PASS
Deno std N/A 1/1 passed ✅ PASS
.NET hello-world N/A (run OK) ✅ PASS
.NET json-parse N/A (run OK) ✅ PASS
Go color ok ✅ PASS
Go env ok ✅ PASS
Go uuid ok ✅ PASS
Java gson 1/1 passed ✅ PASS
Java caffeine 1/1 passed ✅ PASS
Node.js clsx all passed ✅ PASS
Node.js execa all passed ✅ PASS
Node.js p-limit all passed ✅ PASS
Rust fd 1/1 passed ✅ PASS
Rust zoxide 1/1 passed ✅ PASS

Overall: 8/8 ecosystems passed — PASS

Note: Java's ~/.m2/repository was not writable by the runner user, so -Dmaven.repo.local=/tmp/gh-aw/agent/m2repo was used as a local workaround (unrelated to the firewall itself); all builds/tests still succeeded through the Squid proxy.

Generated by Build Test Suite for #7153 · auto · 33.7 AIC · ⊞ 11.5K ·
Add label ready-for-aw to run again

@github-actions

github-actions Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Chroot Version Comparison Results

Runtime Host Version Chroot Version Match?
Python Python 3.12.13 Python 3.12.13 ✅ YES
Node.js v24.18.0 v22.23.2 ❌ NO
Go go1.22.12 go1.22.12 ✅ YES

Overall: FAILED — Node.js version differs between host and chroot environment.

Tested by Smoke Chroot
Add label ready-for-aw to run again

@github-actions

github-actions Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Merged PRs: "docs: clarify /usr/local read-only mount and hardcoded-binary-path workarounds"; "Upgrade gh-aw extension to latest pre-release and recompile workflows"
Queried PRs: "Drive Google provider adapters (Gemini, Vertex) from declarative specs"; "Confirm --allow-host-ports works standalone with --enable-host-access in strict security mode"
GitHub merged PR review: ✅
safeinputs-gh PR query: ❌ tool unavailable in session
Playwright title contains GitHub: ✅
Temp file write/read: ✅
Discussion lookup/comment: ❌ lookup ok (#7145), discussion comments disabled by workflow permissions
Build (npm ci && npm run build): ❌ E403 fetching yocto-queue-0.1.0.tgz
Overall status: FAIL

Warning

Firewall blocked 5 domains

The following domains were blocked by the firewall during workflow execution:

  • msfeed12.pkgs.visualstudio.com
  • msfeed17.pkgs.visualstudio.com
  • msfeed2.pkgs.visualstudio.com
  • msfeed25.pkgs.visualstudio.com
  • registry.npmjs.org

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "msfeed12.pkgs.visualstudio.com"
    - "msfeed17.pkgs.visualstudio.com"
    - "msfeed2.pkgs.visualstudio.com"
    - "msfeed25.pkgs.visualstudio.com"
    - "registry.npmjs.org"

See Network Configuration for more information.

🔮 The oracle has spoken through Smoke Codex
Add label ready-for-aw to run again

@github-actions

github-actions Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Smoke Test: Docker Sbx — PASS ✅

  • ✅ GitHub MCP connectivity confirmed
  • ✅ GitHub.com reachable (HTTP 200)
  • ✅ File write/read test passed

Recent merged PRs:

Overall: PASS

cc @lpcox

📰 BREAKING: Report filed by Smoke Docker Sbx
Add label ready-for-aw to run again

@lpcox
lpcox merged commit ace59e2 into main Aug 9, 2026
135 of 139 checks passed
@lpcox
lpcox deleted the copilot/duplicate-google-provider-adapter branch August 9, 2026 17:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Duplicate Code] Google provider adapter wrappers repeat the same factory setup

3 participants