Skip to content

fix(ui): discard unsent Incognito drafts on reload - #156398

Merged
steipete merged 2 commits into
mainfrom
codex/incognito-drafts477
Sep 23, 2026
Merged

steipete merged 2 commits into
mainfrom
codex/incognito-drafts477

Conversation

@steipete

@steipete steipete commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

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.

Before: private unsent text survives reload

After: reloading clears private unsent input while keeping the submitted message.

After: private input is discarded and submitted queue remains

Before: saved annotation disappears after reload

After: saved annotation survives reload

@clawsweeper

clawsweeper Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@steipete
steipete marked this pull request as ready for review September 23, 2026 09:30
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui size: XL labels Sep 23, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. 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 Sep 23, 2026
@clawsweeper

clawsweeper Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 23, 2026, 7:03 AM ET / 11:03 UTC (Revision 4).

ClawSweeper review

What this changes

The 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
Reviewed head: 636cec16c920c765a42340790c38f8701a8cfded

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A useful, well-supported repair with the earlier regression corrected and no remaining actionable finding.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (screenshot): Inspected before/after browser captures and the recorded registered-UI reload scenario exercise the changed composer owner with real browser storage: private input disappears, the submitted queue remains, and ordinary annotations survive. Legacy-state coverage verifies compatible retirement across v1/v2/v3 without changing schemas or recovery limits.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (screenshot): Inspected before/after browser captures and the recorded registered-UI reload scenario exercise the changed composer owner with real browser storage: private input disappears, the submitted queue remains, and ordinary annotations survive. Legacy-state coverage verifies compatible retirement across v1/v2/v3 without changing schemas or recovery limits.
Evidence reviewed 9 items Pinned change ownership: Reviewed the merge-base-to-head introduced hunks. The raw test-merge parents match the supplied base followed by the exact PR head; the unrelated Gateway authorization test belongs to base-branch work.
Still necessary on fetched main: The composer and outbox store on fetched main are identical to the corresponding merge-base files. Their original tab-storage write and restore paths lack the introduced Incognito filtering; the existing IndexedDB privacy check does not cover that path. No merged fixing PR is established.
Prior finding resolved: Content equality no longer includes authentication ownership. Initial authentication can therefore restore the complete durable draft before a replacement write. The added regression covers both unchanged text and a genuine edit made before authentication.
Findings None None.
Security None None.

How this fits together

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

Before merge

None.

Agent review details

Security

None.

PR surface

Source +188, Tests +823, Docs 0. Total +1011 across 16 files.

View PR surface stats
Area Files Added Removed Net
Source 7 311 123 +188
Tests 8 1016 193 +823
Docs 1 1 1 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 16 1328 317 +1011

Review metrics

Metric Value Why it matters
Production versus regression coverage Production +188 lines; tests and test support +823 lines net Production growth implements private-input retirement and captured-owner fencing; most growth protects reload, authentication, and legacy-storage behavior.

Stored data model

Persistent data-model change detected: serialized state: ui/src/pages/chat/composer-persistence-state.ts, unknown-data-model-change: ui/src/pages/chat/composer-persistence-state.ts. Migration or upgrade compatibility proof is recorded; maintainers should verify it before merge.

Technical review

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

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This repairs a bounded Control UI Incognito draft-retention defect with ordinary draft recovery preserved.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (screenshot): Inspected before/after browser captures and the recorded registered-UI reload scenario exercise the changed composer owner with real browser storage: private input disappears, the submitted queue remains, and ordinary annotations survive. Legacy-state coverage verifies compatible retirement across v1/v2/v3 without changing schemas or recovery limits.
  • proof: sufficient: Contributor real behavior proof is sufficient. Inspected before/after browser captures and the recorded registered-UI reload scenario exercise the changed composer owner with real browser storage: private input disappears, the submitted queue remains, and ordinary annotations survive. Legacy-state coverage verifies compatible retirement across v1/v2/v3 without changing schemas or recovery limits.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence. Inspected before/after browser captures and the recorded registered-UI reload scenario exercise the changed composer owner with real browser storage: private input disappears, the submitted queue remains, and ordinary annotations survive. Legacy-state coverage verifies compatible retirement across v1/v2/v3 without changing schemas or recovery limits.

