Skip to content

fix(google): support GOOGLE_CLOUD_PROJECT_ID for Vertex AI - #101035

Closed
zhangguiping-xydt wants to merge 3 commits into
openclaw:mainfrom
zhangguiping-xydt:fix/problem-google-cloud-project-id-env
Closed

zhangguiping-xydt wants to merge 3 commits into
openclaw:mainfrom
zhangguiping-xydt:fix/problem-google-cloud-project-id-env

Conversation

@zhangguiping-xydt

@zhangguiping-xydt zhangguiping-xydt commented Jul 6, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes an issue where Google Vertex AI users who configure their project with only GOOGLE_CLOUD_PROJECT_ID would have Vertex project detection treat the project as missing, even though the Google OAuth path already accepts that env name.

Why This Change Was Made

This aligns the Vertex runtime project resolver, ADC credential-marker eligibility, pre-runtime auth evidence, operator-facing provider env metadata, and the published @openclaw/ai built-in Vertex surface with the existing Google OAuth project env support. Without updating the auth evidence contract, GOOGLE_CLOUD_PROJECT_ID-only ADC setups could still be classified as unauthenticated before the Vertex transport path runs.

The change keeps the existing env behavior intact for GOOGLE_CLOUD_PROJECT, GCLOUD_PROJECT, and explicit project options, and does not change credential formats, config schema, migrations, provider selection, or default model routing.

User Impact

Operators can use GOOGLE_CLOUD_PROJECT_ID for Google Vertex AI without duplicating the same value into GOOGLE_CLOUD_PROJECT or GCLOUD_PROJECT. Existing Vertex setups using the older env names continue to work.

Evidence

  • Real Google Vertex ADC proof from an OpenClaw bundled Google Vertex transport run using only GOOGLE_CLOUD_PROJECT_ID for the project env. GOOGLE_CLOUD_PROJECT, GCLOUD_PROJECT, and GOOGLE_APPLICATION_CREDENTIALS were unset; local ADC credentials were used from the standard gcloud ADC location. The request reached the project-scoped Vertex streamGenerateContent endpoint, and Vertex returned PERMISSION_DENIED only because billing is disabled on the proof project.

    proof_subject=OpenClaw bundled google-vertex transport ADC request
    GOOGLE_CLOUD_PROJECT=unset
    GCLOUD_PROJECT=unset
    GOOGLE_CLOUD_PROJECT_ID=openclaw-proof-0707-7h9iwv
    GOOGLE_CLOUD_LOCATION=us-central1
    GOOGLE_APPLICATION_CREDENTIALS=unset
    [provider-transport-fetch] [model-fetch] start provider=google-vertex api=google-vertex model=gemini-2.5-flash method=POST url=https://us-central1-aiplatform.googleapis.com/v1/projects/openclaw-proof-0707-7h9iwv/locations/us-central1/publishers/google/models/gemini-2.5-flash:streamGenerateContent timeoutMs=undefined proxy=none policy=default
    [provider-transport-fetch] [model-fetch] response provider=google-vertex api=google-vertex model=gemini-2.5-flash status=403 elapsedMs=2338 contentType=text/event-stream
    request_count=1
    request_1_url=https://oauth2.googleapis.com/token
    openclaw_result_stop_reason=error
    openclaw_result_error=Google Vertex AI API error (403): This API method requires billing to be enabled on project #openclaw-proof-0707-7h9iwv. [code=PERMISSION_DENIED]
    
  • Regression proof before the fix:

    • node scripts/run-vitest.mjs run extensions/google/transport-stream.test.ts failed the new GOOGLE_CLOUD_PROJECT_ID Vertex transport case because no guarded Vertex request was emitted.
    • node scripts/run-vitest.mjs run extensions/google/index.test.ts failed the new ADC marker case with expected undefined to be 'gcp-vertex-credentials'.
    • node scripts/run-vitest.mjs run src/agents/model-auth.profiles.test.ts failed the new auth discovery case with expected undefined to be 'gcp-vertex-credentials'.
    • node scripts/run-vitest.mjs run src/llm/env-api-keys.test.ts failed the new published @openclaw/ai env helper case with expected undefined to be '<authenticated>'.
    • node scripts/run-vitest.mjs run packages/ai/src/providers/google-vertex.test.ts failed the new published @openclaw/ai provider adapter case with expected 'error' to be 'stop'.
  • node scripts/run-vitest.mjs run extensions/google/transport-stream.test.ts

    Test Files  1 passed (1)
         Tests  85 passed (85)
    [test] passed 1 Vitest shard in 28.45s
    
  • node scripts/run-vitest.mjs run src/agents/model-auth.profiles.test.ts

    Test Files  1 passed (1)
         Tests  71 passed (71)
    [test] passed 1 Vitest shard in 24.37s
    
  • node scripts/run-vitest.mjs run extensions/google

    Test Files  28 passed (28)
         Tests  389 passed (389)
    
  • node scripts/run-vitest.mjs run src/llm/env-api-keys.test.ts

    Test Files  1 passed (1)
         Tests  6 passed (6)
    [test] passed 1 Vitest shard in 12.81s
    
  • node scripts/run-vitest.mjs run packages/ai/src/providers/google-vertex.test.ts

    Test Files  1 passed (1)
         Tests  2 passed (2)
    [test] passed 1 Vitest shard in 3.83s
    
  • env OPENCLAW_CHECK_CHANGED_REMOTE_CHILD=1 OPENCLAW_CHANGED_LANES_RAW_SYNC=1 CI=1 PNPM_CONFIG_VERIFY_DEPS_BEFORE_RUN=false pnpm check:changed

    [check:changed] lanes=core, coreTests, extensions, extensionTests
    [check:changed] test temp creation report (warning-only)
    No new test temp-directory migration warnings found.
    Import cycle check: 0 runtime value cycle(s).
    

    The default pnpm check:changed path attempted to delegate to Crabbox, but the local Crabbox binary failed its self-check before running project checks; the local remote-child mode above ran the changed lanes directly.

  • CI red follow-up attribution:

    • The failing check-additional-boundaries-bcd job reported extensions/google/transport-stream.test.ts: Use a documented openclaw/plugin-sdk test subpath instead of repo-only test helper bridges.
    • The same boundary failure surfaced inside build-artifacts through test/extension-test-boundary.test.ts.
    • The test now uses openclaw/plugin-sdk/test-env for the temp-dir helper instead of importing from ../../test/helpers/temp-dir.js.
  • node --import tsx scripts/check-no-extension-test-core-imports.ts

    OK: extension test files, support helpers, and plugin test helpers avoid direct core test/internal imports (2244 extension files, 1 plugin helpers checked).
    
  • node scripts/run-vitest.mjs run test/extension-test-boundary.test.ts

    Test Files  1 passed (1)
         Tests  11 passed (11)
    [test] passed 1 Vitest shard in 10.58s
    

