[BUG] Claude Code does not bound repeated identical tool calls

Open 💬 2 comments Opened Jun 12, 2026 by N0zoM1z0

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

A deterministic provider stream repeats the same tool call. Claude Code repeatedly returns tool-result state for the same call id and continues the identical-call loop instead of bounding or rejecting it. The standalone check verifies duplicate tool-result submissions for the same call id.

The reproduction uses a local deterministic provider, so no external model behavior or provider outage is required.

Severity / performance impact: High. The agent does not bound an identical-call loop, so one provider-side repetition can drive hundreds or thousands of requests/tool results until timeout or context exhaustion, wasting paid model/API credits and CPU while repeatedly applying the same tool work.

What Should Happen?

Claude Code should not repeatedly accept or return the same tool-call identity/signature in a loop without new user intent or distinct provider state.

Error Messages/Logs

Steps to Reproduce

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/c4787dc27ebccb754d565ad122736f29

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

gh gist clone c4787dc27ebccb754d565ad122736f29 claude-repeated-identical-tool-call-loop-reproducer
cd claude-repeated-identical-tool-call-loop-reproducer
python3 claude-repeated-identical-tool-call-loop.reproduce.py

To reuse an already-built local image:

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

Key output from a local run against the affected version:

process_exit=143
provider_requests=1284
tool_result_counts={'repeat_loop_followup': 1281, 'repeat_loop_initial': 1282}
late_stream_events_after_stop=0
duplicate_tool_result repeat_loop_initial: observed=1282 expected>=2
REPRODUCED

Claude Model

Other

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

Claude Code 2.1.168

Platform

Anthropic API

Operating System

Ubuntu/Debian Linux

Terminal/Shell

Non-interactive/CI environment

Additional Information

The scenario is intentionally minimal: it controls only the provider stream and local interruption/cancellation events needed to reproduce the behavior.

View original on GitHub ↗

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