Summary
When GitHub Copilot CLI is used as an external ACP agent, its background-agent tools report that an agent was started successfully and return an agent_id. However, attempts to retrieve that agent from a later Huabu turn fail consistently:
read_agent returns Cancelled shortly after the parent ACP turn ends.
read_agent returns Agent not found after the ACP session has been idle and its underlying process has been suspended or recreated.
Huabu persists the outer chat thread and ACP session state, but Copilot CLI background-agent handles appear to be process- or turn-local and are not recoverable across those lifecycle boundaries.
Reproduction A: parent turn ends
- Configure GitHub Copilot CLI as an external ACP Agent.
- Ask it to start one or more background research agents.
- Observe successful tool results such as:
Agent started in background with agent_id: <id>. You will be notified when it completes.
- Allow the parent ACP turn to finish.
- In the next turn, call
read_agent with the returned ID.
Actual result
status: failed
message: Cancelled
In one observed run, five agents were created successfully. The parent turn emitted done about 50 seconds later. Reading all five IDs approximately five minutes after creation returned Cancelled immediately.
Reproduction B: idle suspension or process recreation
- Start background agents and retain their IDs.
- Call
read_agent(wait=true, timeout=180) in the same active session.
- Observe successful results reporting
status: running.
- Leave the external ACP session idle long enough for suspension, then send a new prompt so Huabu resumes or recreates the underlying ACP process.
- Call
read_agent with the same IDs.
Actual result
status: failed
message: Agent not found
In one observed run, all five IDs were readable as running, but all five returned Agent not found after the session had been idle overnight.
Expected behavior
One of the following contracts should be explicit and reliable:
- Background agents survive the end of the parent prompt and remain addressable from later turns in the same durable ACP session; or
- Background agents are explicitly documented and surfaced as turn-scoped, and the tool must not instruct the model to end its response and wait for a later completion notification; or
- Huabu receives a structured ACP task resource with lifecycle and recovery metadata, allowing it to persist or reconnect to the task.
At minimum, the UI/tool result should distinguish a task cancelled with its parent turn from a task lost because the ACP process was replaced.
Analysis
The observed lifecycle appears to be:
Huabu durable chat thread\n
-> recoverable ACP session
-> Copilot CLI process
-> process-local background-agent registry
Huabu receives the background-agent creation and read_agent calls only as ordinary ACP tool events. The agent_id is embedded in tool output; ACP does not currently expose it as a durable task resource. Huabu can therefore restore the outer thread/session without restoring Copilot CLI internal background-agent state.
This is adjacent to #38 and #84, but neither tracks background/sub-agent handles becoming Cancelled or Agent not found across turn/session recovery boundaries.
Suggested investigation
- Confirm whether Copilot CLI background agents inherit the parent
session/prompt abort signal.
- Confirm whether their registry is scoped to one prompt, one ACP session, or one CLI process.
- Define behavior when Huabu idle-suspends and later repairs an ACP session.
-
- Consider persisting background-task metadata or exposing a structured ACP task lifecycle.
- Until recovery is supported, adjust the Copilot tool guidance so it does not promise later notification/readback after the parent turn ends
Summary
When GitHub Copilot CLI is used as an external ACP agent, its background-agent tools report that an agent was started successfully and return an
agent_id. However, attempts to retrieve that agent from a later Huabu turn fail consistently:read_agentreturnsCancelledshortly after the parent ACP turn ends.read_agentreturnsAgent not foundafter the ACP session has been idle and its underlying process has been suspended or recreated.Huabu persists the outer chat thread and ACP session state, but Copilot CLI background-agent handles appear to be process- or turn-local and are not recoverable across those lifecycle boundaries.
Reproduction A: parent turn ends
read_agentwith the returned ID.Actual result
In one observed run, five agents were created successfully. The parent turn emitted
doneabout 50 seconds later. Reading all five IDs approximately five minutes after creation returnedCancelledimmediately.Reproduction B: idle suspension or process recreation
read_agent(wait=true, timeout=180)in the same active session.status: running.read_agentwith the same IDs.Actual result
In one observed run, all five IDs were readable as
running, but all five returnedAgent not foundafter the session had been idle overnight.Expected behavior
One of the following contracts should be explicit and reliable:
At minimum, the UI/tool result should distinguish a task cancelled with its parent turn from a task lost because the ACP process was replaced.
Analysis
The observed lifecycle appears to be:
Huabu receives the background-agent creation and
read_agentcalls only as ordinary ACP tool events. Theagent_idis embedded in tool output; ACP does not currently expose it as a durable task resource. Huabu can therefore restore the outer thread/session without restoring Copilot CLI internal background-agent state.This is adjacent to #38 and #84, but neither tracks background/sub-agent handles becoming
CancelledorAgent not foundacross turn/session recovery boundaries.Suggested investigation
session/promptabort signal.