Skip to content

fix: explain when a required account cannot serve a model route - #208739

Merged
daniel-lxs merged 8 commits into
mainfrom
openclaw/api-key-route-sign-in-hint-76b6d6
Nov 30, 2026
Merged

daniel-lxs merged 8 commits into
mainfrom
openclaw/api-key-route-sign-in-hint-76b6d6

Conversation

@roboclaw-bot

@roboclaw-bot roboclaw-bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Collaborator

Related: #208709

This PR changes the interactive chat reply only. The automation repair brief is covered separately by @brandon-julio-t in #208731.

What Problem This Solves

A run tied to a subscription account can select a model route that requires an API key. The run stops before inference, but the reply tells the sender to sign in again. Signing in to the same account cannot make it an API key.

Thanks @brandon-julio-t for reporting the required-account case and @daniel-lxs for the reproduction and fix work.

Work sessions

Linked for team reference; these sessions aren’t public.

User Impact

The reply names what the route accepts and what the run requires, then suggests changing the route or account. It does not identify the account. An identity-only sign-in gets a shorter message: “This account can't run models. Choose another account.” Neither route accepts that account, so the reply does not suggest switching routes. Chat clients still receive the sanitized provider details, including HTTP status and error code, when a provider plugin supplies its own error message. This does not change which accounts can run a model, or how rejected credentials are handled.

Why This Change Was Made

I checked #197737 and #206797. The former distinguished the credential’s inference contract from its storage type. The latter deliberately kept the required profile ID out of chat. The route selector now supplies separate sender-safe text based on that contract. The original profile-specific diagnostic stays available to operators; auth preparation forwards only the sender-safe text through the existing failover path. Route selection and fallback classification are unchanged.

Evidence

Main vs fix: real Control UI screenshots and terminal WebSocket results

I tested main 531c79714e61 against d124152f5ca7 on CrabBox AWS. Its tree is identical to tested commit b143ae973b21. All three runs started from Chromium’s Try again button on an isolated Gateway. I matched each browser request to its terminal frame, then verified the title and expanded detail after reloading that run.

  • Saved identity-only account: I saved the session selection through the Gateway on both an API-key route and a subscription route. Main returned “No route-compatible authentication source is configured for openai.” On the fix, both routes said “This account can't run models. Choose another account.” The live frame matched the visible notice.

  • Bound subscription on an API-key route: On main, the visible error asked for a new sign-in, and the corresponding browser frame contained the synthetic profile ID. On the fix, both said the route requires an API key but the run requires a subscription account. The complete terminal chat frame contained no profile ID.

  • The saved pin stays a retry preference; it is not promoted to a requirement. The private diagnostic is preserved for operators. The separate composer availability warning is unchanged. The accounts and prior interruption were synthetic; the tested retry and failure were real. No live inference or automation owner repair was exercised.

  • All 113 focused tests across six files passed on the fix, as did the production build, core typecheck and scoped lint. The saved-selection and live-error regressions failed on the prior PR head.

  • On 57cf95016, three Chromium retries on an isolated Gateway confirmed that the terminal chat event, saved error, and expanded notice agree for both identity-only routes and the bound subscription. None of the three complete terminal frames contained the profile ID.

  • A local Responses endpoint accepted a working key and returned HTTP 401 for a rejected key. The rejected key kept its sign-in guidance. A saved account preference rotated to a compatible key and completed the turn. A provider plugin with its own 401 wording retained the provider, model, error code, and HTTP status in the terminal chat event. The focused suite passed all 208 tests, along with the Gateway build, core typecheck, scoped lint, and formatting.

Worked on by

🦞 Made with OpenClaw

roboclaw-bot and others added 2 commits November 30, 2026 02:39
Keep the profile-specific diagnostic separate from the message sent to the requester. Explain the route and account classes without sending account identifiers or suggesting a fresh sign-in.

Co-authored-by: daniel-lxs <[email protected]>
Worked on by:
- @daniel-lxs

Co-authored-by: daniel-lxs <[email protected]>
OpenClaw-Publication: e1dbe0eb-cea3-4dae-a01a-a9039937a650
@clawsweeper

clawsweeper Bot commented Nov 30, 2026

Copy link
Copy Markdown
Contributor

🦞👀
Pull request received.

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: S labels Nov 30, 2026
@roboclaw-bot

Copy link
Copy Markdown
Collaborator Author

Main vs fix on CrabBox AWS, captured from the real Control UI. The account and prompt are synthetic. I opened the saved failure for the same Gateway chat request on each build.

Annotated comparison

Main: the reply asks for another sign-in.

Main suggests signing in again

Fix: the reply names both account types and the next step.

Fix explains the route and account mismatch

Clean comparison

Main, expanded failure

