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

Skip to content

🤖 fix: admit fresh automatic input after settled Stop - #4209

Merged
ThomasK33 merged 4 commits into
codex/effect-prepared-history-publicationfrom
codex/effect-compaction-settled-stop
Sep 12, 2026
Merged

🤖 fix: admit fresh automatic input after settled Stop#4209
ThomasK33 merged 4 commits into
codex/effect-prepared-history-publicationfrom
codex/effect-compaction-settled-stop

Conversation

@ThomasK33

@ThomasK33 ThomasK33 commented Sep 11, 2026

Copy link
Copy Markdown
Member

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 #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 #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: 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 #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 11, 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:12:30.744350Z 86e3487 Manual request
🔒 Security Review Completed 2026-09-12T13:16:22.138587Z 86e3487 Manual request

Security findings

Advisory findings (3)

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

Copy link
Copy Markdown
Member Author

@codex review

Please review current head 8aab3bd7b3265715fa3cd1b716b3b58d52742f65. The phase has been reconciled with the actual merged pending-state base, all known findings have published fixes or a tracked phase-layer split and replies, and the split passed independent review. The new V1 intermediate tree passed 257 tests and canonical static checks. The final top exactly preserves the complete implementation with its prior static/backend/IPC/UI evidence, plus main’s documentation-only update; see the PR bodies for the precise validation scope.


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: 8aab3bd7b3

ℹ️ 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/agentSession.ts
@ThomasK33
ThomasK33 force-pushed the codex/effect-compaction-settled-stop branch from 8aab3bd to 463d635 Compare September 11, 2026 11:51
@ThomasK33

Copy link
Copy Markdown
Member Author

Addressed all three findings in 463d63508d6b63de803e3c0b672bbf48e7f930f7:

  • Foreign Stop admission: retain the original persisted nonce/generation through preparation and enforce it under the history publication lock. Ordinary automatic prefixes stage with their trigger and use 🤖 feat: record durable history acceptance for compaction replacement #4182’s preserve-cancellation mode. Regressions hold the request after the second early read and immediately before publication, from both absent and scoped V1 frontiers; a later fresh request still succeeds.
  • Pre-turn persistence accounting: actual V2 acceptance marks durable pre-turn rows before a fallible acceptance observer. Ordinary automatic appends retain rollback ownership; if rollback fails, surviving rows are marked durable before refund-capable callbacks. Canceled-before-CAS requests still invoke existing cancellation cleanup.
  • Stale V2 generation: the admission getter reports mismatched settled generations as blocked, so real monitor reconciliation defers owed attention instead of repeatedly scheduling an impossible idle wake.

Validation: 923 tests across eight suites, 240 budget tests covering the final test-seam adjustment, and canonical static on final tree 15fdba9fe60dd4053f334770c1071d60335f8ebd. Independent review approved the final publication, rollback and callback boundaries. The separate oversized-history scanner finding on #4182 remains open and blocks the phase merge.


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

@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

Please review current head 463d63508d6b63de803e3c0b672bbf48e7f930f7. The latest review fixes are published in their owning layers, with replies and qualified validation in the PR descriptions. Both integrated runtime candidates passed canonical static checks. The whole cancellation phase will remain unmerged until every prerequisite and member is ready.


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: 463d63508d

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

@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 Security Review · Automatically triggered

Here are some automated security review suggestions for this pull request.

Reviewed commit: 463d63508d

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

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

Copy link
Copy Markdown
Member Author

The failed unit job on463d635 exposed14 obsolete test-seam cases after automatic publication moved to guarded batch acceptance. The fixtures now inject failure/cancellation at the real HistoryService acceptance boundary. Per-prefix failure/cancellation states no longer exist in this layer, so two batch cases replace seven old parameter cases while checking durable receipt, own-row rollback and foreign-row preservation. Five affected suites62/432 and canonical static pass; the composed lower-plus-top suite145/870 passes. Runtime Stop-cleanup review findings remain open and are being addressed separately.


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

@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review


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: 2f0a66a0f1

ℹ️ 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
@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: 2f0a66a0f1

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

Copy link
Copy Markdown
Member Author

Responses to all current findings:

  • 3988920128: session Stop now supplies an idempotent exact-owner finalizer to the workspace path. V2 waits for physical/policy completion and the actual outer cleanup. Held monitor-retirement/descendant tests verify V1 remains, and a foreign newer Stop survives unchanged. Failed physical completion and retryable retirement preserve eventual fresh-wake behavior; initial cleanup errors retain truthful physical completion for exact retry.
  • 3989137828: unresolved foreign V1 with no summary now blocks automatic admission. Intended scoped-V1 ordinary preserve-mode behavior remains unchanged, as the review explicitly permits.
  • 3988933696 (security policy): fresh monitor wakes after completed Stop are an existing product contract, not a newly introduced permission. Main already tests that Stop retires owed attention without disarming future wakes. This phase preserves that approved behavior; requiring a manual Resume or terminating every monitor would change it. The actionable early-settlement race is corrected above, and the original captured frontier remains enforced at real trigger publication. We are not relying on an untrusted-output label as the cancellation ownership check.

Fresh reset heartbeat recovery also retains durable generation provenance through restart and optional-sidecar failure, while the real follow-up input remains the replacement witness. The combined candidate passed 1,077 tests / 4,472 assertions, followed by 39 focused cases / 169 assertions for the final cleanup-handler/test-typing delta. Canonical static checks passed on the final composed tree, and independent source/delta reviews are clean.


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

@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review


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: 9c3904c24c

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: 9c3904c24c

ℹ️ 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
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Chef's kiss.

Reviewed commit: e5c62c16be

ℹ️ 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: e5c62c16be

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-settled-stop branch from e5c62c1 to 0d4df99 Compare September 12, 2026 10:31
@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

Please review current head 0d4df990ea5946ff0c5740eedc775a6beb4b071b. This inherits #4191’s automatic-reset fix and adds a control proving that fresh automatic input can still replace fully settled V2 Stop during token-budget rollover.

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. Keep them coming!

Reviewed commit: 0d4df990ea

ℹ️ 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: 0d4df990ea

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-settled-stop branch from 0d4df99 to d83e1cb Compare September 12, 2026 12:37
@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

Please review head d83e1cb55f50676562e675398f76e0b5118053ab 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 Review: Didn't find any major issues. Keep them coming!

Reviewed commit: d83e1cb55f

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

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
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-settled-stop branch from d83e1cb to 86e3487 Compare September 12, 2026 13:07
@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

Please review head 86e3487151fde2273d8e7595504f3b87a2ea9d62. Rebased onto the corrected owning layer #4191. This PR’s production tree is byte-for-byte unchanged from its previously reviewed head; only the six peer-frontier regression cases are added.

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. What shall we delve into next?

Reviewed commit: 86e3487151

ℹ️ 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: 86e3487151

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
Base automatically changed from codex/effect-compaction-cancellation-runtime to codex/effect-prepared-history-publication September 12, 2026 14:12
Merged via the queue into main with commit 023701d Sep 12, 2026
35 of 38 checks passed
@ThomasK33
ThomasK33 deleted the codex/effect-compaction-settled-stop branch September 12, 2026 14:15
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
…coder#4191)

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; coder#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
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: 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 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