Skip to content

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

Open
ThomasK33 wants to merge 1 commit into
codex/effect-prepared-history-publicationfrom
codex/effect-compaction-cancellation-runtime
Open

🤖 fix: activate durable compaction cancellation across turn admission#4191
ThomasK33 wants to merge 1 commit 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.

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. Manual replacement remains eligible to compact, and the existing scoped-V1 ordinary-input path remains 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.

Validation covers two-backend preflight races, queue/Send Now admission, downgrade publication boundaries, late compaction completion, directory flush failures, and real budget rejection. Final integrated validation passes on #4191 052fc084517c1a6fd8cfbecdf08c05b635358a32 (4026 tests / 36442 assertions) and #4209 02651d365f63c9dc04d95744207f42f8065d6f35 (4095 tests / 36847 assertions), across 54 affected suites each. Full source/test TypeScript and make static-check pass on both exact commits.

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

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-11T19:36:44.810350Z 052fc08 Manual request
🔒 Security Review Completed 2026-09-11T19:36:51.620940Z 052fc08 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
ThomasK33 added this pull request to stack #4222 September 11, 2026 14:24
@ThomasK33

Copy link
Copy Markdown
Member Author

Addressed both current findings:

  • 3989632086: edit/truncation publication fsyncs the directory after the complete rename/removal transaction and before its receipt, including the recovered-transaction and chat-deletion paths. Tests inject directory flush failure and verify no receipt.
  • 3989632100: reset heartbeats refuse outstanding scoped-summary cancellation debt. Tests cover live and restarted sessions, preserve the summary and cancellation, then prove reset succeeds after normal cleanup. Ordinary scoped-V1 automatic preserve-mode input remains supported.

The affected suites pass 90 tests / 490 assertions; canonical static and independent review pass.

Final phase integration on main ad8a01b: independent composition review and full canonical static checks pass on tree 3ed04896. Across 35 affected files, 2,549 tests / 28,590 assertions pass: 34 files passed before a test-only lifecycle repair, then all 28 pinned-budget tests passed after it. Two final-flush fixtures now complete their fake stream on Stop instead of waiting for later disposal; their original assertions and production behavior are unchanged.


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

@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

Please review the current head after the complete phase was composed on current main. All known findings have fixes and replies in their owning layers; the eight-member phase stays held until all members are approved and green.


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: 2391f02cb4

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: 2391f02cb4

ℹ️ 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/compactionCancellation.ts Outdated
Comment thread src/node/services/agentSession.ts Outdated
@ThomasK33
ThomasK33 force-pushed the codex/effect-compaction-cancellation-runtime branch from 2391f02 to 0582c26 Compare September 11, 2026 16:27
@ThomasK33

Copy link
Copy Markdown
Member Author

Addressed 3990222839: old-reader summary/partial neutralization now precedes Stop sidecar publication. Failed initial cleanup preserves the predecessor bytes or absence and exact local retry debt, rather than reporting a durable Stop. Live compaction requests retain their admission generation through AgentSession and pass it to completion publication. This prevents a late producer from recreating stopped recovery even after that Stop has been retired. Authored follow-up text, attachment data, and request metadata remain intact. Real storage crash-boundary controls and real-session late-completion controls distinguish this from merely checking whether a sidecar currently exists.

Addressed 3990222848: service send and Resume acquire the persisted frontier before pricing/settings awaits and carry it through preparation to the existing publication CAS. Repair and capture occur under the same history lock, retaining one-call explicit malformed/unsupported-state recovery. A newer foreign Stop cannot be adopted by an older request; explicit Send Now retains its exact initiating receipt. The two-backend pricing regressions failed on the previous implementation and pass with the carried frontier. Context-budget continuations retain that same originating capture. Legitimate queued input can cross an owned reset or Stop retirement only through its exact committed predecessor-to-successor receipt; this is not a later storage recapture, and foreign-Stop interleavings remain fenced.

Combined phase validation: 3,715 tests across 50 affected service suites passed (34,595 assertions). Full make static-check passed on the final publication tree. The only change after the behavioral run was one verified test-fixture formatting correction.


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

@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

Please review the updated head 0582c26778aa57e64f243dc8e45fd4a903f70114, including the addressed findings and the exact reset/retirement integration carried through this phase. Combined phase validation: 3,715 tests across 50 affected service suites passed (34,595 assertions). Full make static-check passed on the final publication tree. The only change after the behavioral run was one verified test-fixture formatting correction.


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: 0582c26778

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: 0582c26778

ℹ️ 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/compactionCancellation.ts Outdated
Comment thread src/node/services/agentSession.ts
@ThomasK33
ThomasK33 force-pushed the codex/effect-compaction-cancellation-runtime branch from 0582c26 to 5a63d1b Compare September 11, 2026 17:49
@ThomasK33

Copy link
Copy Markdown
Member Author

Addressed 3991360908: full Clear and destructive replacement execute the existing history deletion transaction under the cancellation lock before publishing the sidecar, after workspace monitor/workflow barriers. Tests cover malformed history, chat/archive/foreign partial removal at the publication boundary, failed barriers, uncertain deletion, observer failure, sidecar-only retry preserving a newer append, and deletion accounting after a later publication failure. No new persisted transaction format was added.

Addressed 3991360914: the captured admission travels through ordinary and prepared request startup and is rechecked before provider construction. Manual Send/Resume attachment-window tests and actual engine/provider tests reproduce foreign Stop refusal. If refusal follows construction, the captured provider is aborted before resource release; local cancellation and successor registrations retain their existing ownership. The A rollover CI fixture now holds the real guarded publication receipt, preserving both rollback outcomes. The foreign-Stop rollover cases now require zero provider calls while retaining any already accepted input and the exact newer Stop.

