Skip to content

fix(google): add timeout to Vertex ADC token refresh - #102050

Merged
steipete merged 7 commits into
openclaw:mainfrom
Alix-007:alix/google-vertex-adc-fetch-timeout
Jul 9, 2026
Merged

steipete merged 7 commits into
openclaw:mainfrom
Alix-007:alix/google-vertex-adc-fetch-timeout

Conversation

@Alix-007

@Alix-007 Alix-007 commented Jul 8, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Google Vertex Application Default Credentials refresh could wait indefinitely. The custom authorized_user OAuth path had no request deadline, and library-managed ADC sources such as Workload Identity Federation or GCE/GKE metadata could also leave OpenClaw waiting forever.

Why This Change Was Made

  • The custom OAuth refresh now uses the shared 30-second abort deadline across both response headers and bounded body consumption.
  • The google-auth-library fallback has an owner-level 30-second deadline. This is necessary because the pinned library uses separate transports for some STS and metadata refresh paths, so configuring its top-level Gaxios transporter would not cover every ADC source.
  • Timeout proof is folded into the existing Google transport suite; the 205-line private TCP harness and its test-only production seam were removed.

Credential discovery, token caching, response-size limits, gzip handling, and error parsing are unchanged. No config or environment surface was added.

User Impact

Vertex authentication failures now return within 30 seconds instead of leaving provider work stuck indefinitely, including authorized_user refresh and library-managed ADC resolution.

Collision / Differentiation Check

Evidence

  • Exact head: 2cc02c4f41d35d530e0754fbd781f10eca1a6f29
  • Sanitized AWS Crabbox (aws, lease cbx_9013e7de2edc, run run_3acff6e93db3): pnpm test extensions/google/transport-stream.test.ts — 1 file, 85 tests passed.
  • Fresh structured autoreview: clean.
  • git diff --check: clean.

Mutation proof: the focused tests hang without the corresponding deadline and reject with TimeoutError when the production deadline is restored.

Google contracts checked: OAuth refresh-token flow and Application Default Credentials.

Not tested: a live Google OAuth, Workload Identity, or Vertex tenant; no live ADC credentials were available. The deterministic tests cover both the custom fetch path and the google-auth-library owner boundary.

@clawsweeper

clawsweeper Bot commented Jul 8, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed July 9, 2026, 7:55 AM ET / 11:55 UTC.

Summary
This PR adds 30-second deadlines to both hand-rolled authorized_user Vertex ADC token fetches and google-auth-library ADC refreshes, plus transport-stream regression coverage.

PR surface: Source +19, Tests +48. Total +67 across 2 files.

Reproducibility: yes. from source and contributor proof: current main performs the authorized_user refresh without an AbortSignal and constructs GoogleAuth without transporter timeout options. I did not execute a local repro in this read-only review.

Review metrics: 1 noteworthy metric.

  • ADC refresh deadlines: 2 paths changed from unbounded to 30s. Both authorized_user fetches and google-auth-library ADC refreshes now have an operator-visible auth timeout contract.

Stored data model
Persistent data-model change detected: serialized state: extensions/google/transport-stream.test.ts. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster
Relationship: canonical
Canonical: #102050
Summary: This PR is the focused candidate for the Vertex ADC token-refresh request deadline; related items cover adjacent response body limits, retry behavior, project env detection, broader provider hangs, or Google Meet sibling deadlines.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge readiness
Overall: 🐚 platinum hermit
Proof: 🐚 platinum hermit
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] Merging intentionally changes Google Vertex ADC OAuth, service-account, external-account, and metadata-backed token refreshes from unbounded waits to a fixed 30-second auth failure path.
  • [P1] Green CI and loopback proof do not prove every slow enterprise proxy or credential source finishes under 30 seconds, so maintainers should explicitly accept that operator-visible auth-provider contract.

Maintainer options:

  1. Land with fixed ADC deadline (recommended)
    Accept the provider-auth behavior change and rely on the 30-second deadline to turn stuck credential refreshes into bounded failures.
  2. Wire to existing timeout policy first
    Require a small follow-up that derives the ADC refresh deadline from an approved provider/request timeout contract instead of a fixed constant.
  3. Pause for combined Vertex auth work
    Pause or close this branch if maintainers want the overlapping Vertex ADC timeout, body-limit, and retry work unified before landing.

Next step before merge

  • No automated repair is needed; the remaining action is maintainer acceptance of the fixed Google Vertex ADC auth timeout before merge.

Maintainer decision needed

  • Question: Should Google Vertex ADC token refresh use this fixed 30-second deadline for both authorized_user and google-auth-library ADC paths before merge?
  • Rationale: The patch is correct for the source-reproducible hang, but the timeout changes provider-auth behavior for existing operators and green CI cannot settle that product/upgrade contract.
  • Likely owner: steipete — steipete has the strongest feature-history and current assignment signal for deciding the Vertex ADC auth timeout contract.
  • Options:
    • Accept fixed ADC deadline (recommended): Land the narrow 30-second fail-fast behavior because it matches recent Google sibling timeout work and prevents stuck provider authentication.
    • Require inherited timeout policy: Ask for the token refresh paths to use an existing provider/request timeout contract if a hard-coded auth deadline is not the desired operator behavior.
    • Pause for broader Vertex reliability plan: Hold this branch if timeout, response-limit, stale-token retry, and project-env Vertex ADC work should land through one coordinated owner plan.

