Repository navigation
fix(ui): prevent duplicate commentary during active runs - #158459
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 October 7, 2026, 2:37 AM ET / 06:37 UTC (Revision 15). ClawSweeper reviewWhat this changesThe PR adds optional assistant-item identity and display offsets to Gateway chat updates so the Control UI replaces saved commentary’s live copy while preserving surrounding text. Merge readiness✅ Ready for maintainer review This remains a useful fix absent from current main. No blocking correctness findings remain; the prior continuation and stale-identity concerns are addressed. Related unmerged work does not supersede it. Likely related people: @steipete and @shakkernerd, as routing candidates for Gateway streaming and chat presentation. Priority: P2 Review scores
Verification
How this fits togetherThe Gateway projects assistant output into live chat events and saved transcript rows. The Control UI reconciles those inputs into one ordered conversation display. flowchart LR
A[Assistant output] --> B[Gateway text projection]
B --> C[Live text with item identity]
A --> D[Saved transcript rows]
C --> E[Control UI reconciliation]
D --> E
E --> F[Single ordered chat display]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +183, Tests +144. Total +327 across 18 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep producer identity authoritative and render each saved commentary occurrence once without suppressing distinct repeated text. Do we have a high-confidence way to reproduce the issue? Yes, source establishes the sequence: a saved commentary row precedes its cumulative chat delta, while main only prunes keyed segments. I did not execute tests during this read-only review. Is this the best way to solve the issue? Yes, the patch uses existing producer identity and projection owners, preserves cumulative continuation, and avoids a competing text-equality deduplication policy. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against eb1b48c58b61. 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 (14 earlier review cycles; latest 8 shown)
|
33f5a8c to
f40bb7f
Compare
f40bb7f to
b3b4bf9
Compare
Rendered-state evidenceSanitized before capture from the reported Control UI failure: Exact-head after capture from an isolated mocked-Gateway E2E on The mocked-Gateway browser assertion found one rendered assistant row. No live Gateway, credentials, or personal state were used. |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
b3b4bf9 to
56357e1
Compare
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
3b3b601 to
9c61a7e
Compare
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
9c61a7e to
6ccb436
Compare
…7054) * fix(gateway): retire live assistant text by exact occurrence identity Control UI rendered run commentary twice mid-run: cumulative inFlightRun snapshots replayed committed text beside paged history while bounded event replay omitted most earlier commentary identities. Client text subtraction could not reliably recover ownership from those partial views. Give embedded runs, workers, CLI, ACP, Agents API and native Codex exact assistant occurrence identities. Gateway retirement owns the unpersisted live tail across snapshots, replacement deltas and display-final projection; terminal delivery content remains complete. Native capture freezes occurrence IDs before mirror persistence so later bytes cannot share an older receipt. Decide silent-reply suppression from full available source, preserving the existing trailing-token and directive policies. Keep still-streaming unsaved text at the bottom of its run, below saved rows, and give it a transcript position when saved. Steers remain below all run output. Preserve completed commentary and saved-row causal order. Remove client cumulative-prefix retirement, pending commentary handoffs, steer splitting and redundant unreleased delta itemId/itemStartOffset fields. Cap eviction may conservatively redisplay committed text; never infer ownership to hide potentially unsaved output. Builds on and supersedes the live-delta reconciliation from #158459; its regression suite is retained with ordering updated to the live-at-bottom invariant. Rebased onto 278d66f, preserving main's native settlement helpers, transcript authority checks and terminal identity reader consolidation. Keep native provisional-stream decisions with the occurrence tracker and move existing type/test support to their adjacent owners without ratchets. Proof: all 144 focused files pass one at a time, including the 22-paragraph production-shaped regression, all 17 retained acceptance cases plus reconnect, and the seeded real-cap/reused-identity model (891 ms). Core, UI-test, extension and Gateway test typechecks, protocol registry/generation/native checks, scoped core/UI/extension lint, formatting and diff checks pass. Full-range and refinement P2 autoreviews found no actionable findings. Co-authored-by: Dallin Romney <[email protected]> * fix(ui): apply hidden replacement frames to the live stream A Gateway replacement frame can now carry an unpersisted tail that is a bare silent token after its saved prefix retires. The delta handler skipped silent and heartbeat text before applying replacements, so the previous baseline stayed visible beside its durable row. Treat a replacement as authoritative even when its new text is hidden: it retracts the live stream instead of being ignored. Non-replacing silent deltas are still ignored. Proof: the new chat-gateway case fails before the change (expected 'The token is ' to be '') and passes after; chat-gateway (87), commentary-dedupe acceptance (18) and inflight history (44) suites pass; UI typecheck, oxfmt and diff checks pass. * fix(agents): reconcile run identity additions with main Align identical runId fields with the positions already added on main so Git does not produce duplicate properties in the PR merge tree. Preserves exact assistant occurrence retirement and complete ACP transcript persistence. * fix(gateway): preserve canonical streaming order across clients Publish canonical assistant events before their derived chat projection so SDK live consumers receive text once. Keep inflight snapshot projection and buffer contracts in leaf owners, migrate retained UI fixtures to the unsaved-text contract, preserve real compaction event exports, and shrink obsolete mock baseline entries. * fix(gateway): retain commentary correction ordering Apply the shared chat projection before commentary item delivery and after canonical assistant delivery. Preserve correction-before-preamble rendering and duplicate-free SDK delivery together; both existing regressions pass. --------- Co-authored-by: Dallin Romney <[email protected]>
…nclaw#167054) * fix(gateway): retire live assistant text by exact occurrence identity Control UI rendered run commentary twice mid-run: cumulative inFlightRun snapshots replayed committed text beside paged history while bounded event replay omitted most earlier commentary identities. Client text subtraction could not reliably recover ownership from those partial views. Give embedded runs, workers, CLI, ACP, Agents API and native Codex exact assistant occurrence identities. Gateway retirement owns the unpersisted live tail across snapshots, replacement deltas and display-final projection; terminal delivery content remains complete. Native capture freezes occurrence IDs before mirror persistence so later bytes cannot share an older receipt. Decide silent-reply suppression from full available source, preserving the existing trailing-token and directive policies. Keep still-streaming unsaved text at the bottom of its run, below saved rows, and give it a transcript position when saved. Steers remain below all run output. Preserve completed commentary and saved-row causal order. Remove client cumulative-prefix retirement, pending commentary handoffs, steer splitting and redundant unreleased delta itemId/itemStartOffset fields. Cap eviction may conservatively redisplay committed text; never infer ownership to hide potentially unsaved output. Builds on and supersedes the live-delta reconciliation from openclaw#158459; its regression suite is retained with ordering updated to the live-at-bottom invariant. Rebased onto 3b164e5, preserving main's native settlement helpers, transcript authority checks and terminal identity reader consolidation. Keep native provisional-stream decisions with the occurrence tracker and move existing type/test support to their adjacent owners without ratchets. Proof: all 144 focused files pass one at a time, including the 22-paragraph production-shaped regression, all 17 retained acceptance cases plus reconnect, and the seeded real-cap/reused-identity model (891 ms). Core, UI-test, extension and Gateway test typechecks, protocol registry/generation/native checks, scoped core/UI/extension lint, formatting and diff checks pass. Full-range and refinement P2 autoreviews found no actionable findings. Co-authored-by: Dallin Romney <[email protected]> * fix(ui): apply hidden replacement frames to the live stream A Gateway replacement frame can now carry an unpersisted tail that is a bare silent token after its saved prefix retires. The delta handler skipped silent and heartbeat text before applying replacements, so the previous baseline stayed visible beside its durable row. Treat a replacement as authoritative even when its new text is hidden: it retracts the live stream instead of being ignored. Non-replacing silent deltas are still ignored. Proof: the new chat-gateway case fails before the change (expected 'The token is ' to be '') and passes after; chat-gateway (87), commentary-dedupe acceptance (18) and inflight history (44) suites pass; UI typecheck, oxfmt and diff checks pass. * fix(agents): reconcile run identity additions with main Align identical runId fields with the positions already added on main so Git does not produce duplicate properties in the PR merge tree. Preserves exact assistant occurrence retirement and complete ACP transcript persistence. * fix(gateway): preserve canonical streaming order across clients Publish canonical assistant events before their derived chat projection so SDK live consumers receive text once. Keep inflight snapshot projection and buffer contracts in leaf owners, migrate retained UI fixtures to the unsaved-text contract, preserve real compaction event exports, and shrink obsolete mock baseline entries. * fix(gateway): retain commentary correction ordering Apply the shared chat projection before commentary item delivery and after canonical assistant delivery. Preserve correction-before-preamble rendering and duplicate-free SDK delivery together; both existing regressions pass. --------- Co-authored-by: Dallin Romney <[email protected]>


