Skip to content

fix(native-chat): save a Codex message's receipt from either of Codex's reports of it, not only the first - #30403

Merged
brennanb2025 merged 13 commits into
mainfrom
brennanb2025/send-lifecycle-codex-observations
Oct 19, 2026
Merged

brennanb2025 merged 13 commits into
mainfrom
brennanb2025/send-lifecycle-codex-observations

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

When Codex takes a message you sent, it repeats the message's id back to Orca, and Orca writes that down as proof the message arrived. Today Orca only tries to write it down once. If that one write fails, the proof is lost, even though Codex repeats the id a second time a moment later. This change lets Orca use either of Codex's repeats, so one failed write no longer loses the proof.

What Changed

The problem. Codex reports every message it records twice, back to back: once when it starts recording it and once when it finishes. Each report carries the message's id. Orca saves the first report as the message's receipt, the record that says "Codex got this". But Orca decided whether a receipt was still owed from an in-memory list of sends it was waiting on, and the first report removes the send from that list. So if the first save failed (a rare failed database write), the second report found nothing waiting and was ignored. The failure was only logged.

What a user saw in that case: the message never got its confirmation, and after a Stop, sending a message directly did not lift the pause on queued messages; they stayed held.

The user-facing change.

  • When Codex reports a message's id, Orca records the message as received even if the first save failed: Codex's second report retries it.
  • After a Stop, sending a message directly now lifts the paused queue in that case too, the same as it already does when the first save succeeds.
  • Nothing else changes: no new label, row or wording. Withdrawn, refused and failed messages stay that way even if a report of them arrives later.

The mechanism. Orca still releases the send from its in-memory list on each exact report of its id; that is what tells the chat Codex is no longer holding it. Both reports are now passed on, and the chat's saved history decides whether a receipt is still owed, at the moment the write reaches its turn in the chat's write queue: the receipt is written only if the message is still waiting for a delivery answer, so two reports save once. This decision lives in the shared late-receipt path used by every agent, so for Claude, Pi and ACP agents too, a repeated receipt for a message that is already settled no longer writes an extra (ignored) saved row or sends clients an identical update.

Changed files: codex-structured-session-journal.ts (pass on both reports), journal-submission-writer.ts and journal-store.ts (the one "accept if still owed" write), and structured-agent-session-late-dispatch.ts (route late receipts to it).

Why

Earlier revisions of this PR built much more: a saved "every receipt for this turn is complete" marker, a saved "which turn answered this message" row, a record of who ended each turn, a saved prompt-hook reason, and an in-memory retention list whose entries were re-saved with the turn's end and when Codex exited. All of that existed so Orca could one day conclude "not sent" from a missing receipt. The decision since then is that Orca never says "not sent" because a receipt is missing; a message counts as sent only on Codex's exact report of its id. With that ruling none of those pieces has a reader, so this PR removes all of them before they ship. No new saved field or wire change remains.

Two narrower designs were considered. Keeping a separate retry list for failed receipt saves was rejected: the common pattern keeps the receipt in one place and clears remaining doubt later from the agent's own history, which is needed anyway for a crash before any save. Checking "still owed" in the Codex adapter when the report arrives (an earlier revision of this rework) was also rejected: the check ran before the write reached the queue, so two reports arriving while the queue was busy could both write, and it needed extra plumbing and a test-only fallback. Deciding inside the queued write is smaller and has one source of truth.

Known gaps (unchanged from main). A receipt whose save fails on both reports, a crash before any save, and a report Orca could not read at all leave the message without a confirmation, exactly as today. They are cleared by the planned positive replay of Codex's history.

Differences from the common pattern:

  • The receipt is saved to the chat's history. Intended: several clients, phones and an Orca restart read the saved history; in-memory state reaches none of them.
  • A receipt whose saves all fail stays unconfirmed until a positive replay of Codex's history. Temporary: removed by the planned positive-replay change.
  • When Codex's history is replayed (at reopen on older servers, and at rewind), replayed messages are still confirmed by their text rather than by the id they carry, and two identical-text messages can confirm the wrong one. This is existing behavior for all agents, not changed here. Temporary: removed by the planned positive confirmation by exact id.
  • The in-memory "not sent" verdicts for interrupted or failed turns stay. Temporary: removed together with the planned "couldn't confirm whether this was sent" recovery action.

