Repository navigation
fix(ui): preserve offline drafts and resume canceled queue edits - #133628
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 30, 2026, 11:17 PM ET / August 31, 2026, 03:17 UTC. ClawSweeper reviewWhat this changesThe branch preserves durable offline composer drafts, resumes queued delivery after canceling a reconnect-time edit, and consolidates Control UI outbox ownership and related regression coverage. Regression provenancePossible regression — probable (reproduction; reviewed change). No predecessor PR is attributed. Merge readinessThis maintainer-owned PR remains necessary: current main lacks both the reconnect-time Cancel wake and the pending-before-notify draft fence. The repair follows the existing outbox owner boundary and has focused browser coverage, but current main has advanced substantially through the same files since the branch diverged. Priority: P1 Review scores
Verification
How this fits togetherThe Control UI keeps unsent drafts and queued chat messages in browser storage while the Gateway connection changes. Captured conversation identity determines which durable draft and queue are restored, displayed, and eventually sent through the Gateway. flowchart LR
A[Control UI split panes] --> B[Browser draft and outbox storage]
B --> C[Captured conversation identity]
C --> D[Reconnect and queue drain]
D --> E[Gateway chat delivery]
C --> F[Durable composer draft]
F --> A
Before merge
Agent review detailsSecurityNone. PR surfaceSource -142, Tests +685. Total +543 across 80 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Rebase the coherent owner-boundary repair onto current main, retain its split-pane durable-draft and Cancel/FIFO regression coverage, and verify the exact merged candidate before landing. Do we have a high-confidence way to reproduce the issue? Yes, source-reproducible: the added browser regression drives the reported split-pane/offline/reconnect sequence and verifies the durable draft plus post-Cancel delivery outcome. This review did not execute the checkout. Is this the best way to solve the issue? Yes: keeping conversation identity captured at admission, retaining the authenticated browser owner while offline, and waking the existing drain after a released edit hold repairs the responsible UI owners without adding policy or storage formats. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against bef84be7f5e9. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (4 earlier review cycles)
|
514049b to
b277529
Compare
Unify queue location and captured admission ownership, consolidate draft revision/lineage bookkeeping, and remove obsolete projection adapters. Reserve composer snapshots before synchronous publication and reconcile native persistence using the retained authenticated offline owner. Wake the existing drain after successful queued-edit Cancel without mutating the stored row. Preserve explicit startup routes and own file-icon styles statically so their first offline use cannot cache a rejected load. Fixes #133555 Fixes #133603 Validated owner and native-browser regressions, integration checks, compilers, complete builds, scoped independent review, and real isolated Gateway/provider/browser flows including Cancel and Save. Production code shrinks; persistence formats, CAS, uncertainty and Blob custody stay unchanged.
b277529 to
1038fb3
Compare
|
Resolved-head proof for 1038fb3cd98b, addressing the conflict-resolution and exact-candidate replay requested in the latest ClawSweeper review. Both required integrations preserve newer main behavior. The first kept pending-input/consumption receipts, active-run state, preference fencing and attachment release ownership; it required two test-only migrations to the canonical admission and fixture APIs. The later conflict was only the Copy submenu test import: the new menu interaction stays, and the removed fixture wrapper stays removed. No compatibility API or production workaround was restored. The first integrated tree passed 1,492 cases in 43 files, full changed checks, both compiler contracts and both cycle checks. The final small refresh passed 602 focused cases in 12 files (including native queue/draft/attachment, current menus and visibility/history coverage), both compiler contracts and scoped lint, with zero failures, skips or todos. Those cohorts overlap and are not summed as unique tests. Earlier stale-caller failures and the one no-output watchdog termination remain recorded; the final selected runs pass without larger timeouts or weakened assertions. The fresh complete Rebuilt real flow: actual isolated Gateway → OpenClaw runtime → OpenAI ( The attached final screenshot and uncut Cancel/Save recordings were inspected: synthetic conversations/files, empty or masked credential controls, and no unrelated/private data. The earlier failed-Cancel screenshot remains in the PR body as the before evidence. Stored-data review note: the consolidated revision/lineage maps are in-memory bookkeeping. Metadata v4, IndexedDB v2, keys, retention, migration receipts/source retention, tombstones, CAS/winner semantics, uncertainty and Blob custody remain unchanged. Existing legacy migration, conflict, credential and native-storage cases remain covered; this is not a schema or serialized-format migration. The separately recorded raw-global ACP ownership and custom-main policy gaps remain explicit; no global/custom-main live pass is claimed. Final exact-head CI and complete browser inventory are recorded below. attachment-3367646139.webmattachment-2500158143.webmFinal exact-head verification and review dispositionThe corrected head is 789afd1c42cd. CI run 33352526228, attempt 1 completed successfully. Actual checkout and workflow identity in every audited job is synthetic merge Canonical discovery and actual execution reconcile 334 mocked-browser files / 1,365 passed cases across 13 disjoint shards. All 78 pairwise file intersections are empty; no missing, unexpected or duplicate files. Every terminal count agrees with observed case records. Zero failed/skipped/todo/pending/retried/repeated cases, and zero reported unhandled errors or leaked processes in these shards. The complete job listing reconciles 127 unique jobs across two pages. Seven E2E bodies and timing weights differ between head and the tested merge; filenames and selection-config bytes agree. Actual shard membership and counts came from CI logs, not head timing weights or an inferred partition.
Separately, real Gateway job 99368671395 passed all 4 files / 9 cases, and browser-extension job 99368672160 passed 1 file / 1 case. These are not added to the mocked union. Supplemental Control UI job 99368671641 reports 847 files, 13,040 passed and one skipped case: the explicitly opt-in memory-panel Chromium proof did not execute. The zero-skip claim applies to the audited E2E lanes, not all UI tests. The earlier head's first run and the requested retry both failed at the page-wide assistant locator. The final test-only correction scopes the active rendered pane and strengthens single-send, DOM/canonical reply uniqueness and captured recovery-owner assertions. Fixture agent identity is now independent of busy/idle state. Local proof passed 306 cases in 30 files plus the exact final case, compilers/lint and a fresh independent scoped Codex review. Production at789 is byte-identical to the rebuilt/live-tested1038 candidate above; the recordings are not being relabeled as a different production build. Latest ClawSweeper rank-up disposition: no actionable code/security findings remain. The requested resolved-candidate owner/native tests, real Cancel/Save replay and exact-head browser shards have been completed. I am deliberately skipping another rebase solely for main drift: comparing shared base Exact focused local commands from the final production refresh (overlapping cohorts are not summed as unique tests): node scripts/run-vitest.mjs run ui/src/pages/chat/chat-state.test.ts ui/src/pages/chat/chat-send.test.ts ui/src/pages/chat/composer-persistence.test.ts ui/src/lib/chat/outbox-store.test.ts ui/src/pages/chat/chat-history.inflight.test.ts --maxWorkers 2 --reporter=default --reporter=json --outputFile=.artifacts/outbox-cleanup/rebase2-unit.vitest.jsonnode scripts/run-vitest.mjs run --config test/vitest/vitest.ui-e2e.config.ts --configLoader runner --maxWorkers 2 ui/src/e2e/session-color.e2e.test.ts ui/src/e2e/session-management.copy-session-id.e2e.test.ts ui/src/e2e/session-management.sidebar.e2e.test.ts ui/src/e2e/session-management.draft-indicator.e2e.test.ts ui/src/e2e/composer-recovery-fences.e2e.test.ts ui/src/e2e/attachment-file-styles.e2e.test.ts ui/src/e2e/composer-draft-store.e2e.test.ts --reporter=default --reporter=json --outputFile=.artifacts/outbox-cleanup/rebase2-native.vitest.jsonpnpm tsgo:uinode scripts/run-tsgo-core-test-shards.mjsnode scripts/run-oxlint.mjs --tsconfig config/tsconfig/oxlint.core.json ui/src/e2e/session-management.copy-session-id.e2e.test.ts ui/src/pages/chat/chat-state-events.ts ui/src/e2e/session-color.e2e.test.ts ui/src/e2e/session-management.sidebar.e2e.test.tsenv OPENCLAW_BUILD_CACHE=0 pnpm buildFinal LOC remains production +509/−623 = −114; tests/support +1,079/−422 = +657; 80 files. The separately recorded raw-global ACP and custom-main live gaps remain—not claimed passes. Ten older unrelated quota/lobster fixture PNGs were overwritten before backup during local replay; eight other outputs were restored, all79outbox captures and published proof remain intact. Run-scoped fixture output is a separate follow-up. Owned live resources are stopped and the temporary provider-key copy has been removed. Native review artifacts validated, mandatory hosted-evidence preparation passed in exact-head mode, and native merge completed as 8715e87f666c. Both linked issues closed automatically. The landed production files match the reviewed head exactly; the worktree is clean and synchronized to main. The native drift warning was advisory under the existing policy, with the overlapping test changes inspected as described above. |
Retained hidden panes can contain the same conversation output. Keep strict visible-owner assertions and require one canonical reply and one send instead of querying every cached pane in the page. Keep fixture session and run identities tied to the agent, not its busy flag, and verify that recovery history queries retain the Work owner. Reproduced both page-wide locator failures before correction. The original 26-file selection and fitting siblings pass; timeouts, runtime behavior, and deliberate raw-event fault injection remain unchanged.
|
Merged via squash.
|
…nclaw#133628) * fix(ui): preserve offline drafts and resume canceled queue edits Unify queue location and captured admission ownership, consolidate draft revision/lineage bookkeeping, and remove obsolete projection adapters. Reserve composer snapshots before synchronous publication and reconcile native persistence using the retained authenticated offline owner. Wake the existing drain after successful queued-edit Cancel without mutating the stored row. Preserve explicit startup routes and own file-icon styles statically so their first offline use cannot cache a rejected load. Fixes openclaw#133555 Fixes openclaw#133603 Validated owner and native-browser regressions, integration checks, compilers, complete builds, scoped independent review, and real isolated Gateway/provider/browser flows including Cancel and Save. Production code shrinks; persistence formats, CAS, uncertainty and Blob custody stay unchanged. * test(ui): scope cross-agent outbox proof to the active pane Retained hidden panes can contain the same conversation output. Keep strict visible-owner assertions and require one canonical reply and one send instead of querying every cached pane in the page. Keep fixture session and run identities tied to the agent, not its busy flag, and verify that recovery history queries retain the Work owner. Reproduced both page-wide locator failures before correction. The original 26-file selection and fitting siblings pass; timeouts, runtime behavior, and deliberate raw-event fault injection remain unchanged.

Closes #133555 — offline split-pane drafts can remain only in tab storage after queue activity.
Closes #133603 — Cancel can close a queued edit after reconnect without waking delivery.
Related: #133067 — the earlier main-session recovery-target repair; #133409 — the already-landed custody simplification. Their changes are not duplicated here.
Additional instructions
Maintainer-owned branch in
openclaw/openclaw; maintainers can update it.What Problem This Solves
Fixes an issue where users composing an independent draft while manipulating an offline split-pane queue could see newer text in the UI and tab storage while the native durable draft remained older. It also fixes Cancel closing a queued-message editor after reconnect without waking delivery: the original messages stayed parked until another event occurred.
This maintainer-requested follow-up removes repeated queue discovery, overlapping admission arguments, duplicate draft bookkeeping and thin adapters. Real-browser verification also exposed two nearby ownership mistakes: saved selection could override an explicit
/chat/mainURL, and first use of attachment icons during a complete Gateway outage could leave a rejected stylesheet import cached.Why This Change Was Made
The existing owners now carry their facts forward. One located queue row includes its captured destination; callers supply the admission captured before asynchronous work; committed and attempted draft revisions remain separate facts inside one record; New Session lineage retains in-flight writes without parallel maps. Composer persistence reserves its pending snapshot before synchronous publication can reenter it, and offline reconciliation uses the already-authenticated retained owner.
Cancel wakes the existing drain only after successfully releasing its local edit hold. It does not mutate storage, invent a retry or bypass history, uncertainty, credential or peer-edit checks. Explicit startup routes and attachment styles remain with their actual owners, while the sidebar asks the projection for domain answers rather than interpreting storage keys and raw maps.
Storage boundary: the consolidated maps are in-memory bookkeeping, not a serialized-format migration. Metadata v4, IndexedDB v2, storage keys and limits, retention, migration receipts/source retention, tombstones, revision/CAS and winner semantics, uncertainty, and Blob custody remain unchanged. No new dependency, configuration option, schema, compatibility layer, timeout increase or performance-budget change.
User Impact
Independent drafts remain durably committed through offline queue activity. Cancel resumes original queued messages in order, preserving their original run IDs and attachment bytes, without submitting or overwriting the main composer draft. Explicit agent URLs win over saved selection, and attachment icons work on first offline use.
The cleanup removes 114 production lines: +509/−623. Tests/support are +1,079/−422, net +657, across 80 files overall. Upstream #133409's 139 removed production lines are excluded. The structural reduction includes one queue-location policy, consolidated revision/lineage containers, explicit admission capture, and removal of forwarding layers, obsolete scope reexports, promise-return wrappers and raw-map sidebar coupling.
Evidence
Resolved-head proof and final Cancel/Save recordings document the rebuilt production candidate. The later CI correction is test-only; production bytes are unchanged.
The native draft regression failed before repair at transaction-complete IndexedDB equality. The extended same-tab Cancel regression also failed before the action fix: the editor closed, but only the seed send existed. The identical test then passed with the existing drain wake, preserving original run IDs, attachment bytes, FIFO, the peer edit hold and the independent visible/durable draft.
The first current-main integration passed 1,492 cases in 43 files, full changed checks, both compiler contracts and both cycle checks. The subsequent small refresh passed 602 focused cases in 12 files, both compilers and scoped lint. Fresh complete builds and independent scoped Codex reviews passed; the final build measured 345,427/347,353 B startup JavaScript gzip and 54,771/54,784 B largest CSS gzip, with unchanged limits and no ineffective-dynamic-import warnings. Frozen source hashes were matched to the resulting commit and served assets. These overlapping validation cohorts are not summed as unique tests.
Real isolated flow: Gateway → OpenClaw runtime → OpenAI (
gpt-5.6-luna), with synthetic content and no fabricated Gateway replies. The final rebuilt Cancel and Save runs each completed three logical sends, exact 91-byte attachment delivery, correct original/replacement run identities and FIFO, and independent native/visible draft retention. Both had zero browser errors or observer failures and complete owned-resource cleanup. Earlier source-equivalent flows also passed whole-Gateway restart/first-offline attachment, both main/work destination directions, attachment reload, legacy confirmation/explicit uncertainty Retry, newer New Session handoff and Incognito. Every offered capture was inspected; published downloads matched the inspected originals.CI correction: the first exact-head run and the requested retry exposed a page-wide locator matching both the active pane and a retained hidden pane. Local diagnostics showed one visible reply, one canonical reply per pane and one send—not duplicate delivery. The test now scopes strict assertions to the active owner, adds canonical/DOM uniqueness and recovery-history ownership checks, and keeps fixture agent identity independent of activity. The original 26-file selection plus fitting siblings pass 306 cases in 30 files, with no skips/todos; the exact final case, compilers, lint and independent review also pass. Local replay order differs from CI cache order, but the defect reproduces in isolation. Fresh exact-head CI and complete browser audit passed: 334 files / 1,365 tests across 13 disjoint mocked shards, with zero failed/skipped/retried cases; separate real-Gateway 4 files / 9 cases and browser-extension 1 file / 1 case also passed. The supplemental UI suite has one opt-in memory Chromium skip, not counted as executed proof.
Explicit gaps: raw
globallive verification failed at the seed turn, before queue activity, because a backend ACP metadata lookup dropped the explicit agent owner. Custom-main variants were blocked by the existing loaded-config policy forcingmaindespite the documented custom key. These are separately recorded follow-ups, not hidden by special fixtures or counted as live passes. The distinct recorded-idle wake-up work in #131948 is not incorporated.Provenance: exact introducing commits and last-known-good releases are not established. The pre-fix Cancel action's complete owning module matched the verified current-main snapshot
5835fbeac7d6be65612fb666f47f10b6bc4ca30c. No introduction claim is inferred from blame alone.Validation limitation: the broader CI-file replay regenerated ten older quota/lobster fixture PNGs at fixed paths before backup; their prior bytes were not preserved. Eight other fixture outputs were restored. All 79 task-specific outbox captures remained byte-identical, and none of the overwritten fixture outputs is offered as PR proof. Run-scoped fixture capture output is recorded as a separate follow-up.
Before and after
Before: Cancel closed the editor, but both messages remained parked.
After: both original messages delivered, with the independent draft retained.
Final uncut Cancel flow:
attachment-3367646139.webm
Final uncut Save control:
attachment-2500158143.webm