Repository navigation
fix(ui): preserve unsaved file edits during interface reloads - #156208
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 23, 2026, 1:47 AM ET / 05:47 UTC. ClawSweeper reviewWhat this changesThe PR prevents automatic and in-app interface reloads while unsaved workspace-file edits remain, adds recovery guidance, and covers closed previews with browser regressions. Merge readiness✅ Ready for maintainer review Keep open: this is a focused, supported fix that remains absent from current main and the latest release. No blocking correctness findings were identified. Priority: P2 Review scores
Verification
How this fits togetherThe Control UI retains workspace-file edits in page memory when editor previews close. Its shared reload guard decides whether update recovery or an in-app reload may replace that page. flowchart TD
A[Workspace file edits] --> B[Retained drafts]
B --> C{Unsaved drafts remain?}
D[Automatic or in-app reload] --> C
C -->|Yes| E[Keep page and explain manual block]
C -->|No| F[Allow document reload]
G[Save or discard edits] --> B
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +14, Tests +133, Docs +5. Total +152 across 4 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep reload protection with the retained-draft owner until every edit is saved or discarded, preserving the existing memory-only storage contract. Do we have a high-confidence way to reproduce the issue? Yes: edit a workspace file, close its preview, and trigger an in-app reload; current main retains the buffer without registering reload protection. This review verified the source path and contributor evidence without executing it. Is this the best way to solve the issue? Yes: extending the existing retained-draft owner through the shared guard is a narrow repair and avoids a competing reload policy or new persistence mechanism. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 80bab7e23ce0. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash auto-merge.
|
What Problem This Solves
Fixes unsaved workspace-file edits disappearing when an update or an in-app Reload replaces the Control UI document.
User Impact
Unsaved file edits now block automatic and in-app reloads, including drafts in closed previews or other conversations. Save or discard all file edits to release the reload. Explicit browser reloads and closing the tab retain their existing behavior: these drafts live only in the current page's memory.
Why This Change Was Made
The retained file-draft owner now participates in the existing document reload guard. The guard follows the retained drafts rather than mounted editor panels, so closing a preview cannot release protection. A manual blocked reload explains the next step. No storage, Gateway, credential, or file-save contract changes.
Evidence
pnpm test ui/src/pages/chat/components/chat-file-drafts.browser.test.ts --maxWorkers=1) passes in 4.489 seconds wall time; the four cases total 1.283 seconds of browser-test execution in the sibling run. Together with existing text-file and HTML-editor cases, 32 Chromium tests pass in 6.09 seconds. Hosted CI run 35822154674 passes all three UI shards and all nine Chromium E2E shards; the Chromium jobs take 256–435 seconds each including setup and the full shard, rather than the individual regression alone.Before
After