[BUG] SendMessage to running agent: queued message silently dropped on completion
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?
SendMessage to a running background agent confirms the message is queued, then silently drops it when the agent completes.
Steps to Reproduce
- Spawn a background agent with a multi-tool-call task (e.g., search a codebase, read multiple files)
- While it's running, send it a SendMessage
- Observe response:
{"success":true,"message":"Message queued for delivery to my-agent at its next tool round."} - Agent completes its original task (e.g., 5 tool calls, ~44 seconds)
- Message is never delivered — agent returns original task result with no sign of the queued message
- Agent is not auto-resumed with the pending message after completion
What Should Happen?
Either:
- The message gets delivered between tool rounds (as the response promises), or
- If the agent completes before the next delivery point, it should be auto-resumed with the pending message
SendMessage to an already-completed agent successfully resumes it — so the mechanism exists. The gap is that messages queued during execution are lost when the agent finishes before the next delivery point.
Actual Behavior
System confirms the message is queued, then silently drops it. No error, no notification that delivery failed. The race window is when the message arrives during or after the agent's final LLM generation — if the LLM produces a text response (no more tool calls), there's no "next tool round" for delivery and the message has nowhere to go.
Suggested Fix
When an agent completes, check if there are undelivered queued messages. If so, auto-resume the agent with those messages instead of discarding them.
Claude Model
Opus 4.6
Claude Code Version
2.1.91
Platform
macOS (Darwin 24.4.0)
Operating System
macOS
Terminal/Shell
zsh
<claude>
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