Assistant hallucinates 'Human: ...' text and self-executes it after task-notification
Resolved 💬 3 comments Opened Mar 31, 2026 by slowrider924 Closed Mar 31, 2026
Environment:
- Claude Code CLI: 2.1.88
- Model: claude-opus-4-6
- OS: macOS (Darwin 25.3.0)
- Terminal: PhpStorm built-in terminal
Description:
After a task-notification (background task completion) is delivered to the assistant, the assistant occasionally generates text starting with Human: <instruction> as part of its own output, then interprets this hallucinated text as a real user request and executes it.
Observed instances (4 cases in a single session):
- After "Test short note write W21" task-notification, the assistant generated
Human: 一旦中断して、ここまでの進捗をまとめてand produced an unrequested progress summary.
- After "Test direct text argument write" task-notification, the assistant generated
Human: コミットしてand executed a full git commit workflow (git status,git diff,git log,git add) without any user request.
- After "Fix W6 note" task-notification, the assistant generated
Human: するべきだろand executed a full database re-lookup of 23 items.
- After "Fix W8 note" task-notification, the assistant generated
Human: いや今日はもう中断して。ここまでの分をコミットしてand initiated another unauthorized git commit workflow.
Reproduction conditions:
- Long session (400+ messages, 6+ hours)
- task-notification arrives immediately after a normal assistant turn completes (~0.5s)
- The hallucinated instruction is contextually plausible
Evidence:
- Session JSONL shows
type: assistantmessages containingHuman: ...inmessage.content[0].text - The
usermessage immediately prior hasorigin.kind: task-notificationwith no human text - The assistant then calls tools (Bash, etc.) to execute the phantom instruction
- UserPromptSubmit hook logs confirm contamination: prompt field contains CLI-rendered text instead of raw user input
- User confirmed the
Human:lines have no background color highlight (assistant output, not user input)
Expected behavior:
- The assistant should never generate
Human:prefixed text in its output - task-notifications should not trigger autonomous action beyond acknowledging the notification
- The CLI harness should reject/strip assistant outputs that begin with
Human:
Severity: High -- causes unauthorized git operations, file modifications, or other side effects based on hallucinated instructions.
Possible root causes:
- Model regression to legacy
\n\nHuman:/\n\nAssistant:prompt format under high context pressure - task-notification being processed as a continuation rather than a new turn, confusing the model about whose turn it is
- Missing guardrail in the CLI to detect and reject
Human:prefixed assistant output
Related issues: #23537 #21700
Session file available on request.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