Skip to content

fix(ui): make chat history failures retryable - #128691

Closed
vyctorbrzezowski wants to merge 1 commit into
mainfrom
ui/st-foundation-run-status
Closed

vyctorbrzezowski wants to merge 1 commit into
mainfrom
ui/st-foundation-run-status

Conversation

@vyctorbrzezowski

Copy link
Copy Markdown
Member

Closes #128655

What Problem This Solves

Fixes an issue where users opening Chat would receive a dismiss-only alert when chat.startup or chat.history failed. 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):

CHOKIDAR_USEPOLLING=1 node --import tsx scripts/control-ui-mock-dev.ts --host 127.0.0.1 --port 5327
node .artifacts/control-ui-e2e/st-foundation-repro/repro.mjs

The Chromium script installs the repository mock Gateway, defers the first chat.startup, opens /chat, rejects that exact request with GATEWAY_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-error and its Retry control never render.

Why This Change Was Made

Chat history now owns a PanelRefreshStatus fact 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 onRefresh path, which calls refreshPageChat; 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 parallel panel-empty-state.ts and lazy-view-error.ts implementations while keeping the thin loading-state.ts facade for the already-clean Workboard surface. renderSettingsEmpty remains 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

Before and after
Desktop dark comparison

Mobile dark

Before and after
Mobile dark comparison

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:

  • Regression pre-fix proof: focused E2E fails waiting for .chat-history-error.
  • node scripts/run-vitest.mjs ... across panel and chat owners: 618 UI + 6 isolated assertions passed.
  • Focused browser regression: 1 passed; Retry issued chat.history, rendered History 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 build compiled the UI/packages but failed in unrelated post-build plugin validation: imessage loaded a stale local @openclaw/ai/internal/runtime build missing createToolArgumentPreviewSchedule. 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.

@vyctorbrzezowski vyctorbrzezowski self-assigned this Aug 24, 2026
@clawsweeper

clawsweeper Bot commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui size: L maintainer Maintainer-authored PR labels Aug 24, 2026
@clawsweeper clawsweeper Bot added merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. P2 Normal backlog priority with limited blast radius. 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. labels Aug 24, 2026
@clawsweeper

clawsweeper Bot commented Aug 24, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge. Reviewed August 24, 2026, 7:52 AM ET / 11:52 UTC.

ClawSweeper review

What this changes

The PR gives failed Control UI chat-history loads a targeted Retry action and consolidates loading, empty, error, and stale panel rendering.

Merge readiness

⚠️ Ready for maintainer review - 3 items remain

Keep 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
Reviewed head: d9612f214e3a6fa372eff229a3fe6aafacca7a0a

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The central retry behavior is well targeted, but the unresolved shadow-root rendering regression prevents a higher patch rating.
Proof confidence 🌊 off-meta tidepool Not applicable: This MEMBER-authored PR is exempt from the external-contributor proof gate; its body also describes a mock-Gateway browser recovery scenario.
Patch quality 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This MEMBER-authored PR is exempt from the external-contributor proof gate; its body also describes a mock-Gateway browser recovery scenario.
Evidence reviewed 6 items Current-main behavior: Current main writes failed history loads into the generic error state, whose renderer supplies only a dismiss control; the central user problem is not already solved on main.
Correct history owner boundary: The branch records failures in chatHistoryStatus and passes that status to the notices renderer, which invokes the canonical onRefresh callback for Retry.
Shadow-root styling regression: The new empty state returns only global classes, while Browser and Terminal extend the shadow-DOM base; their local static styles do not adopt components.css. The deleted component instead carried its own host, fill, centering, icon, and action styles.
Findings 1 actionable finding [P2] Preserve empty-state styles in shadow-root panels
Security None None.

Live Verification

Command: pnpm test:ui:e2e ui/src/e2e/chat-flow.history-recovery.e2e.test.ts

Result: FAIL (partial) — step 2 expect_output retries a failed history bootstrap from the visible panel error: expected terminal output was not visible within 30 seconds: "retries a failed history bootstrap from the visible panel error"