Evidence

What I checked:

  • Pinned change ownership: Reviewed the merge-base-to-head introduced hunks. The raw test-merge parents match the supplied base followed by the exact PR head; the unrelated Gateway authorization test belongs to base-branch work. (636cec16c920)
  • Still necessary on fetched main: The composer and outbox store on fetched main are identical to the corresponding merge-base files. Their original tab-storage write and restore paths lack the introduced Incognito filtering; the existing IndexedDB privacy check does not cover that path. No merged fixing PR is established. (ui/src/pages/chat/composer-persistence.ts:258, 5ed1f2d0a172)
  • Prior finding resolved: Content equality no longer includes authentication ownership. Initial authentication can therefore restore the complete durable draft before a replacement write. The added regression covers both unchanged text and a genuine edit made before authentication. (ui/src/pages/chat/composer-persistence.ts:835, 636cec16c920)
  • Correction continuity: GitHub content API blob identities for composer-persistence.ts, outbox-store.ts, and settle.test-support.ts at the previously clean-reviewed correction match their current-head blobs exactly. The older commit was unavailable for a local comparison; these API checks independently verified the central implementation and corrected proof predicate. (ui/src/pages/chat/composer-persistence.ts, c3a2ae1881b4)
  • Inspected browser evidence: Inspected all four downloaded PR images. The Incognito pair shows private unsent text disappearing while the submitted held message remains; the annotation pair shows the ordinary draft retaining its comment after correction. The captured PR body describes the registered browser flow through typing, attachment staging, Settings/Back, and reload, with real browser storage and a mocked Gateway. It reports 21 browser cases passing in 57.489 seconds and the ordinary annotation scenario passing at both viewport sizes. (ui/src/e2e/composer-draft-store.e2e.test.ts:600, 636cec16c920)
  • Existing-state compatibility: The existing storage owner removes only unsent private fields while preserving explicit revisions, submitted queues, ambiguous identities, and migration receipts. Added v1/v2/v3 cases exercise deferred migration, failed deletion, repeated reads, and concurrent source replacement. The captured discussion reports the 170-case owner batch passing; storage versions and recovery limits remain unchanged. (ui/src/lib/chat/outbox-store.ts:430, 636cec16c920)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)

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 (3 earlier review cycles)
  • reviewed 2026-09-23T10:10:13.475Z sha b7a0ea1 :: blocked before merge. :: [P1] Restore ordinary drafts before treating authentication as an edit
  • reviewed 2026-09-23T10:19:45.605Z sha c3a2ae1 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-23T10:57:23.238Z sha 636cec1 :: needs maintainer review before merge. :: none

@steipete

steipete commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor Author

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.

@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 23, 2026
@steipete
steipete force-pushed the codex/incognito-drafts477 branch from c3a2ae1 to bbe0464 Compare September 23, 2026 10:32
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.
@steipete
steipete force-pushed the codex/incognito-drafts477 branch from bbe0464 to 636cec1 Compare September 23, 2026 10:50
@steipete

Copy link
Copy Markdown
Contributor Author

@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.

@clawsweeper

clawsweeper Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@steipete
steipete enabled auto-merge (squash) September 23, 2026 10:58
@steipete
steipete merged commit 62dd212 into main Sep 23, 2026
107 of 108 checks passed
@steipete
steipete deleted the codex/incognito-drafts477 branch September 23, 2026 11:13
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash auto-merge.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 24, 2026
* 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.
@roboclaw-bot roboclaw-bot mentioned this pull request Sep 24, 2026
2 of 8 tasks
roboclaw-bot added a commit that referenced this pull request Sep 26, 2026
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]>
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 docs Improvements or additions to documentation P2 Normal backlog priority with limited blast radius. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XL status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant