anthropics / anthropics/claude-code

[BUG] Bug: model emits the next user turn and system/hook markers inside its own assistant message

Open
#95,337 0 comments 0 reactions 0 assignees View on GitHub
api:anthropic area:core area:model bug platform:macos
Dominant language
Python
Stars
145k
Forks
23.1k
PR merge metrics
PR metrics pending

Description

### Preflight Checklist

- [x] I have searched [existing issues](https://github.com/anthropics/claude-code/issues?q=is%3Aissue%20state%3Aopen%20label%3Abug) 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?

[bug_report_turn_bleed.md](https://github.com/user-attachments/files/32378004/bug_report_turn_bleed.md)

### What Should Happen?

[bug_report_turn_bleed.md](https://github.com/user-attachments/files/32378010/bug_report_turn_bleed.md)

### Error Messages/Logs

```shell

```

### Steps to Reproduce

[bug_report_turn_bleed.md](https://github.com/user-attachments/files/32378033/bug_report_turn_bleed.md)

### Claude Model

Opus

### Is this a regression?

Yes, this worked in a previous version

### Last Working Version

_No response_

### Claude Code Version

21.6.0

### Platform

Anthropic API

### Operating System

macOS

### Terminal/Shell

Terminal.app (macOS)

### Additional Information

_No response_

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reading the attached bug_report_turn_bleed.md files for the expected output and reproduction steps. Reproduce the issue with Opus through the Anthropic API on Claude Code 21.6.0, then trace the relevant message-generation entry point. Done means the model no longer emits the next user turn or system/hook markers inside its assistant message.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.