claude-code
claude-code copied to clipboard
[BUG] Closing a /btw side pane stopped an unrelated background agent, recorded it as "stopped by user", and resume was then refused
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report
- [x] I am using the latest version of Claude Code
What's Wrong?
A long-running background subagent (launched with the Agent tool, run_in_background: true) was terminated when I closed a /btw side-question pane. I did not stop the agent.
- The task notification reported:
status: killed, summaryAgent "…" was stopped by user. - When the main session tried to resume the agent with SendMessage, it was refused:
Agent "<id>" was stopped by the user and was not resumed. Treat its work as cancelled; only start a new agent for it if the user explicitly asks.
So closing an unrelated UI pane (1) killed a different agent and (2) was attributed to me, which (3) then blocked resuming it. Its in-progress work had to be recovered from its transcript by a new agent.
What Should Happen?
Closing a /btw pane should only close that pane. Background agents should keep running. If an agent does get stopped by a UI action, it shouldn't be labelled as an explicit user stop, and resuming should remain possible.
Error Messages/Logs
<task-notification> … <status>killed</status> <summary>Agent "Round 4 record coordinator" was stopped by user</summary>
SendMessage → {"success":false,"message":"Agent \"<id>\" was stopped by the user and was not resumed. Treat its work as cancelled; only start a new agent for it if the user explicitly asks."}
Steps to Reproduce
- Start Claude Code 2.1.304 in a terminal.
- Have the main session launch a background subagent that runs for several minutes (Agent tool, run in background).
- While it runs, open a side question with
/btw …, wait for the answer, then close the/btwpane. - Observe the background agent's notification: killed / "stopped by user".
- Ask the main session to resume it (SendMessage to the agent id) → refused as above.
Is this a regression?
I don't know
Claude Code Version
2.1.304
Platform
Anthropic API
Operating System
macOS (26.x)
Terminal/Shell
Other (Ghostty)
Additional Information
Related /btw issues: #96019, #95521.