🤖 refactor: coordinate compaction and durable continuations - #4121
🤖 refactor: coordinate compaction and durable continuations#4121ThomasK33 wants to merge 14 commits into
Conversation
Compaction work can finish after its originating turn has been canceled or replaced. Give compaction observations and durable continuation handoffs explicit coordinator ownership so late work cannot clear a replacement's state, replay a continuation after Stop, or report a handoff that never reached durable acceptance. - Track semantic compaction intent, observation stages, and handoff tokens in the turn coordinator. A continuation preserves its ownership across its own admission; unrelated manual or edited turns retire it. - Keep original eager summary jobs and journal cleanup physically leased through reset and shutdown. Reuse the existing journal queue, and guard completion callbacks against retired intent. - Guard summary updates and heartbeat-boundary cleanup under the existing history lock and at final publication. Serialize pending-state writes and unlinks, and detach rollback snapshots before awaiting I/O. - Count a durable continuation as accepted only when its acceptance callback runs. Preserve ordinary continuation queue priority and the existing manual-input vetoes for optional and goal continuations. - 2,039 backend tests passed across session/compaction, history, workspace/task/container, and CLI suites. - 15 UI tests passed across compaction, interruption, and send modes; one existing compaction test remains skipped. - Deterministic regressions cover held preparation, summary generation, journal clearing, history reads/writes, Stop, replacement, rollback, and successful sends that never reach acceptance. - The automatic-compaction UI fixture now explicitly configures its mock provider and compaction model. The original fixture timed out on unchanged main without those prerequisites; the corrected fixture passes on both main and this branch. - The separate credential-backed context-limit UI suite could not run locally because `OPENAI_API_KEY` is unavailable. The mock-provider compaction suite covers context-limit recovery. This changes ownership across continuous, legacy, and heartbeat compaction and startup replay. Cancellation ordering, manual-turn priority, and durable cleanup are the primary regression risks; the held-I/O and UI tests exercise those boundaries. Signed-off-by: Thomas Kosiewski <tk@coder.com> --- _Generated with `xum` • Model: `unavailable` • Thinking: `unavailable` • Cost: `$unavailable`_ <!-- mux-attribution: model=unavailable thinking=unavailable costs=unavailable --> Change-Id: I8ff308b1367d223a86fe3914da56c8e928f334df
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
@codex review Please review the compaction and continuation ownership changes, particularly Stop versus replacement cleanup, durable acceptance, and shutdown joining original asynchronous work. Local backend and mock-provider UI validation is complete. Generated with |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 44d48d3b8d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Record supersession at the session failure source so replacement after durable acceptance cannot restart the predecessor's recovery path. Genuine startup failures retain their error handling even when a replacement arrives later. Reject new dispatch claims after Stop and allow a separate guarded cleanup claim to remove the abandoned durable follow-up without sending it or changing a replacement's history. Signed-off-by: Thomas Kosiewski <tk@coder.com> --- _Generated with `xum` • Model: `unavailable` • Thinking: `unavailable` • Cost: `$unavailable`_ <!-- mux-attribution: model=unavailable thinking=unavailable costs=unavailable --> Change-Id: Ia08d923a50745a76ccc2bab5235820ebf5b1e90e
|
Addressed both findings:
The coherent session/compaction suite passes all 772 tests; workspace/task/container suites pass 1,161 tests and full static checks pass. Generated with |
|
@codex review Both P1 findings are fixed in Generated with |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4af8d68d3b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Restore the captured pending state and publish boundary deletion synchronously with the guarded history commit. A replacement admitted during later cleanup can no longer observe a deleted boundary with stale attachments. Join the ordered persistence afterward and preserve committed-write facts through cleanup errors. Signed-off-by: Thomas Kosiewski <tk@coder.com> --- _Generated with `xum` • Model: `unavailable` • Thinking: `unavailable` • Cost: `$unavailable`_ <!-- mux-attribution: model=unavailable thinking=unavailable costs=unavailable --> Change-Id: If698c58a4512d3a41536e56f413a003e5f0dc82f
|
Addressed The regression gates the real post-rename filesystem cleanup and admits a replacement while it is held. It verifies that the replacement sees restored attachments and that the renderer deletion has already been published. Additional cases cover cleanup errors after commit, throwing observers, guard vetoes, archived/missing targets, and late persistence that must not overwrite a successor's snapshot. Validation passes: 777 session/compaction tests, all 102 real HistoryService tests, 1,161 workspace/task/container tests, and full static checks. Generated with |
|
@codex review The heartbeat rollback commit/publication race is fixed and covered by a real post-rename cleanup gate. Please review the synchronous commit observer, state restoration/publication ordering, and postcommit error handling. The finding has a detailed reply and is resolved. Generated with |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4e5bed7367
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Keep rollback scoped to the compaction handoff that persisted the rows. Stop retains abandoned cleanup ownership; a superseded handoff cannot invalidate a successor. Cover held append before and after commit, successor preservation, and restart recovery. Signed-off-by: Thomas Kosiewski <tk@coder.com> --- _Generated with `xum` • Model: `unavailable` • Thinking: `unavailable` • Cost: `$unavailable`_ <!-- mux-attribution: model=unavailable thinking=unavailable costs=unavailable --> Change-Id: I0b812c3898c4c0c9e54de4f41dde21e8d35eb4de
|
Addressed A four-case regression gates the real append both before and after persistence, with and without a manual successor. It reproduced all four failures before the fix and now verifies cleanup, successor row/token/summary preservation, and no canceled continuation on restart. The 781-test session/compaction group and full static checks pass. Generated with |
|
@codex review The Stop-during-append cleanup ownership finding is fixed and covered on both sides of the persistence boundary, including manual successor and restart recovery cases. Please review the captured handoff guard and retained abandoned cleanup behavior. The finding has a detailed reply and is resolved. Generated with |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 75808743a0
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Acknowledge the compaction handoff at the irrevocable row frontier, preserve actual startup errors, and keep abandoned cleanup joined through shutdown. Handle rejected goal work with captured cleanup ownership without removing an accepted continuation's recovery marker. Signed-off-by: Thomas Kosiewski <tk@coder.com> --- _Generated with `xum` • Model: `unavailable` • Thinking: `unavailable` • Cost: `$unavailable`_ <!-- mux-attribution: model=unavailable thinking=unavailable costs=unavailable --> Change-Id: I44b6643d5f3c64d8e9bf1f1b8235dce240ffe0b5
|
Addressed both findings and adjacent rejection windows:
The regression matrix covers held goal sync, synchronous row observers, failed rollback, cleanup before and after claim, guarded rewrites through shutdown/disposal, and rejected goal admission/update/publication. Rejection cleanup uses the captured summary and durable receipt, preserving successor state and original error reporting. Independent review reran both additional rejection reproductions red-to-green. The coherent session/compaction group passes 800 tests and full static checks pass. Generated with |
|
@codex review Both durable-handoff and shutdown-cleanup P1s are fixed. The receipt now precedes all post-durability observers/awaits, abandoned cleanup remains joined through shutdown, and rejected goal work follows the same guarded cleanup obligation without masking the original error or clearing an accepted row's marker. Both findings have a detailed reply and deterministic regression coverage. Please review the durable frontier and exact cleanup ownership paths. Generated with |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 83ed03e3fb
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Retry an initial failed summary read once under the retained abandoned owner, update only the captured pending handoff from the locked current row, and reset abandonment when a replacement context advances the epoch. Signed-off-by: Thomas Kosiewski <tk@coder.com> --- _Generated with `xum` • Model: `unavailable` • Thinking: `unavailable` • Cost: `$unavailable`_ <!-- mux-attribution: model=unavailable thinking=unavailable costs=unavailable --> Change-Id: Ifb99c5fbc1fca3d7c91b98ec29794a96afa00928
|
Addressed all three findings:
Twelve new regressions cover targeted/untargeted thrown and Result.Err reads, persistent failure bounds, successor preservation, late summary updates, changed pending requests/IDs/sequences, and actual replacement dispatch. Independent review reran all twelve successfully. The coherent session/compaction/history group passes 914 tests, including all 102 real HistoryService tests; full static checks pass. Generated with |
|
@codex review The three cleanup-identity findings are fixed and covered by twelve regressions. Please review the bounded same-owner reread, locked-row transform that preserves unrelated fields, and replacement epoch abandonment reset. Each finding has a detailed reply and is resolved. Local coherent validation and static checks pass. Generated with |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e5a0b0c4b5
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Retain failed canceled cleanup under its exact owner across recovery, disposal, and lazy session recreation. Retry through bounded lifecycle operations and report unresolved teardown after releasing resources. Temporary admission holds preserve cancellation; committed context replacement explicitly starts a new intent. Restore local heartbeat state when another backend already deleted the exact boundary, without duplicate publication. Integrate main's merged streaming replay fix (#4123) while preserving both coordinator regression suites. Signed-off-by: Thomas Kosiewski <tk@coder.com> --- _Generated with `xum` • Model: `unavailable` • Thinking: `unavailable` • Cost: `$unavailable`_ <!-- mux-attribution: model=unavailable thinking=unavailable costs=unavailable --> Change-Id: I3f7ce21ee0d9b837e8fa79354af6a0244c4eb74f
|
Addressed both latest findings:
Regression coverage uses fresh real HistoryService instances and public startup recovery. It includes failed publication and deletion, replacement acceptance followed by a crash, repeated Stop, held post-rename Retry cleanup, corrupt-state repair, nested holds, and public reset/clear/replace cleanup after retirement failure. Generated with |
|
@codex review Please review the latest changes for durable Stop cancellation across restarts and deterministic recovery after temporary admission holds, including explicit Retry acceptance and subsequent Stop ownership. Generated with |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7ca91fd5ba
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Refresh settled cancellation records while preserving local mutation debt and fencing stale reads. Require a locked summary match before narrowing and a durable cleanup receipt before retirement, so obsolete cleanup cannot remove a successor Stop. Complete replacement append and chat publication before returning cancellation-retirement errors. Capture exact cancellation identity, including absence, across reset, clear, replacement, and no-op reset cleanup. Add real-history regressions for shared backends, held I/O, failed writes, and fresh-service recovery. Signed-off-by: Thomas Kosiewski <tk@coder.com> --- _Generated with `xum` • Model: `unavailable` • Thinking: `unavailable` • Cost: `$unavailable`_ <!-- mux-attribution: model=unavailable thinking=unavailable costs=unavailable --> Change-Id: I6381dea8142e3c2fc01bf67d3320a1d7955cfde8
|
Addressed both findings from review 5133792357:
Validation: 1,138 combined session/compaction/history/replay tests and 1,182 workspace/task/container tests pass. Regression cases were reproduced failing before the fixes. Canonical static checks pass after removing one unused test binding. Generated with |
|
@codex review Addressed both latest P1 findings, with regression coverage for shared-backend cancellation refresh and replacement publication after failed cancellation retirement. Also fenced stale cleanup and captured cancellation identity across context mutations. Generated with |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 507b70ab6d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Regarding 3951413562 (downgrade behavior): I checked the parent build,
This PR continues to remove the legacy marker and retain/retry failed cleanup. Successful cleanup therefore remains compatible with older builds. The independent sidecar adds restart protection when that transcript write is unavailable; an unmodified older binary cannot honor a file it never reads. This is a limitation of the added guarantee, rather than a new legacy failure state. Guaranteeing it in that older binary would require backported reader support or a successful transcript mutation, which the reported scenario excludes. I will make this limit explicit in the code and PR risk assessment. I am also addressing 3951413565, the separate valid malformed-record recovery issue, with conservative sanitization and regression coverage. Generated with |
Distinguish malformed JSON/schema bytes from storage errors. Recheck corruption under the history write lock, preserve a private quarantine copy, and durably sanitize the continuous journal and pending follow-ups before removing the corrupt cancellation fence. Failed repair remains blocked and retriable; newer cancellation and local persistence debt retain ownership. Publish repair receipts with the history commit and carry them through follow-up admission/rollback checks, preventing stale snapshots from dispatching during concurrent recovery. Cover corruption, each repair-stage failure, fresh-service recovery, and concurrent Stop. Document that the sidecar supplements legacy cleanup and cannot add support to unmodified older readers. Signed-off-by: Thomas Kosiewski <tk@coder.com> --- _Generated with `xum` • Model: `unavailable` • Thinking: `unavailable` • Cost: `$unavailable`_ <!-- mux-attribution: model=unavailable thinking=unavailable costs=unavailable --> Change-Id: I972fea04b4cd6bfc34f3a516b0c73f5d534b2de1
|
Addressed review 5133990163:
Validation: 1,155 session/compaction/history/replay tests and canonical static checks pass. The repair implementation also passed all 1,182 workspace/task/container tests. Malformed startup and direct-dispatch cases were reproduced failing before the fixes; the final focused suite passes 92 tests, including stage failures, fresh-service recovery, concurrent repair/Stop, and public startup repair during goal admission, model preparation, and pre-acceptance row writes. Generated with |
|
@codex review Malformed cancellation now self-heals by quarantining bytes and durably sanitizing automatic compaction intent before removing the corrupt fence. Review 5133990163's downgrade claim was compared against parent 76f0ce3: that build already resumes the same failed-cleanup state on its own restart. The source evidence and compatibility limit are documented in the response and PR risks; healthy legacy cleanup remains unchanged. Generated with |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4b17334007
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Revalidate captured summary identity, pending follow-up, permitted trailing rows, and cancellation under the same cross-process history lock as the continuation append. Apply the condition to both direct user-row persistence and the on-send compaction request that carries its follow-up. Ordinary appends retain their existing path. Skipped writes refuse through existing admission/rollback handling without creating acceptance receipts. Snapshot-only cleanup failures remain errors. Add real shared-history regressions for repair and cancellation racing preparation. Signed-off-by: Thomas Kosiewski <tk@coder.com> --- _Generated with `xum` • Model: `unavailable` • Thinking: `unavailable` • Cost: `$unavailable`_ <!-- mux-attribution: model=unavailable thinking=unavailable costs=unavailable --> Change-Id: I1d2d46d3efa6ab60112c136ae0ac64c528607e9e
|
Addressed 3951582944 / PRRT_kwDOPxxmWM6f_Hg4. Durable-summary follow-ups now pass a compaction-only condition into history append. Under the existing cross-process write lock, the append rechecks the exact summary ID, sequence, and pending payload; allows only preserved copies or this preparation's own recorded snapshot rows after it; and reads current cancellation through the raw reader. A matching Stop, repaired/changed summary, or unrelated tail refuses the append. Malformed/storage failures cannot authorize it, and the locked reader never invokes repairing code. The same guard covers normal continuation rows and on-send compaction requests, which carry the reconstructed follow-up. A skipped append branches before registering a persisted row or emitting an acceptance receipt. Snapshot cleanup failures and genuine locked I/O errors remain failures, including when rollback changes local ownership. Existing local Stop-before-acceptance rollback semantics stay intact. Two real backend/history instances reproduced the race before the fix. The focused suite passes all 110 tests, including repair during capture/preparation, forced compaction fallback, shared cancellation, permitted/foreign tail rows, and snapshot cleanup failures. Broader validation passes 1,173 combined session/compaction/history/replay tests, all 1,182 workspace/task/container tests, and canonical static checks. Generated with |
|
@codex review The cross-backend repair finding is addressed with compaction-only conditional append under the existing shared history lock. Both direct continuation rows and on-send compaction requests revalidate the exact source, trailing rows, and cancellation before writing. Skipped writes cannot publish an acceptance receipt. Generated with |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1e84781767
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Recheck shared Stop for direct compaction handoffs, acknowledge Stop only after durable publication, and preserve accepted manual rows when witnessed cancellation cleanup fails. Restore absent heartbeat rollback state only when its captured predecessor identities survive. Signed-off-by: Thomas Kosiewski <tk@coder.com> --- _Generated with `xum` • Model: `unavailable` • Thinking: `unavailable` • Cost: `$unavailable`_ <!-- mux-attribution: model=unavailable thinking=unavailable costs=unavailable --> Change-Id: I0e7f9c97d751d5197304584df113347eb20ca38b
|
Addressed all four findings from review 5134320929:
Each reported failure was reproduced before the fix. All 134 focused tests, 1,186 combined session/compaction/history/replay tests, 1,182 workspace/task/container tests, and canonical static checks pass. Independent bounded review also checked the heartbeat/direct guards, overlapping Stop acknowledgment, and witnessed-retirement identity races. The service suite used an isolated Git template after a local inherited commit hook made fixture setup exceed the normal timeout; no test or user configuration was changed. Generated with |
|
@codex review Addressed all four findings: shared cancellation checks for direct compaction handoffs, positive predecessor identity for absent heartbeat rollback, durable manual acceptance despite witnessed cleanup failure, and durable Stop acknowledgment including overlapping Stops. Focused real-history regressions also protect foreign Stop identity and stale replacement receipts. Generated with |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1fbb58db38
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Reject all unwitnessed cancellation scopes for handoffs without durable source identity. Compare explicit Retry's captured nonce or absence under the history write lock before committing acceptance, while preserving witnessed cleanup debt and local Stop guards. Signed-off-by: Thomas Kosiewski <tk@coder.com> --- _Generated with `xum` • Model: `unavailable` • Thinking: `unavailable` • Cost: `$unavailable`_ <!-- mux-attribution: model=unavailable thinking=unavailable costs=unavailable --> Change-Id: I6cfad4dad94e65713e31948a5bf5435d148cf491
|
Addressed both findings from review 5134517500:
Both Retry races and all three narrowed direct-handoff races failed before the fix. All 130 focused tests pass, including witnessed old debt, ancillary retirement failure, genuine shared-read/write errors, guarded no-ops, and a local Stop after the atomic receipt. Broader validation passes 1,196 session/compaction/history/replay tests, 1,182 workspace/task/container tests, and canonical static checks. Independent bounded review cleared locking and acceptance ordering. Generated with |
|
@codex review Both findings from review 5134517500 are addressed. Source-less compaction handoffs reject every unwitnessed cancellation scope. Explicit Retry compares its captured nonce or absence with shared cancellation under the same lock as its guarded acceptance write. Ordinary history updates retain their existing path. Generated with |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cd43821fc9
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| else if (history.data.length === 0) | ||
| await this.compactionCancellation.retire(cancellation.nonce); |
There was a problem hiding this comment.
Revalidate empty history before retiring the Stop
With XUM_ALLOW_MULTIPLE_INSTANCES=1, another backend can append a late compaction summary with pendingFollowUp after this method reads an empty active history but before retire() removes the cancellation sidecar. The intervening witness check does not detect that summary because it carries no replacement nonce, so this stale history.data.length === 0 result deletes the only Stop fence and startup recovery can dispatch the late continuation. Revalidate emptiness while holding the same cross-process lock as the nonce retirement, or make the summary append participate in that cancellation check.
AGENTS.md reference: AGENTS.md:L150-L150
Useful? React with 👍 / 👎.
| flag: "wx", | ||
| }); | ||
| if (!isCurrent()) return null; | ||
| await this.getContinuousCompactionJournal(workspaceId).clear(); |
There was a problem hiding this comment.
Serialize journal repair with foreign journal writers
With XUM_ALLOW_MULTIPLE_INSTANCES=1 and a malformed cancellation sidecar, this clear is not synchronized with another backend's ContinuousCompactionJournalStore.write(), which uses only its process-local queue. A foreign in-flight compaction can therefore publish its journal after this clear; repair then removes the cancellation fence, allowing that journal to be finalized or recovered despite the conservative Stop repair. Fresh evidence beyond the earlier repaired-follow-up issue is this separate unsynchronized journal write path; journal sanitization and publication need a shared cross-process exclusion or an equivalent cancellation revalidation.
AGENTS.md reference: AGENTS.md:L108-L113
Useful? React with 👍 / 👎.
|
Security review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
Merge main 7c27339 (#4097) into the compaction coordination branch. Preserve raw reset privacy boundaries and append provenance, guard token-budget single/batch admission, retain prepared request snapshots, and keep committed rollover ownership separate from cancellation retirement. Signed-off-by: Thomas Kosiewski <tk@coder.com> --- _Generated with `xum` • Model: `unavailable` • Thinking: `unavailable` • Cost: `$unavailable`_ <!-- mux-attribution: model=unavailable thinking=unavailable costs=unavailable --> Change-Id: I321cbfd3af5c8466dea2834035c459e440b98827
Summary
Compaction can finish after its turn has been canceled or replaced. Give observations and durable continuation handoffs explicit coordinator ownership, and persist Stop independently of transcript cleanup. Late work cannot clear a replacement's state or revive a canceled continuation after restart; temporary admission holds resume recovery when released.
Implementation
Validation
OPENAI_API_KEY.Risks
This changes ownership across continuous, legacy, and heartbeat compaction and startup recovery. Cancellation ordering, manual-turn priority, and durable cleanup are the main regression risks. Storage errors remain visible and retriable; failure of both transcript cleanup and cancellation publication cannot provide crash durability. Older builds honor successful legacy pending-marker cleanup but cannot read the new fallback sidecar. If cleanup remains impossible, downgrading loses the added restart protection; the parent build already resumes that failed-cleanup state after its own restart.
Pains
Some tests used admission holds as a proxy for committed context replacement; they now signal the actual commit. Tests that artificially awaited Stop while holding its required history write lock now start Stop, release the writer, then await completion. Production callers do not hold that lock while awaiting Stop. A task fixture hit its five-second timeout in Git setup with inherited local template hooks; isolating
init.templateDirfor the validation process made it pass in 377 ms and the full service suite pass without changing tests or user configuration.Generated with
xum• Model:unavailable• Thinking:unavailable• Cost:$unavailable