Bug: JSON output drops command_execution aggregated_output when only deltas are streamed
What Version Of Codex Is Running?
codex-cli 0.92.0
What Subscription Do You Have?
Pro
Which Model Were You Using?
GPT 5.2-Codex
What Platform Is Your Computer?
Mac Mini M4 - Darwin 25.3.0 arm64 arm
What Terminal Emulator And Version Are You Using (If Applicable)?
Apple_Terminal 466 (TERM_PROGRAM=Apple_Terminal), shell: /bin/zsh, TERM=xterm-256color
What Issue Are You Seeing?
In --json mode, command output can be dropped in the final JSONL command_execution item when output is emitted only via ExecCommandOutputDelta events and ExecCommandEnd.aggregated_output is empty. Downstream JSON consumers see an empty aggregated_output even though output deltas were streamed.
What Steps Can Reproduce The Bug?
- Run Codex CLI with
--jsonso JSONL events are emitted. - Trigger a command execution where output arrives as
ExecCommandOutputDeltaevents butExecCommandEnd.aggregated_outputis empty (this happens in some backends that only stream deltas). - Observe the final
command_executionitem:aggregated_outputis empty despite earlier delta output.
Example generator:
Not available (requires a backend that emits ExecCommandOutputDelta events but leaves ExecCommandEnd.aggregated_output empty).
What Is The Expected Behavior?
The final JSONL command_execution item should include the concatenated delta output as a fallback when ExecCommandEnd.aggregated_output is empty, so JSON output preserves command output.
Additional Information
- Impacted component:
codex-rs/execJSON output event processor. - Proposed fix: buffer stdout/stderr delta bytes separately (cap at 1 MiB per stream) and aggregate with the same stderr-biased cap as core when
ExecCommandEnd.aggregated_outputis empty. - Manual repro (CLI-level): use a backend that emits deltas but leaves
ExecCommandEnd.aggregated_outputempty; runcodex exec --json, execute any command with output, and compare finalaggregated_outputto streamed deltas.