Linked Issue

Part of the native-chat send lifecycle work, after #29907 and #29922. Not a GitHub issue.

Visual Proof

Nothing new is drawn; these show the changed flows look the same on main and on this branch. Real Electron QA with the real Codex CLI in the chat view, on macOS (driven by an automated QA agent) and on Windows (send, steer, Stop then a direct send, quit and reopen). The main side is the commit this branch started from; the branch side is this PR's head. On both, every message got exactly one saved receipt and no duplicates. A failed first save can't be forced in the real app; the held-sends test covers it.

Flow main this branch
Send, completes main-f1.jpg pr-f1.jpg
/compact, then send main-f5.jpg pr-f5.jpg
Stop mid-turn, then send directly main-f3.jpg pr-f3.jpg

The queued-message flows couldn't be exercised: the message queue is switched off in this build, so a send during a reply steers it instead.

Testing

  • structured-agent-session-codex-held-sends.test.ts, through the shipped host, journal and Codex adapter with only the Codex process faked: one send, Codex reports it twice (started, then completed), and the first receipt save is made to fail. The send is still waiting after the first report and accepted after the second, in the host's saved record and in what clients receive. Fails on main.
  • structured-agent-session-late-settlement.test.ts: two identical receipts at once plus a different one for an accepted send add no saved row (main wrote three); a receipt that arrives after a send was withdrawn leaves it withdrawn.
  • Codex adapter tests that pinned "a report for an unsent, refused or settled send is not passed on" were updated: that rule now lives in the shared write, covered by the tests above.
  • I manually tested these changes (real Electron QA on Windows with the real Codex CLI, current main vs this branch; see Visual Proof)
  • Automated tests added/updated, or explained why not below

Notes

Ensure no issues in: Security, Cross-platoform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance

  • SSH and mixed versions: the change runs where the agent runs and writes the existing receipt row, so older clients read it as before. No wire change.
  • Mobile: reads the same saved receipt.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

Author: @BrennanKB5

…ed and which turn took it, with the turn's end

Codex's exact-ID echo of a message and its answer naming the turn that took a message are kept
until the journal holds them, saved at once and nonfatally, and any still unsaved go into the
turn end's transaction and every exit's settlement. Turn ends record who ended them, whether
receipt capture was complete, and a hook reason attributed to the turn.
@brennanb2025
brennanb2025 marked this pull request as ready for review October 18, 2026 19:34
@coderabbitai

coderabbitai Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: fbbdfb0a-f405-4192-9778-edec4a0c6003
📥 Commits

Reviewing files that changed from the base of the PR and between 91fd624 and eafd805.

📒 Files selected for processing: 10
  • src/main/acp/acp-structured-host-lifecycle.test.ts
  • src/main/codex/codex-structured-dispatch-admission.test.ts
  • src/main/codex/codex-structured-session-journal.ts
  • src/main/codex/codex-structured-turn-end-settlement.test.ts
  • src/main/codex/codex-structured-turn-steer.test.ts
  • src/main/native-chat/agent-session-journal/journal-store.ts
  • src/main/native-chat/agent-session-journal/journal-submission-writer.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-late-dispatch.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-late-settlement.test.ts
  • src/main/runtime/structured-agent-session-codex-held-sends.test.ts
💤 Files with no reviewable changes: 1
  • src/main/codex/codex-structured-turn-end-settlement.test.ts

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

📝 Walkthrough

Accepted late receipts now use a journal writer path that appends a dispatch row only when the submission satisfies journalDispatchRowApplies. The echo callback invokes late-settlement handling after every dispatch-settlement attempt. Tests cover receipt retries, cancellation, duplicate receipts, echo client IDs, and changes to prior late-echo assertions.

