Conversation
✅ Coverage Check PassedOverall Coverage
📁 Per-file Coverage Changes (1 files)
Coverage comparison generated by |
There was a problem hiding this comment.
Pull request overview
Updates AWF’s api-proxy sidecar routing so the Gemini CLI uses the correct environment variable (GOOGLE_GEMINI_BASE_URL) to route Gemini traffic through the sidecar for key injection, preventing direct calls to generativelanguage.googleapis.com that fail with API_KEY_INVALID.
Changes:
- Set
GOOGLE_GEMINI_BASE_URL(Gemini CLI) alongsideGEMINI_API_BASE_URL(older SDK compatibility) whengeminiApiKeyis configured. - Exclude
GOOGLE_GEMINI_BASE_URLfrom--env-allpassthrough to prevent host env bleed-through. - Add/extend tests and docs to cover the new env var behavior and intended routing.
Show a summary per file
| File | Description |
|---|---|
| src/docker-manager.ts | Sets GOOGLE_GEMINI_BASE_URL to the Gemini api-proxy listener URL (and keeps GEMINI_API_BASE_URL) and excludes the new var from --env-all inheritance. |
| src/docker-manager.test.ts | Adds tests verifying GOOGLE_GEMINI_BASE_URL behavior (set with Gemini key, not set/ not inherited without it). |
| docs/authentication-architecture.md | Documents both Gemini base URL env vars and clarifies which one the Gemini CLI reads. |
| docs/api-proxy-sidecar.md | Updates env var table and notes for Gemini routing; troubleshooting section also updated (but currently conflicts with code behavior). |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 4/4 changed files
- Comments generated: 2
| EXCLUDED_ENV_VARS.add('ANTHROPIC_API_KEY'); | ||
| EXCLUDED_ENV_VARS.add('CLAUDE_API_KEY'); | ||
| EXCLUDED_ENV_VARS.add('GEMINI_API_KEY'); | ||
| EXCLUDED_ENV_VARS.add('GOOGLE_GEMINI_BASE_URL'); |
There was a problem hiding this comment.
GOOGLE_GEMINI_BASE_URL is excluded from --env-all passthrough, but GEMINI_API_BASE_URL is not. In non-Gemini runs with --env-all, a host-defined GEMINI_API_BASE_URL will still be inherited because the Gemini routing block doesn’t run, which can accidentally re-enable Gemini SDK traffic (or at least cause confusing/proxy-bypass behavior). Consider adding GEMINI_API_BASE_URL to EXCLUDED_ENV_VARS (and/or explicitly deleting/overriding it when config.geminiApiKey is absent) for consistency with the “Gemini setup is conditional” intent.
| EXCLUDED_ENV_VARS.add('GOOGLE_GEMINI_BASE_URL'); | |
| EXCLUDED_ENV_VARS.add('GOOGLE_GEMINI_BASE_URL'); | |
| EXCLUDED_ENV_VARS.add('GEMINI_API_BASE_URL'); |
| ### Gemini proxy returns 503 | ||
|
|
||
| When `--enable-api-proxy` is active, `GEMINI_API_BASE_URL` and a placeholder `GEMINI_API_KEY` are always injected into the agent container. If the real `GEMINI_API_KEY` was not set in the AWF runner environment, the api-proxy Gemini listener (port 10003) responds with **503** to all requests. | ||
| When `--enable-api-proxy` is active, `GOOGLE_GEMINI_BASE_URL`, `GEMINI_API_BASE_URL`, and a placeholder `GEMINI_API_KEY` are always injected into the agent container. If the real `GEMINI_API_KEY` was not set in the AWF runner environment, the api-proxy Gemini listener (port 10003) responds with **503** to all requests. | ||
|
|
There was a problem hiding this comment.
This troubleshooting text says the Gemini base URL vars and placeholder GEMINI_API_KEY are “always injected” when --enable-api-proxy is active, but generateDockerCompose only configures the Gemini env vars/placeholder when geminiApiKey is provided. Update this section to reflect the conditional behavior (or, if the doc is correct, the code needs to be updated to match).
|
@copilot address the review feedback |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Done in commit 09cb7e1:
|
Smoke Test Results: Gemini Engine
Overall Status: PASS PR Titles:
cc:
|
|
Smoke Test: Copilot BYOK — Run #25218663643
Running in BYOK offline mode ( Overall: PASS — Author:
|
|
Smoke Test Results ✅ GitHub API: #2339, #2337 Overall: PASS
|
🔬 Smoke Test Results
PR: fix(api-proxy): set GOOGLE_GEMINI_BASE_URL to route Gemini CLI through sidecar Overall: FAIL — pre-computed test data (
|
Chroot Version Comparison Results
Result: ❌ Not all tests passed — Python and Node.js versions differ between host and chroot environments.
|
Smoke Test
Warning Firewall blocked 1 domainThe following domain was blocked by the firewall during workflow execution:
network:
allowed:
- defaults
- "registry.npmjs.org"See Network Configuration for more information.
|
Smoke Test Results
Overall: FAIL —
|
🏗️ Build Test Suite Results
Overall: 8/8 ecosystems passed — ✅ PASS
|
|
@copilot look into why this ci check is failing https://github.com/github/gh-aw-firewall/actions/runs/25218663391/job/73946029400?pr=2348 |
This CI failure is unrelated to the code changes in this PR. Root cause: The Gemini CLI v0.37.2 is calling MCP This is a pre-existing, intermittent MCP compatibility issue — run #143 on |
The Gemini CLI reads
GOOGLE_GEMINI_BASE_URLto redirect its API endpoint — notGEMINI_API_BASE_URL. AWF was only setting the latter, so the CLI bypassed the api-proxy sidecar entirely and hitgenerativelanguage.googleapis.comdirectly without key injection, causing400 API_KEY_INVALIDerrors.Changes
src/docker-manager.ts: WhengeminiApiKeyis set, now emits bothGOOGLE_GEMINI_BASE_URL(primary — read bygoogle-gemini/gemini-cli) andGEMINI_API_BASE_URL(kept for backward compat with older@google/generative-aiSDK usage), both pointing tohttp://172.30.0.30:10003. Also adds bothGOOGLE_GEMINI_BASE_URLandGEMINI_API_BASE_URLtoEXCLUDED_ENV_VARSto prevent host env bleed-through via--env-allin non-Gemini runs.src/docker-manager.test.ts: Five new tests assertingGOOGLE_GEMINI_BASE_URLis set to the sidecar URL when a Gemini key is present, matchesGEMINI_API_BASE_URL, is absent when no Gemini key is configured, and that neitherGOOGLE_GEMINI_BASE_URLnorGEMINI_API_BASE_URLis inherited from the host via--env-all.docs/: Updatedauthentication-architecture.mdandapi-proxy-sidecar.mdto document both env vars, clarify which one the CLI reads, and correct the troubleshooting section to reflect that the Gemini routing vars are only injected whengeminiApiKeyis provided (not "always" when--enable-api-proxyis active).The fix was traced to
contentGenerator.tsin the Gemini CLI source: