[BUG] Background terminals block user query from agent client protocol
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 operating claude code over ACP,
- Give the agent a long task, and it spawns a background terminal
- Wait until the agent finishes its task
- Then send a prompt.
At this point, a user message containing ONLY the information of a background terminal has done is sent to the model. The actual user query is NOT sent to the model. It seems background terminal notification would block in the user message queue.
Sometimes this requires the user to repeat several times until the model receives it. This isn't even a workaround. Let's say there are 3 queued background terminal notifications, you need to repeat 3 times to send your prompt to the model. After that, you need another 3 repeat for your next prompt, meanwhile the model gets your first prompt 3 times.
What Should Happen?
The agent should immediately process the user query when sent, regardless of any pending or finished background terminals.
Error Messages/Logs
Steps to Reproduce
I often hit this when using Telegram-ACP, but should be triggerable on any ACP client.
- Give the agent a long task, and it spawns a background terminal
- Wait until the agent finishes its task
- Then send a prompt.
At this point, a user message containing ONLY the information of a background terminal has done is sent to the model. The actual user query is NOT sent to the model. It seems background terminal notification would block in the user message queue.
Claude Model
Sonnet (default)
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.120
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Non-interactive/CI environment
Additional Information
_No response_
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