Codex returns an unbounded huge stdout tool result
Codex returns an unbounded huge stdout tool result
What version of Codex CLI is running?
@openai/codex 0.140.0
What subscription do you have?
N/A. The reproduction uses a local OpenAI-compatible mock provider and a fake API key.
Which model were you using?
gpt-4 in the local mock-provider replay.
What platform is your computer?
Linux x86_64 in Docker (node:24-bookworm-based target image).
What terminal emulator and version are you using?
Non-interactive Docker/CI shell.
Codex doctor report
Not available in this minimal Docker reproduction.
What issue are you seeing?
Severity / performance impact: High. A single shell tool call can return more than 8 KiB of output to the provider loop, increasing memory, context, and retry pressure instead of being truncated or rejected.
What steps can reproduce the bug?
Prerequisites: Docker, Python 3, and the GitHub CLI (gh) for the clone command below. The linked reproducer is self-contained and uses only Python standard-library modules plus Docker. It builds the affected CLI version from the public package registry, starts a local mock provider, and runs the CLI in an isolated workspace. The Docker run is limited to 2 CPUs and 4 GiB RAM by default.
Complete self-contained reproducer: https://gist.github.com/N0zoM1z0/da205de7c577a57801a6acf2018b8b30
The Gist contains codex-huge-stdout-resource-bound.reproduce.py. Download and run:
gh gist clone da205de7c577a57801a6acf2018b8b30 codex-huge-stdout-resource-bound-reproducer
cd codex-huge-stdout-resource-bound-reproducer
python3 codex-huge-stdout-resource-bound.reproduce.py
To reuse an already-built local image:
python3 codex-huge-stdout-resource-bound.reproduce.py --skip-build
Expected successful reproduction output includes:
REPRODUCED
Observed evidence
The reproducer asks the CLI to run a command that prints 100000 bytes. The CLI sends a large tool result back to the local provider; the script checks for at least one tool result above 8 KiB.
What is the expected behavior?
Codex should cap, summarize, or reject oversized tool output before sending it back into the model/provider loop.
Additional information
Public-upstream status: This reproduces against stock public @openai/codex@0.140.0 built from npm.