Thanks to visit codestin.com
Credit goes to github.com

Skip to content

🤖 fix: activate durable compaction cancellation across turn admission - #4191

Merged
ThomasK33 merged 3 commits into
codex/effect-prepared-history-publicationfrom
codex/effect-compaction-cancellation-runtime
Sep 12, 2026
Merged

🤖 fix: activate durable compaction cancellation across turn admission#4191
ThomasK33 merged 3 commits into
codex/effect-prepared-history-publicationfrom
codex/effect-compaction-cancellation-runtime

Conversation

@ThomasK33

@ThomasK33 ThomasK33 commented Sep 9, 2026

Copy link
Copy Markdown
Member

Activates durable compaction cancellation across Stop, manual send/edit/Resume, queued input, and automatic recovery. Failed preparation preserves cancellation; a durably accepted replacement may release it. This V1 layer defers unresolved automatic recovery; #4209 adds settlement proof for eligible fresh input.

Automatic prefixes wait for their trigger and publish through the existing captured-frontier history transaction. Comparing the original persisted Stop and appending the batch under one write lock prevents another backend’s Stop or Clear from leaving stale automatic rows durable. Ordinary automatic input preserves cancellation and its existing rollback ownership.

Requests capture the persisted Stop frontier before pricing/settings preflight and retain it through preparation and queued dispatch. Publication must match that original nonce/generation, so an older request cannot adopt another backend's later Stop. Exact Send Now admission carries its initiating Stop receipt; manual malformed-record recovery remains a single operation. Context-budget continuations retain their originating capture, and committed local resets and verified Stop retirement advance only queued or active captures matching the exact predecessor nonce and generation. This preserves legitimate queued input across rollover without adopting a foreign Stop. The recorded admission is checked again after request preparation and immediately before provider construction, including prepared requests. A refusal after stream construction aborts that captured provider before releasing its resources.

Stop joins physical execution and terminal policy outside history locks. Legacy summary/partial follow-up metadata is neutralized before the Stop sidecar is published, and live compaction completion retains its original admission generation so it cannot republish stopped recovery. Failed initial cleanup preserves the predecessor and exact local retry debt; it does not claim a successful durable Stop. Authored follow-up request content remains intact. Full Clear runs the existing deletion transaction under the cancellation history lock, after workspace cleanup barriers and before sidecar publication. This preserves malformed-history Clear while removing downgrade-readable recovery. Uncertain deletion is not retried over later foreign input; a confirmed deletion receipt permits only sidecar retry and retains UI/monitor accounting if publication fails.

Edit/truncation receipts follow directory durability. Reset heartbeats refuse scoped-summary cancellation debt while ordinary scoped-V1 automatic admission remains supported. Rejected manual input keeps preserve-mode receipts so committed rejection rows are not duplicated into the composer and uncommitted drafts can be restored.

Outstanding scoped cleanup debt prevents automatic input from starting legacy token-pressure compaction or publishing a token-budget reset. Reset publication checks the persisted cancellation scope under the existing history write lock, including same-nonce narrowing by another backend, so restart recovery can still find the canceled summary. Manual replacement and ordinary automatic input without a reset remain supported.

The original persisted nonce/generation is revalidated while holding the existing shared history lock through synchronous provider construction, registration, and supervision. Prepared requests use the final caller’s fence. Playback, envelope writes, and cleanup are outside the lock. Factory or fence failure retains exact registered-resource cleanup ownership; mock playback keeps its existing immediately awaited admission check.

A caller whose exact witnessed Stop was already retired by a peer can receive the same verified absent-frontier transition. The original nonce/generation is copied before waiting and the existing durable witness is revalidated under the history lock. This advances only matching owned admission and does not accept an arbitrary missing sidecar or a newer generation.

Validation covers two-backend preflight races, queue/Send Now admission, downgrade publication boundaries, late compaction completion, directory flush failures, and real budget rejection. Integrated validation on #4191 df5972870696ef9b78c2854f8a4b9ddf3fd15769 and #4209 86e3487151fde2273d8e7595504f3b87a2ea9d62: 14 affected suites passed on each tree (A 1,271 tests / 6,521 assertions; B 1,352 tests / 7,006 assertions), with full TypeScript, canonical static, and final changed-file lint/format checks. Four deterministic peer Stop/Clear cases fail on the original A head and pass with the fence; unchanged-frontier controls pass. B production is unchanged.

Risk: ownership mistakes can resume canceled work or strand valid input. Held preflight/cleanup and foreign-supersession controls exercise those boundaries directly.

This stack integrates main 0d31680932fe5b2cb33ce33ec43cb576c86ee0e6, including #4225’s workspace-fork recovery fix. All prior review fixes remain; the shared automatic-publication fence belongs to #4191.

This is one layer of the cancellation phase: #4214#4215#4219#4221#4182#4187#4191#4209. All eight PRs merge together after every member has current-head approval and passing CI.


Generated with xum • Model: unavailable • Thinking: unavailable • Cost: $unavailable

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 9, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-12T13:10:42.420023Z df59728 Manual request
🔒 Security Review Completed 2026-09-12T13:16:47.979439Z df59728 Manual request
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@ThomasK33
ThomasK33 added this pull request to stack #4188 September 9, 2026 15:47

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9ab5348384

ℹ️ 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".

Comment thread src/node/services/agentSession.ts Outdated
Comment thread src/node/services/agentSession.ts
Comment thread src/node/services/agentSession.ts Outdated
@ThomasK33

Copy link
Copy Markdown
Member Author