Fix, expanded failure

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. impact:auth-provider Auth, provider routing, model choice, or SecretRef resolution may break. impact:ux-friction User-facing flow adds avoidable confusion or support burden without fully blocking progress. labels Nov 30, 2026
@roboclaw-bot
roboclaw-bot marked this pull request as ready for review November 30, 2026 02:50
@roboclaw-bot

Copy link
Copy Markdown
Collaborator Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀

Re-review progress:

@github-actions

github-actions Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ Security sensitive changes

This maintainer PR changes sensitive security components.

No secops approval is required. This comment is informational because the PR author has Maintain or Admin access.

  • Current SHA: f27b3636f13ae044700aa0c3f18f5f865098c142
  • Maintainer: @roboclaw-bot
  • Repository role: maintain

These security sensitive changes were made:

  • src/agents/provider-model-route-auth.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/agents/runtime-plan/prepare-auth.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.

Carefully review these changes before merging.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. labels Nov 30, 2026
@clawsweeper

clawsweeper Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: passed.

What this changes

This PR explains incompatible account and model-route requirements through the existing live and saved chat failure notices.

Example: An OpenAI subscription account is required for a run using the openai-responses API-key route.

  • Before: Chat tells the sender to sign in again.
  • After: Chat explains that the route requires an API key while the run requires a subscription account, and suggests changing the route or account.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The scoped chat repair has real-product evidence and no identified defects; overall scope remains partial against the linked chat-and-automation report.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (screenshot): Inspected Control UI screenshots show the required-subscription mismatch before and after the fix; public verification describes real browser retries through an isolated Gateway, matching terminal frames, reload persistence, identity-only accounts, rejected-key controls, and retained provider details.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Partial
User problem: Senders are told to sign in again when the selected route cannot use the required account type.
Reason: The maintainer-authored direction corrects actionable chat guidance; the broader linked report's automation repair is explicitly assigned to a sibling PR.

Merge readiness

✅ Ready for maintainer review

This PR repairs a confirmed chat diagnostic gap without exposing account identifiers or discarding sanitized provider details; no actionable defects were found.

Reviewed head: f27b3636f13ae044700aa0c3f18f5f865098c142

Before merge

None.

Findings

None.

Agent review details

How this fits together

The route-auth selector supplies diagnostic and sender-safe failure text; runtime preparation and fallback carry it to Gateway projections for live events and saved chat failures.

flowchart LR
  A[Account and model route] --> B[Route auth selector]
  B --> C[Runtime auth preparation]
  C --> D[Failover error]
  D --> E[Reply failure owner]
  E --> F[Gateway projections]
  F --> G[Live and saved chat notices]
Loading

Technical review

Best possible solution:

Land the focused chat repair after existing current-head gates pass, keeping automation remediation in #208731.

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

Current-main source confirms that required-profile mismatches lack sender-safe guidance, and inspected browser captures corroborate the misleading sign-in result; no target code was executed during this review.

Is this the best way to solve the issue?

The change uses the existing selector, FailoverError, reply owner, and Gateway projections to preserve the privacy boundary while correcting the explanation.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 5df0dd1873be.

Provenance checked

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 1b1cebf adds src/agents/provider-model-route-auth.ts:277 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 1b1cebfe4218; files: src/agents/provider-model-route-auth.ts)
  • DanCanadian: Raw commit fe9694b adds src/agents/provider-model-route-auth.ts:356 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: fe9694b8733c; files: src/agents/provider-model-route-auth.ts)
  • Ayaan Zaidi: Raw commit 6a6431b adds src/agents/runtime-plan/prepare-auth.ts:608 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 6a6431b2db24; files: src/agents/runtime-plan/prepare-auth.ts)
  • RoboClaw: Raw commit 74e3e13 adds src/shared/assistant-error-format.ts:69 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 74e3e1352a85; files: src/shared/assistant-error-format.ts)

PR surface

Source +61, Tests +104. Total +165 across 13 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 11 111 50 +61
Tests 2 104 0 +104
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 13 215 50 +165

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Root-cause cluster

Relationship: partial_overlap
Canonical: #208709
Summary: Interactive chat and automation repair briefs expose the same route/account mismatch through different failure consumers.

Members:

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

Labels

Label changes:

No label changes.

Label justifications:

  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; 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.
  • proof: sufficient: Contributor real behavior proof is sufficient.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall readiness starts with the lower of the proof and patch scores. It is capped at 3/6 if the fix is partial, the change offers little benefit, a product decision is still open, or the PR reverses an earlier decision without saying why. ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (4 earlier review cycles)
  • reviewed 2026-11-30T02:55:57.548Z sha dcb8e68 :: passed. :: none
  • reviewed 2026-11-30T03:25:09.304Z sha 200ad86 :: passed. :: none
  • reviewed 2026-11-30T04:21:55.569Z sha d124152 :: passed. :: none
  • reviewed 2026-11-30T05:50:54.946Z sha 57cf950 :: passed. :: none

