Skip to content

fix: recover orchestration mail after interrupted chats - #32108

Closed
brennanb2025 wants to merge 17 commits into
mainfrom
brennanb2025/fix-stuck-codex-review
Closed

brennanb2025 wants to merge 17 commits into
mainfrom
brennanb2025/fix-stuck-codex-review

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 25 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1849 $\color{#cf222e}{\Huge{\mathbf{−}}}$​1498 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​351
Prod 55 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​2397 $\color{#cf222e}{\Huge{\mathbf{−}}}$​448 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1949

A review chat stopped after a connection drop while holding an unacknowledged orchestration batch. Later reports were saved but could not wake it: the previous batch blocked delivery, and an accepted notice no longer identified the turn responsible for it.

Fresh mail now wakes chats independently of earlier unacknowledged batches. Eligible messages share one ordinary chat input, while each keeps its own immutable authorization and recovery allowance. An unread notice can receive one automatic recovery only when the exact original receiving turn or terminal process supplies the required failure evidence. Stop and consuming reads invalidate that old permission; independent fresh mail can still progress. Existing FIFO delivery IDs, replay and exact acknowledgements remain intact.

The implementation reconciles the original receipt before replay, validates the actual local or attached mailbox authority, and rechecks the terminal recipient before writing and Enter. Held mail keeps its reservation and recovery budget, then redrives in original eligible order on the real release edge. Skipped Enter is never reported as accepted. Accepted lifecycle changes permanently retire old terminal proof. Legacy mail with missing ownership remains explicitly readable and is never guessed into a fresh automatic send. Helper settlement also clears only the former recipient's handoff when existing ownership transfers unread mail back to its Run; the recovery allowance is preserved.

Only two private message columns are added; no new wire operation, journal/history field or minimum paired-server version is introduced. The common pattern settles the actual ordinary input. Intended differences preserve external FIFO consumers, independently versioned hosts and exact terminal-process evidence. Pointer content and timing work remains tracked in #28567.

Validation on reviewed head 6b9ce8b650fda17d6ed3989fcb740d2a9c04de4f:

  • Three functional review rounds complete; final independent whole-mechanism and performance conclusions carry through the narrowly checked integration/type/test fixes. Canonical production churn is 2228 (1787 additions, 441 deletions) against merged main 09873c1442914d8d78c7ca03e8a2b6090e502eee, within the binding 2300 ceiling; existing .spec paths remain production.
  • Exact-head PR Checks 40211745671 passed, including static/type/declaration gates and all unit shards. Routing, old inbox shape, conservative migration and recipient-transfer reopen regressions are covered.
  • Conflict-blocking main merge 367904836c0 preserves upstream composer/dialog holds, Cursor Enter submission and relocated sources alongside the reviewed receipt/authorization/authority contracts. All 13 conflicts and narrow automatic overlaps checked; 104 targeted test executions (103 distinct cases in 11 named files) and the required direct merge hook passed. Main integration carries accepted QA; no broken run-row flow was established. Follow-up 6b9ce8b650f completes only the incoming dialog test fixture’s numeric pane identity; its 12-case named suite and normal pre-commit hook passed, with runtime source unchanged.
  • Integrated production host → scripted ACP → RPC check/replay/ack/completion exercises five members with two prompts, zero cancellations and recovery use [1,0,0,0,0]. N/10N contracts count underlying SQLite work and journal operations. These establish stated population-dependent bounds, not constant cost or a latency benchmark.
  • Real Claude and Codex native lifecycle evidence at 6342786b7cde9f4ec917b7e2f9999c5922bf40d3 carries: previous-build state upgrade/restart, actual HTTP200 SSE cuts and recovery, Stop with independent fresh mail, two real replies after restart, held release, rewind/fork, compiled CLI receipts and attachment integration (3/3). Later main integration, equivalent/type-only corrections and non-shipped changes do not stale those flows. The helper-recipient transfer is a CLI/orchestration tests-row change with actual DB/RPC reopen coverage.

Terminal coverage is deliberately precise: positive exact-target abandonment, retained restart proof and permanent retirement have contract-test coverage only; a positive real history remains unexercised. Current CLI idle-start or unavailable-proof cases stay conservative and explicitly readable. This is not a real positive pass or a claim of impossibility. The owner has supplied a written technical acceptance disposition without changing shipped behavior or the proof contract.

Targeted real Claude/Codex terminal lifecycle acceptance is complete after an independent raw-receipt audit. Each original notice was captured before check as unread/offered with target:null and recovery use0. The same original identity, delivery time and budget survived exact installed CLI exit and graceful same-state app restart. Each real agent then used the compiled CLI for original check, same-Delivery/member replay, exact acknowledgement, empty result and a content reply; each independently handled one later automatic fresh notice through the same protocol and a real reply. No external consuming check was used.

Limits are retained: Codex's installed TUI exited while its backend daemon survived until separate cleanup, so this is not daemon-death proof. Claude tool receipts have no numeric exit field; its fresh ack/empty calls were submitted together, so invocation order is not guaranteed. The real restart screenshots retain their onboarding/session-search overlays, corroborated by read-only state; the resumed Claude PID was not separately recorded. Codex's initial sandbox EPERM and subsequent ordinary approval are retained. Neither target was retrospectively reassigned after Enter.

The original port-only FAILED report is preserved with an appended factual correction: all configured ports were9500/9501 inside the assigned9500–9519 range; stock hook listeners request port0, permitted by the existing OS-assigned-listener rule. This was neither a waiver nor a rerun. The audit confirms all42 recorded process identities, keepers and four driver sessions stopped, four graceful app stops, configured/recorded hook ports free and seven protected hashes unchanged. Ticket2202 is released and the lead terminal is closed.

@brennanb2025
brennanb2025 marked this pull request as ready for review October 22, 2026 22:03
@coderabbitai

coderabbitai Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
Walkthrough

The change adds terminal and structured mail handoff tracking. It records terminal targets and structured-session evidence, adds persisted handoff and recovery state to orchestration messages, and updates selection, delivery, and recovery paths to validate that state. The database schema advances to version 44. Tests cover handoff selection, provider failures, restarts, recovery limits, and message acknowledgement.

Priority: Normal

Merge Risk: Low · up to 505b7

The change makes mail recovery after interrupted chats work. A few small edge-case problems remain: a possible uncaught error during teardown, a lost reservation hint when deliveries overlap, and a few recovery-target and test robustness details. None of these is likely to cause serious failure, but the owners should address or accept them before merging.

Pre-merge checks: Passed 3 · Failed 2

Failed Failed checks: 2 warnings

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 12.99% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 77 functions across 64 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check Warning The description explains the change and includes extensive validation details, but it does not follow the required template. It omits the required section headings, leaves Fixes # empty, and does no… Rewrite the description using the repository template. Add an actual issue link after Fixes #, include N/A with a reason under Visual Proof if applicable, complete the Testing and Checklist sections, and address AI Disclosure, Review, A…
Passed Passed checks: 3 passed
Check name Status Explanation
Title check Passed The title clearly summarizes the main change: recovering orchestration mail after interrupted chats.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description explains the change and includes extensive validation details, but it does not follow the required template. It omits the required section headings, leaves Fixes # empty, and does not provide the required visual-proof, testing checklist, AI disclosure, review, boundary, notes, and checklist sections.

Resolution

Rewrite the description using the repository template. Add an actual issue link after Fixes #, include N/A with a reason under Visual Proof if applicable, complete the Testing and Checklist sections, and address AI Disclosure, Review, Agent skill upstream boundary, and Notes. Preserve the existing technical details under ELI5, What Changed, Why, and Testing.

Finishing Touches: 💡 2
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
⚔️ Resolve merge conflicts: 💡
  • Resolve merge conflict in branch brennanb2025/fix-stuck-codex-review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments: 1
src/main/runtime/orchestration/structured-mailbox-pointer-delivery.test.ts: 1

97-99: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Make the "no second send" assertion able to fail.

onJournalActivity starts deliver(), which awaits readSessionFacts, readHandoffEvidence, and selectStructuredMailHandoff before it reaches send. A single await Promise.resolve() returns before those awaits finish.

The first delivery loop can also still be in flight at this point. In that case, changedDuringFlight defers the redelivery to a microtask after finally. The check expect(send).toHaveBeenCalledTimes(1) therefore passes even if a second send occurs. Wait for the delivery to settle before the assertion.

♻️ Proposed fix
   delivery.onJournalActivity('session')
-  await Promise.resolve()
+  await new Promise((resolve) => setTimeout(resolve, 0))
+  await new Promise((resolve) => setTimeout(resolve, 0))
   expect(send).toHaveBeenCalledTimes(1)

ℹ️ Review info
⚙️ Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: c6b77453-4339-46e6-82bd-5244caa52103
📥 Commits

Reviewing files that changed from the base of the PR and between aecb992 and 9c6168d.

📒 Files selected for processing: 55
  • src/main/agent-hooks/agent-hook-runtime-deps.ts
  • src/main/agent-hooks/server-agent-presence.test.ts
  • src/main/agent-hooks/server/retained-provider-session-row.ts
  • src/main/agent-hooks/server/server-cleanup.ts
  • src/main/agent-hooks/server/terminal-mail-target.ts
  • src/main/native-chat/agent-session-journal/journal-dispatch-reducer.ts
  • src/main/native-chat/agent-session-journal/journal-reducer.ts
  • src/main/native-chat/agent-session-journal/journal-rewind-submission-retirement.ts
  • src/main/native-chat/agent-session-journal/journal-store.ts
  • src/main/native-chat/agent-session-journal/journal-submission-fold.ts
  • src/main/native-chat/agent-session-journal/journal-submission-handoff.test.ts
  • src/main/native-chat/agent-session-journal/journal-submission-handoff.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-host.ts
  • src/main/native-chat/agent-session-wire/structured-mail-handoff-evidence.ts
  • src/main/runtime/construction/runtime-construction-dependencies.ts
  • src/main/runtime/construction/runtime-construction.ts
  • src/main/runtime/construction/runtime-service-state.ts
  • src/main/runtime/orchestration/agent-facing-parity.test.ts
  • src/main/runtime/orchestration/db/attach-orchestration-db-methods.ts
  • src/main/runtime/orchestration/db/contract-constants.ts
  • src/main/runtime/orchestration/db/messages/mail-handoff-store.ts
  • src/main/runtime/orchestration/db/messages/mailbox-pointer-enter-state.ts
  • src/main/runtime/orchestration/db/messages/message-inbox.ts
  • src/main/runtime/orchestration/db/messages/role-mailbox-delivery.ts
  • src/main/runtime/orchestration/db/orchestration-db-methods.ts
  • src/main/runtime/orchestration/db/schema/create-core-tables-sql.ts
  • src/main/runtime/orchestration/db/schema/migrate-v44.ts
  • src/main/runtime/orchestration/db/schema/migrate.ts
  • src/main/runtime/orchestration/legacy-mail-handoff.test.ts
  • src/main/runtime/orchestration/legacy-mail-handoff.ts
  • src/main/runtime/orchestration/mail-handoff.ts
  • src/main/runtime/orchestration/mailbox-pointer-delivery-contract.ts
  • src/main/runtime/orchestration/mailbox-pointer-delivery.ts
  • src/main/runtime/orchestration/mailbox-pointer-eligibility.ts
  • src/main/runtime/orchestration/mailbox-pointer-resume.ts
  • src/main/runtime/orchestration/mailbox-pointer-stage.ts
  • src/main/runtime/orchestration/mailbox-pointer-submit.test.ts
  • src/main/runtime/orchestration/mailbox-pointer-submit.ts
  • src/main/runtime/orchestration/mailbox-settlement.test.ts
  • src/main/runtime/orchestration/mailbox-settlement.ts
  • src/main/runtime/orchestration/orchestration-schema-version-skew.ts
  • src/main/runtime/orchestration/structured-mailbox-pointer-delivery.test.ts
  • src/main/runtime/orchestration/structured-mailbox-pointer-delivery.ts
  • src/main/runtime/orchestration/structured-mailbox-pointer-host.test.ts
  • src/main/runtime/orchestration/structured-mailbox-pointer-host.ts
  • src/main/runtime/orchestration/structured-pointer-operation-id.test.ts
  • src/main/runtime/orchestration/structured-pointer-operation-id.ts
  • src/main/runtime/orchestration/terminal-mail-settlement.ts
  • src/main/runtime/orchestration/terminal-pane-mail-routing.ts
  • src/main/runtime/orchestration/types.ts
  • src/main/runtime/rpc/methods/orchestration/messaging/mailbox-message-receipt.ts
  • src/main/runtime/structured-chat-coordinator-mail-rig.test-fixture.ts
  • src/main/runtime/structured-chat-coordinator-mail.test.ts
  • src/main/runtime/structured-chat-dispatch-worker-mail.test.ts
  • src/main/runtime/structured-chat-mail-recovery.test.ts
💤 Files with no reviewable changes: 1
  • src/main/runtime/orchestration/structured-pointer-operation-id.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2


ℹ️ Review info
⚙️ Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a1ad62f8-7746-4f43-89c8-53b5948a6431
📥 Commits

Reviewing files that changed from the base of the PR and between 9c6168d and e3d767a.

📒 Files selected for processing: 38
  • src/main/acp/acp-structured-steer.test.ts
  • src/main/agent-hooks/server-agent-presence.test.ts
  • src/main/agent-hooks/server/server-cleanup.ts
  • src/main/agent-hooks/server/server-row-ownership.ts
  • src/main/agent-hooks/server/terminal-mail-target.ts
  • src/main/native-chat/agent-session-journal/journal-dispatch-reducer.ts
  • src/main/native-chat/agent-session-journal/journal-item-fold.ts
  • src/main/native-chat/agent-session-journal/journal-reducer.ts
  • src/main/native-chat/agent-session-journal/journal-rewind-submission-retirement.ts
  • src/main/native-chat/agent-session-journal/journal-store.ts
  • src/main/native-chat/agent-session-journal/journal-submission-fold.ts
  • src/main/native-chat/agent-session-journal/journal-submission-handoff.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-current-work.test.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-current-work.ts
  • src/main/native-chat/agent-session-wire/structured-mail-handoff-evidence.ts
  • src/main/runtime/orchestration/agent-facing-parity.test.ts
  • src/main/runtime/orchestration/db/messages/mail-handoff-store.ts
  • src/main/runtime/orchestration/db/messages/mailbox-pointer-enter-state.ts
  • src/main/runtime/orchestration/legacy-mail-handoff.test.ts
  • src/main/runtime/orchestration/legacy-mail-handoff.ts
  • src/main/runtime/orchestration/mail-handoff.ts
  • src/main/runtime/orchestration/mailbox-owner.test.ts
  • src/main/runtime/orchestration/mailbox-pointer-delivery.ts
  • src/main/runtime/orchestration/mailbox-pointer-release-query.test.ts
  • src/main/runtime/orchestration/mailbox-pointer-resume.ts
  • src/main/runtime/orchestration/mailbox-pointer-stage.test.ts
  • src/main/runtime/orchestration/mailbox-pointer-stage.ts
  • src/main/runtime/orchestration/mailbox-pointer-submit.test.ts
  • src/main/runtime/orchestration/mailbox-pointer-submit.ts
  • src/main/runtime/orchestration/mailbox-settlement.test.ts
  • src/main/runtime/orchestration/mailbox-settlement.ts
  • src/main/runtime/orchestration/structured-mailbox-pointer-delivery.test.ts
  • src/main/runtime/orchestration/structured-mailbox-pointer-delivery.ts
  • src/main/runtime/orchestration/structured-mailbox-pointer-host.test.ts
  • src/main/runtime/orchestration/structured-mailbox-pointer-host.ts
  • src/main/runtime/orchestration/structured-mailbox-pointer-receipt.ts
  • src/main/runtime/orchestration/terminal-mail-settlement.ts
  • src/main/runtime/structured-chat-coordinator-observation-clock.test-fixture.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments: 1
src/main/runtime/orchestration/legacy-mail-handoff.test.ts: 1

231-261: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Make the VM-step measurement skip when python3 is unavailable.

The test calls execFileSync('python3', ...) without a fallback. On a machine where python3 is not on PATH, execFileSync throws and the test fails. The cause is a missing tool, not a migration defect. This can happen on a Windows developer machine, where python3 is often absent or a Store stub.

Probe for the interpreter once. Skip the step-count assertions when the probe fails. Keep the migration-state assertions in a separate case so they still run.

The ast-grep warning about child_process is a false positive here. The call passes an argument array, and path, migrationSql and UNKNOWN_MAIL_HANDOFF are not shell-interpolated.

Source: Linters/SAST tools


ℹ️ Review info
⚙️ Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 87621856-010f-4e25-9268-714a8bfdebd1
📥 Commits

Reviewing files that changed from the base of the PR and between e3d767a and 1cbdded.

📒 Files selected for processing: 12
  • src/main/native-chat/agent-session-journal/journal-store.ts
  • src/main/native-chat/agent-session-journal/journal-submission-handoff.test.ts
  • src/main/native-chat/agent-session-journal/journal-submission-handoff.ts
  • src/main/runtime/orchestration/db/messages/mail-handoff-store.ts
  • src/main/runtime/orchestration/db/schema/migrate-v44.ts
  • src/main/runtime/orchestration/legacy-mail-handoff.test.ts
  • src/main/runtime/orchestration/mailbox-owner.test.ts
  • src/main/runtime/orchestration/mailbox-pointer-delivery.ts
  • src/main/runtime/orchestration/structured-mailbox-pointer-receipt.ts
  • src/main/runtime/orchestration/terminal-mail-settlement.ts
  • src/main/runtime/rpc/methods/orchestration/messaging/check.test.ts
  • src/main/runtime/rpc/methods/orchestration/messaging/message-methods.ts
💤 Files with no reviewable changes: 1
  • src/main/native-chat/agent-session-journal/journal-submission-handoff.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments: 1
src/main/runtime/orchestration/structured-mailbox-pointer-delivery.test.ts: 1

97-99: 📐 Maintainability & Code Quality | Trivial | ⚡ Quick win

The no-redelivery assertion cannot fail.

await Promise.resolve() waits for one microtask only. deliver awaits readSessionFacts, reconcileLegacyMailHandoff, and selectStructuredMailHandoff before it reaches send. A wrongful redelivery therefore cannot call send before the toHaveBeenCalledTimes(1) assertion runs, so the test passes even if a redelivery happens. Use the setImmediate flush that the other tests in this file use.

Proposed fix
   delivery.onJournalActivity('session')
-  await Promise.resolve()
+  await new Promise<void>((resolve) => setImmediate(resolve))
   expect(send).toHaveBeenCalledTimes(1)

Review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 62dbf678-6bbb-47c1-9c98-d35efa80ea91
Commits

Reviewing files that changed from the base of the PR and between 3545d0c and 505b722.

Files selected for processing: 17
  • src/main/acp/acp-structured-steer.test.ts
  • src/main/agent-hooks/agent-hook-runtime-deps.ts
  • src/main/agent-hooks/server/server-cleanup.ts
  • src/main/agent-hooks/server/server-row-ownership.ts
  • src/main/native-chat/agent-session-journal/journal-reducer.ts
  • src/main/native-chat/agent-session-journal/journal-store.ts
  • src/main/native-chat/agent-session-journal/journal-submission-fold.ts
  • src/main/runtime/construction/runtime-construction-dependencies.ts
  • src/main/runtime/construction/runtime-construction.ts
  • src/main/runtime/construction/runtime-service-state.ts
  • src/main/runtime/orchestration/db/messages/message-inbox.ts
  • src/main/runtime/orchestration/mailbox-pointer-stage.test.ts
  • src/main/runtime/orchestration/mailbox-settlement.test.ts
  • src/main/runtime/orchestration/structured-mailbox-pointer-delivery.test.ts
  • src/main/runtime/orchestration/structured-mailbox-pointer-delivery.ts
  • src/main/runtime/orchestration/terminal-pane-mail-routing.ts
  • src/main/runtime/rpc/methods/orchestration/messaging/message-methods.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.

@brennanb2025

brennanb2025 commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor Author

A connection drop left the review chat holding an unacknowledged mailbox batch. Later reports were saved but could not wake it. This change lets independent fresh mail progress and ties recovery to the actual receiving input, instead of letting an old delivery block the mailbox.

Eligible messages share one normal input while retaining separate immutable authorizations and recovery budgets. Original receipts are reconciled before replay. Stop or a consuming read invalidates only the affected old obligation. Held mail retains its reservation/budget and releases in eligible FIFO order. Actual routed authority and terminal recipients are revalidated; skipped Enter is not accepted, and accepted lifecycle changes permanently retire old terminal proof. Legacy missing ownership remains explicitly readable. Existing helper ownership transfer retires the former recipient's transport without resetting recovery.

Review: three completed functional rounds, with all proven P0/P1 findings fixed and the final independent reference/performance conclusions carried across checked integration/type/test corrections. No new functional round was counted for CI execution turns. Production churn is 2228 (1787 additions, 441 deletions), tests/fixtures 3952, config 12 against merged main 09873c1442914d8d78c7ca03e8a2b6090e502eee; the binding ceiling remains 2300; .spec classification is unchanged. Pointer content/timing remains tracked in #28567. No neighbor timing change ships here.

Verified: exact-head PR Checks 40211745671 passes. The conflict-blocking main integration passed the required direct merge hook and 104 targeted test executions (103 distinct cases in 11 named files). Actual host/scripted ACP/RPC integration exercises five-message check/replay/exact ack/completion (two prompts, zero cancellations, recovery [1,0,0,0,0]). N/10N tests count underlying work, including excluded candidates; scaling is population/trigger dependent, not constant-cost. Migration, old output shape, attachment authority, fresh survivors, receiver/Enter fences, unique UNKNOWN and helper-recipient reopen/rollback contracts remain covered.

Real native QA uses Claude and Codex, with saved state made by the previous build: upgrade/restart, actual HTTP200 SSE cuts, Stop/fresh mail, two real replies, held release, rewind/fork and real CLI FIFO receipts. Attachment integration passed 3/3. Native evidence head remains 6342786b7cde9f4ec917b7e2f9999c5922bf40d3; reviewed head is 6b9ce8b650fda17d6ed3989fcb740d2a9c04de4f. The later changes and their evidence are listed below.

Terminal limit: positive exact offered-target abandonment, retained-proof restart and permanent retirement are CONTRACT TEST ONLY; REAL POSITIVE HISTORY UNEXERCISED. Current conservative UNKNOWN/explicit-read histories do not prove that positive branch or a universal impossibility. The written owner technical disposition changes only the original separate real-demonstration acceptance requirement, without changing any shipped proof, behavior or budget. No Brennan waiver is claimed.

Accepted targeted terminal lifecycle: Targeted real Claude/Codex terminal lifecycle acceptance is complete after an independent raw-receipt audit. Each original notice was captured before check as unread/offered with target:null and recovery use0. The same original identity, delivery time and budget survived exact installed CLI exit and graceful same-state app restart. Each real agent then used the compiled CLI for original check, same-Delivery/member replay, exact acknowledgement, empty result and a content reply; each independently handled one later automatic fresh notice through the same protocol and a real reply. No external consuming check was used.

Limits are retained: Codex's installed TUI exited while its backend daemon survived until separate cleanup, so this is not daemon-death proof. Claude tool receipts have no numeric exit field; its fresh ack/empty calls were submitted together, so invocation order is not guaranteed. The real restart screenshots retain their onboarding/session-search overlays, corroborated by read-only state; the resumed Claude PID was not separately recorded. Codex's initial sandbox EPERM and subsequent ordinary approval are retained. Neither target was retrospectively reassigned after Enter.

The original port-only FAILED report is preserved with an appended factual correction: all configured ports were9500/9501 inside the assigned9500–9519 range; stock hook listeners request port0, permitted by the existing OS-assigned-listener rule. This was neither a waiver nor a rerun. The audit confirms all42 recorded process identities, keepers and four driver sessions stopped, four graceful app stops, configured/recorded hook ports free and seven protected hashes unchanged. Ticket2202 is released and the lead terminal is closed.

Deferred / limits: the ACP test teardown journal_closed observation was bounded to a fixture path that bypasses production lifecycle drain; no production defect was established. Counts do not prove Windows/WSL/SSH runtime latency, heap or disk/lock behavior. Earlier controlled HTTP400 exhaustion is not double literal-SSE-cut coverage; the never-admitted clear race and positive terminal history are not real-run passes.

Final dispositions of the five automated review threads (recorded here before resolution; no source changes):

Thread topic Disposition and source basis
Missing legacy pending handover scope (PRRT_kwDORpCz1s6vZmfb) Intentional conservative behavior. journal-dispatch-reducer.ts:52 records the actual handover scope or unknown. journal-submission-fold.ts:19,51,71 separates original admission provenance from execution ownership and derived display scope; journal-submission-handoff.ts:68–97 requires original handover or genuine opener evidence. An unavailable legacy handover must not inherit unrelated admission authority.
Synchronous resolver throw on queued redrive (PRRT_kwDORpCz1s6vZmf0) Deferred concern. structured-mailbox-pointer-delivery.ts:87,95,300 can expose a synchronous injected resolver throw before its async catch. The runtime DB/session lookup trace did not establish the claimed production DB-close → queued-callback failure. No reproduced production crash or new P0/P1 is claimed.
Retired-target property ordering (PRRT_kwDORpCz1s6vzhm1) P2 deferred. The builders at terminal-mail-target.ts:40,68 order properties differently, so a decoded target can miss the JSON-key guard at154. Retirement at106–111 also deletes abandoned proof and marks rows examined;170–175 refuses missing/examined evidence. Normal observeExit constructs the original-order target. No user-visible revival of retired proof was established; canonical keys are not claimed implemented.
Current terminal target becomes null (PRRT_kwDORpCz1s6vzhm5) Intentional conservative behavior. terminal-mail-settlement.ts:126–158 records current recipient evidence before Enter. Keeping a stale non-null target when the current receiver is unavailable would invent attribution. Immutable original recovery source remains separate; null-target mail stays explicitly readable.
Coalesced reserved-type snapshot (PRRT_kwDORpCz1s6v1uIB) Deferred concern. The coalescing branch at structured-mailbox-pointer-delivery.ts:91–94 does not merge a later transient snapshot. Selection143–144 freshly reads live waiters, and mailbox-settlement.ts:94–103 excludes their types. The notification caller resolves matching waiters instead of pushing. No concrete wrong-delivery history was established; no permanent union or additional guard was introduced.

Later commits and evidence carry:

Commit after native QA head Flow and evidence carry
8c96b57f086 Main integration including adapter error-class move; narrow overlap review and exact-head CI, no proven broken run-row flow.
b5516cc992c Explicit seven-method DB type boundary plus equivalent local/branch structure; eight SQL templates, full checked decoder, UNKNOWN and receivers preserved. Two named suites/11 tests passed; exact-head type-aware gate now passes.
fa658a3fd03 Compiler/fixture/reliability metadata corrections and equivalent main cleanup boundaries; nine named suites/88 tests passed. Discriminated outcome narrowing, original submission capture and numeric pane projection preserve values.
0c4d6064816 Existing main raw-read type boundaries and source-equivalent local associations; normal hook passed; prior 88 tests carry.
b29676d8d28 CLI/orchestration tests-row helper recipient transfer clears former handoff only. Existing DB/RPC reopen/rollback/late-old-recipient contracts and affected helper/dispatch/runtime tests cover it; fresh notification+stale-leaf suites 44/44 passed. Native lifecycle runs retain original evidence.
bf6838983dd Named fixture instance/constructor type boundary only; runtime imports, entire factory body and consumer expression byte-identical. Earlier tests carry; fresh exact-head compiler/declaration/full CI passed.
367904836c0 Conflict-blocking merge of main 09873c14429: retained upstream composer/dialog holds, Cursor Enter submission and moved source paths alongside the existing per-member, original-receipt, actual-authority and recipient fences. All 13 conflicts and narrow automatic overlaps checked; 104 targeted executions/103 distinct cases in 11 named files passed. Required direct merge hook passed. Main integration carries accepted native/terminal evidence; no broken run-row flow was established.
6b9ce8b650f Test-only completion of the incoming dialog fixture with its numeric pane runtime identity; all existing deferral/release/Enter assertions and production source unchanged. The 12-case named suite and normal pre-commit hook passed. Earlier run evidence carries.

For Brennan's review

Three source locations where judgment matters:

Existing QA screenshots — original outcomes and qualifications retained (30)

codex / upgrade-baseline — BASELINE_NO_WAKE

Codex baseline: old delivery left unacknowledged; later mail did not wake after transport restoration. Controlled HTTP400 history, not literal SSE cut.

codex / upgrade-native-reply-fifo — PASS_WITH_RETAINED_SETUP_CORRECTION

Codex same-home branch: real original FIFO replay/exact ack then newer batch; queue empty. One ordinary protocol correction retained in report.

codex / native-stop — PASS

Codex renderedStop leaves Interrupted; passive suppression and later fresh sends recorded in stage evidence.

codex / actual-sse-cut-recovery — PASS

Codex automatic recovery real reply/check/replay/ack without successor mail. Actual200 SSE-cut proof is in stream logs; screenshot also retains HTTP400 retry history.

codex / bounded-recovery-exhaustion — PASS_HTTP400_ONLY

Codex second controlled HTTP400 failure exhausted automatic budget; explicit read/ack recorded. Not double literal-SSE-cut coverage.

codex / graceful-restart-two-person-replies — PASS

Codex same saved state after graceful restart: two distinct ordinary prompts and two real replies.

codex / graceful-restart-fresh-mail — PASS

Codex restart: independent ordinary mail auto notice followed by real replay/exact ack/empty reply.

codex / manual-terminal-fifo — PASS

Codex manually started real terminal: original then newer delivery replay/exact ack and empty queue. Claude parallel next replay/ack qualification retained.

claude / upgrade-baseline — BASELINE_NO_WAKE

Claude baseline: old delivery left unacknowledged; later mail did not wake after transport restoration. Controlled HTTP400 history, not literal SSE cut.

claude / upgrade-native-reply-fifo — PASS_WITH_RETAINED_SETUP_CORRECTION

Claude same-home branch: real original FIFO replay/exact ack then newer batch; queue empty. One ordinary protocol correction retained in report.

claude / native-stop — PASS

Claude rendered Stop leaves Interrupted; passive suppression and later fresh sends recorded in stage evidence.

claude / actual-sse-cut-recovery — PASS

Claude automatic recovery real reply/check/replay/ack without successor mail. Actual200 SSE-cut proof is in stream logs; screenshot also retains HTTP400 retry history.

claude / bounded-recovery-exhaustion — PASS_HTTP400_ONLY

Claude second controlled HTTP400 failure exhausted automatic budget; explicit read/ack recorded. Not double literal-SSE-cut coverage.

claude / graceful-restart-two-person-replies — PASS

Claude same saved state after graceful restart: two distinct ordinary prompts and two real replies.

claude / graceful-restart-fresh-mail — PASS

Claude restart: independent ordinary mail auto notice followed by real replay/exact ack/empty reply.

claude / manual-terminal-fifo — PASS

Claude manually started real terminal: original then newer delivery replay/exact ack and empty queue. Claude parallel next replay/ack qualification retained.

claude / native-held-prompt — PASS

Actual rendered AskUserQuestion pending; two ordinary reports held never admitted; runtime facts accompany image.

claude / native-held-release — PASS_WITH_SAME_ROOT_QUALIFICATION

Rendered answer releases ordered A/B automatically; real same-root check/replay/exact ack/result. Group remint qualification retained.

codex / native-held-prompt — PASS

Actual normal shell approval pending; two ordinary reports held without provider admission.

codex / native-held-release — PASS

Rendered Allow releases ordered A/B automatically with real check/replay/exact ack and completed reply.

claude / rendered-rewind-confirm — PASS

Actual Rewind to here confirmation; no file-retention scenario was exercised.

claude / rendered-rewind-edited-reply — PASS

Real edited reply after rendered rewind; host/journal facts establish removal and provider fork.

codex / rendered-continue-with-terminal-fork — PASS

Actual Continue with Terminal Agent path produces real fork reply. This is not native Resume.

claude / native-clear — PASS

Rendered clear followed by real CLEAR-CLAUDE-OK. Codex clear has journal evidence but no representative final screenshot.

claude / prompt-cancel-clear-unacked-preservation — PASS_ADMITTED_UNACKED_ONLY

Actual prompt cancellation/clear preserves already-admitted unacked A/B for replay/exact ack. Not never-admitted clear-race proof.

codex / manual-terminal-stop — PASS

Actual terminal Escape interruption with CLI alive; passive no retry documented.

codex / manual-terminal-fresh-after-stop — PASS

Fresh person real reply and independent mail replay/exact ack after terminal interruption.

claude / manual-terminal-fresh — PASS_FRESH_ONLY_STOP_UNKNOWN

Real fresh person/mail reply and exact ack. Earlier harness-refused wait is visible; safe in-turn Claude terminal Stop remains UNKNOWN.

claude / supported-terminal-exact-proof-checkpoint — NOT_PASSED_MISSING_OFFERED_TARGET

FAILED checkpoint: actual owned working root and unread mail, corrected route but no offered exact root target. Visible earlier EXACT-PROOF-RESULT text refers only to ordinary mail and does not establish exact proof.

claude / terminal-normal-mail-after-root-completed — PASS_ORDINARY_ONLY

Original root completes; ordinary notice auto delivers then real check/replay/exact ack. No controlled exact-process exit, saved-proof restart or retirement established.

Accepted conservative terminal lifecycle screenshots (14) — positive exact-target history remains unexercised

Claude: restored shell after exact recorded CLI process exit; original mail retained unread.

Claude: same-state restored shell after dismissing onboarding overlay, before CLI relaunch.

Claude: same saved-state app restart, with ordinary onboarding overlay still visible.

Claude: explicit original Cedar comet read, same Delivery replay, exact acknowledgement and empty check.

Claude: independent Maple lantern mail handled automatically with actual content reply.

Claude: ordinary idle terminal before original scratch mail; corroborated by saved root observations.

Claude: actual automatic notice before mailbox check; original mail unread, offered target null.

Codex: restored shell after exact recorded CLI TUI exit; managed daemon death is not claimed.

Codex: same saved-state app restart with actual session-search overlay; shell corroborated by read-only output.

Codex: explicit original Birch orbit read, same Delivery replay, exact acknowledgement and empty check.

Codex: independent Willow prism mail handled automatically with actual content reply.

Codex: genuine completed idle root before original scratch mail.

Codex: actual automatic notice acknowledged without check; original mail unread, offered target null.

Codex: actual GPT-6.1-Sol High status and context settings in isolated manual terminal.

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Closing: superseded. The original problem (an unacknowledged batch blocking every later report from waking the chat) is fixed on main by #33639. Native-chat report delivery is moving to the ordinary chat message path in #28567, where a delivered report is the chat's message like any other, so the per-report handoff tracking and recovery allowance here are no longer needed. Turns that die on a temporary provider failure will be handled by automatic retry in a separate PR.

The branch is kept for now because #28567 currently targets it; it will be retargeted to main before the branch is deleted.

@brennanb2025
brennanb2025 deleted the brennanb2025/fix-stuck-codex-review branch October 31, 2026 04:34
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