Priority: ➖ Normal

Merge Risk: ⚪ Minimal · up to eafd8

No outstanding issue identified here prevents merging after normal checks.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 39.22% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 51 functions across 64 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
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.
Title check Passed The title clearly summarizes the primary change: saving a Codex message receipt from either of two reports instead of only the first.
Description check Passed The description is detailed and covers the required explanation, changes, rationale, testing, visual proof, compatibility notes, and checklist. It does not provide an actual linked issue and omits the…
Full details: Description check

Explanation

The description is detailed and covers the required explanation, changes, rationale, testing, visual proof, compatibility notes, and checklist. It does not provide an actual linked issue and omits the Review and Agent skill upstream boundary sections, but the substantive description is mostly complete.

  • Fix all pre-merge checks with AI
✨ Finishing Touches: 💡 2
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
⚔️ Resolve merge conflicts: 💡
  • Resolve merge conflict in branch brennanb2025/send-lifecycle-codex-observations
  • 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: 1


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 420bac12-ed49-46be-9877-d17d3d5ac5ee
📥 Commits

Reviewing files that changed from the base of the PR and between 63f0cb9 and 5c166f0.

📒 Files selected for processing: 52
  • src/main/codex/codex-journal-command-turn.ts
  • src/main/codex/codex-structured-dispatch-observations.ts
  • src/main/codex/codex-structured-dispatch-test-support.ts
  • src/main/codex/codex-structured-journal-contracts.ts
  • src/main/codex/codex-structured-journal-settlement.ts
  • src/main/codex/codex-structured-journal-sink.ts
  • src/main/codex/codex-structured-journal-thread-item-routing.ts
  • src/main/codex/codex-structured-journal-translation-settlement.test.ts
  • src/main/codex/codex-structured-journal-translation-turn-boundaries.ts
  • src/main/codex/codex-structured-journal-translation-turn-lifecycle.test.ts
  • src/main/codex/codex-structured-journal-translation-turn-settles-once.test.ts
  • src/main/codex/codex-structured-journal-translation-turns.ts
  • src/main/codex/codex-structured-journal-translation.test.ts
  • src/main/codex/codex-structured-journal-translation.ts
  • src/main/codex/codex-structured-journal-turn-endings-replay.test.ts
  • src/main/codex/codex-structured-session-acquire.ts
  • src/main/codex/codex-structured-session-adapter.ts
  • src/main/codex/codex-structured-session-close.ts
  • src/main/codex/codex-structured-session-journal.ts
  • src/main/codex/codex-structured-session-state.ts
  • src/main/codex/codex-structured-turn-start.ts
  • src/main/native-chat/agent-session-journal/journal-lifecycle-batch-appender.ts
  • src/main/native-chat/agent-session-journal/journal-observed-sends.ts
  • src/main/native-chat/agent-session-journal/journal-reducer.ts
  • src/main/native-chat/agent-session-journal/journal-row-schema.ts
  • src/main/native-chat/agent-session-journal/journal-row-unusable-annotations.ts
  • src/main/native-chat/agent-session-journal/journal-stop-and-resume-rows.ts
  • src/main/native-chat/agent-session-journal/journal-store-contracts.ts
  • src/main/native-chat/agent-session-journal/journal-store.ts
  • src/main/native-chat/agent-session-timeline/agent-journal-turn-row-revision.ts
  • src/main/native-chat/agent-session-wire/agent-session-journal-batch.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-adapter.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-child-exit.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-command-turn.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-dead-generation-settlement.test.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-event-recovery.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-host-types.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-host.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-late-dispatch.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-leftover-settlement.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-queued-command-refusal.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-stale-turn-verdict.test.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-stale-turn-verdict.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-transition.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-unexpected-exit.test.ts
  • src/main/runtime/structured-agent-session-codex-held-sends.test.ts
  • src/main/runtime/structured-agent-session-codex-opening-send-hold.test.ts
  • src/main/runtime/structured-agent-session-dispatch-followups.ts
  • src/main/runtime/structured-agent-session-lifecycle-delivery.ts
  • src/main/runtime/structured-agent-session-runtime.ts
  • src/shared/agent-session-journal-item-key.ts
  • src/shared/agent-session-journal-types.ts

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

