Repository navigation
fix(gateway/ui): record model auth unavailability reasons; gate composers only on actionable auth failures - #131697
Conversation
Record missing credentials, unusable auth, and cooldown separately from unknown availability. Carry native runtime auth facts and retry times through the additive models.list projection without changing protocol versions.
Read producer availability reasons in chat and new-session gates. Preserve Model Setup for missing credentials, keep accurate rejection copy, and allow sending during cooldown or unknown availability. Keep unavailable picker options disabled.
Keep permanently rejected profiles and inline credentials actionable without a retry timestamp. Use only viable transient profiles for the earliest recovery time, preserving explicit profile retry behavior.
Extract the existing submit-gate suite and shared draft fixture to stay within the file-size limit. Supply registered CLI metadata through the existing test boundary so availability checks do not cold-load executable plugin setup code.
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs real behavior proof before merge. Reviewed August 28, 2026, 5:47 AM ET / 09:47 UTC. ClawSweeper reviewWhat this changesThe branch adds model-unavailability reasons to Gateway catalog entries and blocks Chat and New Session only for missing or rejected credentials. Merge readiness⛔ Blocked until stronger real behavior proof is added - 2 items remain No blocking finding. The PR preserves the auth-cold recovery path while carrying the producer-recorded availability distinction through the catalog, avoiding false authentication claims and recoverable-send dead ends. Priority: P1 Review scores
Verification
Live VerificationCommand: Result: FAIL (failed) — step 1 Assertions:
How this fits togetherThe Gateway turns provider and credential availability into the flowchart LR
A[Provider credentials and runtime state] --> B[Model availability evaluator]
B --> C[Gateway model catalog]
C --> D[Control UI model selection]
D --> E{Availability reason}
E -->|Missing or rejected auth| F[Block with setup guidance]
E -->|Cooldown or unknown| G[Allow send and show outcome]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +373, Tests +349, Docs +1, Other +8. Total +731 across 30 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep one producer-owned availability reason in Do we have a high-confidence way to reproduce the issue? Yes—source and the included evaluator and browser-test matrix define the four availability states, though this read-only review did not execute them. Is this the best way to solve the issue? Yes. Recording the distinction at the evaluator and protocol boundary avoids UI inference and gives both composer surfaces one mapping. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 4ef3b14275f4. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
After-fix proof from a real setup (per the rank-up move), plus attribution for the failed ClawSweeper live verification. Live-gateway proof (real setup)Isolated dev gateway built from this branch ( 1. No credential configured ( Composer disabled with "No provider credential is configured for this model. Set it up in Model Setup." and the working setup link. 2. Genuine provider rejection ( Composer disabled with the existing "Authentication failed…" copy — now only shown when it is true. A subsequently scripted stats cooldown did not override the live rejection (presence isn't acceptance). 3. Transient cooldown ( Composer stayed enabled with no banner; a real send dispatched against the provider and the transcript showed the visible run outcome ( 4. Reason-less unknown — native CLI runtime rows with an unread account stay ClawSweeper live-verification failure attributionThe review's live run crashed before executing any test: the sandbox's system Chromium aborted at startup ( |
|
Merged via squash.
|
…sers only on actionable auth failures (openclaw#131697) * fix(gateway): preserve model auth unavailability reasons Record missing credentials, unusable auth, and cooldown separately from unknown availability. Carry native runtime auth facts and retry times through the additive models.list projection without changing protocol versions. * fix(ui): gate composers only on actionable auth failures Read producer availability reasons in chat and new-session gates. Preserve Model Setup for missing credentials, keep accurate rejection copy, and allow sending during cooldown or unknown availability. Keep unavailable picker options disabled. * fix(gateway): distinguish permanent auth rejection from cooldown Keep permanently rejected profiles and inline credentials actionable without a retry timestamp. Use only viable transient profiles for the earliest recovery time, preserving explicit profile retry behavior. * test: isolate submit gates and native runtime availability fixtures Extract the existing submit-gate suite and shared draft fixture to stay within the file-size limit. Supply registered CLI metadata through the existing test boundary so availability checks do not cold-load executable plugin setup code. * chore(protocol): regenerate Swift gateway models for availability reasons * test(gateway): expect availability reasons in models.list projections
What Problem This Solves
The chat composer (and the new-session Start gate) shows "Authentication failed. Review the provider credential or sign-in, then retry." and hard-disables sending whenever every catalog entry for the selected model reports
available: false. That boolean conflates four distinct producer states with different correct operator responses:falseby the default projection (e.g. a native CLI runtime account that has not been read yet).Observed in production: a gateway with a valid OpenAI OAuth profile showed the "Authentication failed" banner on a session whose runs were succeeding — a transient state rendered as a false, actionless auth claim with a dead-ended composer on the default path.
Why This Change Was Made
Record the fact at its producer; read it where needed. The availability evaluator (
src/agents/model-auth-availability.ts) now records why an entry is unavailable as a closed reason —missing-auth,auth-failed, orcooldown(with the earliest known retry time) — andmodels.listprojects it additively (unavailableReason,unavailableUntilonModelChoiceSchema; emitted only when the projectedavailableisfalse). A live provider catalogauth-rejectedoutcome still outranks a stats cooldown ("stored credentials prove presence, not acceptance") and clears any stale retry deadline. The native-CLI-runtime path now delegates the whole auth evaluation to the runtime provider instead of merging booleans, preserving the distinction between a missing credential and an account not yet read.The Control UI reads the reason instead of reconstructing credential state:
missing-authauth-failedcooldownAlongside, the shared unusable-window classification now distinguishes an active
auth_permanentdisable from transient cooldowns (previously combined), with red-first regression coverage. The auth-cold Model Setup funnel from #123130 is intact; picker options still disable onavailable: false.User Impact
Evidence
Before — model in transient cooldown, composer falsely disabled with an auth claim:
After — same cooldown state: no banner, message sent, run completed:
After — missing credential (auth-cold): honest copy + Model Setup funnel:
After — genuine auth rejection: existing copy, now accurate:
Captures are from the deterministic mock-gateway rig (real Control UI in Chromium); every capture was opened and inspected. Cooldown/unknown scenarios send a real
chat.sendand display the completed assistant response.Live-gateway proof (isolated
OPENCLAW_STATE_DIR, dedicated port, this branch's dist):models.list→{"id":"claude-fable-5","available":false,"unavailableReason":"missing-auth"}; composer disabled with the new copy and Model Setup link.{"available":false,"unavailableReason":"auth-failed"}; composer disabled with the (now accurate) auth banner. The live rejection correctly outranks a subsequently scripted stats cooldown.rate_limit):{"id":"grok-4","available":false,"unavailableReason":"cooldown","unavailableUntil":1787907366124}; composer stayed enabled with no banner, a real send dispatched, and the transcript showed the visible run outcome (HTTP 400: "Incorrect API key provided…").available:false, nounavailableReason) and do not block the composer.Tests: 628 scoped tests across 18 files (evaluator + reasons, route selection, five models.list suites, protocol schema, seven UI suites, two browser e2e suites) — all passing; every new regression case was captured failing on pre-fix code first (evaluator reasons, gateway projection, schema, submit gates, browser cooldown/unknown send paths, permanent-vs-transient classification).
node scripts/check-changed.mjsgreen;pnpm ui:i18n:baselineproduced no baseline change (English-only copy addition). Rebased onto currentmain; full changed-gate re-run green post-rebase.Production LOC: +275/−124 (net +151) — the additive reason/timestamp capability across evaluator, wire schema, and UI; tests +968/−419 (includes two pure size-gate extractions).