Addressed all three findings in 38b907a:

  • Stop cleanup after cancellation persistence failure: AgentSession now reports explicit physical-stop evidence only after the engine succeeds and terminal accounting finishes. Direct callers still receive the cancellation error. WorkspaceService uses that evidence to retire monitor attention, delete the requested partial, terminate descendants, and restore queued input before returning the standard Stop durability error. The regression holds terminal accounting open while cancellation publication fails and verifies cleanup, the direct session error, and the final service error; the existing actual-engine-failure control still passes.
  • Crash after follow-up clearing but before cancellation retirement: the existing locked cleanup operation can now confirm that the exact unique active assistant summary ID and sequence has no pending follow-up, without rewriting history. Startup retires only the matching ordinary scoped cancellation after this confirmation. Repeated confirmation is safe; missing, duplicate, malformed, unreadable, changed, or non-summary rows do not prove cleanup. Restart tests verify ordinary retirement, retained-floor preservation, and a foreign Stop published between confirmation and retirement retaining its nonce.
  • Explicit recovery from future or oversized cancellation records: automatic reads and repair still preserve unsupported bytes. Explicit Stop or manual replacement now uses the existing captured-frontier publication path to install a supported retained Stop, advancing the generation before publication. Failed manual preparation leaves that floor intact; successful durable manual acceptance retires it. Real-storage tests cover automatic byte preservation, explicit Stop and manual recovery, and retry refusal after a foreign Stop or generation change.

Validation: 701 tests across cancellation runtime/core/storage, exact cleanup, and WorkspaceService; 743 tests across AgentSession callers and history truncation (overlapping the runtime suite); TypeScript, no-cache ESLint, and full make static-check pass. Independent review approved the production change and completed regression controls.


Generated with xum • Model: unavailable • Thinking: unavailable • Cost: $unavailable

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 38b907ac6b

ℹ️ 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".

Comment thread src/node/services/agentSession.ts Outdated
Comment thread src/node/services/agentSession.ts Outdated
Comment thread src/node/services/historyService.ts
@ThomasK33

Copy link
Copy Markdown
Member Author

Addressed the three commit-boundary findings in their owning layers:

  • Automatic append surviving Stop: the existing post-append rollback checkpoint now uses the complete captured admission predicate, including compaction Stop generation and caller epoch. Real-I/O regressions cover single and batch appends, verify the refused attempt's rows are removed, and preserve concurrently appended unrelated rows. The committed manual replacement boundary remains unchanged.
  • Ordinary manual sends rewriting all active history: the lower replacement-acceptance layer in 🤖 feat: record durable history acceptance for compaction replacement #4182 now uses provenance's append-only path for a single trigger, preserving raw bytes, torn-tail handling, and certification. HistoryService prepares the handle and verifies its physical lease before the final logical check and synchronous append. Acceptance is captured when the complete JSON row becomes readable, including a missing final delimiter, so live results and restart witnesses agree. Incomplete JSON cannot issue a receipt, same-object retry cannot duplicate acceptance, and later sync/close/certification errors cannot revoke it. Prefix batches retain atomic publication.
  • Edit truncation committing after Stop wins during staging: active edits use the final guarded history publisher. Archived edits stage every retained output and the existing recovery marker before synchronously publishing marker, tombstone, retained archive, and chat. Stop or lease loss during staging preserves the winning history. Failure recovery verifies physical ownership before shared mutations; tests cover retained raw archive bytes, interrupted commit, successor preservation, cleanup failure, and restart.

The lower layer also fixes the Integration CI value-comparison failure: capture CAS compares primitive nonce/generation values, and exact resume comparisons use a realm-local JSON snapshot. The original mock-only IPC test reproduced the normal-send rejection; dedicated append and resume acceptance tests now pass under Jest's VM and complete mock streaming.

Final validation: lower commit a057374906837d3699abe4866054b1c423b9d4a6 passes all 99 publication/replacement/provenance tests and full make static-check. On combined runtime head 1ac4cea9b742ec1225b37bf739f358a9e3e04360, all 2,653 selected tests across 52 files and all eight mock-only IPC cases pass, along with make build-main and full make static-check. The original normal-send CI reproduction is included. Independent review approved both production repairs, and root review approved the test-only append publication adaptation in #4182. The original #4187 patch replays unchanged; the runtime range-diff retains only the expected node:fs import merge.


Generated with xum • Model: unavailable • Thinking: unavailable • Cost: $unavailable

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1ac4cea9b7

ℹ️ 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".

Comment thread src/node/services/workspaceService.ts Outdated
Comment thread src/node/services/agentSession.ts
@ThomasK33

Copy link
Copy Markdown
Member Author

Addressed both findings in 639a4d78cbcbde1e9c5fc5ece6213f7c7464c53e:

  • Send Now retained pre-Stop queue admission: WorkspaceService captured compaction admission when the message was queued, so Send Now's own Stop made its selected manual entry stale. Dispatch now refreshes only that manual entry's compaction capture. Caller cancellation and automatic origin remain intact, and the attempt still rejects a second Stop. Real ServiceContainer/IPC coverage verifies manual success, automatic refusal, caller cancellation, hidden automatic work, and a second Stop during dequeue. The original queued IPC case and all five Send Mode UI cases pass.
  • Oversized pending follow-up permanently blocked manual recovery: manual replacement now converts the still-current, size-refused narrowing mutation into a durable retained Stop and continues preparation. It checks both the pending operation and mutation identity before doing so; newer Stop/retry work wins. Ordinary I/O failure retains its exact debt, automatic recovery stays blocked, and failed manual preparation cannot release the retained fence. Real-storage coverage exercises an actual over-limit follow-up followed by failed and successful manual replacement, plus deterministic in-flight and retry races.

The resume CI failure had a separate subscription window: the helper counted the previous attempt's replayed stream-error as a failure of the resumed attempt. The shared helper now waits for initial subscription replay and clears those events before resume. Existing prefix/continuation assertions are unchanged; mock tests prove both successful resume and rejection of a fresh resumed error.