Security
Cleared: Cleared: the diff uses existing timeout helpers and dependency options, adds no workflows, lockfile changes, dependencies, secret logging, package-resolution changes, or external code execution.

Review details

Best possible solution:

Land this narrow deadline if maintainers accept 30 seconds as the Vertex ADC auth contract; otherwise route the same boundaries through an owner-approved provider timeout policy before merge.

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

Yes, from source and contributor proof: current main performs the authorized_user refresh without an AbortSignal and constructs GoogleAuth without transporter timeout options. I did not execute a local repro in this read-only review.

Is this the best way to solve the issue?

Yes, if the fixed deadline is accepted: the PR changes the actual token-refresh boundaries and uses google-auth-library's supported transporterOptions timeout path. The safer alternative is only policy-level, not a mechanical code defect.

AGENTS.md: found and applied where relevant.

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

Label changes

Label justifications:

  • P2: This is a normal-priority Google Vertex auth reliability fix with limited provider-specific blast radius.
  • merge-risk: 🚨 auth-provider: The diff changes Google Vertex ADC OAuth and google-auth-library token refresh behavior from unbounded to a fixed deadline.
  • merge-risk: 🚨 availability: The deadline prevents stuck provider requests, but an incorrect timeout can make slow credential refreshes fail fast instead of eventually succeeding.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): Sufficient: the PR body includes terminal output from a real local Node HTTP loopback path exercising the exported ADC resolver against a stalled token response, plus current CI proof checks are green.
  • proof: sufficient: Contributor real behavior proof is sufficient. Sufficient: the PR body includes terminal output from a real local Node HTTP loopback path exercising the exported ADC resolver against a stalled token response, plus current CI proof checks are green.
Evidence reviewed

PR surface:

Source +19, Tests +48. Total +67 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 24 5 +19
Tests 1 48 0 +48
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 72 5 +67

What I checked:

  • Repository policy read: Root AGENTS.md and extensions/AGENTS.md were read fully; the review applied the plugin-boundary, dependency-contract, and auth-provider merge-risk guidance. (AGENTS.md:1, 1fdb0e79d329)
  • Current main has no authorized_user fetch deadline: On current main, refreshGoogleVertexAuthorizedUserAccessToken posts to the OAuth token endpoint with method, headers, and body, but no signal or timeout option. (extensions/google/vertex-adc.ts:246, 1fdb0e79d329)
  • PR wires deadline through the hand-rolled token fetch: At the PR head, the ADC refresh path builds a timeout AbortSignal, passes it to fetch, and intentionally keeps the deadline active through response-body parsing before cleanup. (extensions/google/vertex-adc.ts:248, a5c39cf8efb6)
  • PR bounds google-auth-library ADC refreshes too: The PR constructs GoogleAuth with clientOptions.transporterOptions.timeout set to the same 30-second ADC refresh deadline. (extensions/google/vertex-adc.ts:362, a5c39cf8efb6)
  • Regression coverage targets both paths: The updated test asserts GoogleAuth receives the transporter timeout and adds a fake-timer test proving an authorized_user token body stall aborts with TimeoutError. (extensions/google/transport-stream.test.ts:1134, a5c39cf8efb6)
  • Dependency contract checked: google-auth-library 10.9.0 passes GoogleAuth clientOptions into AuthClient construction, AuthClient creates a Gaxios transporter from transporterOptions, and Gaxios applies timeout by appending an AbortSignal before requests.

