Repository navigation
fix(chat): stop the crash-recovery reload loop on a busy long chat - #16017
Conversation
UX Review (Fable 5) — 🟡 CONCERNSUX-level review of UX-Verdict: CONCERNS Crash recovery lands the user on the welcome screen with no explanation of why their chat did not reopen. Watch
[UX-REVIEWED] 60bda97 Description read[DESCRIPTION-READ] 86a3908b5b4d4b33f4f64a54b762c0d4602625235276ed53bbc50032259d190d That sha256 names everything this verdict read: the PR description, plus the 3 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
First Principles Review (Fable 5) — 🟡 CONCERNSPremise-level review of First-Principles-Verdict: CONCERNS The safe-flag survives four self-reloads but not all six: Not justified as shipped
What this change shipsInventory (7 items) — 6 justifiedIntent: stop a busy long chat from freezing the dashboard on open and from being reopened in a loop after the crash (#12907) — a FIX.
The deleted "unbounded while streaming is deliberate" pin (comment + test) is declared in the description and reversed with evidence: linked issue #12907 and prior proposal #10026. [FIRST-PRINCIPLES-REVIEWED] 60bda97 Description read[DESCRIPTION-READ] e3cb8f4a56e951364a01e0b91ffaac1947e7fae101e892e9d5ec1e4a82f79dbc That sha256 names the PR description this verdict read. Recompute it with |
GPT 5.6 Review — ✅ no blocking findingsGPT 5.6 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
Design Review (Fable 5) — 🟡 CONCERNSDesign-level review of Design-Verdict: CONCERNS Desktop crash-recovery path is declared unverified — the description's own "Manual verification: Still required" must be done before merge. Watch
Suggestions
[DESIGN-REVIEWED] 60bda97 Description read[DESCRIPTION-READ] 34f298f225d35fe786ea710608b6a99e0f22674d4746a7f40e66e596095ec519 That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
Opus 5 Review — ✅ no blocking findingsReviewed Review detailsNothing blocks merge; one advisory — the unbounded whole-transcript hydrate this change removes for running slots is still routinely reachable on the crewmate pane. FINDING — website/src/components/ChatPane.tsx:739 — the surviving [OPUS-REVIEWED] 60bda97 Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
4e42340 to
ed50e00
Compare
|
self-added: yes
|
|
self-added: yes
|
|
|
|
|
ed50e00 to
786fce3
Compare
|
self-added: yes
|
|
786fce3 to
60bda97
Compare
|
|
|
|
Problem / Motivation
Goal: A long chat that is still running no longer freezes the dashboard on open, and a crash no longer reopens the same chat in a loop.
Users report the app window freezing over and over (#12907). The terminal shows
Renderer process killed, then the window comes back frozen again. The web dashboard freezes the same way. Users cannot switch chats at all.Why it matters
Anyone with a long chat that is busy (a long task, a monitor loop) can be locked out of the whole dashboard. Restarting does not help, because the app reopens that same chat. The only way out today is to clear browser storage by hand.
Not a goal
refreshSlot/switchSlot. perf: walk slot windows older instead of unbounded re-reads #13236 already fixed those on main.What changed (motivation → approach → change)
Two fixes. One breaks the loop. One removes the freeze.
website/electron/renderer-recovery.js,website/electron/window-lifecycle.jssafe=1to the dashboard URL. If that load gets a 403, the token retry keepssafe=1website/src/lib/safeReload.ts,website/src/main.tsx,website/src/lib/staleShellHeal.tssafe=1once at startup, then strips it from the address bar. Every reload the page makes for itself during boot (restored UI prefs, the stale-shell heal, a stale-chunk reload) putssafe=1back, so the load that renders is still safewebsite/src/pages/chat/useChatPageSessionController.tswebsite/src/components/ChatPane.tsxPANE_HYDRATE_LIMITrows, like an idle oneThe freeze:
ChatPanedropped its row limit whenever the chat was running. A busy long chat then loaded its whole history at once. The renderer hung, and the watchdog killed it.The loop: the recovery reload restored the last open chat. That was the same busy chat, so it froze again.
The old reason for loading everything while running no longer holds. The server collapses streaming chunks before it counts and slices rows, so a bounded page is correct mid-stream too. This is the change #10026 proposed, redone on current main.
The remembered chat is not erased. A normal launch still returns to it. A manual refresh is a normal load, because
safe=1is already gone from the URL.Known residual
ChatPane.tsxstill reads the whole transcript for a crewmate pane whose bounded window holds no speech (crewmateQuietUnproven). That path is not changed here. It only applies to crewmate panes, and bounding it needs its own design for the quiet-hint read. It is left for a follow-up.Backwards compatibility
Compatible: nothing that works today is rejected.
safe=1is a new optional URL flag, and normal loads behave as before.Tests
website/electron/test/renderer-recovery.test.js: the recovery reload URL carriessafe=1, with or without a credential.website/src/lib/safeReload.test.ts:safe=1is detected, stripped from the URL, and other params stay.website/src/lib/safeReload.test.ts: a boot-time reload of a safe load restoressafe=1; on a normal load it is a plain reload.website/src/test/staleShellHeal.test.ts,website/src/test/staleChunkReloadKeepsSafe.test.ts: the stale-shell heal and the stale-chunk handler keepsafe=1on a safe load. Both fail without the fix.website/src/test/ChatPage.persist.integration.test.tsx: a safe reload opens no chat; once the user opens one, closing it moves to another chat as usual.website/src/test/ChatPage.persist.integration.test.tsx: a safe reload opens no chat, and a normal load still restores the remembered one.website/src/test/ChatPane.hydrateBound.test.tsx: a running chat requests a bounded page. Both tests fail with theChatPanechange reverted.Manual verification
Still required: open a running long chat in the desktop app built from this branch (
make desktop), and confirm it opens without freezing. Then force a renderer crash and confirm the window comes back with no chat open.Screenshots / video
Why no screenshot: No layout or style changes; the diff only changes which chat opens after a crash and how many rows a running chat loads.
Related Issues
Supersedes #10026, which was closed as covered by #13203; #13203 bounded only the background warm-up, not this
ChatPanepath.Fixes #12907
Pattern harvest
Rule candidate: review-prompt
Pattern: "a crash-recovery path that restores the same state that caused the crash"
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)