runner@runnervm76f27:/tmp/clawsweeper-live-proof-128691-cXbuxO/target$ pnpm test:ui:e2e ui/src/e2e/chat-flow.history-recovery.e2e.test.ts
$ node --import tsx scripts/ensure-playwright-chromium.mts && node scripts/run-vitest.mjs run --config test/vitest/vitest.ui-e2e.config.ts --configLoader runner
 ui/src/e2e/chat-flow.history-recovery.e2e.test.ts
pnpm test:ui:e2e ui/src/e2e/chat-flow.history-recovery.e2e.test.ts
[ui-e2e] Using system Chromium at /usr/bin/chromium-browser.
Downloading FFmpeg (playwright ffmpeg v1011) from https://cdn.playwright.dev/dbazure/download/playwright/builds/ffmpeg/1011/ffmpeg-linux.zip
2.3 MiB [====================] 100% 0.0s
FFmpeg (playwright ffmpeg v1011) downloaded to /tmp/clawsweeper-live-proof-128691-cXbuxO/profile/cache/ms-playwright/ffmpeg-1011

 RUN  v4.1.10 /tmp/clawsweeper-live-proof-128691-cXbuxO/target








































Assertions:

  • FAIL expect_output: retries a failed history bootstrap from the visible panel error

How this fits together

Control 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]
Loading

Before merge

  • Preserve empty-state styles in shadow-root panels (P2) - renderPanelEmptyState now returns global components.css classes, but Browser and Terminal render inside shadow roots that do not adopt that stylesheet. The deleted custom element carried the full-height centered layout and action styling, so these panels render an unstyled empty state; retain a shadow-styled component or adopt equivalent scoped styles. This is the unresolved prior finding on the same head.
  • Resolve merge risk (P1) - Merging as-is removes the shadow-local empty-state styles from Browser and Terminal, so those panels lose their intended fill, centering, and action layout.
  • Complete next step (P2) - A narrow mechanical repair can restore the deleted shadow-root empty-state presentation without changing the chat-history retry design.

Findings

  • [P2] Preserve empty-state styles in shadow-root panels — ui/src/components/panel-state.ts:43-47
Agent review details

Security

None.

PR surface

Source +1, Tests +57. Total +58 across 38 files.

View PR surface stats
Area Files Added Removed Net
Source 25 239 238 +1
Tests 13 89 32 +57
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 38 328 270 +58

Review metrics

Metric Value Why it matters
Production versus test LOC production +235/-238 (net -3); tests/test support +93/-32 (net +61) The proposed refactor is production-net-negative while adding focused history-recovery coverage.

Stored data model

Persistent data-model change detected: serialized state: ui/src/e2e/chat-flow.history-recovery.e2e.test.ts, serialized state: ui/src/pages/chat/components/session-discussion-panel.open-flow.test.ts, serialized state: ui/src/pages/chat/components/session-discussion-panel.test.ts, serialized state: ui/src/pages/chat/components/session-discussion-panel.ts. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #128655
Summary: This PR is the proposed implementation for the reported missing chat-history retry action.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge-risk options

Maintainer options:

  1. Restore shadow-root empty-state presentation (recommended)
    Retain a shadow-styled empty-state component or adopt equivalent scoped styles in Browser and Terminal, then prove their rendered layout.
Copy recommended automerge instruction
@clawsweeper automerge

Special instructions:
Preserve the shared panel-state API while restoring full-height centered empty-state and action styling inside Browser and Terminal shadow roots.

Technical review

Best 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:

  • [P2] Preserve empty-state styles in shadow-root panels — ui/src/components/panel-state.ts:43-47
    renderPanelEmptyState now returns global components.css classes, but Browser and Terminal render inside shadow roots that do not adopt that stylesheet. The deleted custom element carried the full-height centered layout and action styling, so these panels render an unstyled empty state; retain a shadow-styled component or adopt equivalent scoped styles. This is the unresolved prior finding on the same head.
    Confidence: 0.99

Overall correctness: patch is incorrect
Overall confidence: 0.99

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 0d840c0fce11.

Labels

