Skip to content

Support Claude on Vertex AI with GCP WIF - #72273

Open
pelikhan with Copilot wants to merge 4 commits into
mainfrom
copilot/support-claude-on-vertex-ai
Open

pelikhan with Copilot wants to merge 4 commits into
mainfrom
copilot/support-claude-on-vertex-ai

Conversation

Copilot AI commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Claude accepted GCP WIF configuration but still required an Anthropic key, lacked Vertex routing, and disabled retries needed while the initial token exchange was pending.

  • Authentication: Detect complete GCP WIF configuration, skip Anthropic secret validation, clear inherited Anthropic credentials, and require the agent sandbox. Token exchange remains sidecar-owned.
  • Routing and startup: Apply Vertex settings after environment merges, select the Vertex model catalog, route through topology-aware port 10004, and enable eight CLI retries. Location defaults to global; proxy-bypass changes affect only Vertex workflows.
  • Coverage and documentation: Add compiler, generated-lock, startup-retry, model-resolution, and Anthropic compatibility regressions. Document Model Garden enablement, model/location availability, and VPC-SC ingress.
permissions:
  contents: read
  id-token: write

engine:
  id: claude
  auth:
    type: github-oidc
    provider: gcp
    workload-identity-provider: projects/PROJECT_NUMBER/locations/global/workloadIdentityPools/POOL/providers/PROVIDER
    service-account: claude@my-project.iam.gserviceaccount.com
    project: my-project
    location: global

model: claude-sonnet-4-6

Firewall adapter changes remain separate. End-to-end inference through gh-aw is not yet verified.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Add support for Claude on Vertex AI in the Claude engine Support Claude on Vertex AI with GCP WIF Oct 27, 2026
Copilot AI requested a review from pelikhan October 27, 2026 01:40
@pelikhan
pelikhan marked this pull request as ready for review October 27, 2026 09:02
Copilot AI max review requested due to automatic review settings October 27, 2026 09:02

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.

🟡 Changes recommended

Blocking workflow-generation and model-resolution issues remain unresolved.

4 open issues
What changed in this PR

Extends gh-aw’s Claude engine to compile workflows using Vertex AI with Google Cloud Workload Identity Federation instead of an Anthropic API key.

Changes:

  • Adds keyless authentication handling, credential clearing, and sandbox validation.
  • Configures topology-aware Vertex routing, model-catalog selection, and startup retries.
  • Adds compiler and harness regressions plus setup documentation; end-to-end inference remains unverified.
File Description
pkg/​workflow/​sandbox_validation.go Requires the agent sandbox for Claude Vertex authentication.
pkg/​workflow/​claude_vertex_test.go Tests authentication, environment overrides, topology, and generated workflows.
pkg/​workflow/​claude_engine.go Detects GCP WIF and configures Vertex credentials, routing, and retries.
pkg/​constants/​constants.go Adds the Vertex gateway port and proxy-bypass constants.
docs/​src/​content/​docs/​reference/​auth.mdx Documents setup, locations, cloud prerequisites, and current limitations.
docs/​src/​content/​docs/​engines/​claude.md Links Claude users to the Vertex authentication guide.
actions/​setup/​js/​claude_harness.test.cjs Adds Vertex model-resolution and startup-retry regressions.

Review effort: Max

Comment thread pkg/workflow/claude_engine.go Outdated
// The adapter returns retryable 503s while its first WIF exchange is pending.
env["CLAUDE_CODE_MAX_RETRIES"] = "8"
env["NO_PROXY"] = constants.AWFVertexNoProxyHosts
env["no_proxy"] = constants.AWFVertexNoProxyHosts

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in d6fec07: generated env keeps only NO_PROXY; the sandbox command exports no_proxy from it. Updated regression assertions cover both.

