Repository navigation
Conversation
The claude backend reaches Claude through Claude Code, which natively supports Vertex, but buildClaudeEnv's allowlist stripped the Vertex routing vars so they never reached the spawned child. Forward them: CLAUDE_CODE_USE_VERTEX, ANTHROPIC_VERTEX_PROJECT_ID, GOOGLE_CLOUD_PROJECT, GCLOUD_PROJECT, CLOUD_ML_REGION, GOOGLE_APPLICATION_CREDENTIALS, CLOUDSDK_CONFIG, CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS, and dynamic VERTEX_REGION_CLAUDE_*. Secrets outside the allowlist stay dropped. Run it with gcloud ADC plus --agent claude --model-auth local and the Vertex env set. Adds a unit test and a Vertex section in docs/models.md. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
@Nehanth is attempting to deploy a commit to the Vercel Labs Team on Vercel. A member of the Team first needs to authorize it. |
🤖 auto-maintain reviewAutomated, advisory triage for
Review panel: 🔴 high highest severity deepsec maintainer code review: 🟡 medium
General code review: 🔴 high
Scanner and matcher quality: 🔴 high
Sandbox and credential boundaries: 🟡 medium
Durability and distributed state: 🟢 low
Posted by auto-maintain. This automated code review is advisory; a human maintainer makes the call. |
Address the review on Vertex support: - Gate the Vertex env block on CLAUDE_CODE_USE_VERTEX, so non-Vertex runs forward no Vertex-related vars. - Stop forwarding GOOGLE_APPLICATION_CREDENTIALS and CLOUDSDK_CONFIG. Rely on ADC discovery from the well-known path (HOME, or APPDATA on Windows) so no credential-file pointer enters the repo-reading agent's environment. - Allowlist APPDATA and LOCALAPPDATA so ADC discovery works on Windows. - Clear CLAUDE_CODE_USE_VERTEX in applyResolvedModelRoute, so an explicit gateway/direct route wins over an ambient Vertex setup instead of silently routing to Vertex with mismatched billing and attribution. - Docs: ADC login only, local route only, narrowly-scoped identity note. Tests cover the gate, the dropped credential pointers, and a non-local route clearing the switch. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
What
Lets the
claudebackend run Claude from Google Vertex AI (Anthropic's partner models in Model Garden).Why
The
claudebackend reaches Claude through Claude Code, which already supports Vertex. ButbuildClaudeEnv's env allowlist forwards only the gateway/direct/OAuth credential vars, so the Vertex routing vars were stripped and never reached the spawnedclaudechild. Running on Vertex was therefore impossible even with a fully configured machine.Change
Forward the Vertex routing vars that Claude Code reads:
CLAUDE_CODE_USE_VERTEX,ANTHROPIC_VERTEX_PROJECT_ID,GOOGLE_CLOUD_PROJECT,GCLOUD_PROJECT,CLOUD_ML_REGION,GOOGLE_APPLICATION_CREDENTIALS,CLOUDSDK_CONFIG,CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS, and the dynamicVERTEX_REGION_CLAUDE_*overrides. The allowlist stays tight: anything outside it (for exampleGITHUB_TOKEN) is still dropped.Vertex authenticates with Google Application Default Credentials rather than an API key, so there is no credential to broker. This rides on the existing
localroute.Usage
Testing
buildClaudeEnvtests pass;biomelint andpnpm -r buildare clean.claude-sonnet-4-6: a smoke repo and a real Java package (commons-cli), both completing a full scan while authenticating through GCP ADC.Docs: adds a 'Claude on Google Vertex AI' section to
docs/models.md.Notes
CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1is required on Vertex, which rejects the Anthropic beta headers the SDK adds by default. A dedicated--model-auth vertexroute (interactive prompt, preflight, auto-setting the beta flag) is a sensible follow-up; this PR is the minimal enabler.