Fix Gemini CLI Vertex routing and authentication - #1105
Open
kywch wants to merge 5 commits into
Open
Conversation
Collaborator
|
Thermo-nuclear review at exact head
Merge gate remains: one independent human approval plus either a reviewer-verifiable exact-head live artifact or Vertex-enabled credentials for a fresh exact-head run. I requested |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
BenchFlow configured Gemini CLI's Vertex mode with the Gemini API endpoint setting. Vertex mode ignores that setting, so the CLI contacted Google Vertex directly using BenchFlow's internal gateway key. Google rejected that key with 401. This is a BenchFlow routing bug; no Gemini CLI change is required.
This fix sets the correct Vertex endpoint and enables LiteLLM's native Vertex passthrough:
The gateway authenticates the CLI, resolves the project/location, and supplies Google credentials upstream. Existing Gemini API and translated Vertex routes remain supported. Stale Vertex endpoint overrides are cleared before wiring the gateway. The Gemini API route also clears inherited bearer mode so the CLI uses the x-goog-api-key header expected by that endpoint.
Validation:
70 focused tests passed; Ruff and type checks passed. Routing coverage uses gemini-3.1-pro-preview, gemini-3.8-flash, and gemini-3.5-flash-lite. Stale-bearer regression failed in all three API cases before the fix and passes afterward.
Full suite before the later test parameterization and stale-bearer follow-up: 6,003 passed, 48 skipped, 7 deselected; 3 failures reproduced on unchanged baseline. The baseline failures came from terminal-width wrapping and host Claude login detection; those 3 passed with an isolated home and wider terminal.
Live canaries on
gdoc-search-by-titleall scored 1.0: Gemini CLI +google-vertex/gemini-3.1-flash-liteon Docker and Daytona; Gemini CLI +google/gemini-3.1-flash-liteon Docker; Claude ACP +anthropic-vertex/claude-sonnet-4-6on Docker. Vertex usedglobaland ADC; Gemini API credentials were tested separately.Artifact validator passed for all four canaries. Manual review found an existing Gemini training-export issue: tool-call ID matching drops tool responses despite intact raw captures. Reproduced on the earlier API route; outside this routing fix.
Additional live Vertex/global calls returned HTTP 200 with matching model versions for Pro 3.1, Flash 3.8, and Flash-Lite 3.5. Docker task scores: Pro 1.0, Flash 1.0, Flash-Lite 0.0 (agent stopped early; no provider/auth error). These runs verified model execution before the API-only stale-bearer cleanup.
Additional artifact checks: Pro and Flash-Lite passed the validator. Flash 3.8 completed the task but training export failed with missing_tool_defs. Successful model/auth execution does not imply training-export readiness; export issues remain outside this fix.