Repository navigation
Conversation
ymichael
force-pushed
the
bb/split-codex-runtime-correctness-fixes-into-pr-thr_zm5ci3rpua
branch
from
August 12, 2026 21:36
35f3092 to
b258007
Compare
Codex app-server can deliver a command's `item/completed` event before the matching `rawResponseItem/completed` record that carries the full stdout. The adapter repaired completed items only from output it had already captured, so the reordered case published the provider's truncated `aggregatedOutput` and the real output arrived too late to be used. Hold a completed command item whose shell call is still awaiting its raw output, repair it once the raw record lands, and emit it then. If the raw record never arrives, flush the held item at turn completion so output is delayed rather than lost. Unparseable raw output clears the pending shell call so the completed item is released unchanged. This changes what the host daemon sends the server, so it bumps HOST_DAEMON_PROTOCOL_VERSION to 109. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
A newly started Codex session can have its rollout file created before the first record is written to it. A generated-title rename that lands in that window fails with "rollout at <path> is empty", and the thread keeps its placeholder title even though a retry moments later would succeed. Retry only that exact transient error, and only for Codex, backing off 50ms then 200ms before a final attempt. Every other rename failure, and every other provider, still fails immediately. The backoff is only ever paid when the rename has already failed, and the full 250ms only when it fails for good. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
ymichael
force-pushed
the
bb/split-codex-runtime-correctness-fixes-into-pr-thr_zm5ci3rpua
branch
from
August 12, 2026 22:18
b258007 to
6a0c042
Compare
ymichael
deleted the
bb/split-codex-runtime-correctness-fixes-into-pr-thr_zm5ci3rpua
branch
August 12, 2026 22:29
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two Codex runtime reliability fixes, split out of #1385 so they can be reviewed on their own.
Bug 1: command output lost when Codex reorders events
Codex app-server normally reports a shell command as
function_call→function_call_output(the full stdout) →item/completed. Sometimes theitem/completedevent arrives before the raw record carrying the output.The adapter only repaired a completed item using output it had already captured. In the reordered case there was nothing captured yet, so it published the provider's truncated
aggregatedOutputand the real output — which arrived a moment later — was dropped. Users saw a finished command with missing or partial output.Fix: when a completed command item arrives while its shell call is still awaiting raw output, hold it instead of publishing it. Repair and emit it as soon as the raw record lands. If the raw record never arrives, flush the held item at turn completion, so output is at worst delayed rather than lost. Unparseable raw output clears the pending shell call so the completed item is released unchanged.
Bug 2: generated-title rename fails on a brand-new session
A new Codex rollout file can exist briefly before its first record is written. A generated-title rename landing in that window fails with
rollout at <path> is empty, and the thread keeps its placeholder title even though the same call would succeed moments later.Fix: retry only that exact transient error, and only for Codex, backing off 50 ms then 200 ms before a final attempt. Every other rename failure, and every other provider, still fails immediately.
The backoff is only ever paid when the rename has already failed — the happy path returns on the first attempt — and the full 250 ms only when it fails for good, where the alternative was failing instantly and leaving the thread on a placeholder title.
Protocol version
Bug 1 changes what the host daemon sends the server, so
HOST_DAEMON_PROTOCOL_VERSIONgoes 109 → 110 with its contract test and comment updated. Older daemons can publish a truncated completed item, so enrolled machines must update.Note for reviewers: #1408 bumped the constant to 109 and updated the assertion, but left the test name and comment describing 108. Rebasing onto it meant rewriting those exact lines, so this PR lands a correct 110 lineage and clears that stale wording as a side effect.
These are product reliability changes only — no database schema, migration, or Drizzle snapshot changes, and no other behavior from #1385.
Validation
turbo run typecheck --filter=@bb/agent-runtime --filter=@bb/host-daemon-contract— passturbo run typecheck --filter=@bb/host-daemon --filter=@bb/server(downstream protocol consumers) — passturbo run test --filter=@bb/host-daemon-contract— 49/49 pass3bd8e79a0and fully re-validatedturbo run test --filter=@bb/agent-runtime— 921 pass, 0 failuresThree regression tests were each verified to fail against current
mainand pass with the fix:A fourth test pins the exhaustion path: a rollout that stays empty makes exactly 3 attempts and then propagates the error, so the retry can neither loop nor swallow a genuine failure.
Previously-noted test failure is resolved upstream
Earlier revisions of this description flagged
runtime.process-lifecycle.test.ts > bounds provider stderr while data arrives without a newlineas failing locally on macOS. #1402 landed that fix onmain(the fixture usedprocess.exit(), which discards Node's async-buffered pipe output on macOS). After rebasing onto it, the full suite is green: 921/921 with zero failures.