[BUG] Background task/agent notifications interrupt in-progress prompt typing
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?
When a background task or subagent (e.g. one launched via the Agent/Task tool, or a "broker" completion notification) finishes while I'm in the middle of typing a prompt in the input box, the notification message is inserted/sent immediately, splitting my in-progress text. This causes my prompt to be submitted incomplete (cut off mid-sentence), interrupting my typing flow.
What Should Happen?
Background task/agent completion notifications should be delivered automatically (as they are today) without touching or submitting the current input buffer. The user's in-progress prompt should remain intact in the input box, unaffected by the incoming notification, so they can finish typing and submit it themselves.
Error Messages/Logs
Steps to Reproduce
- Start typing a multi-line or longer prompt in the Claude Code CLI input.
- While still typing (before pressing Enter), have a background agent/task complete and emit its notification ("broker" message).
- Observe that the notification is delivered into the conversation immediately, and the text currently being typed is submitted/interrupted partway through instead of remaining in the input box untouched.
Claude Model
None
Is this a regression?
No, this never worked
Last Working Version
_No response_
Claude Code Version
2.1.228
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