Description
When a background agent is running and the assistant calls read_agent with wait: true, pressing Esc twice (cancel) to interrupt that blocking wait cancels not only the read but the underlying background agent itself. The agent is terminated and becomes unrecoverable.
Steps to reproduce
- Start a background agent via the Task tool (
mode: background).
- The assistant calls
read_agent with wait: true on that agent.
- Press Esc twice to cancel while it is waiting.
- The tool returns:
The execution of this tool, or a previous tool was interrupted.
- A later
read_agent (wait: false) returns Agent not found — the background agent was killed.
Expected behavior
Esc/cancel during a blocking read should cancel only the read (stop waiting). The background agent should keep running and remain readable later.
Actual behavior
The background agent is terminated along with the cancelled read, losing all in-flight progress.
Impact
Silent loss of in-flight background work. A cancel intended only for the foreground wait destroys the background task.
Environment
- Copilot CLI version: v1.0.66
- OS: Linux
Notes
Reproduced twice in one session (two explore background agents both became Agent not found after an Esc-cancelled blocking read_agent).
Workaround
Avoid wait: true on read_agent; rely on completion notifications plus non-blocking read_agent polls.
Description
When a background agent is running and the assistant calls
read_agentwithwait: true, pressing Esc twice (cancel) to interrupt that blocking wait cancels not only the read but the underlying background agent itself. The agent is terminated and becomes unrecoverable.Steps to reproduce
mode: background).read_agentwithwait: trueon that agent.The execution of this tool, or a previous tool was interrupted.read_agent(wait: false) returnsAgent not found— the background agent was killed.Expected behavior
Esc/cancel during a blocking read should cancel only the read (stop waiting). The background agent should keep running and remain readable later.
Actual behavior
The background agent is terminated along with the cancelled read, losing all in-flight progress.
Impact
Silent loss of in-flight background work. A cancel intended only for the foreground wait destroys the background task.
Environment
Notes
Reproduced twice in one session (two
explorebackground agents both becameAgent not foundafter an Esc-cancelled blockingread_agent).Workaround
Avoid
wait: trueonread_agent; rely on completion notifications plus non-blockingread_agentpolls.