Repository navigation
fix: keep compaction in one persistent transcript marker - #136169
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
Pre-merge verificationCurrent head: The compaction producer/persistence owner now carries one operation identity to the shared Chat/Home transcript row. Removed the competing compaction toast, delayed clearing, successful Late ClawSweeper finding and Rank-up movesAddressed the sequence-order finding and both Rank-up moves. Compaction and terminal lifecycle events now reuse Five cases failed before the correction for the reported ordering defect. Local verification
Browser CI investigationCI run 33611403128, attempt 1, failed only browser shard 5/14 and its dependent rollup. The focused four interrupted-scroll cases pass locally, and the original CI shard command, The refreshed ClawSweeper review at 09:05:44 UTC reports no actionable correctness finding. Its remaining maintainer risk asks that historical compaction entries without identity metadata remain completed markers. That optional shape is retained: producer correlation is added to new operations, not required to render old transcript boundaries. Existing historical-metadata, repeated-operation, delayed-event, and live reload evidence cover the decision; no schema migration or configuration change is introduced. Personally inspected real-flow proofinline-compaction-before-after.mp4Before left, after right; synthetic conversation, real isolated gateway and browser. Active, completed and reloaded frames were inspected. The recorder asserted stable DOM identity and one marker without a compaction toast. Setup was trimmed, surrounding chrome cropped, speed unchanged, final frame held for alignment. Direct Codex contract inspection: Known limitation: the pre-existing native fresh-session active-writer conflict reproduced in baseline and candidate; open PR #135441 — native compaction writer coordination — tracks it. Successful recordings use the existing synthetic session after restarting only the owned isolated gateway. Test gateway and temporary authentication copy are cleaned up; operator state is untouched. The latest ClawSweeper review is fresh and its actionable finding, merge-risk repetitions and both Rank-up moves are addressed above. Production growth is justified by the requested persistent-marker identity capability; the ordering repair extends the existing owner instead of introducing another state path. No related duplicate issue was found in the scoped search. The latest review will be checked again before repository-native preparation and merge, without bypassing gates. |
|
Codex review: needs maintainer review before merge. Reviewed September 2, 2026, 5:04 AM ET / 09:04 UTC. ClawSweeper reviewWhat this changesThe PR gives each compaction operation a persistent identity so Control UI progress becomes one durable transcript marker instead of a separate completion message. Merge readinessNo blocking correctness finding. The branch carries one compaction identity from the producer into persisted transcript entries and the Control UI, and it addresses the prior sequence-order finding; it remains an active maintainer-authored PR with an unmerged change. Priority: P2 Review scores
Verification
How this fits togetherCompaction events originate in the agent/runtime layer, are persisted in a session transcript, and are projected into Control UI chat history. This change links the live event and persisted boundary so one row transitions from active to completed across refreshes. flowchart LR
A[Agent compaction] --> B[Compaction event]
B --> C[Session transcript]
C --> D[Gateway projection]
D --> E[Chat history]
B --> F[Live chat state]
F --> E
Before merge
Agent review detailsSecurityNone. PR surfaceSource +114, Tests +201, Other -1. Total +314 across 50 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep the producer-generated run/item identity optional for historical transcripts and use it as the single matching key for live-to-persisted marker adoption. Do we have a high-confidence way to reproduce the issue? Yes, source-reproducible: the prior independent transient and persisted presentation paths are replaced by producer-to-transcript identity matching, with focused ordering and refresh regressions in the branch. This read-only review did not execute the supplied harness. Is this the best way to solve the issue? Yes. Recording identity at the compaction producer and preserving it through transcript projection is preferable to inferring completion from timing or independently rendered UI paths; the inspected Codex contract uses the same single-item lifecycle. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against a359864ed5cc. 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)
|
|
Merged via squash.
|
…6169) * fix: keep compaction in one persistent transcript marker * fix: fence compaction status by gateway sequence
What Problem This Solves
Fixes an issue where users compacting a conversation see both a transient composer status and a separate “Context compacted” transcript message. The approved follow-up is one inline transcript element: animate while compacting, settle into a compacted marker, and retain that marker after history refresh or reload.
Related: #135988 — the original folding-line compaction animation. This is the maintainer-requested presentation and lifecycle follow-up, not a change to compaction policy.
Why This Change Was Made
The composer toast, slash-command success response, and persisted runtime activity had independent presentation paths. The transient row also lacked a stable identity connecting it to the stored boundary. Compaction producers now carry the same operation/item identity through lifecycle events and persistence; the shared transcript projection adopts the persisted boundary without replacing the live row. Rewriting old transcript boundaries preserves their recorded identity, including an unknown historical run.
Removed paths: compaction toast rendering and five-second completion clearing, successful
/compactassistant text, and native compaction activity conversion into an assistant message. Cancellation, no-op and failure outcomes remain explicit. No settings, database schema version, model/provider routing, or compaction-policy changes.User Impact
Evidence
Behavior and regression coverage
inline-compaction-before-after.mp4
Before is left, after is right. Real isolated gateway/browser proof exercises
/compact, observes the same DOM row transition from active to complete, asserts exactly one visible marker and no compaction toast, and reloads to confirm the persisted marker. Both source captures and the comparison's active/completed/reloaded frames were personally inspected. The video trims setup, crops surrounding chrome, preserves playback speed, and holds the final frame to align the two recordings. Baseline UI is0b9cf4bf187; both use the same isolated gateway and synthetic observatory notes. The existing generic command queue row is not a compaction toast and disappears when/compactfinishes.Focused regression coverage includes manual and automatic compaction identity, cancellation, transcript replay, native activity projection, matching persisted-row adoption, active-leaf refresh, repeated compactions, session/reset boundaries, and browser accessibility/motion. The history-handoff and historical-identity regressions failed before their fixes.
The late ClawSweeper sequence-order finding and both Rank-up moves are addressed: compaction and terminal lifecycle events reuse the existing per-run Gateway sequence fence. Delayed start/success/cancel/retry events cannot replace a newer active item, and stale lifecycle completion cannot finish a newer retry. Five regression cases failed before this correction; the corrected lifecycle/transcript suites pass 207 tests across six files. Different runs still accept their own sequence numbering. No extra state or cleanup path was added. The attached nominal-flow recording predates this ordering-only correction; the correction is proven at the real event-handler boundary in the reported order and does not change the visual treatment.
Dependency contract inspected directly: sibling Codex
codex-rs/core/src/compact.rs:252creates one compaction item for start;compact.rs:379persists compacted history before completing that same item atcompact.rs:392. OpenClaw preserves this identity rather than inferring completion from timing.Validation
node scripts/run-vitest.mjs src/agents/embedded-agent-runner/transcript-rewrite.test.ts src/agents/sessions/agent-session-compaction-correlation.test.ts src/agents/sessions/agent-session-compaction.test.ts ui/src/pages/chat/history-merge.test.ts ui/src/pages/chat/components/chat-transcript-render.test.ts— 87 tests passed across five files.node scripts/run-vitest.mjs ui/src/pages/chat/chat-thread.test.ts ui/src/pages/chat/components/chat-transcript-render.test.ts ui/src/pages/chat/history-merge.test.ts— 297 tests passed across three files, including the upstream reasoning-grouping changes.pnpm ui:buildandnode --import ./scripts/tsx.mjs scripts/build-all.mts qaRuntimepassed, including UI budgets and runtime bundle/import guards.Scope and known proof limitation
Production delta: +263 / -163, net +100 lines. This adds the missing operation-to-persisted-marker identity boundary and persistent inline presentation while removing competing toast/message paths. The late sequence fix contributes net +9 by extending the existing fence instead of adding state. Tests/support: +477 / -262, net +215. Assertion baseline: -1, recording a removed assertion. No proof assets are committed.
The existing native active-writer conflict reproduced in both baseline and candidate immediately after creating a fresh session. It is separately tracked by #135441 — native compaction writer coordination. Successful capture uses the existing synthetic session after restarting only the isolated test gateway; the operator gateway and live state are untouched.