Final validation on this exact combined head: 2,665 tests across 52 files with 13,488 assertions; 15 mock IPC cases; five original Send Mode UI cases; the original queued Send Now case; make build-main; and full make static-check. All final Jest runs deny outbound fetch/HTTP/HTTPS.


Generated with xum • Model: unavailable • Thinking: unavailable • Cost: $unavailable

@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

Please review current head 639a4d78cbcbde1e9c5fc5ece6213f7c7464c53e. The complete description records the final validated layer and integration; addressed findings have replies and are resolved.


Generated with xum • Model: unavailable • Thinking: unavailable • Cost: $unavailable

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

Security review completed. No security issues were found in this pull request.

Reviewed commit: 639a4d78cb

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 639a4d78cb

ℹ️ 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".

Comment thread src/node/services/workspaceService.ts Outdated
Comment thread src/node/services/agentSession.ts Outdated
@ThomasK33

Copy link
Copy Markdown
Member Author

Addressed both findings in the runtime repair pair ending at 1843fe91e5163e6962acb47c37077600882f1272:

  • Ordinary queued sends stopped batching: the service no longer places the common Stop capture in the caller-specific probe that seals entries. Each queued addition retains its own compaction probe and manual refresh alongside its origin; dispatch combines the remaining probes, and keyed removal removes only that addition's authority. Caller-specific cancellation still seals entries. The real ServiceContainer/IPC regression reproduces the lost second addition before repair, then verifies one persisted user row containing both additions. Automatic identity, caller cancellation, mixed hidden work, and second-Stop controls pass. This is the separate commit fb135bf0c793325f2d1be4d8f62a86c49cba6595.
  • Downgrade restarted a stopped persisted follow-up: after generation advancement and sidecar commit, Stop now removes legacy-visible pending follow-ups through the existing guarded history helper. It preserves the summary fold, boundaries, tail, and unrelated metadata. A second cleanup follows the captured engine and policy settlement and verifies the same nonce and generation before writing. Cleanup failure preserves the new-reader fence, exact retry debt, and physical Stop evidence. Automatic ingress rechecks blocking debt after history reads before narrowing, avoiding a Stop/policy cycle. No persistent schema, migration, or journal was added.

The actual older parent 2f180b0c dispatches the continuation from the former disk shape, but starts no stream from the repaired summary or committed-partial fixtures. Held-writer, successor nonce/generation, both cleanup failures/retry, engine failure, and both captured-old-Stop/new-Stop cycle regressions pass.

Validation: 795 focused tests, 94 queue tests, 16 mock IPC cases, five original Send Mode UI cases, the original queued Send Now case, and four actual-parent compatibility cases; build, types, lint, formatting, and diff checks pass. Fresh full make static-check passes on the corrected candidate. All final Jest runs deny outbound fetch/HTTP/HTTPS.


Generated with xum • Model: unavailable • Thinking: unavailable • Cost: $unavailable

@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

Please review current head 1843fe91e5163e6962acb47c37077600882f1272. The batching and downgrade findings have separate commits, published replies, real-storage and older-handler regression coverage, independent approval, and fresh full static validation. Lower and middle layer heads are unchanged.


Generated with xum • Model: unavailable • Thinking: unavailable • Cost: $unavailable

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

try {
partial = this.normalizeTranscriptMessage(JSON.parse(text));
} catch {
throw new Error("Cannot safely neutralize malformed partial summary");
}

P1 Badge Keep malformed partials from blocking Stop recovery

When a hard Stop that preserves partials (such as ACP cancellation or the CLI budget stop) encounters a malformed partial.json, this unconditional parse failure occurs after the cancellation sidecar has been committed. The mutation remains blocking, and every subsequent manual send retries the same cleanup and fails before it can publish a replacement, permanently bricking the workspace until the user manually deletes the partial. Quarantine or discard malformed partial state, or allow explicit replacement to supersede this cleanup debt.

AGENTS.md reference: AGENTS.md:L110-L111

ℹ️ 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".

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

Security review completed. No security issues were found in this pull request.

Reviewed commit: 1843fe91e5

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@ThomasK33
ThomasK33 force-pushed the codex/effect-compaction-cancellation-runtime branch from 1843fe9 to f68020e Compare September 10, 2026 15:48

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f68020eeab

ℹ️ 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".

Comment thread src/node/services/agentSession.ts
Comment thread src/node/services/agentSession.ts
@ThomasK33

Copy link
Copy Markdown
Member Author

Addressed review-body finding 5159513658, "Keep malformed partials from blocking Stop recovery."

Stop now removes an unusable partial under the existing history locks after the final physical lease and logical generation checks. Valid partials retain their recovery fields; ambiguous privacy markers and I/O failures remain protected. The sidecar stays durable through cleanup, including a late settlement writer or a failed deletion retried by manual input. An invalid manual replacement retains the same Stop; an accepted replacement becomes durable before retirement.

Real HistoryService regressions cover malformed JSON, invalid message shape, damaged UTF-8, late partial publication, cleanup retry, and successor preservation after lease/generation displacement. The final integrated phase on current main passes 1,884 tests and 9,390 assertions. The independent coordinator review approved the production repair; the final main-integrated candidate also passes the complete make static-check. Fixed in 0716a3d1100a5fa890dd8c6abab9622ab33d573c. There is no inline review thread to resolve for this finding.


Generated with xum • Model: unavailable • Thinking: unavailable • Cost: $unavailable

@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

Please review current head f68020eeabc134537b1093e9984051c7d660aba0. The complete phase has been reconciled with current main and passes 1,884 focused tests and full static checks. The PR description records the final layer scope and validation; the runtime malformed-partial finding has a published fix and reply.


Generated with xum • Model: unavailable • Thinking: unavailable • Cost: $unavailable

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

Security review completed. No security issues were found in this pull request.

Reviewed commit: f68020eeab

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f68020eeab

ℹ️ 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".