Reviewed November 30, 2026, 1:34 AM ET / 06:34 UTC (Revision 5).

roboclaw-bot and others added 2 commits November 30, 2026 03:12
Worked on by:
- @daniel-lxs

Co-authored-by: daniel-lxs <[email protected]>
OpenClaw-Publication: 56adfc8f-688a-4242-ab78-451081503b76
@roboclaw-bot

Copy link
Copy Markdown
Collaborator Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀

Re-review progress:

Keep saved chat account pins as retry preferences. When the sole eligible profile for selection is identity-only, report that it cannot run models. Project the sender-facing failure title into public terminal events instead of the private diagnostic.

Co-authored-by: daniel-lxs <[email protected]>
Worked on by:
- @daniel-lxs

Co-authored-by: daniel-lxs <[email protected]>
OpenClaw-Publication: 083cf0f5-62a0-47c6-a916-b39cc00ca81e
@openclaw-barnacle openclaw-barnacle Bot added the gateway Gateway runtime label Nov 30, 2026
@roboclaw-bot

Copy link
Copy Markdown
Collaborator Author

I compared main 531c79714e61 with b143ae973b21 on CrabBox AWS. In Chromium I clicked Try again on an interrupted fixture turn, matched the outgoing chat.send idempotency key to the incoming terminal chat error, reloaded the real Control UI, and opened the failure with that exact run ID. Only the accounts and the earlier interruption were seeded; the retry and its error were not injected.

Actual retry Main Fix
Only saved account is identity-only; API-key route Generic “No route-compatible authentication source” “This account can't run models. Choose another account.”
Same saved selection; subscription route Same generic text Same account-only guidance
Required subscription; API-key route Display says to sign in; matching browser error contains fixture profile ID Display and live error both name the account/route mismatch; no profile ID anywhere in the terminal chat frame

For the first two cases I saved the account with sessions.patch and verified the stored selection source was user. I did not pass a required profile to those runs. For the third, I bound the provider entry to the saved subscription token and left the session unpinned. The separate composer availability warning is unchanged. No live inference or external provider credentials were needed.

Annotated: saved account on the API-key route

Main

Main: generic saved-account error

Fix

Fix: the account cannot run models

Annotated: bound subscription on the API-key route

Main

Main: sign-in advice

Fix

Fix: the route needs an API key

Clean captures

Scenario Main Fix
Saved identity, API-key route Main identity, API-key route Fix identity, API-key route
Saved identity, subscription route Main identity, subscription route Fix identity, subscription route
Bound subscription, API-key route Main bound subscription Fix bound subscription

@roboclaw-bot

Copy link
Copy Markdown
Collaborator Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀

Re-review progress:

Distinguish provider-formatted notices from account diagnostics when publishing lifecycle failures. Keep sanitized provider facts and previews available to chat clients, scrub private previews for host notices, and preserve the existing policy-stop redaction.
@daniel-lxs

Copy link
Copy Markdown
Member

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀

Re-review progress:

@daniel-lxs

Copy link
Copy Markdown
Member

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀

Re-review progress:

@daniel-lxs
daniel-lxs merged commit dbf2924 into main Nov 30, 2026
235 of 237 checks passed
@daniel-lxs
daniel-lxs deleted the openclaw/api-key-route-sign-in-hint-76b6d6 branch November 30, 2026 07:40
brandon-julio-t added a commit to brandon-julio-t/openclaw that referenced this pull request Nov 30, 2026
…eeds another account type

openclaw#208739 gave route/account mismatches profile-free requester text, but
buildFailoverRemediationHint still appends "Re-authenticate with: openclaw
models auth login …" to every provider-attributed auth failure. Exhausted
fallback summaries and automation run errors therefore still carried
sign-in advice, and the failure-repair brief passed it to the owner agent,
which asked the user to reconnect a working account.

prepare-auth now throws selector-explained mismatches with code
model_route_auth_incompatible, and the remediation hint skips that code as
it already skips selected_auth_profile_unavailable. The exhausted-fallback
error inherits the last attempt's code and builds its hint from the last
error, so automations keep the diagnostic without the re-auth hint. Real
sign-in failures keep it.

Verification: new failover-error test (no hint for the code; a rejected
credential keeps it) and code assertions on the openclaw#208739 prepare-auth cases
fail on main and pass here; runtime-plan, provider-model-route-auth,
model-auth-availability, failover-error, model-fallback and server-chat
native-provider-error suites pass.

Related: openclaw#208709 (builds on openclaw#208739)
Model: claude-opus-5-5 (reasoning effort not exposed to the session)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling gateway Gateway runtime impact:auth-provider Auth, provider routing, model choice, or SecretRef resolution may break. impact:ux-friction User-facing flow adds avoidable confusion or support burden without fully blocking progress. P2 Normal backlog priority with limited blast radius. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. security-sensitive-changed 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