Likely related people:

  • steipete: Auth history shows steipete introduced Vertex authorized_user ADC and later hardened token expiry/caching; live PR metadata also shows steipete assigned and recently force-pushed maintainer edits to this branch. (role: feature introducer and assigned reviewer; confidence: high; commits: 0b59964ec945, 697bafa9c97d, e3be541a6c2a; files: extensions/google/vertex-adc.ts, extensions/google/transport-stream.test.ts)
  • damianFelixPago: damianFelixPago authored the production ADC modes change that shaped the current google-auth-library fallback path this PR now bounds. (role: prior Vertex ADC contributor; confidence: high; commits: f09b4ebe314e; files: extensions/google/vertex-adc.ts, extensions/google/transport-stream.test.ts, extensions/google/provider-registration.ts)
  • liaoandi: liaoandi authored compressed Vertex ADC token response handling in the same token refresh/parser area now protected by the timeout. (role: adjacent token-refresh contributor; confidence: medium; commits: 97d68b69027f; files: extensions/google/vertex-adc.ts, extensions/google/transport-stream.test.ts)
  • wangmiao0668000666: wangmiao0668000666 authored the recently merged Google Meet API/OAuth fixed-deadline PRs that are the closest sibling timeout policy pattern. (role: recent adjacent timeout contributor; confidence: medium; commits: 28bbbe4f603c, 51b4e78c339d; files: extensions/google-meet/src/calendar.ts, extensions/google-meet/src/meet.ts, extensions/google-meet/src/oauth.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 (5 earlier review cycles)
  • reviewed 2026-07-08T06:01:17.464Z sha 35c0e922d97adfb9c5a71428d0358403a10d992b :: needs maintainer review before merge. :: none
  • reviewed 2026-07-08T06:15:32.217Z sha 35c0e922d97adfb9c5a71428d0358403a10d992b :: needs maintainer review before merge. :: none
  • reviewed 2026-07-09T06:38:36.786Z sha 514142dda773d68ccf54086a0576c0ae21a2ec67 :: needs maintainer review before merge. :: none
  • reviewed 2026-07-09T08:37:31.113Z sha 40326d6f8c6c97f162ada0758e4f58d23511bc64 :: needs maintainer review before merge. :: none
  • reviewed 2026-07-09T09:23:54.866Z sha 6d24dadccb4d67144975b5b88240fd1201268365 :: needs maintainer review before merge. :: none

@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. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. labels Jul 8, 2026
@steipete steipete self-assigned this Jul 9, 2026
@steipete
steipete force-pushed the alix/google-vertex-adc-fetch-timeout branch from 6d24dad to a3e1593 Compare July 9, 2026 11:33
@steipete
steipete force-pushed the alix/google-vertex-adc-fetch-timeout branch from a3e1593 to a5c39cf Compare July 9, 2026 11:43
@steipete
steipete requested review from a team as code owners July 9, 2026 12:30
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: android App: android app: web-ui App: web-ui gateway Gateway runtime scripts Repository scripts docker Docker and sandbox tooling agents Agent runtime and tooling channel: qqbot extensions: codex extensions: xai size: XL and removed size: S labels Jul 9, 2026
@github-actions github-actions Bot removed the dependencies-changed PR changes dependency-related files label Jul 9, 2026
@openclaw-barnacle openclaw-barnacle Bot added size: S and removed docs Improvements or additions to documentation app: android App: android app: web-ui App: web-ui gateway Gateway runtime scripts Repository scripts docker Docker and sandbox tooling agents Agent runtime and tooling channel: qqbot extensions: codex extensions: xai size: XL labels Jul 9, 2026
@steipete

steipete commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Land-ready review complete at exact head 2cc02c4f41d35d530e0754fbd781f10eca1a6f29.

Maintainer refinements:

  • Kept the custom OAuth deadline active through bounded response-body consumption.
  • Added an owner-level 30-second deadline around the complete google-auth-library ADC operation. Pinned dependency inspection showed WIF STS and GCE/GKE metadata paths can bypass the top-level Gaxios transporter.
  • Retained transporter timeout as best-effort cancellation, and discard only the exact timed-out cached GoogleAuth holder so a recovered identity endpoint can retry without restarting OpenClaw.
  • Replaced the 205-line private TCP harness and test-only production seam with focused fake-time cases in the existing Google transport suite.

Proof:

Proof gap: no live Google OAuth, Workload Identity, or Vertex credentials were available. The deterministic coverage exercises both the custom fetch deadline and the library owner boundary, including timeout recovery.

@steipete
steipete merged commit e5259fa into openclaw:main Jul 9, 2026
108 of 112 checks passed
@steipete

steipete commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 10, 2026
* fix(google): add timeout to Vertex ADC token refresh

* test(google): consolidate ADC timeout proof

* fix(google): bound all ADC token refreshes

* test(google): observe ADC timeout before advancing time

* fix(google): keep dependency timeout claims exact

* fix(google): bound library-managed ADC refreshes

* fix(google): recover after ADC refresh timeout

---------

Co-authored-by: Peter Steinberger <[email protected]>
Monkey-wusky added a commit to Monkey-wusky/openclaw that referenced this pull request Jul 14, 2026
Google Chat auth requests made through createGoogleAuthFetch() had no
request deadline, which could leave token refresh and cert fetch
operations waiting indefinitely when a Google auth endpoint accepted
the HTTP connection but never responded.

Add a 30s request timeout (GOOGLE_AUTH_REQUEST_TIMEOUT_MS) to the
guarded fetch call inside createGoogleAuthFetch(), matching the
deadline used by Vertex ADC (openclaw#102050), Chutes OAuth (openclaw#102026),
and the sibling googlechat cert fetch path (openclaw#102924).
wheakerd pushed a commit to wheakerd/clawdbot that referenced this pull request Jul 15, 2026
* fix(google): add timeout to Vertex ADC token refresh

* test(google): consolidate ADC timeout proof

* fix(google): bound all ADC token refreshes

* test(google): observe ADC timeout before advancing time

* fix(google): keep dependency timeout claims exact

* fix(google): bound library-managed ADC refreshes

* fix(google): recover after ADC refresh timeout

---------

Co-authored-by: Peter Steinberger <[email protected]>
(cherry picked from commit e5259fa)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extensions: google merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. 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: S 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