Comment thread src/node/services/agentSession.ts
Comment thread src/node/services/workspaceService.ts Outdated
Comment thread src/node/services/agentSession.ts
@ThomasK33
ThomasK33 force-pushed the codex/effect-compaction-cancellation-runtime branch from f68020e to c11d840 Compare September 11, 2026 11:02
@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

Please review head ea71003c6517ac0786b7404204e5b134c7bfbf0e against its stack base. The layer’s own source delta is unchanged; its base includes the reviewed legacy-role receipt fix.

Final integrated validation: #4191 ea71003c6517ac0786b7404204e5b134c7bfbf0e passes 4051 tests / 36596 assertions; #4209 e5c62c16be65b46fa6152a9c4e16f68f7cd3274f passes 4133 tests / 37053 assertions, across 54 affected suites each. Full source/test TypeScript and make static-check pass on both exact commits above main b9bc3949cffb231787c9e9fc669672a3bc486aef.

The full eight-member phase remains held until every current head has reviewer approval and passing CI.


Generated with xum • Model: unavailable • Thinking: unavailable • Cost: $unavailable

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

Security review completed. No security issues were found in this pull request.

Reviewed commit: ea71003c65

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ea71003c65

ℹ️ 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".

Comment thread src/node/services/agentSession.ts Outdated
@ThomasK33

Copy link
Copy Markdown
Member Author

Addressed comment 3995907599 in c392f445deebb575ce0f2dddaf271e6fad80ea47. The token-budget path reproduced the reported failure: automatic reset publication archived the canceled summary, and a fresh HistoryService/session could no longer retire its scoped Stop debt.

The existing history write lock now refuses preserve-mode append batches containing a reset while persisted cancellation is summary-scoped. The scope check shares the publication lock, so same-nonce peer narrowing cannot slip between the check and the reset. Ordinary automatic input without a reset and explicit manual replacement remain eligible; the dependent V2 layer also retains successful fresh-input rollover after full Stop settlement.

The original source fails all three regression cases (rollover/restart and both scoped-publication timings). The fix passes those cases and their positive controls. On the final commits, #4191 passes 506 tests / 3148 assertions and #4209 passes 559 tests / 3460 assertions across five affected suites each. Full TypeScript and canonical make static-check pass on both commits. The prior 54-suite validation remains recorded on the preceding heads.


Generated with xum • Model: unavailable • Thinking: unavailable • Cost: $unavailable

@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

Please review current head c392f445deebb575ce0f2dddaf271e6fad80ea47. The automatic-reset fix for comment 3995907599 checks summary-scoped cancellation under the existing history write lock. Real-history restart and same-nonce peer-narrowing regressions cover the failure, with manual reset and ordinary automatic input controls.

This remains part of the eight-PR cancellation phase; all members merge together after current-head approval and passing CI.


Generated with xum • Model: unavailable • Thinking: unavailable • Cost: $unavailable

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. What shall we delve into next?

Reviewed commit: c392f445de

ℹ️ 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".

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

Security review completed. No security issues were found in this pull request.

Reviewed commit: c392f445de

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

Signed-off-by: Thomas Kosiewski <[email protected]>

---

_Generated with `xum` • Model: `unavailable` • Thinking: `unavailable` • Cost: `$unavailable`_

<!-- mux-attribution: model=unavailable thinking=unavailable costs=unavailable -->
Signed-off-by: Thomas Kosiewski <[email protected]>

---

_Generated with `xum` • Model: `unavailable` • Thinking: `unavailable` • Cost: `$unavailable`_

<!-- mux-attribution: model=unavailable thinking=unavailable costs=unavailable -->
@ThomasK33
ThomasK33 force-pushed the codex/effect-compaction-cancellation-runtime branch from c392f44 to 87badaf Compare September 12, 2026 12:37
@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

Please review head 87badaf62f925e118c2292cf3e788fc92894dafc after this stack’s integration onto main 0d31680932fe5b2cb33ce33ec43cb576c86ee0e6, including #4225’s workspace-fork recovery fix. This update only incorporates that base change; this layer’s diff is unchanged and preserves all prior review fixes.

Integrated validation on #4191 87badaf62f925e118c2292cf3e788fc92894dafc and #4209 d83e1cb55f50676562e675398f76e0b5118053ab above main 0d31680932fe5b2cb33ce33ec43cb576c86ee0e6: six affected suites passed on each integrated tree: A 549 tests / 3,337 assertions and B 602 tests / 3,649 assertions; full TypeScript and canonical static checks passed on both. The rebased A/B trees exactly match those validated trees.

All eight PRs in the cancellation phase will merge together after every member has current-head approval and passing CI.


Generated with xum • Model: unavailable • Thinking: unavailable • Cost: $unavailable

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

Security review completed. No security issues were found in this pull request.

Reviewed commit: 87badaf62f

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 87badaf62f

ℹ️ 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".

Comment thread src/node/services/agentSession.ts Outdated
Publish automatic prefixes with their trigger through the existing captured-frontier history lock. This prevents a peer Stop or Clear from leaving stale input durable between admission and append. Preserve cancellation and rollback behavior; lift existing test hooks with their owning layer.

Signed-off-by: Thomas Kosiewski <[email protected]>

---

_Generated with `xum` • Model: `unavailable` • Thinking: `unavailable` • Cost: `$unavailable`_

<!-- mux-attribution: model=unavailable thinking=unavailable costs=unavailable -->

Change-Id: If85bb904aadc2271f59176dfb75c5265ba699d1a
@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

Please review head df5972870696ef9b78c2854f8a4b9ddf3fd15769. Fixes finding 3996238781: automatic prefixes and trigger now use the existing preserve-cancellation transaction, which compares the captured persisted frontier and appends under the same history lock. No new API, state format, or settlement policy.

