Repository navigation
refactor(ui): simplify outbox custody and draft persistence - #133409
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 30, 2026, 1:19 PM ET / 17:19 UTC. ClawSweeper reviewWhat this changesThe PR consolidates Control UI outbox attachment-custody and composer-draft persistence helpers without intending to change sending, recovery, or draft behavior. Merge readinessNo actionable correctness defect was found in the introduced refactor. This PR remains open for normal maintainer handling because it is member-authored, carries the protected Priority: P3 Review scores
Verification
How this fits togetherThe Control UI keeps unsent messages, drafts, and attachment references in browser storage, then restores and delivers them through the active chat session. These changes simplify the shared code that preserves ownership and revision fences across reloads and split panes. flowchart LR
A[Composer input] --> B[Draft and outbox persistence]
B --> C[Attachment custody]
C --> D[Queued-message actions]
D --> E[Chat delivery]
B --> F[Reload recovery]
Decision needed
Why: The source review found no mechanical blocker, but the protected maintainer label requires explicit maintainer handling for a persistence-sensitive UI refactor. Before merge
Agent review detailsSecurityNone. PR surfaceSource -139, Tests -4. Total -143 across 25 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain the narrow owner-boundary refactor, then land it only after exact-head CI is green and the latest ClawSweeper review guidance has been applied or explicitly skipped. Do we have a high-confidence way to reproduce the issue? Not applicable: this PR is a refactor rather than a report of a distinct user-facing defect; its changed ownership paths are covered by focused source-level and browser-storage tests. Is this the best way to solve the issue? Yes: returning attachment-only updates from the payload owner and merging them at each captured delivery owner removes duplicate reconstruction without weakening the existing ownership or revision fences. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 6f3b26f6a3bb. LabelsLabel changes:
Label 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
|
|
Land-ready maintainer review for exact head CI run 33324603156, attempt 1 is successful, including the required GitHub Actions-owned Read the complete latest ClawSweeper review. Its rank-up move—complete exact-head CI and read the latest review—is satisfied. The current live comment list has no later unread review body. No source repair was requested by that review. Maintainer decision: land this bounded, behavior-preserving refactor after native gates. The stored-data classifier is not a migration change: metadata remains v4, shared IndexedDB remains v2, persisted record fields/keys and existing byte/retention limits remain unchanged. This patch neither adds an embedding/vector store nor combines draft and queued-payload lifetimes. The exact retention-filtered object now feeds cleanup after the same write/read-back verification; raw previous/recovery/legacy reference validation and held-lock deletion authority remain intact. Local proof: 540 focused owner/sibling tests, 35 native Chromium mocked-Gateway tests, all 25-path changed gates, and final UI build passed. Native proof uses real IndexedDB and Web Locks, including offline bytes/run IDs, lost-ACK no-replay, duplicate tabs, migration/recovery, stale edits/drafts, and the original two-large-image steering scenario. It is not authenticated operator-Gateway proof; no operator service or credentials were used. The PR Evidence section contains the exact reproducible test commands and build qualification. Production +136/-275 (net -139); tests +19/-23 (net -4). No budget/baseline/schema/config/dependency changes. The separate Vite failed-build diagnostic follow-up remains excluded. Main drift through native baseline |
Related: #133052 (durable attachment outbox), #133067 (canonical session recovery).
What Problem This Solves
Maintainer-requested cleanup of the Control UI outbox after the attachment and recovery repairs. Sending, editing, previewing, recovering, and retiring queued messages had accumulated duplicate delivery-version checks, draft revision calculations, snapshot shapes, and repeated storage projections. That duplication makes the durability boundary harder to maintain without improving the user experience.
Why This Change Was Made
Keep attachment preparation responsible for attachment updates rather than reconstructed queue rows; each delivery owner retains its own captured destination and delivery state. Consolidate the common delivery-version comparison, revision baseline, and durable write snapshot in their existing owners, remove obsolete wrappers/fields, and carry already-prepared facts instead of rereading or reparsing them.
The narrower admission/removal fences remain distinct. Cleanup still follows verified metadata persistence and examines active plus recovery references across principals; it uses the exact retention-filtered object that was serialized. Draft recovery retains its transaction and identity checks while parsing each record once and skipping destination reads that cannot be used.
Production LOC: +136 / -275, net -139 across 19 files. Tests: +19 / -23, net -4 across six files. Total: net -143 across 25 files. This is not a storage redesign: metadata v4, IndexedDB v2, legacy imports, byte limits, retention, and separate draft/queue lifetimes are unchanged. No configuration, schema, dependency, cache, or index additions.
User Impact
No intended user-visible behavior change. Complete attachment batches remain durable before admission and fully hydrated before transport. Offline reload, explicit recovery confirmation, duplicate-tab uncertainty, credential isolation, native-lock ownership, and stale-write/edit/connection fences retain their existing behavior. There is no partial-send or volatile-storage fallback.
Evidence
openclaw/ci-gate, for997c18351662adeccbcf9bceeff2a89b354649e9.86b6ec0afa2c64d2019ffdb681760b433b2e10b1: all 25 touched files retain their baseline blobs; adjacent placement-cancellation changes do not consume the changed internal APIs.pnpm buildpassed before the final fresh-object serialization adjustment; the finalpnpm ui:build, all focused tests, native browser tests, and changed gates passed afterward. Final startup JavaScript gzip: 345,896 bytes, below the unchanged 346,761-byte enforcement limit.pnpm install --frozen-lockfilerepaired the install without changing manifests or lockfiles. The separate Vite manifest-finalization error-masking defect is recorded as a follow-up and excluded from this PR.Reproduce focused proof
Unit/owner proof used
OPENCLAW_VITEST_MAX_WORKERS=3and a dedicated filesystem-module-cache directory:Native browser proof used a separate filesystem-module-cache directory:
Changed checks ran
node scripts/check-changed.mjs --with the 25 changed paths; no baseline or budget files were modified.