[BUG] Claude Code consumes provider deltas after message_stop

Open 💬 1 comment 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?

After the provider sends message_stop, Claude Code still consumes later streamed deltas for the closed message.

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

Severity / performance impact: High. Accepting deltas after a message has stopped or been cancelled lets stale stream data mutate tool-call state after the valid boundary. That can trigger extra requests, stale tool results, and wasted paid model/API credits instead of stopping cleanly.

What Should Happen?

Once message_stop is received, later deltas for that message should be ignored and must not affect tool-call assembly or execution 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/10f671690d376571fb50bbff42ab5139

The Gist contains claude-late-provider-delta-after-message-stop.reproduce.py. Download and run:

gh gist clone 10f671690d376571fb50bbff42ab5139 claude-late-provider-delta-after-message-stop-reproducer
cd claude-late-provider-delta-after-message-stop-reproducer
python3 claude-late-provider-delta-after-message-stop.reproduce.py

To reuse an already-built local image:

python3 claude-late-provider-delta-after-message-stop.reproduce.py --skip-build

Key output from a local run against the affected version:

process_exit=143
provider_requests=1526
tool_result_counts={'edit_1': 1524}
late_stream_events_after_stop=1526
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 1 comment on GitHub. Read the full discussion on GitHub ↗