@zhangguiping-xydt
zhangguiping-xydt requested a review from a team as a code owner July 6, 2026 17:10
@clawsweeper

clawsweeper Bot commented Jul 6, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed July 7, 2026, 12:54 PM ET / 16:54 UTC.

Summary
The PR adds GOOGLE_CLOUD_PROJECT_ID as a Google Vertex project env alias across bundled Google runtime/auth metadata, @openclaw/ai helpers, and regression tests while preserving existing project precedence.

PR surface: Source +8, Tests +224. Total +232 across 11 files.

Reproducibility: yes. Current main omits GOOGLE_CLOUD_PROJECT_ID from both Vertex project resolvers and has a focused auth-profile test expecting PROJECT_ID-only ADC evidence to resolve null; I did not run tests in this read-only review.

Review metrics: 1 noteworthy metric.

  • Google Vertex env alias: 1 added alias across 6 auth/runtime surfaces. Provider env additions affect operator setup, pre-runtime auth evidence, and runtime project selection, so maintainers should notice the compatibility surface before merge.

Stored data model
Persistent data-model change detected: serialized state: src/llm/env-api-keys.test.ts, vector/embedding metadata: packages/ai/src/providers/google-vertex.test.ts. Confirm migration or upgrade compatibility proof before merge.

Merge readiness
Overall: 🐚 platinum hermit
Proof: 🦞 diamond lobster
Patch quality: 🐚 platinum hermit
Result: ready for maintainer review.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • none.

Risk before merge

  • [P1] The PR intentionally broadens Google Vertex auth/project env recognition, so maintainers should accept that GOOGLE_CLOUD_PROJECT_ID-only ADC setups now classify as authenticated and issue Vertex requests.
  • [P1] The PR is mergeable but behind its base; branch protection or maintainers may still want exact merge-head checks before landing.

Maintainer options:

  1. Accept the Vertex env alias (recommended)
    Land after maintainer acceptance and exact-head gates, treating the alias as intentional compatibility behavior.
  2. Hold for provider-owner contract review
    Pause if maintainers want to decide docs, precedence, or whether the alias should be auth-evidence-only before runtime recognition changes.

Next step before merge

  • [P2] No mechanical repair is currently indicated; maintainers should accept or reject the additive Vertex env alias and land with normal exact-head gates if accepted.

Maintainer decision needed

  • Question: Should OpenClaw accept GOOGLE_CLOUD_PROJECT_ID as a Google Vertex project alias across auth evidence and runtime resolution?
  • Rationale: This is a useful compatibility fix with live proof, but env/config surfaces are high-bar and the upstream @google/genai Node env path only reads GOOGLE_CLOUD_PROJECT, so maintainer intent should confirm the OpenClaw-specific alias.
  • Likely owner: steipete — Recent adjacent Google Vertex ADC reliability work and maintainer-authored provider changes make this the best available owner for the env-surface decision.
  • Options:
    • Accept the additive alias (recommended): Land the PR after normal exact-head merge gates, treating GOOGLE_CLOUD_PROJECT_ID as an OpenClaw-supported Vertex project alias.
    • Ask for provider-owner narrowing: Hold the PR if provider owners want docs wording, a different precedence order, or a narrower auth-evidence-only change before expanding runtime recognition.
    • Do not add the alias: Close or request removal if maintainers want Vertex to stay aligned with the upstream SDK env names only.

