Skip to content

fix(ui): failed replies say which provider rejected the credentials - #193996

Merged
obviyus merged 6 commits into
mainfrom
ux/chat-failure-cause
Nov 6, 2026
Merged

obviyus merged 6 commits into
mainfrom
ux/chat-failure-cause

Conversation

@obviyus

@obviyus obviyus commented Nov 6, 2026

Copy link
Copy Markdown
Collaborator

What Problem This Solves

Fixes: when a reply fails because the provider rejected the saved API key (or reported a billing problem), chat only says "Couldn't finish this reply" and offers Try again. The cause is hidden behind the chevron, and retrying can't help.

User Impact

The failure line names the provider and the problem, for example "Fixture didn't accept the saved credentials" or "OpenRouter reports a billing problem". Open Models opens that provider in Models, and Try again stays as a secondary action. The cause still shows after a reload. Other failures are unchanged.

Why This Change Was Made

The run already classifies the failure: its error observation has the provider and failover reason. That was used only for the live error event and dropped from the stored failure notice. The notice now records those two facts, bounded to a known reason and a short provider id, and the failure line uses them for auth, auth_permanent and billing failures. On phone widths the named cause gets its own line above the actions, so it isn't squeezed out.

Evidence

Real Gateway with a provider that returns 401 for the configured key (chat-provider-failure-cause.real-gateway.e2e.test.ts):

Before (main): the cause is hidden and Try again is the only primary action.

before-failed-reply

After: the provider and cause are on the line, with Open Models.

after-failed-reply

Phone width:

after-failed-reply-phone

  • The E2E asserts the title, re-reads it after a page reload from the stored transcript, and checks that Open Models lands on /settings/model-providers?provider=fixture. On main the line reads "Couldn't finish this reply".
  • A new component test covers billing (Open Models becomes primary, Try again becomes secondary) and an overloaded failure (unchanged). It fails against main's component.
  • Existing failure-notice, notices, history, projection, recorder and lifecycle tests pass. check:changed is green except the changelog-attribution check, which also fails on main.
  • Autoreview (Claude, P2): scoped-clean.

@clawsweeper

clawsweeper Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui gateway Gateway runtime size: M labels Nov 6, 2026
@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. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 6, 2026
@clawsweeper

clawsweeper Bot commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge.

What this changes

The PR preserves provider failure classifications and shows credential or billing problems with an Open Models action.

Example: The fixture provider rejects the configured key with HTTP 401.

  • Before: Chat shows “Couldn’t finish this reply” with Try again as the primary action.
  • After: Chat shows “Fixture didn’t accept the saved credentials” with Open Models as the primary action.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Useful, focused behavior with visible product proof, concrete validation defects, and an outstanding persisted-state upgrade check.
Proof confidence 🦐 gold shrimp (3/6) Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🦐 gold shrimp (3/6) 3 actionable review findings remain.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: A rejected key or billing failure looks retryable because the failure line hides the provider and actionable cause.
Reason: The maintainer-authored direction exposes existing classified facts and reuses the existing in-product Models recovery path.

Merge readiness

⛔ Blocked before merge - 4 items remain

Keep open: this maintainer-authored PR addresses a concrete recovery problem, but packaging, E2E readiness, and bundle-budget failures need repair.

Priority: P2
Reviewed head: 8677f3f4b83b275430c2cfb6023b6e47a359b0c9

Before merge

  • Include the new runtime dependency in the PR wrapper inventory (P2) - This runtime import makes session-run-lifecycle-projection.ts depend on src/shared/run-failure-notice.ts, but scripts/pr-lib/wrapper-components.txt does not extract that module. The exact-head import-closure check reports the missing path, and the extracted-wrapper test fails resolving it. Add the dependency to the existing inventory so wrapper consumers can load the lifecycle module.
  • Wait for Control UI assets before requesting the dashboard handoff (P2) - startGateway can finish while the background Control UI build is preparing. The new test immediately calls dashboard --json, which intentionally exits unsuccessfully in that state; CI fails here before exercising the credential rejection. Await the existing waitForControlUiDocument boundary before this call, as the quota-reset real-Gateway scenario already does.
  • Keep the added UI within the existing bundle budgets (P2) - The exact-head base-comparison check reports total raw CSS at 1637.7 KiB against a 1637.5 KiB cap, together with chat boot JavaScript growth beyond the permitted 64-byte build variance. This added stylesheet block contributes to the CSS growth. Reduce or offset the added UI bytes and rerun the existing comparison without raising the budgets.
  • Add data-model compatibility proof - The review found that existing stored data may not work after upgrade. Show that existing data still loads and works with this change.

