Repository navigation
fix(ui): chat send failures were invisible when the session pane was hidden - #124473
Conversation
Terminal chat send failures were recorded only on the queue item when the owning pane was not visible (reconnect, alias drift, split-pane routing), so the operator saw nothing at all — an action ending in silence. Root cause: every error surface in the send/drain path was gated on visibleSessionMatches(...), and the FIFO outbox drain treated every chat.history reconcile rejection as a silent retryable "blocked", so a non-retryable rejection (e.g. auth loss) wedged the head — and everything behind it — permanently with no visible outcome. Fix, at the owner: - New surfaceChatDeliveryFailure() in steer-lifecycle.ts (the shared error-text owner): visible pane keeps the inline chat error; otherwise the failure routes through the existing global toast host, naming the session. All terminal failure sites in chat-send-delivery, chat-outbox-drain, chat-send-queue-state, and steer-lifecycle now use it. - reconcileStoredChatOutboxHead: a non-retryable GatewayRequestError on the head now terminally fails a never-attempted head (unblocking the lane) or parks an attempted head as unconfirmed — both with a visible outcome — instead of blocking the lane forever. - Composer disabled-reason: the reason now also renders while a draft hides the placeholder, and the cloud-startup-pending gate gets a reason instead of a silently disabled composer. Regression tests: hidden-pane terminal failure surfaces via toast; wedged head fails visibly and the lane drains the next message; attempted head parks unconfirmed; disabled reason visible with draft text present.
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: found issues before merge. Reviewed August 16, 2026, 4:28 AM ET / 08:28 UTC. ClawSweeper reviewWhat this changesThe PR surfaces hidden-session terminal chat-send failures through a global toast, unblocks non-retryable outbox reconciliation failures, and explains the cloud-startup composer disablement. Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readinessA P1 remains: an interrupted settings update can still fail an off-screen queued send with no visible outcome, so this PR is not ready to merge. Priority: P1 Review scores
Verification
How this fits togetherThe Control UI persists queued chat sends while sessions reconnect or change. Its outbox decides whether to send, wait, fail, or park a message, and terminal failures must reach either the active chat pane or the global toast. flowchart LR
A[Operator queues chat] --> B[Settings update and outbox]
B --> C[Gateway send or history reconcile]
C --> D{Terminal result}
D -->|Visible session| E[Inline chat error]
D -->|Hidden session| F[Global toast]
D -->|Unconfirmed send| G[Park for review]
Before merge
Findings
Agent review detailsSecurityNone. PR surfaceSource +102, Tests +245, Other 0. Total +347 across 10 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Route the interrupted-settings failure through the shared helper, add the off-screen regression, and retain only the global presentation and reconciliation logic that cannot be absorbed into the old visibility-gated paths. Do we have a high-confidence way to reproduce the issue? Yes in source: start a settings update for a queued send, navigate to another session, then resolve the update false; the queue item fails without invoking the global surface. Is this the best way to solve the issue? No: the shared helper is the right owner, but the PR does not invoke it for every reachable terminal queued-send failure. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against b097aaab2061. LabelsLabel 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
HistoryReview history (2 earlier review cycles)
|
…in workspace-sync test clock The chat send path now imports session-display naming for the global failure toast, adding ~1 KiB gzip to startup JS (335452 B on CI's Linux builder, still well under the 358400 B committed cap). workspace-sync "never commands" asserted the exact dispatch timeoutMs (777) but the impl derives it from a Date.now() deadline, so any elapsed ms between admission and dispatch failed the exact-equality assertion on a loaded runner. Pin the clock like the sibling timeout tests do.
…al toast naming ClawSweeper review findings on #124473: - A queued local command failing after the operator navigated away hit failCommand(error) with expose=false; the dispatcher's stale-scope guard had already withheld the inline error, so a successful state write recorded the failure invisibly — the silent class this PR removes. Expose it globally when the scope is stale and the owning pane is hidden; a stale scope with the pane still visible keeps the failed queue chip (the new connection owns the inline surface). - Global session rows are agent-scoped behind one shared "global" key, so the toast row lookup could borrow another agent's label. Match the row's agentId to the failed outbox's agent for global keys. Both regression tests fail pre-fix (stash-verified).
|
Both ClawSweeper findings and both rank-up moves are applied as of
Also in this push series: Focused proof: |
|
Merged via squash.
|
…og noise (#124560) * fix(ui): surface hidden-pane steer terminal failures globally Three terminal branches in steer-lifecycle.ts (transport null result, failed queue-row restore, failed queue-row removal) still gated their error on itemStillVisible, so a steer that failed after the operator navigated away parked the error on the queue row with no visible outcome — the exact invariant #124473 introduced surfaceChatDeliveryFailure() to protect. Route all three through the canonical helper and delete the divergent visibility-only branches. Regression test fails pre-fix (stash-verified): steer transport failure with the pane hidden now surfaces the session-named global toast. * fix(logging): demote per-turn gateway log noise to debug Live campaign evidence showed three lines dominating operator logs at info level with no per-turn diagnostic value: - 'tool policy removed N tool(s)': the policy pipeline runs on every turn, so this repeated 42x in one session. Demote to debug and delete the now-dead toolPolicyAuditLogLevel/auditLogLevel plumbing that only existed to lower diagnostic probes to the level that is now the default (net -13 production LOC). - 'codex app-server one-shot cleanup checked shared client retirement': routine per-attempt teardown detail; demote to debug. - 'codex trajectory capture requires the SQLite host recorder': static config condition warned per attempt; warn once per process. Skipped: the [model-fetch] info carve-out in model-transport-debug.ts is a named contract (docs/logging.md, #89648) — always-info by design. * fix(codex): drop test-only trajectory warn-once reset export Knip's production unused-export gate rejects resetCodexTrajectoryRecorderWarningForTest — it was a test-only seam in production code. Reset the process-wide warn-once flag via vi.resetModules() + fresh dynamic import in the test instead. * test(cron): wait for backoff re-arm instead of fixed sleep The 0ms retry timer arms only after async watcher-state persistence, so 'await delay(5)' races it on loaded CI workers (flaked on checks-node-compact-large-2: spawn called 1 time, expected 2). Replace both fixed-sleep re-arm waits with vi.waitFor on the spawn count. The remaining delay(5) guards a negative no-further-spawn assertion after cancel, where a bounded sleep is the correct shape. * fix(codex): scope trajectory recorder warn dedupe to session ClawSweeper P2: the host recorder factory returns null for per-session target-mapping conflicts, not only static config, so a process-wide warn-once flag silenced a later distinct session's recorder loss. Warn once per session (bounded set, cleared past 64 entries) so retries stay quiet but each newly affected session records its loss. Regression covers a later distinct session still warning.
…hidden (openclaw#124473) * fix(ui): always surface terminal chat send failures Terminal chat send failures were recorded only on the queue item when the owning pane was not visible (reconnect, alias drift, split-pane routing), so the operator saw nothing at all — an action ending in silence. Root cause: every error surface in the send/drain path was gated on visibleSessionMatches(...), and the FIFO outbox drain treated every chat.history reconcile rejection as a silent retryable "blocked", so a non-retryable rejection (e.g. auth loss) wedged the head — and everything behind it — permanently with no visible outcome. Fix, at the owner: - New surfaceChatDeliveryFailure() in steer-lifecycle.ts (the shared error-text owner): visible pane keeps the inline chat error; otherwise the failure routes through the existing global toast host, naming the session. All terminal failure sites in chat-send-delivery, chat-outbox-drain, chat-send-queue-state, and steer-lifecycle now use it. - reconcileStoredChatOutboxHead: a non-retryable GatewayRequestError on the head now terminally fails a never-attempted head (unblocking the lane) or parks an attempted head as unconfirmed — both with a visible outcome — instead of blocking the lane forever. - Composer disabled-reason: the reason now also renders while a draft hides the placeholder, and the cloud-startup-pending gate gets a reason instead of a silently disabled composer. Regression tests: hidden-pane terminal failure surfaces via toast; wedged head fails visibly and the lane drains the next message; attempted head parks unconfirmed; disabled reason visible with draft text present. * fix(ci): raise startup JS baseline for global failure surfacing and pin workspace-sync test clock The chat send path now imports session-display naming for the global failure toast, adding ~1 KiB gzip to startup JS (335452 B on CI's Linux builder, still well under the 358400 B committed cap). workspace-sync "never commands" asserted the exact dispatch timeoutMs (777) but the impl derives it from a Date.now() deadline, so any elapsed ms between admission and dispatch failed the exact-equality assertion on a loaded runner. Pin the clock like the sibling timeout tests do. * fix(ui): surface route-switched command failures and agent-scope global toast naming ClawSweeper review findings on openclaw#124473: - A queued local command failing after the operator navigated away hit failCommand(error) with expose=false; the dispatcher's stale-scope guard had already withheld the inline error, so a successful state write recorded the failure invisibly — the silent class this PR removes. Expose it globally when the scope is stale and the owning pane is hidden; a stale scope with the pane still visible keeps the failed queue chip (the new connection owns the inline surface). - Global session rows are agent-scoped behind one shared "global" key, so the toast row lookup could borrow another agent's label. Match the row's agentId to the failed outbox's agent for global keys. Both regression tests fail pre-fix (stash-verified).
…og noise (openclaw#124560) * fix(ui): surface hidden-pane steer terminal failures globally Three terminal branches in steer-lifecycle.ts (transport null result, failed queue-row restore, failed queue-row removal) still gated their error on itemStillVisible, so a steer that failed after the operator navigated away parked the error on the queue row with no visible outcome — the exact invariant openclaw#124473 introduced surfaceChatDeliveryFailure() to protect. Route all three through the canonical helper and delete the divergent visibility-only branches. Regression test fails pre-fix (stash-verified): steer transport failure with the pane hidden now surfaces the session-named global toast. * fix(logging): demote per-turn gateway log noise to debug Live campaign evidence showed three lines dominating operator logs at info level with no per-turn diagnostic value: - 'tool policy removed N tool(s)': the policy pipeline runs on every turn, so this repeated 42x in one session. Demote to debug and delete the now-dead toolPolicyAuditLogLevel/auditLogLevel plumbing that only existed to lower diagnostic probes to the level that is now the default (net -13 production LOC). - 'codex app-server one-shot cleanup checked shared client retirement': routine per-attempt teardown detail; demote to debug. - 'codex trajectory capture requires the SQLite host recorder': static config condition warned per attempt; warn once per process. Skipped: the [model-fetch] info carve-out in model-transport-debug.ts is a named contract (docs/logging.md, openclaw#89648) — always-info by design. * fix(codex): drop test-only trajectory warn-once reset export Knip's production unused-export gate rejects resetCodexTrajectoryRecorderWarningForTest — it was a test-only seam in production code. Reset the process-wide warn-once flag via vi.resetModules() + fresh dynamic import in the test instead. * test(cron): wait for backoff re-arm instead of fixed sleep The 0ms retry timer arms only after async watcher-state persistence, so 'await delay(5)' races it on loaded CI workers (flaked on checks-node-compact-large-2: spawn called 1 time, expected 2). Replace both fixed-sleep re-arm waits with vi.waitFor on the spawn count. The remaining delay(5) guards a negative no-further-spawn assertion after cancel, where a bounded sleep is the correct shape. * fix(codex): scope trajectory recorder warn dedupe to session ClawSweeper P2: the host recorder factory returns null for per-session target-mapping conflicts, not only static config, so a process-wide warn-once flag silenced a later distinct session's recorder loss. Warn once per session (bounded set, cleared past 64 entries) so retries stay quiet but each newly affected session records its loss. Regression covers a later distinct session still warning.
What Problem This Solves
Fixes an issue where operators sending a chat message from the Control UI would see no outcome at all when the send terminally failed while the owning session pane was not visible (after navigating to another session, a reconnect, alias drift, or split-pane routing). The failure was recorded only on the stored queue item; nothing on screen changed.
Worse, a non-retryable Gateway rejection (e.g. auth loss) during the FIFO outbox head's history reconcile was treated as a silent retryable "blocked", wedging the head — and every message queued behind it — permanently with no visible outcome. This is the worst bug class under the repo's severity order: an action ending in silence.
A smaller sibling: the composer's cloud-startup-pending gate disabled the composer with no stated reason, and an existing draft hid the disabled-reason placeholder.
Why This Change Was Made
Terminal delivery failures must always end in a visible outcome. A new canonical
surfaceChatDeliveryFailure()helper insteer-lifecycle.ts(the shared error-text owner) routes every terminal failure: a visible pane keeps the inline chat error exactly as before; otherwise the failure surfaces through the existing global toast host, naming the owning session. All terminal failure sites inchat-send-delivery.ts,chat-outbox-drain.ts,chat-send-queue-state.ts, andsteer-lifecycle.tsnow use it — no per-site visibility gating remains.For the wedged-head case,
reconcileStoredChatOutboxHeadnow distinguishes non-retryableGatewayRequestErrorrejections: a never-attempted head terminally fails with a visible outcome and the lane continues draining; an attempted head parks asunconfirmed(duplicate-send safety — we cannot prove the Gateway never executed it). The composer's cloud-startup gate gets a stated reason, and the disabled reason renders even while a draft hides the placeholder.User Impact
Operators always see why a message did not deliver: inline in the chat pane when they are looking at it, or as a global toast naming the session when they are not. A dead credential no longer silently freezes a session's outgoing queue forever — the queue either fails visibly or parks unconfirmed with an explanation, and later messages still drain.
Evidence
Regression tests (fail pre-fix, stash-verified): 3 new tests in
ui/src/pages/chat/chat-send.test.ts(hidden-pane terminal failure surfaces via toast; non-retryable never-attempted head fails visibly and the lane drains the next message; attempted head parks unconfirmed) and 1 inui/src/pages/chat/chat-composer.test.ts(disabled reason visible with draft text present). Full files pass post-rebase: 329 tests, 2 files (node scripts/run-vitest.mjs ui/src/pages/chat/chat-send.test.ts ui/src/pages/chat/chat-composer.test.ts).Mock-gateway E2E lane:
ui/src/e2e/chat-flow.messaging.e2e.test.ts— 17 passed post-rebase.Before/after visual proof (mocked Gateway, Playwright-driven Chromium; scenario: a queued send for "Deploy helper" drains after reconnect while the operator is viewing "Research notes", and the Gateway rejects
chat.sendnon-retryably withUNAUTHORIZED: gateway auth failed):Before (
origin/main@ e2e070c) — send fails while another session is visible; no visible outcome anywhere:After (this branch) — global toast names the owning session and the error:
Video of the after-fix flow:
ui-proof-after-toast.mp4
LOC delta: +87 production / +166 test (net). The production growth carries two missing capabilities that no existing owner could absorb: global failure-surface routing (
surfaceChatDeliveryFailure+ toast session naming) and terminal head handling in the outbox reconcile (fail-visible vs park-unconfirmed discrimination). Reviewed for a net-neutral absorbing refactor; the per-sitevisibleSessionMatchesguards it replaces were the smaller shape only because they dropped the failure on the floor.Checks:
node scripts/check-changed.mjsclean (typecheck UI, lint, i18n verify, dead-export scan). Autoreview clean (0.98).