Integrated validation on #4191 df5972870696ef9b78c2854f8a4b9ddf3fd15769 and #4209 86e3487151fde2273d8e7595504f3b87a2ea9d62: 14 affected suites passed on each tree (A 1,271 tests / 6,521 assertions; B 1,352 tests / 7,006 assertions), with full TypeScript, canonical static, and final changed-file lint/format checks. Four deterministic peer Stop/Clear cases fail on the original A head and pass with the fence; unchanged-frontier controls pass. B production is unchanged.

The lower six PR heads remain unchanged. All eight phase PRs will merge together after every member is ready.


Generated with xum • Model: unavailable • Thinking: unavailable • Cost: $unavailable

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Another round soon, please!

Reviewed commit: df59728706

ℹ️ 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".

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

Security review completed. No security issues were found in this pull request.

Reviewed commit: df59728706

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@ThomasK33
ThomasK33 added this pull request to the merge queue Sep 12, 2026
Merged via the queue into main with commit ed56436 Sep 12, 2026
34 of 38 checks passed
@ThomasK33
ThomasK33 deleted the codex/effect-compaction-cancellation-runtime branch September 12, 2026 14:12
yermakoffivan pushed a commit to yermakoffivan/mux that referenced this pull request Sep 12, 2026
Adds a raw JSONL reader that streams large strings, keys and numbers
without assembling a whole row. This is the inactive parsing
prerequisite for the oversized-history witness finding in coder#4182; the
runtime integration in coder#4182 consumes it through coder#4221.

The reader reports byte ranges, content digests, JSON/UTF-8 validity and
duplicate decoded keys. Consumers receive provisional tokens, optional
isolated raw chunks, and awaited row completion. Explicit replacement
decoding supports legacy identity accounting while keeping strict raw
validity separate. Abort, early exit and visitor errors close the file
and parser.

Uses pinned stream-json 3.6.0 with scalar packing disabled. Retained
memory depends on the read chunk plus nesting and object-key
bookkeeping; this is not an absolute constant-memory guarantee for
arbitrarily deep or wide objects. Callers must bound their own retention
and revalidate file stamps before treating descriptors as evidence.

Validation: 58 tests / 266 assertions, including 12 MiB scalar fixtures,
one-byte reads, malformed UTF-8/JSON, split escapes, duplicate keys,
LF/EOF framing, backpressure and cleanup. A bundled Node 22 smoke run
passed 17 checks; four additional abort-guard checks passed after fixing
cancellation from beginRow; canonical make static-check passed.
Deterministic held-open and held-stat tests on an empty file verify
exact abort reasons and file-handle closure after awaited setup. Runtime
compatibility was checked against the repository's Node 22 Docker
runtime. No provider calls.

The Nix offline dependency-cache hash is updated to the value computed
by CI for the added streaming parser dependency. A prior Flake Hash
Check confirmed the generated value. Local Nix is unavailable.

Risk: the new dependency and streaming-token contract need careful
review before activation.

Raw callbacks receive copies bounded by the read chunk, so mutation of
the full backing buffer cannot corrupt parsed tokens, digests or later
buffered rows. Cancellation remains observable after awaited visitor
completion and asynchronous parser/file disposal. Nine adversarial
regressions failed before these fixes and now pass; an additional
bundled Node 22 run passed 16 mutation and late-cancellation checks.
Canonical static checks passed on the final scanner fix.

The scanner cleanup test now observes only the file handle opened for
its own fixture, so unrelated concurrent opens cannot replace the handle
under assertion. Closure remains required; scanner production is
unchanged.

Integrated validation on coder#4191
`87badaf62f925e118c2292cf3e788fc92894dafc` and coder#4209
`d83e1cb55f50676562e675398f76e0b5118053ab` above main
`0d31680932fe5b2cb33ce33ec43cb576c86ee0e6`: six affected suites passed
on each integrated tree: A 549 tests / 3,337 assertions and B 602 tests
/ 3,649 assertions; full TypeScript and canonical static checks passed
on both. The rebased A/B trees exactly match those validated trees.

This stack integrates main `0d31680932fe5b2cb33ce33ec43cb576c86ee0e6`,
including coder#4225’s workspace-fork recovery fix. Each layer retains its
previously reviewed diff and all addressed review fixes.

The complete cancellation phase is ordered coder#4214coder#4215coder#4219coder#4221coder#4182coder#4187coder#4191coder#4209. The reader prerequisites and runtime
changes merge together only after every member has current-head approval
and green CI.

---

_Generated with `xum` • Model: `unavailable` • Thinking: `unavailable` •
Cost: `$unavailable`_

<!-- mux-attribution: model=unavailable thinking=unavailable
costs=unavailable -->
yermakoffivan pushed a commit to yermakoffivan/mux that referenced this pull request Sep 12, 2026
Adds bounded scalar facts and canonical JSON evidence above coder#4214's raw
token reader. This is an inactive prerequisite for the oversized-history
witness fix in coder#4182; it does not decide message readability or grant
cancellation authority.

Strings retain a bounded prefix, length, digest and optional exact-match
result. Numbers retain up to 2,048 significant digits plus
exponent/position and a nonzero-tail flag, then delegate rounding to
native Number. The retained prefix exceeds every finite binary64
rounding boundary's decimal expansion; a discarded nonzero tail
preserves the side of that boundary. Canonical evidence accounts for
escaping, split surrogate pairs, integer-property ordering, duplicates,
raw digest/length and caller-reported normalization changes.

Validation: reader/scalar tests previously passed 91 cases with 4,712
assertions; the final reader/scalar/projection combination passes 109
tests / 7,339 assertions. A Node 22 native oracle passes 4,704 checks,
including midpoint/subnormal/overflow edges, huge exponent cancellation,
2,000 generated numbers and an 8 MiB canonical row. Both owned layers
passed canonical static checks and independent review before
composition; production scalar code remained unchanged during final test
lint fixes.