What Problem This Solves
Persisted commentary could appear twice during an active Control UI run when its durable transcript row arrived before a cumulative chat delta.
Solution
The Gateway now includes its existing assistant producer identity and the current item's displayed start offset on optional chat-delta fields. The Control UI uses those facts to retire only the matching live occurrence while preserving earlier cumulative text and causal order.
The identity is cleared on unscoped replacement, rollover, history hydration, terminal settlement, and run reset. Metadata-free legacy events keep their existing behavior; no text-equality heuristic claims producer ownership.
Scope
No persistent data model changes.
itemIdanditemStartOffsetare optional protocol fields, so older producers and clients remain valid.Evidence
9c61a7eac8c5; GitHub reports it conflict-free and mergeable against currentmain.check-changedgate passes: all core/core-test/UI type graphs, lint, formatting, line/suppression/assertion/database ratchets, dead exports, boundaries, and import cycles.ui/src/e2e/chat-pull-requests.e2e.test.ts: three unrelated PR-chip spacing assertions measured 12 px against an 8 px test limit. Currentmain(45b18e215b5) reproduces the same three failures and measurements in an isolated worktree; this PR changes neither that test nor its CSS. The failure canceled the remaining CI fanout, so no rerun or rebase was spent to manufacture green.The independent iOS/macOS shared-kit scans and final intersection are green. No CI reruns were requested.