Repository navigation
fix(webchat): preserve quoted replies when restoring drafts - #158335
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 25, 2026, 5:54 PM ET / 21:54 UTC (Revision 2). ClawSweeper reviewWhat this changesThe PR saves WebChat reply selections with drafts and carries them through reload, pane handoff, sending, cancellation, and recovery, with documentation and browser regressions. Merge readiness✅ Ready for maintainer review Current main still loses a selected reply when restoring a WebChat draft. The branch addresses that behavior, and the previously identified quote-only recovery overwrite is guarded at both recovery boundaries on the current head. No discrete blocking defect remains in the reviewed patch. Priority: P2 Review scores
Verification
How this fits togetherThe Control UI composer turns a selected conversation message and typed text into a draft. Browser storage restores that draft after reload, while submission passes its reply target to the chat outbox and Gateway. flowchart LR
A[Selected message] --> C[WebChat composer]
B[Typed draft] --> C
C --> D[Browser draft storage]
D --> E[Restore or recover]
E --> C
C --> F[Chat outbox]
F --> G[Gateway send]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +247, Tests +239, Docs +3. Total +489 across 45 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep the selected reply in the composer’s existing revisioned draft state so reload, recovery, cancellation, and submission use one consistent selection. Do we have a high-confidence way to reproduce the issue? Yes. Current-main source keeps the selected reply outside the saved draft, and the PR supplies a before/after browser scenario; this read-only review did not execute it independently. Is this the best way to solve the issue? Yes. Extending the existing revisioned composer snapshots and recovery guards keeps reply selection with the draft that owns it. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 800bf8e10e7c. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
@clawsweeper re-review Please review current head The prior review run completed its analysis but could not publish its result because GitHub rate-limited publication. The PR body contains the updated proof and original before/after screenshots. |
|
🦞👀 Re-review progress:
|
|
Merged via squash auto-merge.
|
…#158335) * fix(webchat): preserve quoted replies when restoring drafts * fix(webchat): preserve quote-only drafts during recovery * test(webchat): scope async answer checks to the transcript
Continue the y01 largest-owner, export/caller and duplicate-helper audit. Delegate composer mounting to the canonical interop boundary while retaining field equality, keyed renderer identity and foreground picker cleanup. Remove test-only panel refresh methods and commit counters; exercise the actual view, polling and committed DOM instead. Trust admitted immutable composer metadata and the full tool-stream owner contract. Narrow sidebar traversal to its normalized single column and simplify browser/Gateway realtime decoding. Both shipping Lit/Solid paths and rendered markup remain unchanged. No config, protocol, storage, dependency, security-boundary or Phase E backend changes. Best-effort tradeoffs accepted - Malformed internal tool-stream hosts: #158032 introduced shape probes during a bookkeeping refactor, not a human incident. Real owners have complete state; a broken internal caller now fails rather than silently skipping cleanup. #125197's human steering/order report still justifies the unchanged causal reconciliation algorithm; no report ties malformed-host probes to that bug. - In-place mutation of admitted draft metadata: #158335 added reply persistence and #166682 moved the annotation copies, without a mutation incident. Actual editors replace records/arrays. A future in-place mutator must follow that contract or it may alter a pending snapshot. Durable receipts/revisions stay. - Non-JSON relay events: #146676 added transport machinery without a human cyclic-frame incident. Frames already crossed JSON decoding; an impossible internal cycle or BigInt now throws. Activation count/byte bounds remain. - Older Gateway close-disposition support: #171377 added a compatibility path, but UI/Gateway ship together and the current server advertises the field. Unsupported skew now rejects. Accepted-answer durability from the real human report #171310 and fixes #171377/#172159 remains intact. - Blob/typed-array/arbitrary Google message representations: c399fb7 added these alternate decoder branches without a linked human report. The browser WebSocket is configured as arraybuffer before listeners. Unsupported synthetic representations are ignored; actual strings/ArrayBuffers still decode, and removal of the artificial await needs no post-await stale check. - Extra sidebar columns after normalization: #123874 flattened the flexible #113712 layout to one tabbed panel. A broken internal producer is no longer searched as a multi-column layout; persisted legacy flattening still runs. The earlier commit records the original eight accepted best-effort scenarios. Coverage and remaining justified owners are logged in .local/y01-ledger.md for coordinator bundling. Combined candidate removes 416 net production lines against 5716bb1 (tests/support excluded).
Continue the y01 largest-owner, export/caller and duplicate-helper audit. Delegate composer mounting to the canonical interop boundary while retaining field equality, keyed renderer identity and foreground picker cleanup. Remove test-only panel refresh methods and commit counters; exercise the actual view, polling and committed DOM instead. Trust admitted immutable composer metadata and the full tool-stream owner contract. Narrow sidebar traversal to its normalized single column and simplify browser/Gateway realtime decoding. Both shipping Lit/Solid paths and rendered markup remain unchanged. No config, protocol, storage, dependency, security-boundary or Phase E backend changes. Best-effort tradeoffs accepted - Malformed internal tool-stream hosts: #158032 introduced shape probes during a bookkeeping refactor, not a human incident. Real owners have complete state; a broken internal caller now fails rather than silently skipping cleanup. #125197's human steering/order report still justifies the unchanged causal reconciliation algorithm; no report ties malformed-host probes to that bug. - In-place mutation of admitted draft metadata: #158335 added reply persistence and #166682 moved the annotation copies, without a mutation incident. Actual editors replace records/arrays. A future in-place mutator must follow that contract or it may alter a pending snapshot. Durable receipts/revisions stay. - Non-JSON relay events: #146676 added transport machinery without a human cyclic-frame incident. Frames already crossed JSON decoding; an impossible internal cycle or BigInt now throws. Activation count/byte bounds remain. - Older Gateway close-disposition support: #171377 added a compatibility path, but UI/Gateway ship together and the current server advertises the field. Unsupported skew now rejects. Accepted-answer durability from the real human report #171310 and fixes #171377/#172159 remains intact. - Blob/typed-array/arbitrary Google message representations: c399fb7 added these alternate decoder branches without a linked human report. The browser WebSocket is configured as arraybuffer before listeners. Unsupported synthetic representations are ignored; actual strings/ArrayBuffers still decode, and removal of the artificial await needs no post-await stale check. - Extra sidebar columns after normalization: #123874 flattened the flexible #113712 layout to one tabbed panel. A broken internal producer is no longer searched as a multi-column layout; persisted legacy flattening still runs. The earlier commit records the original eight accepted best-effort scenarios. Coverage and remaining justified owners are logged in .local/y01-ledger.md for coordinator bundling. Combined candidate removes 416 net production lines against 5716bb1 (tests/support excluded).
* refactor(ui): consolidate chat owners and remove obsolete adapters Keep both live rendering routes and the existing DOM, text, persisted shapes, security boundaries, draft durability, and ordinary session concurrency. Consolidate effective-tool loading, header registration, transcript refs, history target capture, and PCM output ownership. Remove unused adapters after their completed native-control cutovers and redundant internal work. Best-effort tradeoffs accepted: - Pending-page/live-update overlap: #145240 records synthetic request-order proof, not a cited human incident. Displayed disposition can briefly lag until the next ordinary refresh; durable receipts remain authoritative. - Synchronous rail self-retirement: #153245 records a synthetic benchmark, not a cited human incident. Focus restoration is best effort in that case. - Obsolete intersection callbacks: #142227 records synthetic E2E proof, not a cited stale-delivery incident. Target maps ignore retired rows; a late callback can request redundant layout. - Obsolete mutation callbacks: the same #142227 provenance. Native disconnect remains; a late delivery can resample the current scroller. - Obsolete resize callbacks: #162617 records synthetic performance traces, not a cited stale-delivery incident. Native cleanup remains; a late callback can sample current layout. - Wrong bundled Gateway PR identity: #148070/#147952 describe the feature, not a wrong-target incident. The producer constructs the exact requested target; a contract violation now displays its returned result. - Cross-tab prefetch election: #125128 covered a retired five-session idle sweep with synthetic performance proof. Two tabs can now redundantly read one explicitly hover/focus-intended target; per-tab limits remain. - Malformed internal sidebar maps: #113712 introduced feature normalization, not a cited incident. Settings validates load/save and all callers use that output; impossible malformed typed values are not repaired at every update. * refactor(ui): consolidate chat lifecycle and internal state paths Continue the y01 largest-owner, export/caller and duplicate-helper audit. Delegate composer mounting to the canonical interop boundary while retaining field equality, keyed renderer identity and foreground picker cleanup. Remove test-only panel refresh methods and commit counters; exercise the actual view, polling and committed DOM instead. Trust admitted immutable composer metadata and the full tool-stream owner contract. Narrow sidebar traversal to its normalized single column and simplify browser/Gateway realtime decoding. Both shipping Lit/Solid paths and rendered markup remain unchanged. No config, protocol, storage, dependency, security-boundary or Phase E backend changes. Best-effort tradeoffs accepted - Malformed internal tool-stream hosts: #158032 introduced shape probes during a bookkeeping refactor, not a human incident. Real owners have complete state; a broken internal caller now fails rather than silently skipping cleanup. #125197's human steering/order report still justifies the unchanged causal reconciliation algorithm; no report ties malformed-host probes to that bug. - In-place mutation of admitted draft metadata: #158335 added reply persistence and #166682 moved the annotation copies, without a mutation incident. Actual editors replace records/arrays. A future in-place mutator must follow that contract or it may alter a pending snapshot. Durable receipts/revisions stay. - Non-JSON relay events: #146676 added transport machinery without a human cyclic-frame incident. Frames already crossed JSON decoding; an impossible internal cycle or BigInt now throws. Activation count/byte bounds remain. - Older Gateway close-disposition support: #171377 added a compatibility path, but UI/Gateway ship together and the current server advertises the field. Unsupported skew now rejects. Accepted-answer durability from the real human report #171310 and fixes #171377/#172159 remains intact. - Blob/typed-array/arbitrary Google message representations: c399fb7 added these alternate decoder branches without a linked human report. The browser WebSocket is configured as arraybuffer before listeners. Unsupported synthetic representations are ignored; actual strings/ArrayBuffers still decode, and removal of the artificial await needs no post-await stale check. - Extra sidebar columns after normalization: #123874 flattened the flexible #113712 layout to one tabbed panel. A broken internal producer is no longer searched as a multi-column layout; persisted legacy flattening still runs. The earlier commit records the original eight accepted best-effort scenarios. Coverage and remaining justified owners are logged in .local/y01-ledger.md for coordinator bundling. Combined candidate removes 416 net production lines against 5716bb1 (tests/support excluded). * test(ui): align talk fixtures with transport contracts Require detach disposition when append rejection closes the relay. The UI and Gateway ship together; the prior fallback's omitted field is no longer valid. Close the Google socket before start settles when testing startup rejection. Synchronous frame decoding removed the fixture's former artificial decode microtask; waiting one turn now settles start before the close. Preserve all error, callback, microphone, socket and timer assertions. No production change or new best-effort tradeoff. The preceding commit records the accepted transport assumptions and their provenance. * refactor(agents): consolidate runner lifecycle plumbing Share lifecycle hook capture, native policy loops and gated diagnostic content construction. Combine initial session metadata updates through the existing writer and reuse the persisted-input notifier. Keep delivery evidence in a typed WeakMap without mutating or wrapping frozen error objects. Security checks, public contracts, transcript durability, parallel tool correlation and ordinary shutdown settlement remain. No schema, configuration, dependency, protocol or public SDK signature changes. The standalone session memory backend and its lifecycle machinery are untouched. Best-effort tradeoffs accepted: - Reusing the same engine during active disposal no longer has a WeakRef tombstone rejection. #168789 cites synthetic #143426/#143592 disposal cases, not a human production report. Misuse may fail in the engine normally; closing admission and actual resource settlement remain. - Fresh bounded primitive diagnostics are not redundantly cloned before publication (#108304). Listener egress still isolates its payloads. - Internal delivery-evidence readers receive the attachment-time snapshot, not another defensive copy (0ea0807). No human mutation report was found; unsupported internal mutation could affect a later reader. Confirmed-send suppression and attachment-time copying remain. Lane y08: 105 net production lines removed (165 added / 270 removed), excluding tests; tests add 67 net lines. Below-500 branch-only handoff for coordinator bundling after recent, older and largest-owner audits found no further sound candidate. No PR or hosted-CI success is claimed. Proof: production and affected test types, changed-file lint/format, runtime and madge cycles (zero), lint-suppressions (3/3), and independent P2 review passed. Maintenance resources (6/6), CLI spawn (40/40), and restart recovery (33/33) completed. Support proof was stopped after ten minutes without an assertion result; Gateway cancellation timed out during startup/imports with no assertion result, and deletion was not reached. CLI reliability was only partially exercised in an earlier interrupted selection. These are unresolved proof gaps, not attributed main failures. * refactor(agents): remove duplicate runner preparation work Trust canonical inline model modalities and waiter-owned cleanup. Fold the sole-caller HTTP setup wrapper and stage warning predicate into their owners, and remove an unused diagnostic clock option. This pass removes 32 net production lines; the branch total is 137. Core and affected test types, lint, format, cycle checks, stage timing and suppression tests pass. Independent P2 review is clean. Wider focused runtime selections remain incomplete under host load; coordinator bundling needs broad CI proof. * refactor: withdraw inconclusive stream cleanup and repair bundle ratchets Retain current main stream-state contracts after the UI failure replay could not establish an exact-main comparison. Shrink the delivery-evidence assertion allowance and keep its frozen/primitive regression intact in a focused unit file.
…w#173015) * refactor(ui): consolidate chat owners and remove obsolete adapters Keep both live rendering routes and the existing DOM, text, persisted shapes, security boundaries, draft durability, and ordinary session concurrency. Consolidate effective-tool loading, header registration, transcript refs, history target capture, and PCM output ownership. Remove unused adapters after their completed native-control cutovers and redundant internal work. Best-effort tradeoffs accepted: - Pending-page/live-update overlap: openclaw#145240 records synthetic request-order proof, not a cited human incident. Displayed disposition can briefly lag until the next ordinary refresh; durable receipts remain authoritative. - Synchronous rail self-retirement: openclaw#153245 records a synthetic benchmark, not a cited human incident. Focus restoration is best effort in that case. - Obsolete intersection callbacks: openclaw#142227 records synthetic E2E proof, not a cited stale-delivery incident. Target maps ignore retired rows; a late callback can request redundant layout. - Obsolete mutation callbacks: the same openclaw#142227 provenance. Native disconnect remains; a late delivery can resample the current scroller. - Obsolete resize callbacks: openclaw#162617 records synthetic performance traces, not a cited stale-delivery incident. Native cleanup remains; a late callback can sample current layout. - Wrong bundled Gateway PR identity: openclaw#148070/openclaw#147952 describe the feature, not a wrong-target incident. The producer constructs the exact requested target; a contract violation now displays its returned result. - Cross-tab prefetch election: openclaw#125128 covered a retired five-session idle sweep with synthetic performance proof. Two tabs can now redundantly read one explicitly hover/focus-intended target; per-tab limits remain. - Malformed internal sidebar maps: openclaw#113712 introduced feature normalization, not a cited incident. Settings validates load/save and all callers use that output; impossible malformed typed values are not repaired at every update. * refactor(ui): consolidate chat lifecycle and internal state paths Continue the y01 largest-owner, export/caller and duplicate-helper audit. Delegate composer mounting to the canonical interop boundary while retaining field equality, keyed renderer identity and foreground picker cleanup. Remove test-only panel refresh methods and commit counters; exercise the actual view, polling and committed DOM instead. Trust admitted immutable composer metadata and the full tool-stream owner contract. Narrow sidebar traversal to its normalized single column and simplify browser/Gateway realtime decoding. Both shipping Lit/Solid paths and rendered markup remain unchanged. No config, protocol, storage, dependency, security-boundary or Phase E backend changes. Best-effort tradeoffs accepted - Malformed internal tool-stream hosts: openclaw#158032 introduced shape probes during a bookkeeping refactor, not a human incident. Real owners have complete state; a broken internal caller now fails rather than silently skipping cleanup. openclaw#125197's human steering/order report still justifies the unchanged causal reconciliation algorithm; no report ties malformed-host probes to that bug. - In-place mutation of admitted draft metadata: openclaw#158335 added reply persistence and openclaw#166682 moved the annotation copies, without a mutation incident. Actual editors replace records/arrays. A future in-place mutator must follow that contract or it may alter a pending snapshot. Durable receipts/revisions stay. - Non-JSON relay events: openclaw#146676 added transport machinery without a human cyclic-frame incident. Frames already crossed JSON decoding; an impossible internal cycle or BigInt now throws. Activation count/byte bounds remain. - Older Gateway close-disposition support: openclaw#171377 added a compatibility path, but UI/Gateway ship together and the current server advertises the field. Unsupported skew now rejects. Accepted-answer durability from the real human report openclaw#171310 and fixes openclaw#171377/openclaw#172159 remains intact. - Blob/typed-array/arbitrary Google message representations: 2a4c20f added these alternate decoder branches without a linked human report. The browser WebSocket is configured as arraybuffer before listeners. Unsupported synthetic representations are ignored; actual strings/ArrayBuffers still decode, and removal of the artificial await needs no post-await stale check. - Extra sidebar columns after normalization: openclaw#123874 flattened the flexible openclaw#113712 layout to one tabbed panel. A broken internal producer is no longer searched as a multi-column layout; persisted legacy flattening still runs. The earlier commit records the original eight accepted best-effort scenarios. Coverage and remaining justified owners are logged in .local/y01-ledger.md for coordinator bundling. Combined candidate removes 416 net production lines against 7f7310a (tests/support excluded). * test(ui): align talk fixtures with transport contracts Require detach disposition when append rejection closes the relay. The UI and Gateway ship together; the prior fallback's omitted field is no longer valid. Close the Google socket before start settles when testing startup rejection. Synchronous frame decoding removed the fixture's former artificial decode microtask; waiting one turn now settles start before the close. Preserve all error, callback, microphone, socket and timer assertions. No production change or new best-effort tradeoff. The preceding commit records the accepted transport assumptions and their provenance. * refactor(agents): consolidate runner lifecycle plumbing Share lifecycle hook capture, native policy loops and gated diagnostic content construction. Combine initial session metadata updates through the existing writer and reuse the persisted-input notifier. Keep delivery evidence in a typed WeakMap without mutating or wrapping frozen error objects. Security checks, public contracts, transcript durability, parallel tool correlation and ordinary shutdown settlement remain. No schema, configuration, dependency, protocol or public SDK signature changes. The standalone session memory backend and its lifecycle machinery are untouched. Best-effort tradeoffs accepted: - Reusing the same engine during active disposal no longer has a WeakRef tombstone rejection. openclaw#168789 cites synthetic openclaw#143426/openclaw#143592 disposal cases, not a human production report. Misuse may fail in the engine normally; closing admission and actual resource settlement remain. - Fresh bounded primitive diagnostics are not redundantly cloned before publication (openclaw#108304). Listener egress still isolates its payloads. - Internal delivery-evidence readers receive the attachment-time snapshot, not another defensive copy (8c995fb). No human mutation report was found; unsupported internal mutation could affect a later reader. Confirmed-send suppression and attachment-time copying remain. Lane y08: 105 net production lines removed (165 added / 270 removed), excluding tests; tests add 67 net lines. Below-500 branch-only handoff for coordinator bundling after recent, older and largest-owner audits found no further sound candidate. No PR or hosted-CI success is claimed. Proof: production and affected test types, changed-file lint/format, runtime and madge cycles (zero), lint-suppressions (3/3), and independent P2 review passed. Maintenance resources (6/6), CLI spawn (40/40), and restart recovery (33/33) completed. Support proof was stopped after ten minutes without an assertion result; Gateway cancellation timed out during startup/imports with no assertion result, and deletion was not reached. CLI reliability was only partially exercised in an earlier interrupted selection. These are unresolved proof gaps, not attributed main failures. * refactor(agents): remove duplicate runner preparation work Trust canonical inline model modalities and waiter-owned cleanup. Fold the sole-caller HTTP setup wrapper and stage warning predicate into their owners, and remove an unused diagnostic clock option. This pass removes 32 net production lines; the branch total is 137. Core and affected test types, lint, format, cycle checks, stage timing and suppression tests pass. Independent P2 review is clean. Wider focused runtime selections remain incomplete under host load; coordinator bundling needs broad CI proof. * refactor: withdraw inconclusive stream cleanup and repair bundle ratchets Retain current main stream-state contracts after the UI failure replay could not establish an exact-main comparison. Shrink the delivery-evidence assertion allowance and keep its frozen/primitive regression intact in a focused unit file.
What Problem This Solves
Fixes selected replies disappearing when a WebChat draft is restored after a page reload, leaving the saved text without the message it was meant to answer.
User Impact
Drafts retain their reply preview and original message target across reloads and pane handoffs. Canceling a reply preserves the typed text; sending transfers the quote with the submitted message. Failed admission can restore the complete draft without replacing a newer quote selection. Incognito drafts keep their existing memory-only behavior. No configuration or migration is required.
Why This Change Was Made
Reply selection was stored only in the rendered pane, outside the existing draft snapshots, revision checks, and recovery paths. This change carries the selection through those owners and clears text and reply metadata together at submission. Selection and cancellation update both the draft revision and the visible preview immediately.
Evidence
The defect was reproduced by clicking Reply, typing a draft, and reloading the current UI with a real provider conversation. The new browser regression failed on unchanged production code because the text returned without the reply preview.
The repaired six-case browser file passes, including reload, the original
replyToIdon send, cleared durable input, immediate cancellation, and a second reload. The new case took 2.018 seconds; the full file took 29.067 seconds with--maxWorkers=1. Another 587 focused draft, submission, rewind, and handoff cases passed across 11 files in 10.427 seconds. Independent review found no actionable P0–P2 issues after examining the complete recovery owners.The inspected synthetic before/after screenshots below show the same draft after reload. Production and test types, typed lint, formatting, assertion guards, translation verification, the UI build, and strict performance checks pass. Startup JavaScript grew by 73 compressed bytes and remains within its enforced budget. The first revision passed hosted CI, including all three UI unit shards and nine browser shards (browser jobs: 235–514 seconds). The recovery-guard run exposed an unrelated ambiguous browser-test locator; its test-only repair passed the final exact-head run.
Recovery also treats a selected reply as occupied input at both the rendered confirmation and stored destination. Two regressions reproduced the overwrite before the guard repair: an already saved quote-only destination, and a newer quote selected while confirmation is pending. The repaired storage file passes 40 cases in 3.144 seconds (new case 1.310 ms), and the mounted confirmation table passes five cases in 15.685 seconds (new case 2.408 seconds). Fresh types, lint, formatting, UI build, strict performance, and independent review pass for that correction. Both the recoverable source and the newer quote remain intact.
The failed browser job matched both the visible answer and its temporary screen-reader announcement. Three remaining transcript assertions now scope to the existing message container, preserving exact text and visibility checks. No product timing, fixture, retry, or timeout changed. The unchanged local file passed, so that replay does not reproduce the hosted scheduling; the retained CI failure identifies both matching nodes. The final 19-case file passes in 55.826 seconds (71.501 seconds including fixture setup,
--maxWorkers=1); E2E types, lint, formatting, line-cap checks, and fresh independent review pass. No new test was added.Final hosted CI run passed on
75ccd5cdbf09e1fcd775905d46e2d1647af3edf4, including every UI unit and browser shard. The formerly failing browser shard completed in 531 seconds. Hosted review found no actionable issues. Merged as868d2be0bbb203472698b54b03b1f6c92a2223e1.