Risk: incorrect number or canonical equivalence could misclassify later
history evidence, so this module stays inactive until the
history-specific adapter is reviewed. Retention is bounded for scalars;
nesting/key bookkeeping follows the raw reader's documented limits. No
new persistence format or schema interpreter.

The numeric proof comment names SIGNIFICANT_DIGITS so its retention
bound cannot drift from the implementation. This review correction
changes no behavior.

Two fork/send integration assertions retain their success requirement
while exposing the returned error when a request fails. Scalar-reader
production is unchanged.

Integrated validation on coder#4191
`87badaf62f925e118c2292cf3e788fc92894dafc` and coder#4209
`d83e1cb55f50676562e675398f76e0b5118053ab` above main
`0d31680932fe5b2cb33ce33ec43cb576c86ee0e6`: six affected suites passed
on each integrated tree: A 549 tests / 3,337 assertions and B 602 tests
/ 3,649 assertions; full TypeScript and canonical static checks passed
on both. The rebased A/B trees exactly match those validated trees.

This stack integrates main `0d31680932fe5b2cb33ce33ec43cb576c86ee0e6`,
including coder#4225’s workspace-fork recovery fix. Each layer retains its
previously reviewed diff and all addressed review fixes.

The complete cancellation phase is ordered coder#4214coder#4215coder#4219coder#4221coder#4182coder#4187coder#4191coder#4209. The reader prerequisites and runtime
changes merge together only after every member has current-head approval
and green CI.

---

_Generated with `xum` • Model: `unavailable` • Thinking: `unavailable` •
Cost: `$unavailable`_

<!-- mux-attribution: model=unavailable thinking=unavailable
costs=unavailable -->
yermakoffivan pushed a commit to yermakoffivan/mux that referenced this pull request Sep 12, 2026
…r#4219)

Adds streamed message-readability evidence above the scalar reader in
coder#4215. Oversized history rows need the same identity and readability
decisions as ordinary JSON.parse rows without retaining entire message
payloads. This prerequisite provides those facts; the separate row
adapter and coder#4182 integration will consume them.

The projection checks every part and workflow element against the
existing schema fragments, including constrained strings, finite
numbers, strict objects, array limits and ordered workflow events. It
preserves legacy role coercion, duplicate-key behavior and normalization
detection. Scalar retention is bounded; nesting and distinct object-key
bookkeeping retain the raw reader's documented limits. There is no
persistence change or replacement authority decision in this layer.

Legacy array-coerced system roles remain readable collision evidence but
are classified as system rows, matching the native reader. The
system-role classification is gated by successful readability so
malformed role objects are not coerced.

Integrated validation on coder#4191
`87badaf62f925e118c2292cf3e788fc92894dafc` and coder#4209
`d83e1cb55f50676562e675398f76e0b5118053ab` above main
`0d31680932fe5b2cb33ce33ec43cb576c86ee0e6`: six affected suites passed
on each integrated tree: A 549 tests / 3,337 assertions and B 602 tests
/ 3,649 assertions; full TypeScript and canonical static checks passed
on both. The rebased A/B trees exactly match those validated trees.

Risk: projection drift from the ordinary reader could change which
historical messages count as readable. The implementation deliberately
uses the current schema fragments and native-comparison tests;
activation stays in the separately reviewed adapter/integration change.

This stack integrates main `0d31680932fe5b2cb33ce33ec43cb576c86ee0e6`,
including coder#4225’s workspace-fork recovery fix. Each layer retains its
previously reviewed diff and all addressed review fixes.

This is one layer of the cancellation phase: coder#4214coder#4215coder#4219coder#4221coder#4182coder#4187coder#4191coder#4209. All eight PRs merge together
after every member has current-head approval and passing CI.

---

_Generated with `xum` • Model: `unavailable` • Thinking: `unavailable` •
Cost: `$unavailable`_

<!-- mux-attribution: model=unavailable thinking=unavailable
costs=unavailable -->
yermakoffivan pushed a commit to yermakoffivan/mux that referenced this pull request Sep 12, 2026
…r#4221)

Adds the history-specific row adapter above coder#4219. It preserves
ordinary-row parsing and legacy normalization, derives oversized-row
identity without assembling whole payloads, and compares replay
candidates using exact bounded byte ranges. The owning coder#4182 integration
will use this adapter to finish the oversized-row review finding.

Both existing reset protections remain in force through shared scanner
helpers: raw reset markers, including control-separated keys, and the
reverse token recognizer. Protected or invalid-UTF-8 readable rows still
count for identity collisions, but cannot grant replacement authority.
Digests reject mismatches cheaply; matching digests still require exact
byte comparison and rechecking the captured content digest. LF
termination is excluded from replay equality. Callers retain
responsibility for file provenance and publication-lock validation.

Small and oversized legacy array-coerced system rows retain collision
identities but cannot qualify as replacement candidates. User and
assistant role coercion remains supported; the small-row classification
agrees with the streamed projection.

Token scanning, captured size, and follow-up range reads now share the
same open file handle. A path replacement cannot mix the new inode’s
token evidence with the old inode’s bytes or size. The borrowed-handle
helper retains the caller’s ownership and captured range; existing stamp
and publication-lock checks remain required for in-place writes.

Integrated validation on coder#4191
`87badaf62f925e118c2292cf3e788fc92894dafc` and coder#4209
`d83e1cb55f50676562e675398f76e0b5118053ab` above main
`0d31680932fe5b2cb33ce33ec43cb576c86ee0e6`: six affected suites passed
on each integrated tree: A 549 tests / 3,337 assertions and B 602 tests
/ 3,649 assertions; full TypeScript and canonical static checks passed
on both. The rebased A/B trees exactly match those validated trees.

