Repository navigation
fix(ui): own chat history issuance with a closed state machine - #129776
Conversation
loadChatHistory silently returned undefined when the pane was not yet connected, so any caller racing the connection lifecycle left the pane in skeletons forever: no request, no error, no recorded fact. Failures that did happen fed a dismiss-only alert with no recovery (#128655). Record issuance as one ChatHistoryLoadState union (idle | pending-connection | in-flight | committed | failed) at the owner, absorbing the old inFlightHistory nullable. Disconnected requests record pending-connection and re-arm exactly once at the pane context's connected transition; failures render a retryable transcript error and retryable ones auto-resume on reconnect; invalidated in-flight loads transfer intent back to pending instead of vanishing. Closes #128655. Supersedes #128691.
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
UI proof from the mocked-gateway e2e harness (real Chromium, captured via
|
Repeated identical disconnected snapshots must stay no-ops for pane ownership (chat-pane-lifecycle contract); normalize chatLoading only on the connected->disconnected edge.
|
Codex review: needs changes before merge. Reviewed August 25, 2026, 11:59 PM ET / August 26, 2026, 03:59 UTC. ClawSweeper reviewWhat this changesThe PR records chat-history loading as an owner-scoped state machine, resumes deferred loads after reconnect, and shows retryable failure UI for empty and cached transcripts. Merge readinessKeep open: the current head fixes the prior cached-transcript finding, but its Retry button bypasses the pane’s canonical refresh flow and can leave session reconciliation and startup metadata stale after recovery. Priority: P1 Review scores
Verification
Live VerificationCommand: Result: FAIL (failed) — step 1 Assertions:
How this fits togetherThe Control UI chat pane loads transcript history from the Gateway, then reconciles session state and renders the conversation. This PR governs how disconnected, failed, and retried history requests pass through that lifecycle. flowchart LR
A[Gateway connection] --> B[Chat pane lifecycle]
B --> C[History load state]
C --> D[History request]
D --> E[Session reconciliation]
E --> F[Transcript view]
C --> G[Retry or reconnect]
G --> D
Before merge
Findings
Agent review detailsSecurityNone. PR surfaceSource +192, Tests +311. Total +503 across 9 files. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Copy recommended automerge instructionTechnical reviewBest possible solution: Route the history Retry action through the pane’s existing refresh callback, preserve the retry’s intended startup semantics if required, delete the raw bypass if unused, and cover the full recovered-refresh lifecycle. Do we have a high-confidence way to reproduce the issue? Yes: current main’s disconnected early return is source-reproducible, and the PR provides mocked-Gateway browser coverage for the affected lifecycle. Is this the best way to solve the issue? No: the owner-scoped state machine is the right repair boundary, but Retry should re-enter the canonical pane refresh flow rather than invoke only the low-level loader. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 937c89675b04. LabelsLabel changes:
Label justifications:
EvidenceAcceptance criteria:
What 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 (1 earlier review cycle)
|
…ipts A refresh failure with cached messages rendered nothing: the failure panel only replaced an empty thread, so stale content sat with no error or Retry. Render the same failure surface as a compact non-displacing banner above the transcript when content exists, sharing one builder with the empty-state panel. Adds the cached-refresh browser regression with screenshot proof.
|
Addressed the P1 in 19b2d6c: a failed refresh with cached history now renders the same failure surface as a compact non-displacing banner ( @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Merged via squash.
|
…law#129776) * fix(ui): own chat history issuance with a closed state machine loadChatHistory silently returned undefined when the pane was not yet connected, so any caller racing the connection lifecycle left the pane in skeletons forever: no request, no error, no recorded fact. Failures that did happen fed a dismiss-only alert with no recovery (openclaw#128655). Record issuance as one ChatHistoryLoadState union (idle | pending-connection | in-flight | committed | failed) at the owner, absorbing the old inFlightHistory nullable. Disconnected requests record pending-connection and re-arm exactly once at the pane context's connected transition; failures render a retryable transcript error and retryable ones auto-resume on reconnect; invalidated in-flight loads transfer intent back to pending instead of vanishing. Closes openclaw#128655. Supersedes openclaw#128691. * fix(ui): scope disconnect loading normalization to the transition Repeated identical disconnected snapshots must stay no-ops for pane ownership (chat-pane-lifecycle contract); normalize chatLoading only on the connected->disconnected edge. * fix(ui): keep failed history refreshes actionable over cached transcripts A refresh failure with cached messages rendered nothing: the failure panel only replaced an empty thread, so stale content sat with no error or Retry. Render the same failure surface as a compact non-displacing banner above the transcript when content exists, sharing one builder with the empty-state panel. Adds the cached-refresh browser regression with screenshot proof.
* origin/main: (24 commits) fix(gateway): reject rootless session permission modes (#128149) docs(memory): document shipped turn-taint propagation for network tool output (#129837) fix(ui): pool reply-less wake activity into one chat rollup (#128442) fix(package): prevent installs from deleting validated runtime assets (#129724) fix(nodes): approve silent initial node surfaces and name the pending surface approval (#129795) fix(backup): preserve configured agent state roots (#129773) fix(ui): own chat history issuance with a closed state machine (#129776) fix(cron): preserve cancellation reason after late finalization (#129331) fix(cron): prevent run waits from failing after clock changes (#129805) fix(telegram): route commentary through one frozen progress owner (#128259) fix(release): start approved VCR mirror recovery jobs (#129829) test: complete current-plugin-metadata-snapshot mock factories (#129791) test(telegram): remove duplicate reaction case (#129848) fix(channels): honor supported account reply-threading policies (#129679) refactor(cli): deduplicate lazy subcommand registration (#129351) fix(ai): report interrupted local-model streams instead of empty success (#129794) refactor(cli): consolidate Gateway fallback and hook ownership (#129802) fix(qa): reject token confidence lanes without executed evidence (#129830) fix(tui): fence session state and delayed actions (#129810) fix(control-ui): keep task progress full width on hover (#129832) ...




Closes #128655
Supersedes #128691
What Problem This Solves
Two related silent/dead-end failure legs in Control UI chat history loading:
loadChatHistoryopened withif (!state.client || !state.connected) return undefined;. Any caller racing the connection lifecycle (observed live during onboarding's config hot-reload ws bounce; also reachable through the pane context's early-return legs) left the pane in skeletons forever: zero requests on the wire, no error, no recorded fact, nothing to retry. Reproduced live on a fresh gateway (chat.historynever appeared in the gateway request log while the pane skeletoned across reloads).setChatError— a dismiss-only alert with no recovery action.Why This Change Was Made
History issuance now lives in one closed state machine recorded at the owner (
ChatHistoryLoadState:idle | pending-connection | in-flight | committed | failed), replacing the implicit combination ofinFlightHistory,chatLoading, andconnectedbooleans callers had to keep in sync:pending-connection(the skeleton is then honest — a load is owed) and re-arms exactly once at the pane context'sconnectedfalse→true transition; the resumed promise threads throughrefreshPageChatso startup paths cannot double-issue.failedwith aretryablefact. With an empty transcript it renders an accessible.chat-history-errorpanel with a Retry action instead of the dismiss-only alert; retryable failures also auto-resume on reconnect. In-flight loads invalidated by reconnect transfer their intent back topending-connectioninstead of vanishing.idle; the oldInFlightChatHistoryRequestparallel state is deleted.This supersedes #128691 by fixing the failure leg at the request owner rather than adding a panel-status presentation layer, and by also covering the never-asked leg a retry affordance cannot reach (there is no failure to retry when no request was ever made). Credit to @vyctorbrzezowski for the issue, the deterministic repro, and the retry-affordance direction.
User Impact
Chat panes can no longer skeleton forever after connection races — they either load once connected or show an actionable error. History failures self-heal on reconnect when retryable and otherwise offer Retry in the transcript area.
Evidence
main):chat-flow.history-issuance.e2e.test.tstimes out waiting for.chat-history-error(the dismiss-only alert reality), and the host regression records zero gateway requests for a disconnected-then-connected pane.node scripts/run-vitest.mjs run ui/src/pages/chat— 153 files, 3,154 passed / 15 skipped; e2e batch (chat-flow.history-issuance,chat-flow.streaming,chat-flow.queue-edit,chat-run-lifecycle) — 25/25 passed;node scripts/check-changed.mjsgreen.