Repository navigation
fix(codex): keep wrapped exec_command results in resumed history - #1395
Merged
Merged
Conversation
Codex never persists exec_command_end (codex-rs rollout policy: transient; 0 in 2,541 local rollouts), so dropping the wrapped function_call_output removed the only copy of every exec_command result and exit status. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…carrier per call (review a) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Owner
Author
|
Disposition for review a (head c053f52)
|
…er a persisted event (review b) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Owner
Author
|
Disposition for review b (head
|
Owner
Author
|
READY (W1). Head |
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.
Fixes #1321.
Plan:
docs/plans/2026-09-27-codex-exec-wrapped-output.md.Problem
mapCodexRolloutToFeedEntriesdrops everyfunction_call_outputwrapped asChunk ID … Process exited with code N … Output:. Its stated reason: the correlatedexec_command_endevent carries the same result.rollout/src/policy.rslistsEventMsg::ExecCommandEndas transient. rust-v0.107.0 through v0.136.0 did persist it in extended-history mode (an app-server option), which no local rollout uses.exec_command_endevents.exec_commandcard in resumed history (Codex through 0.144) showed no output and no exit status. This is thedf -hcase from Codex transcript silently drops a tool result or message that shares a millisecond with its sibling #1288.Change
Header-only parsing.
codexExecWrapperExitCodereads the exit code from the header only (before\nOutput:\n). It returns null for unwrapped output or a still-running chunk.Keep the result. A finished wrapped output becomes a tool result with:
is_errorfrom the real exit code;exec_command_endmetadata the event branch stamps.The command adapter therefore reads it as the native transport, which is exit-proven and owns its bytes, and an empty success is still absorbed by the row dispatcher.
Review a, round 1:
exec_command_running, and the command adapter no longer claims a proven exit for it. It showsunknown, not success. Its real exit comes later on awrite_stdinresult, which this card cannot correlate.createCodexTranscriptEntryMapper. A wrapper after its event (Codex's own emit order) wins the later-wins result index.Output:marker. AChunk ID:wrapper it cannot parse is markedexec_command_unparsed, kept whole, and shown asunknown, never success (review b).Comments corrected. The stale comments that claimed the wrapper came from, or was duplicated by,
exec_command_endare fixed.Tests
execWrappedOutput.test.tsuses the fixturetesting/fixtures/codex-exec-output/wrapped-exec-command-output.json: three real 0.132.0exec_commandpairs (exit 0 with output, exit 1, exit 0 empty).fromCodexCommandOperation, and assert output, exit code, failure status and the empty-success result.unknownthrough the adapter; both carriers give one result; a header withoutOutput:makes no exit claim. The exactcodexmetadata is now asserted too. Reverting any of the three fixes fails its test. Review b added: an unparsed (CRLF) wrapper showsunknown; with event then wrapper, the card gets the wrapper; with wrapper then event, the event is dropped.xcharacters, with newlines kept. Keys, call ids, timestamps and the wrapper header are verbatim. I checked every leaf string.Verification
npx tsc -bclean (Node 24).c053f52d:src/providers,src/renderer/src/renderingandfeatures/feedpass (158 files, 1,145 tests at63553e5c, includingshapes.coverage).scripts/audit-rendering-shapes.mtsfails to start withERR_MODULE_NOT_FOUND @renderer/renderingboth here and on main. That is an environment issue, not this change.🤖 Generated with Claude Code