…im for the rest of that child

A per-turn record of lost receipts had to guess which turn a lost receipt belonged to, and an
older Codex can answer a send with one turn while recording it in another. Capture now keeps one
flag per child process: any loss (overflow, a receipt the journal can no longer take, a damaged
frame, a user item with no readable id, a cleared capture) means no later turn end of that child
claims every receipt was saved. Only a turn end that saves the held receipts with itself may
write the claim.
@brennanb2025

Copy link
Copy Markdown
Contributor Author

Review loop status: head ba3d44f (full path)

The problem. When Codex reports that it received a message (it echoes the message back with Orca's exact id), Orca saved that report in a separate write. If that write failed, the report was lost for good, so a message Codex actually ran could later look unconfirmed. Codex's answer naming which turn took a message wasn't saved at all, and a turn's end didn't record who ended it or whether every report for that turn had been captured.

What changes for users. Nothing visible yet. Orca now keeps those reports until they're saved, writes any leftovers in the same database transaction as the turn's end (or in the cleanup when the chat exits), and saves who ended each turn, the answered-turn marks, and a prompt hook's block reason. The later change that turns these facts into "sent", "not sent" or "couldn't confirm" reads them.

Fixed in review

  • If any report is lost (overflow, an echo Orca can't place, a damaged frame, a report the journal can no longer take), no later turn in that Codex process claims every report was captured. The earlier design tried to pin each loss on a turn and got it wrong twice: older Codex can name one turn in its answer and another in its echo. A missing claim reads as "couldn't confirm", never "not sent". The overflow test now covers that older-Codex case.
  • A prompt hook that stops a turn (not only one that blocks it) also drops the message in Codex, so its reason is now saved too.
  • Fallback save paths no longer write the completeness claim without checking it.
  • Type predicate and test fixes for CI. Four sidebar files that were reverted by accident are restored to main's versions.

Deferred / known gaps (listed in the PR body)

  • A report lost at exit during an ownership handover, a failed final exit save, or a hard crash stays "couldn't confirm", as on main.
  • Rewinding right after a report failed to save ends the completeness claim for the rest of that Codex process.
  • A late revision of an already-ended turn could republish a claim the save-time check removed (needs an echo naming a turn after it ended, which current Codex doesn't send).
  • Rebuilding turns from Codex's history, or rewinding, drops the new fields (temporary).

Verified

  • Full PR workflow green on ba3d44f (run 39169661745), no conflicts, no unresolved threads. Production +752/-87 lines.
  • Two review rounds plus an architecture review and a readiness pass. No open P0/P1.
  • A real Codex 0.162.1 transcript (send, steer, /compact, a turn after compaction, resume in a new process): every user message carries Orca's id, so counting an id-less user message as a lost report doesn't fire on routine use.
  • Real Electron QA on macOS with the real signed-in Codex CLI, base 63f0cb9 vs this head, same inputs: send, steer, Stop, /compact (idle and after Stop), a send during a running turn, and quitting mid-turn then resuming. Every rendered screen matched. Only this branch saved the new facts (provider and host turn ends, including one stamped at the mid-turn quit; completeness claims; answered-turn marks), and every send on both builds was accepted.

Not verified

  • Reopening a closed chat from the UI (the test setup had no way to reopen one on either build; quitting and reopening covers reloading from saved history).
  • A real queue-and-drain (no queue control appeared), a storage failure against the real app (covered by unit tests), a prompt hook actually blocking, and SSH.

Seen on both builds, not caused by this PR: a message sent during a running turn joins that turn and Codex's answer to the first request never appears; after Stop the chat keeps showing "Monitoring background tasks" until the next turn; the repo's default tab doesn't open; a promo covers the "Resume interrupted chats?" dialog.

For Brennan's review

Flow base this PR
Send and complete
Steer into a running turn
Stop → Interrupted
/compact after Stop
Send during a running turn
Quit mid-turn, reopen, Resume

Places where a human judgment matters:

  1. codex-structured-dispatch-observations.ts: one lost report ends the completeness claim for the rest of that Codex process. Safe (it only adds doubt), but coarse by design.
  2. codex-structured-journal-sink.ts: the completeness claim is a saved field with no reader in this PR. Whether a later change should instead derive it from Codex's own saved history is taken into that change's plan.
  3. codex-structured-journal-translation-turn-boundaries.ts: the turn end records who ended it (endedBy) and the hook reason (blockedInput) only when the hook names that turn.

…om any echo of it

Drop the completeness certificate, the answered-turn row, end provenance, the saved hook reason
and the retention map with its turn-end retry and exit carry; none has a reader any more.
A Codex echo now saves its send's receipt whenever the journal shows that send handed to this
child and still unsettled, so the second echo retries a failed first save.

@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


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b8f61dad-aa01-4b01-9844-1947d9d13f85
📥 Commits

Reviewing files that changed from the base of the PR and between ba3d44f and 91fd624.

📒 Files selected for processing: 4
  • src/main/codex/codex-structured-session-acquire.ts
  • src/main/codex/codex-structured-session-journal.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-transition.ts
  • src/main/runtime/structured-agent-session-codex-held-sends.test.ts

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

…al queue

Codex now reports either exact live echo of a send, and the journal writes the
acceptance only if the send is still unsettled when the write reaches its turn
in the queue. A second echo therefore retries a receipt whose first save
failed, and repeated receipts for any agent add no row or publication. This
replaces the adapter-side check that read the journal at echo time, with its
fence and handover conditions and the armed-entry fallback.

Adapter tests that pinned "an unarmed echo settles nothing" now leave that to
the journal, which ignores receipts for absent or settled sends.
…ho settling nothing

An exact echo read after the child's exit is now reported like any other; the
journal decides whether the send still owes a receipt.
…ecycle-codex-observations

# Conflicts:
#	src/main/acp/acp-structured-host-lifecycle.test.ts
#	src/main/native-chat/agent-session-wire/structured-agent-session-late-dispatch.ts
@brennanb2025 brennanb2025 changed the title fix(native-chat): save Codex's reports of which message it received and which turn took it, with the turn's end fix(native-chat): save a Codex message's receipt from either of Codex's reports of it, not only the first Oct 19, 2026
@brennanb2025

brennanb2025 commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor Author

Review loop status: finished on 88c07c0

The problem. When you send Codex a message, Codex reports the message's id back twice, once when it starts recording it and once when it finishes, and Orca saves the first report as proof the message arrived. Orca decided whether that proof was still owed from an in-memory list, and the first report removes the message from it. So if the first save failed (a rare failed database write), the second report was ignored and the proof was lost. The user then saw a message that never got its confirmation, and after a Stop a direct send didn't lift the pause on queued messages.

What changes for the user. One failed save no longer loses the proof: Codex's second report saves it. In that case a direct send after Stop now lifts the queue pause, as it already does when the first save works. Nothing else is different: no new label or wording, and withdrawn, refused or failed messages stay that way even if a report arrives later.

How. Both reports are passed on. The chat's saved history decides inside its own write queue whether the receipt is still owed, so two reports save once. The PR is now about +27/-7 production lines; it was +763 before this rework, and it adds no saved field or wire change.

What the loop did

  • Round 1 used two correctness reviewers, a trace of what users see, and an architecture review. They found no P0-P2 bug in the reworked design. The architecture review showed that the "still owed" check ran too early: in the Codex code at report time, before the write reached the queue. Two reports arriving while the queue was busy could both write, and it needed extra plumbing plus a fallback that only tests used. A three-model design panel ruled unanimously to move the check into the queued write. That's built.
  • Round 2 was a fresh review of the whole PR: no code bugs. The final check before merge found no P0/P1.
  • The automated review thread on codex-structured-session-journal.ts (two reports can both queue an accepted row while the write queue is busy) is the same issue. It's fixed by that design in c16ba30: the write rechecks inside the queue and appends nothing when the message is already settled. I resolved the thread.
  • Fixed along the way: a type error and a lint rule CI caught, and a merge of current main (main had reverted fix(native-chat): Claude, Pi and ACP chats are Working only while the agent holds the send #30134 in the same function).
  • Deferred, outside this PR: on main, after Stop, a direct send that stays unconfirmed (for example blocked by a prompt hook) hides the queue's paused header and Resume button while queued cards stay held. The lane owner is filing it. Also deferred: P3 test wording, and a yes/no return in the held-message code that only one test now reads. That file is deliberately untouched.

Verified

  • CI is green on 88c07c0 after merging current main: static analysis, all five test shards, and the aggregate gate.
  • Real Electron QA with the real Codex CLI, main vs this branch, same inputs:
    • Windows: send, steer, Stop then a direct send, quit and reopen.
    • macOS: send, /compact, Stop then a direct send.
  • No user-visible difference on either machine. Every message got exactly one saved receipt and no duplicates, and the macOS journals were row-for-row identical.

Not verified

  • A failed first save can't be forced in the real app; the held-sends test covers it.
  • The queued-message flows weren't run: the queue is switched off in this build, so a send during a reply steers.
  • SSH and phone clients weren't run. The change adds no wire field and writes the existing receipt row.
  • Baseline issues QA saw on main and on this branch alike, so not from this PR:
    • on the Windows test rig, Codex's hooks fail against the rig's hook server and short replies are hidden;
    • after Stop, the sidebar keeps saying "Monitoring background tasks";
    • /compact shows "Working" rather than "Compacting".

For Brennan's review

Flow main this branch
Send, completes main-f1.jpg pr-f1.jpg
/compact, then send main-f5.jpg pr-f5.jpg
Stop mid-turn, then send directly main-f3.jpg pr-f3.jpg

Three places where judgment matters:

  1. codex-structured-session-journal.ts:36-40: every exact live report is now passed on, including one read after Codex exits but before the chat closes. That one now confirms a message that was waiting or in doubt, which is a true receipt under the "sent only on Codex's exact report" ruling.
  2. journal-submission-writer.ts:73: the one new write. It decides "still owed" at its turn in the queue and writes nothing otherwise.
  3. structured-agent-session-late-dispatch.ts:57: this late-receipt path is shared by Claude, Pi and ACP agents. For them, a repeated receipt for an already settled message no longer writes an extra ignored row or sends clients an identical update. What users see is unchanged.

@brennanb2025
brennanb2025 merged commit 43abd59 into main Oct 19, 2026
37 checks passed
nwparker added a commit that referenced this pull request Oct 19, 2026
…(fix red main) (#30865)

* test(codex): the stopped-send receipt guarantee lives in the journal since #30403

#28046's dispatch-boundary tests pinned that the Codex adapter drops an echo
for a stopped or refused send. #30403 moved that rule to the journal's queued
late-accept write. Pin it there through the host's Stop path, and keep the
adapter tests asserting what still holds at the adapter: no fallback or second
turn/start write, and the earlier send's receipt survives an abandoned wait.

* test: pin that a receipt after Stop adds no dispatch row
brennanb2025 added a commit that referenced this pull request Oct 19, 2026
…ecycle-queue-derived-cards

Conflicts, resolved so main's change stands and queued messages stay in
the chat's journal, sent again only on proof the agent never got them:
- #28046 (choices fixed per accepted message): its options type and its
  one reader reach the journal's queue row and the card fold too; the
  queued_messages writers it retyped stay deleted.
- #30403 (Codex late receipt): the late settlement keeps both main's
  accept-at-its-turn path and this branch's unrun proof for a card.
- A drain logging test main deleted stays deleted.
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