Comment on lines +542 to +543
if isClaudeVertexWIF(workflowData) {
applyClaudeVertexEnv(env, workflowData)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in d6fec07: compilation rejects Claude Vertex WIF with a non-Anthropic engine.model-provider or a copilot/ model, preventing GitHub credential resolution from being combined with Vertex routing.

// remain sidecar-owned, even when the runner has unrelated Anthropic credentials.
func applyClaudeVertexEnv(env map[string]string, workflowData *WorkflowData) {
auth := workflowData.EngineConfig.Auth
env["GH_AW_LLM_PROVIDER"] = "vertex"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in d6fec07: Claude Vertex alias patterns are added provider-specifically at runtime, and regressions verify sonnet and sub-agent small resolve against a Vertex catalog.

// remain sidecar-owned, even when the runner has unrelated Anthropic credentials.
func applyClaudeVertexEnv(env map[string]string, workflowData *WorkflowData) {
auth := workflowData.EngineConfig.Auth
env["GH_AW_LLM_PROVIDER"] = "vertex"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in d6fec07: when AWF has no Vertex catalogue endpoint, exact concrete Vertex sub-agent model IDs pass through; a complete catalogue that omits an ID still fails. Added a regression using the null-catalogue response.

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot address the following outstanding work in one pass:

  1. Update this branch with the latest main using make merge-main, resolving any conflicts and preserving the intended changes.
  2. Review (pkg/workflow/claude_engine.go:565): Both NO_PROXY and no_proxy are serialized into the execution step's YAML env mapping. GitHub Actions rejects case-insensitive duplicate environment keys, so every generated Claude Vertex workflow fails parsing before it can start. Keep only NO_PROXY in the final env map and export no_proxy="${NO_PROXY:-}" inside the sandbox command, as in universal_llm_consumer_engine.go:306–309,333–338; update the regression assertions accordingly. - Support Claude on Vertex AI with GCP WIF #72273 (comment)
  3. Review (pkg/workflow/claude_engine.go:543): With complete GCP WIF and engine.model-provider: github or a copilot/ model, provider resolution still selects GitHub for credentials and command generation, but this override forces the runtime to Vertex. For example, model: copilot/auto then fails before Claude starts because Vertex does not support auto. Reject conflicting provider/auth settings during compilation, or make provider selection consistent across validation, command generation, and runtime routing. - Support Claude on Vertex AI with GCP WIF #72273 (comment)
  4. Review (pkg/workflow/claude_engine.go:552): Selecting vertex here scopes model resolution to vertex/<id> catalog entries, but the built-in Claude aliases in pkg/workflow/data/model_aliases.json and its setup-action copy still match only copilot/* or anthropic/*. Consequently, model: sonnet or a declared sub-agent with model: small fails with model_unavailable before Claude starts, even when the Vertex catalog advertises suitable Sonnet/Haiku models. Add Vertex-aware Claude alias patterns or provider-specific alias mapping, and retain an alias-based Vertex regression instead of testing only concrete model IDs. - Support Claude on Vertex AI with GCP WIF #72273 (comment)
  5. Review (pkg/workflow/claude_engine.go:552): The pinned AWF v0.29.0 exposes no Vertex model catalogue (modelsPath: null), so workflow-declared sub-agents with concrete model IDs fail preflight with catalog_unavailable. The added sub-agent test hides this by relabelling a populated Anthropic catalogue as Vertex. Handle the null catalogue for concrete Vertex sub-agent IDs (or reject this unsupported configuration during compilation), and cover the real response in the regression. - Support Claude on Vertex AI with GCP WIF #72273 (comment)

Push the necessary fixes, reply to each listed review thread and resolve it when addressed. Ignore feedback already answered or resolved. Use the pr-finisher skill and stop when only human review or CI remains; do not trigger CI.

Sous-chef head: b0bc79a
Sous-chef work: 38772e8735bce7ff46db41849816ad1b908a9c654cc4179e572e3efd47490271 7261a98a7f2f722279685ea12481c46923ee786c0ebef3beb5a8a35839b4c413 8a9ce298cd400d3c603f5a087aaf49b8acb73aa212ab41ba59415e702f5d37bb ee0c9a9ea7c9afce74021174f2bd2d8fa86a276e75fbc2ad8c321bddb232071f
Sous-chef state: c4222dda0591911ded928b13af96591626ed3e5be5a13ee0def782c0f5e57106

Generated by 👨‍🍳 PR Sous Chef · pi · haiku45 · ~5 AIC · ⌖ ~10 AIC · ⊞ 1.1K · ◷
Comment /souschef to run again

Copilot AI and others added 2 commits October 27, 2026 10:05
…e-on-vertex-ai

Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
childEnv.ANTHROPIC_MODEL = resolution.engineModel;
}
const resolved = reflectData ? resolveProviderEndpointFromReflect({ provider: copilotProvider ? "github" : provider, reflectData, logger }) : null;
const resolved = provider === "vertex" ? null : reflectData ? resolveProviderEndpointFromReflect({ provider: copilotProvider ? "github" : provider, reflectData, logger }) : null;
@gh-aw-bot

Copy link
Copy Markdown
Collaborator

Caution

agentic threat detected
Threat detection flagged this output in warn mode. Manual review is REQUIRED before any follow-up automation.

Details

Potential security threats were detected in the agent output.

Review the workflow run logs for details.

@copilot address the following outstanding work in one pass:

  1. Update this branch with the latest main using make merge-main, resolving any conflicts and preserving the intended changes.
  2. Review (actions/setup/js/claude_harness.cjs:456): Sensitive information disclosure risk: actions/setup/js/claude_harness.cjs skips resolving an approved provider endpoint from AWF /reflect when GH_AW_LLM_PROVIDER normalizes to 'vertex' (provider === 'vertex' ? null : ...). With this bypass, a workflow-controlled environment (e.g., ANTHROPIC_VERTEX_BASE_URL / related Vertex env) can steer Claude traffic to an arbitrary external base URL, potentially sending prompts/repo context outside the AWF sidecar's intended routing. Add a deterministic allowlist/validation that Vertex mode must use the compiler-provisioned internal adapter URL (or a /reflect-configured endpoint) before starting Claude.

Push the necessary fixes, reply to each listed review thread and resolve it when addressed. Ignore feedback already answered or resolved. Use the pr-finisher skill and stop when only human review or CI remains; do not trigger CI.

Sous-chef head: d6fec07
Sous-chef work: 8895bbe58c34d7531042dd35ec88cae265c69b4976788fa823f9d986d4d86e11
Sous-chef state: 49e44a4bc8562b17abd1791f181d560958406b2fb6fa5e7829e9496d834183e2

Generated by 👨‍🍳 PR Sous Chef · pi · haiku45 · ~4 AIC · ⌖ ~13 AIC · ⊞ 1.1K · ◷
Comment /souschef to run again

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support Claude on Vertex AI in the Claude engine (engine.auth provider: gcp)

5 participants