Security
Cleared: No concrete security or supply-chain concern is visible; the diff changes env recognition and tests without new dependencies, workflows, credential formats, or secret storage.

Review details

Best possible solution:

Land the focused alias after maintainer acceptance of the additive Google Vertex env contract, keeping existing project precedence and the current regression coverage.

Do we have a high-confidence way to reproduce the issue?

Yes. Current main omits GOOGLE_CLOUD_PROJECT_ID from both Vertex project resolvers and has a focused auth-profile test expecting PROJECT_ID-only ADC evidence to resolve null; I did not run tests in this read-only review.

Is this the best way to solve the issue?

Yes, for the code shape. The PR updates the bundled resolver, auth evidence, provider metadata, @openclaw/ai, and precedence tests; the remaining choice is maintainer acceptance of the env surface, not a different implementation layer.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against f92ed16e605e.

Label changes

Label justifications:

  • P2: This is a normal-priority Google Vertex auth/provider fix with limited blast radius but real operator impact for ADC setups.
  • merge-risk: 🚨 compatibility: The PR adds a newly recognized project env alias that changes behavior for GOOGLE_CLOUD_PROJECT_ID-only ADC setups.
  • merge-risk: 🚨 auth-provider: The diff changes Google Vertex ADC auth evidence and project selection before provider requests are made.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body includes redacted live output from an ADC-backed Vertex run using only GOOGLE_CLOUD_PROJECT_ID, showing the request reached the project-scoped Vertex endpoint and failed only at billing authorization.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body includes redacted live output from an ADC-backed Vertex run using only GOOGLE_CLOUD_PROJECT_ID, showing the request reached the project-scoped Vertex endpoint and failed only at billing authorization.
Evidence reviewed

PR surface:

Source +8, Tests +224. Total +232 across 11 files.

View PR surface stats
Area Files Added Removed Net
Source 6 14 6 +8
Tests 5 227 3 +224
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 11 241 9 +232

What I checked:

Likely related people:

  • damianFelixPago: Authored merged Google Vertex production ADC support touching the same transport and ADC helper paths. (role: recent area contributor; confidence: high; commits: f09b4ebe314e; files: extensions/google/transport-stream.ts, extensions/google/transport-stream.test.ts, extensions/google/vertex-adc.ts)
  • 849261680: Authored merged Google Vertex ADC catalog/auth-marker repair in the same provider registration and auth-evidence path. (role: recent area contributor; confidence: high; commits: a4f7e4cbb946; files: extensions/google/index.test.ts, extensions/google/provider-registration.ts, extensions/google/vertex-adc.ts)
  • steipete: Recent history shows several adjacent Google Vertex ADC reliability commits and maintainer-authored Google provider work in the affected files. (role: recent adjacent owner; confidence: medium; commits: 0b59964ec945, 697bafa9c97d, aaf5ab910cbe; files: extensions/google/vertex-adc.ts, extensions/google/transport-stream.ts, packages/ai/src/providers/google-vertex.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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.

How this review workflow works
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.
Review history (6 earlier review cycles)
  • reviewed 2026-07-06T18:03:36.449Z sha 4332e9478514dd5e785e26b9178ceeb865ebb4b1 :: needs real behavior proof before merge. :: [P2] Use an allowed extension test helper path | [P2] Keep the built-in Vertex resolver aligned
  • reviewed 2026-07-06T21:37:29.567Z sha 4f0a6678af930d9a1499335da7fa9aab8a0c84c5 :: needs real behavior proof before merge. :: [P1] Preserve existing GCLOUD_PROJECT precedence
  • reviewed 2026-07-07T01:03:52.040Z sha cc3373141beb69d69751ee9c83184d51543c0784 :: needs real behavior proof before merge. :: [P1] Preserve existing GCLOUD_PROJECT precedence
  • reviewed 2026-07-07T06:07:19.834Z sha cc3373141beb69d69751ee9c83184d51543c0784 :: needs real behavior proof before merge. :: [P1] Preserve existing GCLOUD_PROJECT precedence
  • reviewed 2026-07-07T08:27:10.935Z sha cf42b46db663ee2ca7a7b0eaef741f71e185656f :: needs maintainer review before merge. :: none
  • reviewed 2026-07-07T12:38:32.796Z sha 094e0de :: needs real behavior proof before merge. :: none

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. labels Jul 6, 2026
@zhangguiping-xydt

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 7, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@zhangguiping-xydt

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 7, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Jul 7, 2026
@zhangguiping-xydt
zhangguiping-xydt force-pushed the fix/problem-google-cloud-project-id-env branch from cf42b46 to 094e0de Compare July 7, 2026 12:03
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Jul 7, 2026
@zhangguiping-xydt

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 7, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Jul 7, 2026
@steipete

steipete commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Thanks for the contribution. I’m closing this for now because it adds a new Google Vertex auth/environment alias without maintainer-confirmed product direction. Current main intentionally tests GOOGLE_CLOUD_PROJECT_ID-only evidence as unsupported; this should return only with explicit sponsorship of that contract.

@steipete steipete closed this Jul 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling extensions: google merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants