Repository navigation
fix(ui): discard unsent Incognito drafts on reload - #156398
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, 7:03 AM ET / 11:03 UTC (Revision 4). ClawSweeper reviewWhat this changesThe PR prevents unsent Incognito text and attachments from returning after reload, cleans up previously stored private input, and preserves ordinary drafts and submitted messages. Merge readiness✅ Ready for maintainer review This remains a useful fix for behavior still present on main. The prior authentication-restoration finding is resolved, and this review found no new blocking defect. Priority: P2 Review scores
Verification
How this fits togetherThe Control UI composer stores ordinary drafts in browser storage and keeps submitted messages in a separate outbox. Session identity and connection ownership determine which input can be saved or restored. flowchart TD
A[Composer text and attachments] --> B[Session and connection identity]
B --> C{Incognito session?}
C -->|Yes| D[Keep unsent input in page memory]
C -->|No| E[Save ordinary browser draft]
D --> F[Reload discards unsent input]
E --> G[Reload restores ordinary draft]
B --> H[Submitted outbox retains separate recovery]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +188, Tests +823, Docs 0. Total +1011 across 16 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Technical reviewBest possible solution: Keep Incognito unsent input page-local through the existing persistence owners while preserving ordinary draft recovery and submitted-message custody. Do we have a high-confidence way to reproduce the issue? Yes: current-main source exposes the unfiltered tab-storage restore path, and the contributor demonstrates the existing Incognito chat reload scenario. This reviewer did not execute it. Is this the best way to solve the issue? Yes: extending the existing composer and outbox owners closes the second persistence path without adding another store or changing submitted-message recovery. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 5ed1f2d0a172. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (3 earlier review cycles)
|
|
The authentication-readiness finding is fixed in c3a2ae1. An unchanged composer no longer treats the initial authenticated owner as a content edit; durable restoration can complete before replacement writes. Captured-write owner fences and Incognito cleanup remain enforced. The deterministic delayed-authentication regression fails before this correction and passes afterward; its genuine-edit control verifies the new text is durably written to the authenticated owner. The registered annotation reload also now passes at 390 and 1440 pixels with the exact saved comment and submitted attachment bytes intact. The PR body includes inspected before/after evidence and the original CI failure, nonreproducing shard replay, and separate causal reproduction. For compatibility: the extracted state module defines in-memory controller state and owner predicates, not a new serialized storage format. Storage versions and recovery limits are unchanged. The final 170-case owner batch includes v1/v2/v3 private-input retirement, deferred migration, explicit revisions, receipts, failed deletion, concurrent replacement, and preserved submitted queue data; the eight-case registered draft suite also preserves ordinary drafts and the submitted inline outbox. Both screenshot pairs have now been verified to render in this PR. Fresh review and CI remain required for the corrected head. The corrected c3a hosted run completed all nine browser shards successfully. The original annotation shard passed 77 files / 364 cases in 627.18 seconds; the annotation file took 63.545 seconds, including 14.014 seconds at 1440 pixels and 9.525 seconds at 390 pixels. Its only underlying failure was the main-owned SwiftLint scanner entry, fixed by #156415. The subsequent bbe046 refresh exposed a newly merged main fixture that omitted the required transcript pane callback. The same six cases failed under Node and Bun, and the UI chat type graph rejected the argument. Commit 91ee6aa repairs that fixture on main; the original six failures reproduced locally, then all 123 existing cases passed in 3.89 seconds and the UI chat type graph and typed lint passed. No assertions or timeouts changed. Current head 636cec1 incorporates these owning fixes; the PR patch is unchanged, and fresh enforced CI is running. |
c3a2ae1 to
bbe0464
Compare
Keep initial authentication separate from composer content edits so restored tab text cannot overwrite durable annotation attachments. Preserve captured-write ownership and private-input retirement, and require the final saved annotation content before browser reload proof.
bbe0464 to
636cec1
Compare
|
@clawsweeper re-review Please review current head 636cec1. This is a patch-identical refresh of the clean-reviewed correction onto the owning main CI repairs; the automatic synchronize dispatch was cancelled before starting. No source correction has been added since c3a2ae1. |
|
🦞👀 Re-review progress:
|
|
Merged via squash auto-merge.
|
* fix(ui): discard unsent Incognito drafts on reload * fix(ui): restore durable drafts after authentication Keep initial authentication separate from composer content edits so restored tab text cannot overwrite durable annotation attachments. Preserve captured-write ownership and private-input retirement, and require the final saved annotation content before browser reload proof.
Backport producer prerequisite #156398: 62dd212 Backport #158213: 62ec66d Keep private unsent input out of persistence and protect memory-only drafts from automatic reload across chat panes, New Session and navigation handoffs. Review/discard remains bound to the captured owner, content and lifecycle. Preserve submitted queues, ambiguous legacy sources and Google thinking claims. Owner, sibling, New Session and relocated attachment proof is retained; independent review and composed frozen guards pass. Five browser suites ran zero local scenarios because loopback preflight refused; browser interactions and inspected before/after images remain required qualification, not claimed. No broad UI refactor, IndexedDB migration, expiry policy or version change. Co-authored-by: RomneyDa <[email protected]> Co-authored-by: vyctorbrzezowski <[email protected]> Co-authored-by: steipete <[email protected]> Co-authored-by: jalehman <[email protected]>
What Problem This Solves
Fixes unsent text returning after a full page reload in an existing Incognito chat.
User Impact
Reloading discards unsent Incognito text and staged attachments. Settings → Back still keeps them in the current page; ordinary drafts and already-submitted messages in the tab-only inline outbox retain their existing recovery behavior.
Why This Change Was Made
The session-storage outbox also carried unsent composer fields, independently of the IndexedDB privacy check. The registered chat route restored those fields before session metadata identified the chat as Incognito. The existing persistence owners now recognize canonical private session keys immediately, honor late metadata only for the captured session and connection owner, and retire previously stored private input without deleting submitted queue entries. Pending writes cannot publish into a different Gateway or authenticated owner.
Legacy cleanup preserves explicit revision fences, ambiguous identities, and submitted queue bytes. When recovery capacity defers a migration, empty private rows remain valid or are removed; successful migration receipts still prevent duplicate imports if deleting the old source fails. Acknowledged input can be cleared while deletion is unavailable, and its empty key remains in the existing retirement lifecycle until deletion recovers; concurrent replacement bytes remain protected. No storage schema or recovery limit changes.
Evidence
The real UI reproduction and the registered browser regression both retained private unsent text before this fix. The browser flow types text, adds a file, navigates through Settings and Back, then reloads; it verifies private input is gone, a held submitted message survives, and the neighboring ordinary draft remains. The existing eight-case browser suite passes, including the submitted inline queue contract.
Focused owner coverage includes early and late Incognito classification, delayed writes across session/Gateway/credential switches, authentication completing during a pending edit, reentrant IndexedDB retirement, queue admission/update/removal, and v1/v2/v3 deferred migration with repeated reads and failed source deletion. The final seven-file owner batch passes 170 cases with one worker in 4.160 seconds; the 36-case pane handoff suite passes in 3.730 seconds. The final browser batch passes 21 cases in 57.489 seconds wall: the eight-case draft suite takes 21.425 seconds, the eleven-case annotation suite 23.249 seconds, and the two-case committed-state suite 0.568 seconds. This includes ordinary draft recovery and unresolved reconnect authentication. The new stale-record case takes 0.116 seconds; after fixture lint cleanup its two-case file also passes alone in 10.605 seconds wall; the ten-case restore-owner unit file passes in 2.347 seconds wall. The touched browser fixture now awaits its storage transaction instead of polling a timer. Production UI types and all three affected UI test type graphs pass, along with typed lint, export/coercion checks, and line/assertion ratchets. The production UI build passes the unchanged startup budget at 371,132 bytes gzip (200 bytes below its enforcement limit). Independent managed review is clean. Fresh exact-head CI follows the correction below.
CI run 35843375161 / job 107124069809 failed the 390-pixel annotation reload scenario. The original inventory and shard/concurrency replay passed 77 files / 364 tests in 337.555 seconds wall; that was only a nonreproduction. A real IndexedDB negative control then proved that the test helper accepted an older comment with the same draft text, attachment count, and filename. Requiring the final comment fixed that predicate, but the registered reload failure still reproduced, so the failure was not dismissed as a flaky test.
The product cause was an initial-authentication regression in this change: the connection's newly available recovery owner made unchanged tab text look edited, allowing a newer text-only write before complete durable restoration. Content dirtiness is now separate from authentication, while captured-write ownership and private-input retirement keep their fences. A deterministic owner test fails before the correction and passes afterward, including a genuine pre-authentication edit being durably saved to the authenticated owner. The actual annotation reload now passes at both viewport sizes with its exact saved comment and submission bytes intact.
Before: reloading restores private unsent text.
After: reloading clears private unsent input while keeping the submitted message.