Risk: classification or reset-probe drift could admit ambiguous history.
Native-reader comparisons and existing provider privacy suites exercise
those contracts. This layer remains inactive until coder#4182 is integrated
and reviewed; it introduces no new persisted state or scan budget for
lifetime history proofs.

This stack integrates main `0d31680932fe5b2cb33ce33ec43cb576c86ee0e6`,
including coder#4225’s workspace-fork recovery fix. Each layer retains its
previously reviewed diff and all addressed review fixes.

This is one layer of the cancellation phase: coder#4214coder#4215coder#4219coder#4221coder#4182coder#4187coder#4191coder#4209. All eight PRs merge together
after every member has current-head approval and passing CI.

---

_Generated with `xum` • Model: `unavailable` • Thinking: `unavailable` •
Cost: `$unavailable`_

<!-- mux-attribution: model=unavailable thinking=unavailable
costs=unavailable -->
yermakoffivan pushed a commit to yermakoffivan/mux that referenced this pull request Sep 12, 2026
…oder#4182)

Retained Stop needs durable proof that a replacement was accepted before
canceled recovery can be released. This layer adds guarded append,
batch, and Resume publication, with receipts captured at the history
commit point and witnesses verified across active history and archives.
Runtime activation follows in coder#4191/coder#4209.

Acceptance rechecks the captured cancellation nonce, journal generation,
physical lock, and logical ownership. Visible bytes are distinguished
from durable receipts, including file and directory flush failures.
Preserve-mode publication grants no replacement authority. Request-entry
capture and explicit malformed/unsupported-record repair share the
existing history lock so repair cannot adopt an intervening Stop. A
committed context reset can report its exact predecessor and successor
generation through an in-memory receipt; advancing the generation or
exposing bytes alone grants no queue-refresh authority. Stop retirement
similarly reports the exact predecessor and cleared successor only after
verified deletion under that same lock, retaining the receipt obligation
through failed-unlink retries.

Resume preserves the original row, signatures, and metadata. It accepts
the exact typed target or its exact wire projection. Retrying an already
stamped Resume can reuse byte-identical archive replay copies for its
captured nonce; duplicate active rows or changes to identity, sequence,
nonce, formatting, provenance, or generation still refuse authority.
Ordinary unstamped Resume retains its existing checks. A consumed nonce
cannot accept another replacement before retirement; the exact stamped
Resume replay is the only reuse exception. Publication metadata is
written back only to the original snapshotted message references, so
caller array changes cannot interrupt the durable receipt.

Witness traversal uses coder#4221's bounded row adapter. Protected and
invalid-UTF-8 rows still occupy identities; fingerprints can only
conservatively reject collisions, while replay authority requires exact
byte ranges. Ordinary append sequence allocation still has its existing
large archive-tail read; this PR does not claim the entire append path
has bounded memory.

A throwing retirement observer is logged after the state receipt and
cannot skip directory durability or recreate deletion debt. Superseding
a local retirement aborts that attempt’s provisional history scan and
exact replay comparison through their existing cancellation signal;
scanner handles are disposed before the queued Stop publishes. Current
verification errors still propagate. Legacy array-coerced system rows
cannot be stamped or used as replacement witnesses, while readable user
and assistant compatibility remains unchanged.

Under-lock witness verification now returns superseded only when its
original attempt lost ownership; current verification errors still
propagate. Every eligible occurrence of a nonce must prove the same
exact receipt, so conflicting eligible identities anywhere in active or
archived history refuse retirement. Ineligible legacy system stamps
cannot consume replacement authority, while still occupying their ID and
sequence for collision checks.

Separately deserialized legacy user/assistant roles retain an accepted
Resume receipt through a later history update. Comparison uses the
existing role coercion; changed roles cannot inherit the receipt, and
system/invalid rows remain ineligible witnesses.

Validation includes real-file crash replay, foreign-writer/CAS races,
malformed-record recovery, and deterministic file/directory durability
failures. Integrated validation on coder#4191
`87badaf62f925e118c2292cf3e788fc92894dafc` and coder#4209
`d83e1cb55f50676562e675398f76e0b5118053ab` above main
`0d31680932fe5b2cb33ce33ec43cb576c86ee0e6`: six affected suites passed
on each integrated tree: A 549 tests / 3,337 assertions and B 602 tests
/ 3,649 assertions; full TypeScript and canonical static checks passed
on both. The rebased A/B trees exactly match those validated trees.

Risk: conservative refusal can delay recovery when ownership or history
evidence is ambiguous; flush latency affects publication. Tests retain
exact history-byte and foreign-writer assertions.

This stack integrates main `0d31680932fe5b2cb33ce33ec43cb576c86ee0e6`,
including coder#4225’s workspace-fork recovery fix. Each layer retains its
previously reviewed diff and all addressed review fixes.

This is one layer of the cancellation phase: coder#4214coder#4215coder#4219coder#4221coder#4182coder#4187coder#4191coder#4209. All eight PRs merge together
after every member has current-head approval and passing CI.

---

_Generated with `xum` • Model: `unavailable` • Thinking: `unavailable` •
Cost: `$unavailable`_

<!-- mux-attribution: model=unavailable thinking=unavailable
costs=unavailable -->
yermakoffivan pushed a commit to yermakoffivan/mux that referenced this pull request Sep 12, 2026
…#4187)

Centralizes prepared history publication so manual triggers and their
prefixes use one publication boundary. Origin remains independent of
visibility and billing, and later runtime layers consume durable
receipts and rollback facts instead of interpreting a successful send as
acceptance.

This preparation layer exposes coder#4182's guarded publication without
activating cancellation policy; that activation belongs to coder#4191/coder#4209
in the same phase. Both Result errors and unexpectedly rejected
publication promises reach the existing rollback checkpoints. Only the
publication service promise is normalized: acceptance receipts and
subsequent callback failures retain their distinct semantics.

