Repository navigation
fix(ui): make chat history failures retryable - #128691
vyctorbrzezowski wants to merge 1 commit into
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs changes before merge. Reviewed August 24, 2026, 7:52 AM ET / 11:52 UTC. ClawSweeper reviewWhat this changesThe PR gives failed Control UI chat-history loads a targeted Retry action and consolidates loading, empty, error, and stale panel rendering. Merge readinessKeep open: the history-owned retry is the right repair, but the shared empty-state refactor still regresses Browser and Terminal shadow-root panels. The prior P2 finding remains unchanged on the same head. Priority: P2 Review scores
Verification
Live VerificationCommand: Result: FAIL (partial) — step 2 Assertions:
How this fits togetherControl UI loads a selected chat transcript through the Gateway and renders status in the chat pane. History-owned refresh state now controls retry and stale-data notices while unrelated chat errors remain on the generic alert path. flowchart LR
A[Gateway history request] --> B[Chat history owner]
B --> C[History refresh status]
C --> D[Chat notice]
D --> E[Retry action]
E --> B
C --> F[Generic chat errors stay separate]
Before merge
Findings
Agent review detailsSecurityNone. PR surfaceSource +1, Tests +57. Total +58 across 38 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: 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: Keep the history-local Retry design, but preserve empty-state styles inside every shadow-root consumer before merging. Do we have a high-confidence way to reproduce the issue? Yes—the checked-in mock-Gateway E2E deterministically rejects chat.startup, then expects Retry and a recovered transcript; this read-only review did not execute it. Is this the best way to solve the issue? No—the history-owned status is the best owner boundary, but the renderer consolidation must retain shadow-root empty-state styles to avoid a separate UI regression. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 0d840c0fce11. LabelsLabel 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)
|
* 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 (#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. * 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.
|
Superseded by #129776, landed on main as 1e84f42 — closing this one. Thank you @vyctorbrzezowski for #128655's deterministic repro and for driving the retry direction; both shaped the landed fix. The landed change fixes the failure at the request owner instead of the presentation layer: chat history issuance is now a closed recorded state machine ( If any of the panel-status groundwork here is still wanted independently (terminal/browser panel chrome refactors), happy to see it rebased as its own PR. |
…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.
Closes #128655
What Problem This Solves
Fixes an issue where users opening Chat would receive a dismiss-only alert when
chat.startuporchat.historyfailed. The main product surface offered no recovery action, so operators had to guess that refreshing the transcript might work.Deterministic reproduction on pre-fix
main(0155d955241):The Chromium script installs the repository mock Gateway, defers the first
chat.startup, opens/chat, rejects that exact request withGATEWAY_UNAVAILABLE, waits for the alert, and counts Retry controls. Observed pre-fix result:{"alertText":"mock lane: gateway request failed Dismiss error","retryButtons":0,"startupRequests":1}The checked-in regression exercises the same browser boundary. It fails on pre-fix code because
.chat-history-errorand its Retry control never render.Why This Change Was Made
Chat history now owns a
PanelRefreshStatusfact instead of publishing history failures through the generic chat error string. That keeps history loading, success, stale data, and failure in one closed state while preserving stale-request fencing, warm pane retention, IndexedDB transcript hydration, and the existing generic alert for unrelated send, command, dictation, permission, and draft-storage errors.Retry invokes the existing canonical
onRefreshpath, which callsrefreshPageChat; no parallel request, fallback, timeout, protocol, persistence, or Gateway behavior was added.The shared presentation foundation consolidates the existing loading, empty, retryable error, and stale notice renderers into
panel-state.ts. It removes the old parallelpanel-empty-state.tsandlazy-view-error.tsimplementations while keeping the thinloading-state.tsfacade for the already-clean Workboard surface.renderSettingsEmptyremains settings-group-specific and unchanged.Historical decisions preserved:
Blast radius verified: startup and reconnect history, direct history reloads after session events and sends, outbox reconciliation, branch/reset/rewind flows, retained session panes, cached transcript hydration, same-client epoch changes, session/agent switches, missing read scope, and older-history pagination. Older-page failures remain owned by the existing Show earlier flow.
User Impact
Chat history failures now tell operators exactly what to do next: click Retry. A successful retry restores the transcript and removes the alert. If previously loaded messages exist, a failed refresh keeps them visible and marks them stale rather than presenting a false empty state.
Loading and empty presentation now share one panel-state foundation, reducing duplicated markup and making “empty only after success” the representable owner contract for future panel adoptions.
Evidence
Desktop dark
Mobile dark
All four frames were captured from the real mocked-Gateway browser flow and inspected after capture. The before frame has no Retry; the after frame preserves the compact alert and adds the action without shifting the rest of the page.
Validation:
.chat-history-error.node scripts/run-vitest.mjs ...across panel and chat owners: 618 UI + 6 isolated assertions passed.chat.history, renderedHistory recovered., and removed the alert.pnpm tsgo:core:test— passed.pnpm tsgo:ui— passed.node scripts/check-changed.mjs -- <changed files>— format, i18n, guards, dead exports, typechecks, and lint completed without diagnostics after focused fixes.pnpm ui:build— passed; 956 sidecars verified and startup JS/CSS budgets remained green..agents/skills/autoreview/scripts/autoreview --mode uncommitted— clean, no accepted/actionable findings, confidence 0.99; TruffleHog clean.Full
pnpm buildcompiled the UI/packages but failed in unrelated post-build plugin validation:imessageloaded a stale local@openclaw/ai/internal/runtimebuild missingcreateToolArgumentPreviewSchedule. The focused UI build and all touched-surface checks are green.Production LOC: +235/-238, net -3. Tests/test support: +93/-32, net +61. The single new browser regression fails on pre-fix code for the intended missing-Retry reason; the remaining test edits follow the consolidated renderer and required ChatState fixture field.