Label justifications:

  • P2: This repairs a recoverable Control UI history failure, but the remaining regression is limited to empty-state presentation.
  • merge-risk: 🚨 other: The shared renderer migration changes visual behavior across light-DOM and shadow-root panel surfaces.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: This MEMBER-authored PR is exempt from the external-contributor proof gate; its body also describes a mock-Gateway browser recovery scenario.

Evidence

Acceptance criteria:

  • [P1] pnpm test ui/src/components/browser/browser-panel.test.ts ui/src/components/terminal/terminal-panel.test.ts.
  • [P1] pnpm test:ui:e2e ui/src/e2e/chat-flow.history-recovery.e2e.test.ts.

What I checked:

  • Current-main behavior: Current main writes failed history loads into the generic error state, whose renderer supplies only a dismiss control; the central user problem is not already solved on main. (ui/src/pages/chat/chat-history.ts:1856, 0d840c0fce11)
  • Correct history owner boundary: The branch records failures in chatHistoryStatus and passes that status to the notices renderer, which invokes the canonical onRefresh callback for Retry. (ui/src/pages/chat/chat-history.ts:1865, d9612f214e3a)
  • Shadow-root styling regression: The new empty state returns only global classes, while Browser and Terminal extend the shadow-DOM base; their local static styles do not adopt components.css. The deleted component instead carried its own host, fill, centering, icon, and action styles. (ui/src/components/panel-state.ts:43, d9612f214e3a)
  • Tests miss computed-style behavior: The changed Browser and Terminal tests assert that empty-state markup exists but do not assert the full-height, centered layout or Browser Start-action presentation. (ui/src/components/browser/browser-panel.test.ts:100, d9612f214e3a)
  • Prior-review continuity: The affected files are byte-identical to the prior reviewed head, so its unresolved shadow-root finding still applies. (ui/src/components/panel-state.ts:43, d9612f214e3a)
  • Chat-history provenance: The current-main generic-error path is attributed by blame to the immediately preceding baseline commit, with Peter Steinberger as the recent chat-history contributor. (ui/src/pages/chat/chat-history.ts:1856, 68ba1ef641e5)

Likely related people:

  • vyctorbrzezowski: Authored the current branch and the related merged chat side-panel refactor that owns the affected Browser and Terminal presentation surfaces. (role: recent UI panel contributor; confidence: high; commits: d9612f214e3a, 31ce436b5f69; files: ui/src/components/browser/browser-panel-render.ts, ui/src/components/terminal/terminal-panel-chrome.ts, ui/src/components/panel-state.ts)
  • steipete: Blame and recent history connect Peter Steinberger to the current-main chat-history failure path and its surrounding owner module. (role: recent chat-history contributor; confidence: medium; commits: 68ba1ef641e5, 079a874159fb; files: ui/src/pages/chat/chat-history.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Restore the Browser and Terminal shadow-root empty-state styles.
  • Add focused presentation coverage or fresh browser proof showing the corrected empty panels, including Browser's Start action.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (1 earlier review cycle)
  • reviewed 2026-08-24T11:11:15.221Z sha d9612f2 :: needs changes before merge. :: [P2] Keep empty-state styles available in shadow-root panels

steipete added a commit that referenced this pull request Aug 26, 2026
* 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.
@steipete

Copy link
Copy Markdown
Contributor

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 (idle | pending-connection | in-flight | committed | failed). That covers this PR's dead-end-alert leg (failures render an accessible transcript Retry surface — full panel when empty, non-displacing banner over cached history — and retryable failures auto-resume on reconnect) plus a deeper leg a retry affordance can't reach: loadChatHistory's silent no-op when a caller races the connection lifecycle, which left panes skeletoned forever with no request ever issued (reproduced live). Evidence, pre-fix failing regressions for both legs, and inspected screenshots are on #129776.

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.

@steipete steipete closed this Aug 26, 2026
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 26, 2026
…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.
@RomneyDa
RomneyDa deleted the ui/st-foundation-run-status branch October 22, 2026 00:26
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 maintainer Maintainer-authored PR merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: L 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.

[Bug]: Control UI chat history failures offer no retry action

2 participants