Background agent completion notifications can be mistaken for user messages
Description
When using run_in_background: true on an Agent tool call, the system inserts a <task-notification> message into the conversation when the agent completes. This notification can be mistaken for a user message by Claude, causing it to treat the next conversation turn as if the user has responded — when in reality no user input has occurred.
Steps to Reproduce
- Dispatch a background agent with
run_in_background: true - While waiting for it to complete, the user sends a message and Claude responds
- The background agent completes and a
<task-notification>appears in the conversation - Claude may interpret this as a new user turn and take action (e.g., committing code) without actual user confirmation
Expected Behavior
Background agent completion notifications should be clearly distinguishable from user messages in a way that prevents Claude from treating them as user input. Ideally, they should not trigger a new conversation turn at all.
Actual Behavior
The <task-notification> appears as a conversation turn, and Claude may proceed with actions that require user confirmation (like git commits) without the user actually having responded.
Workaround
Added a note to CLAUDE.md instructing Claude to treat <task-notification> messages as system events, not user input.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