The cancellation layer passed 3,996 tests across 54 suites; the settled-Stop layer passed 4,064 across the same 54 suites. Its final test-only assertion adjustment also passed the complete affected 52-test suite. Both final runtime branches passed canonical static checks.


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

@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

Please review the updated head 5a63d1b27e346aff739c305b82e98c8b5cdb4c32 and its addressed findings. The cancellation layer passed 3,996 tests across 54 suites; the settled-Stop layer passed 4,064 across the same 54 suites. Its final test-only assertion adjustment also passed the complete affected 52-test suite. Both final runtime branches passed canonical static checks. The complete eight-member cancellation phase remains held until every member is approved and CI passes.


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: 5a63d1b27e

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: 5a63d1b27e

ℹ️ 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
@ThomasK33
ThomasK33 force-pushed the codex/effect-compaction-cancellation-runtime branch from 5a63d1b to 266cf35 Compare September 11, 2026 18:38
@ThomasK33

Copy link
Copy Markdown
Member Author

Addressed 3992045941: the legacy shouldCompactBeforeSend branch honors outstanding scoped cleanup debt for automatic input. A high-pressure automatic send cannot create another compaction request after cleanup fails. Manual replacement remains eligible to compact, and ordinary scoped input remains supported. Low-pressure scoped sends and high-pressure sends without Stop remain control cases.

The #4209 projection retains the existing exception for already-qualified settled V2 automatic replacement. A valid V2 record is unresolved; unsupported scoped V2 bytes remain preserved and refuse admission. No new persisted state or broader automatic-admission restriction was added.

Regression coverage includes failed-cleanup automatic input, manual replacement, no-Stop compaction, and the settled-V2 exception. Final integrated validation passes on #4191 266cf35aac (4,009 tests) and #4209 d8c34d12ce (4,078 tests), each across 54 affected suites. Full source/test TypeScript and make static-check pass on both exact commits.


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

@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

Please review the updated head 266cf35aac012aa43ebace24c70e14145e88dcd3 against its stack base. Outstanding scoped cleanup debt prevents automatic input from starting legacy token-pressure compaction. Manual replacement remains eligible to compact, and the existing scoped-V1 ordinary-input path remains supported.

Final integrated validation passes on #4191 266cf35aac (4,009 tests) and #4209 d8c34d12ce (4,078 tests), each across 54 affected suites. Full source/test TypeScript and make static-check pass on both exact commits. The eight-member cancellation phase remains held until 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: 266cf35aac

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: 266cf35aac

ℹ️ 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/streamManager.ts
---

_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 266cf35 to 052fc08 Compare September 11, 2026 19:25
@ThomasK33

Copy link
Copy Markdown
Member Author

Addressed 3992409150: the request’s original nonce/generation comparison and synchronous provider construction/registration now share the existing physical history lock. The capture is copied before awaiting entry; no later Stop is adopted. The final prepared caller supplies the fence. Supervision and cleanup ownership are installed before lock release can await, while provider playback, envelopes and cleanup stay outside the lock.

The original source fails the deterministic Stop-after-last-check regression by constructing the provider. The corrected source refuses it and releases resources. Additional real-history controls cover a competing Stop during construction, caller capture mutation, factory and post-registration fence failures, scope shutdown during the release window, and preserved mock playback. A/B four-suite runs pass 514 and 561 tests respectively; final focused controls pass 13 tests / 99 assertions on both layers, with full types, lint and formatting. Final focused runs include the added fence-failure control and fixture-only lint correction.

Final integrated validation passes on #4191 052fc084517c1a6fd8cfbecdf08c05b635358a32 (4026 tests / 36442 assertions) and #4209 02651d365f63c9dc04d95744207f42f8065d6f35 (4095 tests / 36847 assertions), across 54 affected suites each. Full source/test TypeScript and make static-check pass on both exact commits.


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

@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

Please review updated head 052fc084517c1a6fd8cfbecdf08c05b635358a32 against its stack base. 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.

Final integrated validation passes on #4191 052fc084517c1a6fd8cfbecdf08c05b635358a32 (4026 tests / 36442 assertions) and #4209 02651d365f63c9dc04d95744207f42f8065d6f35 (4095 tests / 36847 assertions), across 54 affected suites each. Full source/test TypeScript and make static-check pass on both exact commits.

All eight members remain held until current-head review approval and required CI are complete.


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: 052fc08451

ℹ️ 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 on lines +7346 to +7349
await this.compactionCancellation
.retireReplacement(witness, (predecessor, successor) => {
this.advanceOwnedCompactionAdmission(predecessor, successor, preparing);
})

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Preserve admission when a peer retires the same Stop

With XUM_ALLOW_MULTIPLE_INSTANCES, after backend A stamps a manual replacement row, backend B can discover that witness and unlink the same cancellation sidecar before A finishes this retirement. A's retireReplacement() then returns superseded without invoking onRetired, leaving attempt.admissionCapture at { nonce: N } while disk now reports { nonce: null }; the provider-start revalidation rejects the already-accepted manual turn, so the user's durable row is never sent. Treat a same-generation peer retirement as the expected successor and advance A's capture, while still rejecting a newer Stop.

AGENTS.md reference: AGENTS.md:L101-L106

Useful? React with 👍 / 👎.

@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: 052fc08451

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.

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