Repository navigation
Description
Describe the bug
Multi-turn subagents work only at the top level. A subagent started by another subagent always runs synchronously and can't receive follow-up messages, even when the caller asks for background mode. The changelog says "Multi-turn subagents are always enabled, so you can send follow-up messages to running agents," and it doesn't mention a depth limit.
What actually happens:
- The parent's
taskcall returns the child's final answer inline instead of "Agent started in background". write_agentto the child fails:write_agent only supports background agents. Agent <id> is in sync mode. A new background task must be started for follow-up messages.But the call that started it did ask for background mode.- The
tasktool schema shown to the parent subagent lists onlyagent_type,context_tier,description,model,name,promptandreasoning_effort, with nomode. Passingmode: "background"is accepted and silently ignored. - In
events.jsonl, every subagent started by a subagent has"executionMode":"sync","resumable":false. That held in 27 of 27 nested starts that requested background, across several sessions. Top-level starts that request background get"executionMode":"background", andwrite_agentworks on them.
This breaks layered delegation. A lead agent that delegates to a specialist can't send it a follow-up, such as answers to questions the specialist asked. It has to start a new subagent and repeat all the context.
Affected version
Copilot runtime 1.0.111-0 (bundled in VS Code 1.147.0, commit 8a14f0cc1b08d531eb83255ea3764ae22aa932b5, via the Agent Host), macOS 27.2.1
Steps to reproduce the behavior
- From the top-level session, start agent A with
taskandmode: "background". - Have A start agent B with
taskandmode: "background". In the prompt, ask B to remember a code, e.g. "Remember the code 6612 and reply only 'ok'." - Observe that A's
taskcall returns B's answer (ok) inline, not "Agent started in background". - Have A call
write_agentto B'sagent_id: "What code did I give you?" - Observe the error:
write_agent only supports background agents. Agent <id> is in sync mode. - Optionally check
events.jsonl: B'ssubagent.startedevent has"executionMode":"sync","resumable":false.
Expected behavior
A subagent started by another subagent with mode: "background" runs in the background like a top-level background agent, and write_agent/read_agent work on it, so B answers with the code it was given. This should be subject to the existing subagents.maxDepth and concurrency limits.
If nested background agents aren't meant to be supported, reject mode: "background" from a subagent with a clear error, and document that multi-turn subagents are top-level only. Today the parameter is silently dropped and the failure only shows up later, in write_agent.
Additional context
- The SDK's session event types document subagent
resumableas "Currently always false." - Nested chats created with the VS Code Agent Host's
create_sessioncan be resumed (viasend_message/get_session_context), but they can't run as a custom agent. So there's no delegation path that gives both a specific custom agent and a conversation the caller can resume below the top level. - I found this through the VS Code Agent Host. Does the Agent Host need a matching change (e.g. to show nested background agents or to expose
modein the subagent tool schema)?
Activity