CLI bug: Codex does not bound repeated identical tool calls

Open 💬 2 comments Opened Jun 12, 2026 by N0zoM1z0

What version of Codex CLI is running?

Codex CLI 0.137.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)

What terminal emulator and version are you using (if applicable)?

Non-interactive Docker/CI shell.

Codex doctor report

Not available in this minimal Docker reproduction.

What issue are you seeing?

A deterministic provider stream repeats an identical tool call. Codex executes the repeated call instead of bounding the loop.

What steps can reproduce the bug?

Standalone reproduction

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 upstream package/release source and starts a local mock provider; it does not require this repository or any private fuzzing harness. The Docker run is limited to 2 CPUs and 4 GiB RAM by default.

Complete self-contained reproducer: https://gist.github.com/N0zoM1z0/85ebb2185557a03e0d6486dc093f38cf

The Gist contains codex-repeated-identical-tool-call-loop.reproduce.py. Download and run:

gh gist clone 85ebb2185557a03e0d6486dc093f38cf codex-repeated-identical-tool-call-loop-reproducer
cd codex-repeated-identical-tool-call-loop-reproducer
python3 codex-repeated-identical-tool-call-loop.reproduce.py

To reuse an already-built local image:

python3 codex-repeated-identical-tool-call-loop.reproduce.py --skip-build

Key output from a local run against the affected version:

process_exit=-9
provider_requests=1287
tool_result_counts={'repeat_loop_followup': 826255, 'repeat_loop_initial': 1286}
late_stream_events_after_stop=0
side_effect_file_occurrences codex-repeated-identical-tool-call-loop.log 'codex-repeated-identical-tool-call-loop': observed=1314 expected>=2
REPRODUCED

What is the expected behavior?

Codex should reject or stop repeated identical tool calls rather than executing the same request multiple times.

Additional information

No.

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