Skip to content

fix(auth): decouple plugin synthetic-auth from profile fallback for gateway attempts (#110103) - #110179

Closed
stantheman0128 wants to merge 11 commits into
openclaw:mainfrom
stantheman0128:fix/110103-vertex-synthetic-adc
Closed

stantheman0128 wants to merge 11 commits into
openclaw:mainfrom
stantheman0128:fix/110103-vertex-synthetic-adc

Conversation

@stantheman0128

@stantheman0128 stantheman0128 commented Jul 17, 2026 •

Copy link
Copy Markdown
Contributor

Closes #110103

What Problem This Solves

Fixes “No API key found” on Gateway-routed model calls when a provider uses only Google Application Default Credentials (ADC), although the same credentials work locally.

User Impact

ADC-only providers can authenticate through the Gateway without enabling unrelated stored-profile fallback. No new configuration or migration is required. Explicit managed-secret failures remain terminal; incomplete prepared plugin lookups cannot widen credential discovery.

Why This Change Was Made

Plugin synthetic credentials and stored-profile fallback were controlled by one flag. This separates them and scopes isolated attempts to their prepared provider lookup. The current-main integration applies that scope before both synchronous and asynchronous plugin hooks, preserves cancellation and completed lookup results, and adapts the embedded controller to its current auth state.

The original contributor branch and commit ancestry are preserved. Original implementation: @stantheman0128 (Po-Han Shih).

Evidence

  • Existing real ADC-only Docker failure/success proof and review is retained; the unchanged external credential contract was not replayed.
  • Current-main regression proof: the focused synthetic-auth suite fails on the unchanged auth implementation (8 expected failures); the repaired six-file auth suite passes all 242 tests.
  • Coverage includes stored-profile isolation, incomplete/missing prepared lookup refs, provider/API aliases, disabled async hooks, cancellation, managed SecretRefs, and exact completed-result consumption.
  • The affected compaction and failover harness cases passed. One broad local command reached its outer deadline; the remaining cases were continued separately (25 passed), without replaying completed cases or weakening assertions.
  • Prior auth-candidate production and affected test-graph typechecks, changed-file lint, and independent review passed; the continuation evidence and remaining current-head gaps are below.
  • Current integration head: a7ca21a3d9c586405c142318f80477fe1db99ed0. The previously reported UI budget, Slack cycle/callback, cold-checkout source-closure, and Qwen clock defects are repaired using published canonical corrections. Startup JS is 362,471 bytes against the unchanged 362,588-byte limit; no assertion or baseline was widened. The Slack and wrapper-manifest corrections now exactly match landed main (fix(discord): rejoin threads on unarchive to restore MESSAGE_CREATE events #111148 and fix: restore initialization in fresh PR wrappers #150453), with no remaining PR delta in those paths.
  • CI also exposed incomplete explicit auth mocks in both simple-completion suites and a test-helper import-boundary violation. Those test-only gaps are repaired. Focused auth/boundary, generation/cancellation, compaction, Slack preview/retry and cold-checkout tests pass; changed type graphs and core/tooling lint pass. Fresh independent delta reviews found no actionable P0–P2 issues. All six auth production files remain byte-identical to the earlier reviewed candidate.
  • Hosted checks must qualify this new exact head. Local extension lint stopped at the nested-checkout declaration-isolation guard; the guard and ancestor install were not changed. The exact published Qwen fixture and its matching 27-test/independent-review proof were reused.
  • GitHub initially compared against a stale PR base. One verified close/reopen corrected it to the intended 15-file diff, without a source change.
  • Native exact-head review artifacts are validated with NEEDS DISCUSSION. Actual listed security-owner involvement is still pending on the existing review request. No merge has been attempted.

Original author disclosure

The original contribution was written with Claude; the contributor reported reviewing the diff and running local tests. The current-main integration adds the scoped regression evidence above.

@stantheman0128
stantheman0128 requested a review from a team as a code owner July 17, 2026 21:18
@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: S labels Jul 17, 2026
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. labels Jul 17, 2026
@clawsweeper

clawsweeper Bot commented Jul 17, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 24, 2026, 10:05 AM ET / 14:05 UTC (Revision 32).

ClawSweeper review

What this changes

Gateway model calls can use plugin-provided synthetic credentials, such as Google Application Default Credentials, while keeping stored-profile fallback disabled; the branch also updates auth tests and supporting test and UI translation fixtures.

Merge readiness

⛔ Blocked before merge - 5 items remain

This PR remains necessary: current main still couples plugin synthetic credentials to stored-profile fallback, and an independent Docker check showed the Gateway failure and a successful reply after the targeted auth change. The remaining blocker is whether the new prepared-lookup requirement preserves supported installs when plugin metadata is incomplete; the exact head also needs conflict resolution and the required auth-path owner review.

Priority: P1
Reviewed head: a7ca21a3d9c586405c142318f80477fe1db99ed0
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The auth repair has strong real-path proof and focused regression coverage, with metadata compatibility and landing approvals still unresolved.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): The changed auth owner enables plugin synthetic credentials on isolated Gateway attempts. Branch Gateway traces reached Vertex after auth, and an independent ADC-only Docker before/after check reported a successful Gateway model reply after the targeted change; it does not settle incomplete-metadata upgrades. No persisted data-model contract changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The changed auth owner enables plugin synthetic credentials on isolated Gateway attempts. Branch Gateway traces reached Vertex after auth, and an independent ADC-only Docker before/after check reported a successful Gateway model reply after the targeted change; it does not settle incomplete-metadata upgrades. No persisted data-model contract changes.
Evidence reviewed 8 items Current main remains affected: The fetched main revision still derives plugin synthetic-auth permission from allowAuthProfileFallback, preserving the reported Gateway failure mechanism.
Introduced auth path: The pinned introduced diff gives isolated direct attempts a separate synthetic-auth permission and a prepared runtime lookup while leaving stored-profile fallback disabled.
Incomplete lookup behavior: A supplied lookup with incomplete synthetic-auth refs now prevents the plugin hook from running; the branch test explicitly expects rejection for missing, incomplete, and empty refs.
Findings None None.
Security None None.

How this fits together

The Gateway prepares credentials before sending an agent's model request to a provider. The auth resolver combines the selected model, stored profiles, plugin metadata, and provider hooks to decide which credential reaches that request.

flowchart LR
A[Gateway model request] --> B[Prepared auth route]
C[Stored profiles] --> B
D[Plugin metadata] --> E[Credential eligibility]
B --> E
E --> F[Provider auth hook]
F --> G[Model request]
Loading

Decision needed

Question Recommendation
Should Gateway synthetic-only providers require complete prepared plugin metadata before their credential hook can run, including on fresh or stale-registry installs? Prove and preserve supported installs: Verify fresh and upgraded plugin states and make a narrow repair if an eligible synthetic-only provider is rejected.

Why: The restriction protects provider scope but may leave supported existing installs unable to authenticate; choosing that compatibility boundary requires owner judgment and upgrade evidence.

Before merge

  • Resolve merge risk (P1) - A fresh or upgraded install with missing or stale persisted plugin metadata can produce an incomplete prepared lookup. In that state, a synthetic-only provider's hook is skipped and Gateway model calls may still fail with missing auth; supported install states need upgrade proof or a narrow compatibility repair.
  • Resolve merge risk (P1) - GitHub currently reports merge conflicts for the exact head, so the reviewed branch cannot be landed without resolving them against current main.
  • Resolve merge risk (P1) - The changed agent auth paths require listed security-owner involvement under repository policy; that involvement is not established by the available review activity.
  • Complete next step (P2) - Resolve the exact-head merge conflicts, establish fresh-install and upgrade behavior for eligible synthetic-only plugins under incomplete metadata, and obtain listed auth-path owner review.
  • Resolve maintainer decision - Resolve the maintainer decision shown above before merge.
Agent review details

Security

None.

PR surface

Source +98, Tests +458, Other +3. Total +559 across 24 files.

View PR surface stats
Area Files Added Removed Net
Source 12 164 66 +98
Tests 11 717 259 +458
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 3 0 +3
Total 24 884 325 +559

Review metrics

None.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #110103
Summary: The open issue reports the same Gateway-only synthetic ADC failure, and this PR explicitly proposes its fix.

Members:

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

Merge-risk options

Maintainer options:

  1. Verify metadata compatibility (recommended)
    Show fresh-install and upgrade outcomes for synthetic-only plugins, then repair any supported incomplete-registry path before merge.
  2. Own the fail-closed behavior
    A maintainer may accept that incomplete metadata blocks Gateway credentials after documenting the affected setups and recovery path.

Technical review

Best possible solution:

Let Gateway direct attempts use provider-scoped plugin credentials while excluding unrelated stored profiles and unresolved managed secrets, with verified fresh-install and upgrade behavior across complete and incomplete plugin metadata.

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

Yes. The reported ADC-only Docker setup produced a working local call and a failing Gateway call, and the current-main auth line still supports that failure path; this review did not execute the setup.

Is this the best way to solve the issue?

Yes for separating plugin credentials from stored-profile fallback at the auth owner. The prepared lookup's behavior on incomplete metadata still needs an upgrade-safe decision and proof.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 749b11e54300.

Labels

Label changes:

  • add merge-risk: 🚨 auth-provider: If prepared plugin refs are incomplete, merging this path could leave Gateway credential resolution unavailable for the affected provider.

Label justifications:

  • P1: The reported defect blocks real Gateway-routed model calls for ADC-only providers, and current main retains the coupled auth path.
  • merge-risk: 🚨 compatibility: The new complete-metadata requirement may reject a supported synthetic-only plugin after a fresh install or upgrade.
  • merge-risk: 🚨 auth-provider: If prepared plugin refs are incomplete, merging this path could leave Gateway credential resolution unavailable for the affected provider.
  • 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 (terminal): The changed auth owner enables plugin synthetic credentials on isolated Gateway attempts. Branch Gateway traces reached Vertex after auth, and an independent ADC-only Docker before/after check reported a successful Gateway model reply after the targeted change; it does not settle incomplete-metadata upgrades. No persisted data-model contract changes.
  • proof: sufficient: Contributor real behavior proof is sufficient. The changed auth owner enables plugin synthetic credentials on isolated Gateway attempts. Branch Gateway traces reached Vertex after auth, and an independent ADC-only Docker before/after check reported a successful Gateway model reply after the targeted change; it does not settle incomplete-metadata upgrades. No persisted data-model contract changes.

Evidence

What I checked:

  • Current main remains affected: The fetched main revision still derives plugin synthetic-auth permission from allowAuthProfileFallback, preserving the reported Gateway failure mechanism. (src/agents/model-auth-provider.ts:597, 749b11e54300)
  • Introduced auth path: The pinned introduced diff gives isolated direct attempts a separate synthetic-auth permission and a prepared runtime lookup while leaving stored-profile fallback disabled. (src/agents/runtime-plan/resolve-auth.ts:287, a7ca21a3d9c5)
  • Incomplete lookup behavior: A supplied lookup with incomplete synthetic-auth refs now prevents the plugin hook from running; the branch test explicitly expects rejection for missing, incomplete, and empty refs. (src/agents/model-auth-runtime.ts:133, a7ca21a3d9c5)
  • Metadata completeness boundary: Without an active runtime registry, derived plugin metadata returns refs marked incomplete; missing or stale persisted registry state can produce that derived result. The Anthropic Vertex manifest declares its synthetic-auth ref. (src/plugins/synthetic-auth.runtime.ts:60, a7ca21a3d9c5)
  • Independent real behavior proof: In fix(auth): decouple plugin synthetic-auth from profile fallback for gateway attempts (#110103) #110179 (comment), an independent deployment reports that an ADC-only local call succeeded, the Gateway call failed on [email protected], and the same Docker container returned a model reply after the targeted auth change. Earlier branch Gateway traces also reached Vertex after auth.
  • Prior review continuity: The preceding completed ClawSweeper review had no findings and requested fresh-install and upgrade evidence for synthetic-only plugins under the complete-metadata requirement. The current discussion does not establish those cases.

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • vincentkoc: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Ayaan Zaidi: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Record fresh-install and upgrade evidence that supported synthetic-only plugins remain eligible when registry metadata is complete or incomplete.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
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.

Workflow

  • 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.

History

Review history (31 earlier review cycles; latest 8 shown)
  • reviewed 2026-08-26T06:03:10.739Z sha b4aa8ebcf475518a43a12b6d6d3c68be578cae63 :: needs changes before merge. :: [P1] Restrict the prepared lookup to isolated direct attempts
  • reviewed 2026-08-26T08:49:50.482Z sha 2a848c7 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-03T09:12:12.024Z sha 2a848c7 :: blocked before merge. :: [P1] Fail closed when the prepared plugin lookup is incomplete
  • reviewed 2026-09-03T09:58:25.875Z sha a4deea6 :: blocked before merge. :: none
  • reviewed 2026-09-03T10:53:20.848Z sha 397d6e4 :: blocked before merge. :: none
  • reviewed 2026-09-03T11:16:20.032Z sha 6a0aa2c :: blocked before merge. :: none
  • reviewed 2026-09-17T01:59:49.120Z sha 2da9e72 :: blocked before merge. :: none
  • reviewed 2026-09-17T02:28:11.935Z sha a7ca21a :: blocked before merge. :: none

@stantheman0128
stantheman0128 force-pushed the fix/110103-vertex-synthetic-adc branch from 44b2b98 to 49d080c Compare July 17, 2026 22:47
@stantheman0128

Copy link
Copy Markdown
Contributor Author

Pushed a23f36a881 to fix the CI mock gap in btw.test.ts (providerHasPluginSyntheticAuthHook was missing from the model-auth mock, which broke the agents-core shard).

Updated the PR body with local 334-pass evidence for the auth-related suite.

ADC-only gateway proof is still blocked here: this machine has no Google ADC (gcloud auth application-default reports credentials not found). I will not invent gateway logs. Once ADC is available I will add redacted after-fix gateway output and ping again.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 19, 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.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Jul 19, 2026
@stantheman0128

Copy link
Copy Markdown
Contributor Author

Pushed a CI fix for the two red jobs on this PR.

What broke

  1. plugin-sdk:api:check - new providerHasPluginSyntheticAuthHook export drifted the Plugin SDK API baseline.
  2. checks-node-compact-large-2 - embedded-agent harnesses fully mock model-auth.js and did not export the new helper, so auth init threw and a bunch of compaction/run tests failed with ok: false / missing mock export.

Fix (d663b8cdd4)

  • Added providerHasPluginSyntheticAuthHook: () => false to compact.hooks.harness.ts and run.overflow-compaction.harness.ts.
  • Regenerated docs/.generated/plugin-sdk-api-baseline.sha256 via pnpm plugin-sdk:api:gen.

Local verify

  • pnpm plugin-sdk:api:check -> OK docs\.generated\plugin-sdk-api-baseline.sha256
  • CI-named compact.hooks cases: 9 passed
  • The 13 embedded-agent files that failed with the missing mock: 252 passed
  • run.overflow-compaction.loop.test.ts: 36 passed
  • model-auth.test.ts: 81 passed

@openclaw-barnacle openclaw-barnacle Bot added the docs Improvements or additions to documentation label Jul 19, 2026
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Jul 19, 2026
@stantheman0128

Copy link
Copy Markdown
Contributor Author

Pushed 8bbc196bf7 for the P1 code follow-up: keep gateway synthetic-auth eligibility inside core instead of publishing a Plugin SDK helper.

What changed

  • Removed providerHasPluginSyntheticAuthHook (it was only used by core gateway paths and had landed in the Plugin SDK baseline).
  • Gateway callers now build a prepared RuntimeProviderAuthLookup and pass it through getApiKeyForModel / resolveApiKeyForProvider with allowPluginSyntheticAuth: true.
  • Core gates plugin synthetic-auth via the existing private shouldResolvePluginSyntheticAuth path (including fail-closed when the prepared ref state is incomplete).
  • Regenerated docs/.generated/plugin-sdk-api-baseline.sha256 so the export is gone from the baseline.
  • Behavior kept: plugin synthetic-auth stays decoupled from stored-profile fallback on gateway-isolated attempts.

Local verify

  • pnpm plugin-sdk:api:check -> OK docs\.generated\plugin-sdk-api-baseline.sha256
  • vitest on model-auth.test.ts + auth-controller.test.ts + resolve-auth.test.ts: 228 passed
  • vitest on btw.test.ts + model-auth.test.ts: 272 passed

ADC live proof
Still blocked on this machine. gcloud auth application-default has no credentials here, so I am not inventing a redacted gateway transcript. Once ADC is available I will add real after-fix gateway output showing synthetic auth success with profile-store isolation, then ping again.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 19, 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.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. labels Jul 19, 2026
@stantheman0128

Copy link
Copy Markdown
Contributor Author

ADC / Vertex proof status (2026-07-21 refresh)

Still blocked on this machine. I will not invent gateway logs.

Current probes:

gcloud auth application-default print-access-token
# ERROR: Reauthentication failed. cannot prompt during non-interactive execution.
# Please run: gcloud auth application-default login

GOOGLE_APPLICATION_CREDENTIALS
# unset

Earlier session note (still the product blocker once ADC refreshes): Vertex AI API aiplatform.googleapis.com was SERVICE_DISABLED on ADC quota project gws-cli-stan-2. Until that API is enabled and ADC can mint a token here, I cannot produce the redacted after-fix ADC-only gateway transcript ClawSweeper asked for.

Code/CI side of this PR is unchanged by this note. Unblock path: Stan refreshes ADC + enables Vertex AI API on the quota project, then I re-run local + gateway infer and post redacted Evidence + @clawsweeper re-review.

@stantheman0128

Copy link
Copy Markdown
Contributor Author

ADC-only local + gateway proof (2026-07-21)

Posted redacted after-fix Evidence on the PR body.

Auth path (what this PR fixes): both --local and --gateway resolve anthropic-vertex plugin synthetic ADC auth. Neither fails with No API key found or SERVICE_DISABLED.

--local (redacted): Vertex returns HTTP 403 BILLING_DISABLED for anthropic-vertex/claude-fable-5 after ADC auth succeeds.

--gateway (redacted): gateway from SHA 8bbc196bf7 routes provider=anthropic-vertex model=claude-fable-5, then the same Vertex HTTP 403 BILLING_DISABLED (not No API key).

[agent/embedded] embedded run start: provider=anthropic-vertex model=claude-fable-5
[agent/embedded] embedded run prompt start: provider=anthropic-vertex api=openai-responses
[ws] FailoverError: HTTP 403 ... reason=BILLING_DISABLED ... service=aiplatform.googleapis.com

Honest remaining gap for a text completion: GCP project billing is not linked (gcloud billing projects describe -> billingEnabled=False; no billing accounts listed). That is outside OpenClaw auth routing. Profile-store isolation stays covered by the regression tests already on the branch.

@clawsweeper re-review

@stantheman0128

Copy link
Copy Markdown
Contributor Author

ADC-only local + gateway proof (2026-07-21, post-billing)

Billing is now linked on the ADC quota project (billingEnabled=true). Re-ran live proof from SHA 8bbc196bf7.

Auth path (what this PR fixes): both --local and --gateway resolve anthropic-vertex plugin synthetic ADC auth. Neither fails with No API key found, SERVICE_DISABLED, or BILLING_DISABLED.

Also cleared for this run: Anthropic publisher data sharing for claude-fable-5 via setPublisherModelConfig (dataSharingEnabledProvider=ANTHROPIC).

--local (redacted): Vertex returns HTTP 429 RESOURCE_EXHAUSTED for anthropic-vertex/claude-fable-5 after ADC auth succeeds:

Quota exceeded for aiplatform.googleapis.com/global_online_prediction_requests_per_base_model
with base model: anthropic-claude-fable ... status=RESOURCE_EXHAUSTED

--gateway (redacted): gateway from this PR worktree routes provider=anthropic-vertex model=claude-fable-5, then the same Vertex HTTP 429 (not No API key):

[agent/embedded] ... model=claude-fable-5 provider=anthropic-vertex ... rawError=429 ... anthropic-claude-fable ... RESOURCE_EXHAUSTED
[ws] FailoverError: API rate limit reached

Honest remaining gap for a text completion: Service Usage shows empty/zero effective limits for Anthropic global_online_prediction_requests_per_base_model buckets on this project. That is a GCP Anthropic RPM / eligibility gate, not OpenClaw auth routing. Profile-store isolation stays covered by the branch regression tests.

@clawsweeper re-review

@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Jul 21, 2026
@clawsweeper clawsweeper Bot added 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. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. 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 Aug 16, 2026
…ateway attempts (openclaw#110103)

A gateway-isolated direct attempt resolves auth with an empty profile store
and allowAuthProfileFallback: false. That flag also gated provider plugin
synthetic-auth, so a provider whose only credential source is a plugin hook
(anthropic-vertex ADC) failed with "No API key found" on the gateway path
while local execution and the plugin itself resolved fine.

Give plugin synthetic-auth its own flag (default unchanged: it tracks
allowAuthProfileFallback) and thread it through getApiKeyForModelCore and
resolveApiKeyForProviderCore. The isolated planner attempt and embedded
prepared direct attempts opt in with a prepared RuntimeProviderAuthLookup so
eligibility stays scoped in core. The ordinary embedded profile path passes
neither the flag nor the lookup, keeping its pre-existing unrestricted
behavior; new controller tests pin both directions.

Co-authored-by: Cursor <[email protected]>
@danieljimz

danieljimz commented Sep 1, 2026 •

Copy link
Copy Markdown

Independent reproduction + fix verification (2026-09-01)

We're a production deployment blocked by this exact bug (anthropic-vertex as primary provider, Google Chat channel, GCE). This has had proof: sufficient and a 🐚 platinum hermit review since 2026-08-26 with zero blocking findings, but is still unmerged ~6 weeks after being opened (2026-07-17). Adding independent, isolated evidence to help get this over the line.

1. Bug reproduces cleanly on current latest ([email protected])

Minimal Docker container, nothing baked in except the plugin, ADC-only credentials, no prior config:

Path Result
openclaw infer model run --local --model anthropic-vertex/claude-haiku-4-5 ✅ succeeds
openclaw infer model run --gateway --model anthropic-vertex/claude-haiku-4-5 ❌ No API key found for provider "anthropic-vertex" (missing-provider-auth)

Confirms this isn't limited to the 2026.7.2-beta.x line originally reported against — it's still present in the current stable release.

2. Control: Gemini via google-vertex (same project, same ADC, same gateway) — unaffected

Path Result
--local ✅
--gateway ✅

This isolates the defect to providers that depend on the plugin resolveSyntheticAuth hook specifically (i.e. third-party plugins like anthropic-vertex), not core-owned auth (google-vertex) — consistent with the root cause described in this PR.

3. Applying this PR's fix resolves it

Patched the installed bundle directly (equivalent of model-auth-provider.ts):

- allowPluginSyntheticAuth: params.allowAuthProfileFallback !== false
+ allowPluginSyntheticAuth: params.allowPluginSyntheticAuth !== false

Same container, only that one line changed:

Path (patched) Result
--gateway ✅ "Hi! 👋 How can I help you today?"

Before/after, same config, same ADC, only that line differs.

Ask

@vincentkoc @stantheman0128 — given the review is already at 🐚 platinum hermit / proof:sufficient with no correctness findings, and this now has independent confirmation that the fix works end-to-end, could this get a maintainer merge? Any ADC-only anthropic-vertex deployment (the plugin's only supported auth mode) is completely unusable through any real channel (Google Chat, Control UI, etc.) until this lands — it's been broken for weeks with a ready fix sitting idle.

@stantheman0128

Copy link
Copy Markdown
Contributor Author

Thanks for the independent Docker check on 2026.8.1. The --local vs --gateway split, plus the one-line patch succeeding on the same ADC, is the proof I could not produce on this machine.

From our side this is waiting on a maintainer. Happy to rebase onto current main if someone asks.

@stantheman0128

Copy link
Copy Markdown
Contributor Author

Pushed a follow-up for the incomplete prepared lookup P1.

shouldResolvePluginSyntheticAuth now fail-closes when a lookup is supplied and syntheticAuthProviderRefsComplete is false, or when refs are omitted. Unrestricted plugin discovery stays only when no lookup is passed (the ordinary profile path).

Evidence:

node scripts/run-vitest.mjs src/agents/model-auth.test.ts
Test Files  1 passed (1)
Tests      89 passed (89)

node scripts/run-vitest.mjs src/agents/runtime-plan/resolve-auth.test.ts
Test Files  1 passed (1)
Tests      17 passed (17)

auth-controller.test.ts was 21 passed / 2 failed on this Windows box: EBUSY unlinking a temp sqlite file in the OAuth-refresh cleanup tests. Those tests do not touch the lookup helper.

I did not re-run live ADC gateway proof.

@stantheman0128

Copy link
Copy Markdown
Contributor Author

Pushed a follow-up for the required oxlint max-lines failures on this PR.

src/agents/embedded-agent-runner/run/auth-controller.ts and auth-controller.test.ts were over the core stripe caps (700 / 1000 counted lines). Isolated plugin-auth lookup now lives in isolated-plugin-auth.ts, and the test harness moved to auth-controller-harness.ts. Behavior is unchanged: ordinary profile path still omits the prepared lookup; isolated direct attempts still pass allowPluginSyntheticAuth plus the cached lookup.

The compact-small-6 and compact-small-20 reds on a4deea6 were not this diff:

  • src/commands/agent-exec.test.ts timed out waiting for a pid (1s CLI timeout)
  • src/process/supervisor/adapters/child.service-lifecycle.test.ts got an empty PID pair

Those files are untouched here. check-lint-core-2 was already red on the previous head for the same max-lines files.

Evidence:

node scripts/run-vitest.mjs src/agents/embedded-agent-runner/run/auth-controller.test.ts
Tests  2 failed | 21 passed (23)

The two failures are Windows EBUSY unlinking temp sqlite during OAuth-refresh cleanup, same as before this split.

Rename the test harness so knip production unused-file scan ignores it.
Collapse resolveApiKeyForCandidate to an expression body.

Co-authored-by: Cursor <[email protected]>
@stantheman0128

Copy link
Copy Markdown
Contributor Author

Pushed another follow-up for the remaining lint and knip reds on 397d6e4.

check-lint-core-2 still counted auth-controller.ts at 701. resolveApiKeyForCandidate is now an expression-bodied wrapper around getApiKeyForModelCore, so the file is under 700.

check-dependencies failed because knip production treated auth-controller-harness.ts as an unused file (test imports are not production entries). Renamed it to auth-controller.test-harness.ts to match the existing *.test-harness.ts ignore.

compact-small-6 is still the agent-exec pid timeout flake. Not this diff.

@danieljimz

danieljimz commented Sep 14, 2026 •

Copy link
Copy Markdown

Still blocked, ~2 months after opening — requesting maintainer attention

We've been tracking this fix since it was opened on 2026-07-19. It's now 2026-09-14 and it's still unmerged. Re-verified today directly against current main (HEAD 7eb75ef6, today's commit) and the published latest package ([email protected]): src/agents/model-auth-provider.ts still has the coupled line this PR fixes:

allowPluginSyntheticAuth: params.allowAuthProfileFallback !== false,

For context on our side: this blocks using Vertex AI (GCP Agent Platform) with OpenClaw entirely for any real channel dispatch (Google Chat, and presumably any other gateway-routed integration) — anthropic-vertex auth only resolves via --local/embedded-run paths, never via the Gateway, which is the only path production traffic actually takes. We can't run Claude on Vertex through OpenClaw in production because of this, and have been unable to for two months.

The fix itself has had proof: sufficient and a clean review since 2026-08-26 with no outstanding blocking findings, plus two independent real-world confirmations (ours from 2026-07-29 and 2026-09-01, both against real Google Chat / gateway traffic, not synthetic). @stantheman0128 has also repeatedly offered to rebase if a maintainer asks. At this point the only thing missing is someone with merge rights actually landing it.

@clawsweeper re-review

@steipete could you or someone with merge rights take a look? Happy to provide any further evidence needed.

…lback

Integrate the contributor fix with current embedded auth state, apply prepared
synthetic-auth scope before both readiness hooks, and preserve cancellation
and managed-secret ownership. Add regressions for the gateway isolation path.

Co-authored-by: Po-Han Shih <[email protected]>
@github-actions

github-actions Bot commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

Security-sensitive guard cleared

This PR no longer has blocked security-sensitive file changes. A future security-sensitive change requires a fresh /allow-security-sensitive-change comment after the guard blocks that new head SHA.

  • Current SHA: a7ca21a3d9c586405c142318f80477fe1db99ed0

@openclaw-barnacle

Copy link
Copy Markdown

This assigned pull request has been automatically marked as stale after being open for 27 days.
Please add updates or it will be closed.

1 similar comment
@openclaw-barnacle

Copy link
Copy Markdown

This assigned pull request has been automatically marked as stale after being open for 27 days.
Please add updates or it will be closed.

@openclaw-barnacle

Copy link
Copy Markdown

Closing due to inactivity.
If you believe this PR should be revived, post in #clawtributors on Discord to talk to a maintainer.
That channel is the escape hatch for high-quality PRs that get auto-closed.

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

Labels

agents Agent runtime and tooling app: web-ui App: web-ui extensions: qwen 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. P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. scripts Repository scripts size: XL stale Marked as stale due to inactivity 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.

anthropic-vertex: Gateway-routed calls fail synthetic ADC auth resolution that --local and the plugin itself confirm works

3 participants