Real HistoryService tests inject both failure forms after each prepared
prefix and assert rollback preserves concurrent foreign history. A
CI-only goal fixture now waits for publication entry and settles its
held promise before teardown; observing an atomic rename no longer
substitutes for write completion. Production goal behavior is unchanged.
Integrated validation on coder#4191
`87badaf62f925e118c2292cf3e788fc92894dafc` and coder#4209
`d83e1cb55f50676562e675398f76e0b5118053ab` above main
`0d31680932fe5b2cb33ce33ec43cb576c86ee0e6`: six affected suites passed
on each integrated tree: A 549 tests / 3,337 assertions and B 602 tests
/ 3,649 assertions; full TypeScript and canonical static checks passed
on both. The rebased A/B trees exactly match those validated trees.

Risk: publication callbacks govern queue and budget accounting. The
real-disk assertions protect against lost or duplicated input and
incorrect refunds.

This stack integrates main `0d31680932fe5b2cb33ce33ec43cb576c86ee0e6`,
including coder#4225’s workspace-fork recovery fix. Each layer retains its
previously reviewed diff and all addressed review fixes.

This is one layer of the cancellation phase: coder#4214coder#4215coder#4219coder#4221coder#4182coder#4187coder#4191coder#4209. All eight PRs merge together
after every member has current-head approval and passing CI.

---

_Generated with `xum` • Model: `unavailable` • Thinking: `unavailable` •
Cost: `$unavailable`_

<!-- mux-attribution: model=unavailable thinking=unavailable
costs=unavailable -->
yermakoffivan pushed a commit to yermakoffivan/mux that referenced this pull request Sep 12, 2026
After ordinary Stop settles, fresh automatic monitor or family input can
start a new turn without reopening the canceled continuation. This layer
restores that behavior above coder#4191's V1 deferral using V2 settlement
proof, building on its shared automatic-publication fence.

V2 authority waits for the captured producer/startup work and exact
outer cleanup, including monitor retirement, retries, descendants, and
queued-input handling. A failed physical Stop returns promptly while
supervised completion can observe that same producer finishing
naturally. Supersession and disposal release only the owned wait; failed
cleanup grants no V2 proof. Successful exact settlement wakes deferred
monitor output once. Failed physical Stop also runs the remaining outer
cleanup through its existing supervisor; unresolved monitor retirement
does not hold workspace shutdown.

Automatic sends retain their original persisted Stop frontier through
service preflight and every queued addition. A payload admitted before
another backend's Stop cannot adopt the new settled V2 on dequeue; fresh
post-Stop input remains eligible. Existing scoped-V1 ordinary
preserve-mode admission remains supported. Separate queued inputs remain
eligible after their own accepted replacement resets history or retires
Stop; only the exact committed transition advances their captures, and a
later foreign Stop still blocks them. Both mid-stream compaction
continuation paths retain the originating stream capture. Superseded
retirement refuses automatic acceptance/startup while preserving the
already committed input and budget accounting.

Fresh reset summaries retain captured generation/provenance for
immediate or restarted follow-up recovery. Legacy unmarked or stale
evidence grants no permission, and only the actual accepted follow-up
row can retire replacement cancellation. A transient recovery-frontier
read failure preserves pending work for retry. Automatic batches
preserve rollback accounting; durable trigger publication makes
acceptance irrevocable before fallible observers.

The legacy token-pressure guard prevents automatic compaction from
bypassing scoped-V1 cleanup debt while preserving manual replacement.
The inherited automatic-reset guard keeps canceled summaries reachable
for recovery. Already-qualified settled V2 input retains its
automatic-replacement exception, including token-budget rollover;
unsupported scoped V2 records still refuse admission and remain
byte-for-byte intact.

Automatic replacement now requires settlement/version evidence from the
original admission capture. A request captured during V1 cleanup cannot
gain authority when the same nonce/generation later reaches V2.
Mixed-version queued batches refuse in either order; fresh V2 input and
ordinary scoped-V1 preserve behavior remain supported. Owned transitions
replace or clear the in-memory version evidence.

Review fixes keep original version evidence through active/queued
capture advancement, refuse heartbeat reset admission during V1 cleanup,
and revalidate version before narrowing a persisted Stop. The separate
absent-Stop heartbeat race remains guarded by the existing
journal-generation CAS.

Validation includes real two-backend stale/fresh automatic sends, held
startup/cleanup, cross-instance restart, failed I/O, exact notification
ownership, and rejected-batch rollback with foreign history preserved.
Integrated validation on coder#4191
`df5972870696ef9b78c2854f8a4b9ddf3fd15769` and coder#4209
`86e3487151fde2273d8e7595504f3b87a2ea9d62`: 14 affected suites passed on
each tree (A 1,271 tests / 6,521 assertions; B 1,352 tests / 7,006
assertions), with full TypeScript, canonical static, and final
changed-file lint/format checks. Four deterministic peer Stop/Clear
cases fail on the original A head and pass with the fence;
unchanged-frontier controls pass. B production is unchanged.

Risk: incorrect settlement ownership can resume stopped work or strand
legitimate wakes. The phase keeps failure, supersession, durability, and
receipt checks separate.

This stack integrates main `0d31680932fe5b2cb33ce33ec43cb576c86ee0e6`,
including coder#4225’s workspace-fork recovery fix. All prior review fixes
remain; the shared automatic-publication fence belongs to coder#4191.

This is one layer of the cancellation phase: coder#4214coder#4215coder#4219coder#4221coder#4182coder#4187coder#4191coder#4209. All eight PRs merge together
after every member has current-head approval and passing CI.

---

_Generated with `xum` • Model: `unavailable` • Thinking: `unavailable` •
Cost: `$unavailable`_

<!-- mux-attribution: model=unavailable thinking=unavailable
costs=unavailable -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant