fix(google-vertex): support production ADC modes#83971
Conversation
Dependency Changes DetectedThis PR changes dependency-related files. Maintainers should confirm these changes are intentional. Changed files:
Maintainer follow-up:
|
|
Codex review: found issues before merge. Latest ClawSweeper review: 2026-05-23 04:46 UTC / May 23, 2026, 12:46 AM ET. Workflow note: Future ClawSweeper reviews update this same comment in place. How this review workflow works
Summary Reproducibility: yes. from source at high confidence. Current main only activates the native Vertex transport for PR rating Rank-up moves:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. Real behavior proof Risk before merge
Maintainer options:
Next step before merge Security Review findings
Review detailsBest possible solution: Land a rebased narrow ADC completion after fixing or explicitly descoping default Compute Engine metadata-server activation, while leaving broader Google Vertex provider/catalog/location work to the existing follow-up branch. Do we have a high-confidence way to reproduce the issue? Yes, from source at high confidence. Current main only activates the native Vertex transport for Is this the best way to solve the issue? Partly. Using Label changes:
Label justifications:
Full review comments:
Overall correctness: patch is incorrect What I checked:
Likely related people:
Codex review notes: model gpt-5.5, reasoning high; reviewed against d7a078f1962b. |
Production proof — running this exact patch's behavior in 2026.5.18Validating from a live Hetzner Coolify deployment of OpenClaw What I had to hack to make this work (which this PR fixes)
Working config after patches"models": {
"providers": {
"google": {
"api": "google-vertex",
"baseUrl": "https://aiplatform.googleapis.com",
"models": [
{ "id": "gemini-3.5-flash", "api": "google-vertex", ... }
]
}
}
}Env vars: Session log proof{"type":"message","message":{"role":"assistant","content":[...],
"api":"google-vertex","provider":"google","model":"gemini-3.5-flash",
"stopReason":"stop","responseId":"8xAOaqW7H4nItfAP-uanuAE"}}Multiple successful turns logged with Happy to helpIf you ship a build/branch tag I can pull, I'll re-deploy without the hacks and report back from the same production stack. Particularly useful for validating the |
|
Bundled the full reproduction (env vars, ADC setup, auth-profiles.json sentinel, patch scripts, session-log proof) into a gist for anyone else hitting this in the meantime: https://gist.github.com/wiselancer/edcb1d8b766518ecb9849287d5fc2e36 Will delete it / replace with a "use the official path" note once this PR (or #60860) lands. |
|
ClawSweeper PR egg 🔥 Warming up: real-behavior proof passed; findings, security review, or rank-up moves are still in progress. Hatch commandComment Hatchability rules:
What is this egg doing here?
|
39c2079 to
74f17ef
Compare
|
No dependency changes detected. Learn more about Socket for GitHub. 👍 No dependency changes detected in pull request |
Co-authored-by: Cursor <cursoragent@cursor.com>
697ac92 to
c4b7cad
Compare
Fix Google Vertex production ADC mode support by routing explicit google-vertex models to the Vertex transport and relying on google-auth-library for request-time ADC resolution. Verification: - pnpm install --frozen-lockfile - pnpm test extensions/google/transport-stream.test.ts extensions/google/index.test.ts src/config/zod-schema.models.test.ts src/agents/pi-embedded-runner/model.inline-provider.test.ts -- --reporter=verbose - pnpm check:changed - GitHub PR checks green on c4b7cad - Live ADC smoke reached Google Vertex auth/transport and failed only because the configured redacted project has the Vertex AI API disabled Co-authored-by: Damian Finol <damian@felixpago.com>
Fix Google Vertex production ADC mode support by routing explicit google-vertex models to the Vertex transport and relying on google-auth-library for request-time ADC resolution. Verification: - pnpm install --frozen-lockfile - pnpm test extensions/google/transport-stream.test.ts extensions/google/index.test.ts src/config/zod-schema.models.test.ts src/agents/pi-embedded-runner/model.inline-provider.test.ts -- --reporter=verbose - pnpm check:changed - GitHub PR checks green on c4b7cad - Live ADC smoke reached Google Vertex auth/transport and failed only because the configured redacted project has the Vertex AI API disabled Co-authored-by: Damian Finol <damian@felixpago.com>
Fix Google Vertex production ADC mode support by routing explicit google-vertex models to the Vertex transport and relying on google-auth-library for request-time ADC resolution. Verification: - pnpm install --frozen-lockfile - pnpm test extensions/google/transport-stream.test.ts extensions/google/index.test.ts src/config/zod-schema.models.test.ts src/agents/pi-embedded-runner/model.inline-provider.test.ts -- --reporter=verbose - pnpm check:changed - GitHub PR checks green on c4b7cad - Live ADC smoke reached Google Vertex auth/transport and failed only because the configured redacted project has the Vertex AI API disabled Co-authored-by: Damian Finol <damian@felixpago.com>
Fix Google Vertex production ADC mode support by routing explicit google-vertex models to the Vertex transport and relying on google-auth-library for request-time ADC resolution. Verification: - pnpm install --frozen-lockfile - pnpm test extensions/google/transport-stream.test.ts extensions/google/index.test.ts src/config/zod-schema.models.test.ts src/agents/pi-embedded-runner/model.inline-provider.test.ts -- --reporter=verbose - pnpm check:changed - GitHub PR checks green on c4b7cad - Live ADC smoke reached Google Vertex auth/transport and failed only because the configured redacted project has the Vertex AI API disabled Co-authored-by: Damian Finol <damian@felixpago.com>
Fix Google Vertex production ADC mode support by routing explicit google-vertex models to the Vertex transport and relying on google-auth-library for request-time ADC resolution. Verification: - pnpm install --frozen-lockfile - pnpm test extensions/google/transport-stream.test.ts extensions/google/index.test.ts src/config/zod-schema.models.test.ts src/agents/pi-embedded-runner/model.inline-provider.test.ts -- --reporter=verbose - pnpm check:changed - GitHub PR checks green on c4b7cad - Live ADC smoke reached Google Vertex auth/transport and failed only because the configured redacted project has the Vertex AI API disabled Co-authored-by: Damian Finol <damian@felixpago.com>
Fix Google Vertex production ADC mode support by routing explicit google-vertex models to the Vertex transport and relying on google-auth-library for request-time ADC resolution. Verification: - pnpm install --frozen-lockfile - pnpm test extensions/google/transport-stream.test.ts extensions/google/index.test.ts src/config/zod-schema.models.test.ts src/agents/pi-embedded-runner/model.inline-provider.test.ts -- --reporter=verbose - pnpm check:changed - GitHub PR checks green on c4b7cad - Live ADC smoke reached Google Vertex auth/transport and failed only because the configured redacted project has the Vertex AI API disabled Co-authored-by: Damian Finol <damian@felixpago.com>
Fix Google Vertex production ADC mode support by routing explicit google-vertex models to the Vertex transport and relying on google-auth-library for request-time ADC resolution. Verification: - pnpm install --frozen-lockfile - pnpm test extensions/google/transport-stream.test.ts extensions/google/index.test.ts src/config/zod-schema.models.test.ts src/agents/pi-embedded-runner/model.inline-provider.test.ts -- --reporter=verbose - pnpm check:changed - GitHub PR checks green on c4b7cad - Live ADC smoke reached Google Vertex auth/transport and failed only because the configured redacted project has the Vertex AI API disabled Co-authored-by: Damian Finol <damian@felixpago.com>
Summary
api: "google-vertex"configs through model API validation.api: "google-vertex"during inline model materialization.authorized_userfiles by falling back togoogle-auth-libraryfor production ADC modes, including GKE Workload Identity / metadata-server ADC,external_account,service_account, Cloud Run, GAE, and Compute Engine.Why
OpenClaw already has a native Google Vertex transport:
model.api === "google-vertex"selects the Vertex transport path. The previous ADC preflight and token resolver only acceptedauthorized_usercredentials files, which preserved the localgcloud auth application-default logincase but rejected common production GCP auth shapes before the native Vertex transport could run.Production GCP deployments commonly rely on metadata server ADC, GKE Workload Identity, Workload Identity Federation (
external_account), or service account credentials rather than a static Gemini API key or a user ADC file. This patch keeps the existingauthorized_userrefresh behavior intact and adds the standardgoogle-auth-libraryADC chain for the other supported runtime modes.Related upstream work
This PR is scoped as a production ADC completion for the existing native Google Vertex path, not as a new Vertex provider.
api: "google-vertex"schema/config support, but is still open. This PR includes the schema allowance and also preserves provider-level inheritedapi: "google-vertex"innormalizeResolvedTransportApi, since adding toMODEL_APISalone only covers explicit model-level config.google-genaiSDK provider direction.Real behavior proof
Behavior addressed: Google Vertex requests using the existing native
google-vertextransport can use production ADC instead of requiring a Gemini/Google API key or a localauthorized_userADC file.Real environment tested: GKE-hosted OpenClaw deployment using metadata-server ADC / Workload Identity with no static
GOOGLE_API_KEY, noGEMINI_API_KEY, and noGOOGLE_APPLICATION_CREDENTIALSfile on the gateway.Exact steps or command run after this patch: Configure
models.providers.google.apiKey = "gcp-vertex-credentials", provider/modelapi = "google-vertex",GOOGLE_CLOUD_PROJECT, andGOOGLE_CLOUD_LOCATION=us-central1; send a normal OpenClaw channel message throughgoogle/gemini-2.5-pro.Evidence after fix: GKE metadata server returned HTTP 200 for
/computeMetadata/v1/instance/service-accounts/default/token?scopes=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcloud-platform, then the gateway sentPOST https://us-central1-aiplatform.googleapis.com/v1/projects/<redacted-project>/locations/us-central1/publishers/google/models/gemini-2.5-pro:streamGenerateContentwithapi=google-vertexand received HTTP 200text/event-streamin 2291 ms.Observed result after fix: A user-visible OpenClaw response was returned through the configured channel after the Vertex
streamGenerateContentrequest completed with HTTP 200. The path used thegcp-vertex-credentialsmarker and ADC bearer auth, notx-goog-api-keyor a static service-account JSON file.What was not tested: Maintainer local ADC live generation could not complete because the local configured GCP project has Vertex AI disabled; the local run did reach the Google Vertex API with ADC bearer auth and failed with a redacted
PERMISSION_DENIEDservice-disabled response. Direct AWS Crabbox remote proof was attempted oncbx_bc3464218fb0, but the lease lost SSH after sync before the command could run.Test plan
pnpm install --frozen-lockfilepnpm test extensions/google/transport-stream.test.ts extensions/google/index.test.ts src/config/zod-schema.models.test.ts src/agents/pi-embedded-runner/model.inline-provider.test.ts -- --reporter=verboseenv -u OPENCLAW_TESTBOX -u OPENCLAW_CLOUDFLARE_ACCOUNT_ID -u OPENCLAW_R2_ACCOUNT_ID -u OPENCLAW_R2_S3_ENDPOINT pnpm check:changedpnpm deps:changes:report -- --base-ref origin/main --markdown /tmp/dependency-changes-83971.md --json /tmp/dependency-changes-83971.jsoncreateGoogleVertexTransportStreamFn()withapiKey: "gcp-vertex-credentials"PERMISSION_DENIED, so not counted as successful generation proof.cbx_bc3464218fb0Made with Cursor