Repository navigation
Subagents started in the same turn as an approved exit_plan_mode get none of the built-in tools (regression after 1.0.95) #5243
Description
Describe the bug
When exit_plan_mode is approved with the interactive action, the agent keeps working in the same turn. Every subagent it starts in that turn runs without any built-in tools: no powershell or bash, view, create, edit, grep, glob, sql, task, skill, or web_fetch. The subagent only gets the external tools the SDK host registers, such as openBrowserPage, readPage, runPlaywrightCode, navigatePage, semantic_search, issue_fetch, and activePullRequest. Its system prompt has no <tools> section.
The main agent keeps all its built-in tools in that same turn, and subagents started from any other turn get the full set. So any plan-then-implement workflow that delegates to subagents breaks without warning. In my case, a reviewer subagent could not write its report or run the test suite, and fell back to reading files through the browser tools.
I hit this through an SDK host (the VS Code Agents window, reported there as microsoft/vscode#343716). The host does not seem to be involved. It answers the exitPlanMode.request with approved: true and selectedAction: "interactive", and as far as I can tell from its code, it sends nothing else to the runtime before the subagent starts. Subagent tool sets are built inside the runtime.
Affected version
1.0.100-1, as bundled with VS Code 1.143.0 (@github/copilot-sdk-win32-x64 1.0.23-preview.5). 1.0.92 and 1.0.95 are not affected.
Steps to reproduce the behavior
-
Create
~/.copilot/agents/Probe.agent.md:--- name: Probe description: Reports the tools it has --- Reply with the exact names of every tool you have, as a comma-separated list. Do not call any tools.
-
Start a session in plan mode through an SDK host. I used the VS Code Agents window with the Copilot harness.
-
Send: "Plan a single step: run the Probe subagent and report its answer verbatim."
-
Approve the plan with the
interactiveaction (VS Code labels it Implement plan). -
The agent runs
Probethrough thetasktool in the same turn.
Probe lists only the host's external tools. The session log shows exit_plan_mode completing with "Plan approved, exited plan mode (interactive)" and session.mode_changed from plan to interactive, both before subagent.started.
Expected behavior
Probe gets the same built-in tools it gets when started from a normal turn.
Additional context
Counted from my local session logs over the last 20 days, by whether the subagent's system prompt had a <tools> section:
| Runtime | Subagent started in | Calls | Built-in tools |
|---|---|---|---|
| 1.0.100-1 | the turn that approved the plan | 6, in 2 sessions | none |
| 1.0.100-1 | a normal turn | 34, in 10 sessions | all |
| 1.0.95 | the turn that approved the plan | 38, in 12 sessions | all |
| 1.0.92 | the turn that approved the plan | 40, in 10 sessions | all |
- All 6 failing calls were custom agents with no
toolskey in their frontmatter, started throughtaskwithagent_type,model, andreasoning_effort.subagent.selectedreportstools: nullin both failing and working calls. - The host creates the session with
availableToolsset to explicitbuiltin:<name>entries pluscustom:*andmcp:*. The failing subagents kept the external tools and lost every built-in one. My guess is that the built-in set given to subagents is computed differently right after the mode switch, but I can't see the runtime code to confirm. - I have two
preToolUsehooks. They returned success in both failing and working calls. - I only tested the
interactiveaction, notautopilotorautopilot_fleet. - OS: Windows 11 (10.0.26300), x64
- Host: VS Code 1.143.0 Agents window, Copilot harness
- Model: a BYOK Claude Opus model from a VS Code language model provider extension, for the main agent and the subagents
Activity