Findings

  • [P2] Include the new runtime dependency in the PR wrapper inventory — src/config/sessions/session-run-lifecycle-projection.ts:15
  • [P2] Wait for Control UI assets before requesting the dashboard handoff — ui/src/e2e/chat-provider-failure-cause.real-gateway.e2e.test.ts:85-87
  • [P2] Keep the added UI within the existing bundle budgets — ui/src/styles/chat/run-failure.css:267-271

Tests

  • Missing end-to-end proof: Show an upgrade from the latest stable release retaining existing saved failure notices and recording the new cause after upgrade.
Agent review details

How this fits together

Agent lifecycle observations enter the session recorder, become saved transcript notices, and pass through Gateway display projection into Control UI recovery controls.

flowchart LR
  A[Provider rejection] --> B[Agent error observation]
  B --> C[Session lifecycle projection]
  C --> D[Saved failure notice]
  D --> E[Gateway display projection]
  E --> F[Chat failure line]
  F --> G[Models settings]
Loading

Technical review

Best possible solution:

Retain the existing recorder, display projection, and provider navigation while repairing the wrapper inventory, browser readiness wait, and bundle growth.

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

Current-main source drops the provider classification from saved failure notices, and the supplied before screenshot shows the resulting generic failure line.

Is this the best way to solve the issue?

Preserving the existing classification through the owning recorder is a focused solution; the added tests cover distinct credential, billing, and unchanged transient-failure behavior.

Full review comments:

  • [P2] Include the new runtime dependency in the PR wrapper inventory — src/config/sessions/session-run-lifecycle-projection.ts:15
    This runtime import makes session-run-lifecycle-projection.ts depend on src/shared/run-failure-notice.ts, but scripts/pr-lib/wrapper-components.txt does not extract that module. The exact-head import-closure check reports the missing path, and the extracted-wrapper test fails resolving it. Add the dependency to the existing inventory so wrapper consumers can load the lifecycle module.
    Confidence: 1
  • [P2] Wait for Control UI assets before requesting the dashboard handoff — ui/src/e2e/chat-provider-failure-cause.real-gateway.e2e.test.ts:85-87
    startGateway can finish while the background Control UI build is preparing. The new test immediately calls dashboard --json, which intentionally exits unsuccessfully in that state; CI fails here before exercising the credential rejection. Await the existing waitForControlUiDocument boundary before this call, as the quota-reset real-Gateway scenario already does.
    Confidence: 1
  • [P2] Keep the added UI within the existing bundle budgets — ui/src/styles/chat/run-failure.css:267-271
    The exact-head base-comparison check reports total raw CSS at 1637.7 KiB against a 1637.5 KiB cap, together with chat boot JavaScript growth beyond the permitted 64-byte build variance. This added stylesheet block contributes to the CSS growth. Reduce or offset the added UI bytes and rerun the existing comparison without raising the budgets.
    Confidence: 0.97

Overall correctness: patch is incorrect
Overall confidence: 0.96

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 530ea65a5782.

Provenance checked

  • Terminal failure ownership keeps the original intent (b957f1a: Settled lifecycle receipts own durable failures rather than individual retry attempts.)
  • Compact failure presentation keeps the original intent (6b9eb8a: Show failures as a compact system line with details outside transcript flow.)
  • Private diagnostics keeps the original intent (82ba1ed: Keep raw warning and provider diagnostics out of ordinary failure notices.)
  • Provider settings navigation keeps the original intent (0125ffa: Open provider settings while preserving the chat's source-agent selection.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

Acceptance criteria:

  • pnpm test test/scripts/eager-import-closure.test.ts
  • pnpm test:ui:e2e ui/src/e2e/chat-provider-failure-cause.real-gateway.e2e.test.ts
  • pnpm ui:check-performance:base
  • pnpm check:changed

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 5b1d81e adds src/config/sessions/session-run-lifecycle-projection.ts:10 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 5b1d81e30585; files: src/config/sessions/session-run-lifecycle-projection.ts)

PR surface

Source +126, Tests +173. Total +299 across 17 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 14 140 14 +126
Tests 3 173 0 +173
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 17 313 14 +299

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.

Labels

Label changes:

  • add P2: This improves actionable recovery for failed replies with limited production scope.
  • add merge-risk: 🚨 automation: The new runtime import is absent from the trusted PR wrapper extraction inventory and breaks its import closure.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🦐 gold shrimp.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Label justifications:

  • P2: This improves actionable recovery for failed replies with limited production scope.
  • merge-risk: 🚨 automation: The new runtime import is absent from the trusted PR wrapper extraction inventory and breaks its import closure.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

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

Reviewed November 6, 2026, 1:41 AM ET / 06:41 UTC.

@obviyus
obviyus force-pushed the ux/chat-failure-cause branch 3 times, most recently from 9d37de6 to 18fcdb5 Compare November 6, 2026 07:59
@openclaw-barnacle openclaw-barnacle Bot added the scripts Repository scripts label Nov 6, 2026
@obviyus
obviyus force-pushed the ux/chat-failure-cause branch from 4b8612b to 9adb9b9 Compare November 6, 2026 10:39
obviyus and others added 6 commits November 6, 2026 16:22
A reply that failed because the provider rejected the saved key, or reported a
billing problem, now names the provider on the failure line and offers Open
Models at that provider. Try again stays available as a secondary action.

The run's existing error observation (provider, failover reason) is recorded
with the failure notice, so the cause survives a reload.

Co-authored-by: obviyus <[email protected]>
… budgets

The lifecycle projection passes the raw error observation and the failure
recorder bounds it, so the scripts/pr closure is unchanged. The shared
reader bounds the cause without importing the full failover reason list.
Phone widths give a failure's title its own line using the existing rules.
Adds the test-lines allocation for the new contract tests.

Co-authored-by: obviyus <[email protected]>
The notice reads the application context and opens Models at the provider
directly, so no callback is threaded through the chat pane. This keeps the
chat boot bundle within its cap.

Co-authored-by: obviyus <[email protected]>
Approved by Ayaan Zaidi: +1 KiB for naming a failed reply's provider cause
and offering Open Models on the failure line.

Co-authored-by: obviyus <[email protected]>
Use the shared chat Gateway fixture (no bundled plugins, no catalog refresh)
instead of a full Gateway, and wait out the Gateway's "assets are still
preparing" reply before taking the dashboard handoff.

Co-authored-by: obviyus <[email protected]>
The serial-standalone CI shard does not build dist/, so use the fixture's
default launcher instead of pinning dist/index.js.

Co-authored-by: obviyus <[email protected]>
@obviyus
obviyus force-pushed the ux/chat-failure-cause branch from 9adb9b9 to 28597cb Compare November 6, 2026 10:53
@obviyus
obviyus merged commit 32cff78 into main Nov 6, 2026
136 checks passed
@obviyus
obviyus deleted the ux/chat-failure-cause branch November 6, 2026 11:25
@obviyus

obviyus commented Nov 6, 2026

Copy link
Copy Markdown
Collaborator Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 7, 2026
…penclaw#193996)

* fix(ui): say which provider rejected a failed reply's credentials

A reply that failed because the provider rejected the saved key, or reported a
billing problem, now names the provider on the failure line and offers Open
Models at that provider. Try again stays available as a secondary action.

The run's existing error observation (provider, failover reason) is recorded
with the failure notice, so the cause survives a reload.

Co-authored-by: obviyus <[email protected]>

* fix(ui): keep the failure cause out of the PR wrapper and inside size budgets

The lifecycle projection passes the raw error observation and the failure
recorder bounds it, so the scripts/pr closure is unchanged. The shared
reader bounds the cause without importing the full failover reason list.
Phone widths give a failure's title its own line using the existing rules.
Adds the test-lines allocation for the new contract tests.

Co-authored-by: obviyus <[email protected]>

* fix(ui): open Models from the failure notice itself

The notice reads the application context and opens Models at the provider
directly, so no callback is threaded through the chat pane. This keeps the
chat boot bundle within its cap.

Co-authored-by: obviyus <[email protected]>

* chore(ui): raise the chat boot budget for failed-reply causes

Approved by Ayaan Zaidi: +1 KiB for naming a failed reply's provider cause
and offering Open Models on the failure line.

Co-authored-by: obviyus <[email protected]>

* test(ui): start the failure-cause E2E with the lean chat Gateway

Use the shared chat Gateway fixture (no bundled plugins, no catalog refresh)
instead of a full Gateway, and wait out the Gateway's "assets are still
preparing" reply before taking the dashboard handoff.

Co-authored-by: obviyus <[email protected]>

* test(ui): let the failure-cause E2E prepare its own Gateway entrypoint

The serial-standalone CI shard does not build dist/, so use the fixture's
default launcher instead of pinning dist/index.js.

Co-authored-by: obviyus <[email protected]>
Co-authored-by: Ayaan Zaidi <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui gateway Gateway runtime merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. scripts Repository scripts size: M status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant