Plan Agent: Search subagent if explore disabled#312027
Plan Agent: Search subagent if explore disabled#312027
Conversation
There was a problem hiding this comment.
Pull request overview
Updates the Copilot Plan agent prompt so that when the Explore subagent is disabled, the agent falls back to using the search subagent for discovery.
Changes:
- Make Plan agent “Discovery” instructions conditional on whether Explore agent and/or Search subagent are enabled.
- Introduce a tool-name alias mapping (
explore_subagent→search_subagent) in tool-name resolution. - Refactor
SearchSubagentTool.alternativeDefinition()to build an updated tool definition object before returning.
Show a summary per file
| File | Description |
|---|---|
| extensions/copilot/src/extension/tools/node/searchSubagentTool.ts | Refactors how the tool definition is modified when thoroughness support is enabled. |
| extensions/copilot/src/extension/tools/common/toolNames.ts | Adds alias mapping intended to resolve alternative tool names back to canonical ToolNames. |
| extensions/copilot/src/extension/prompt/node/pseudoStartStopConversationCallback.ts | Updates imports to include getToolName (currently unused). |
| extensions/copilot/src/extension/agents/vscode-node/planAgentProvider.ts | Makes the Plan agent prompt vary based on Explore/Search enablement flags. |
Copilot's findings
Comments suppressed due to low confidence (1)
extensions/copilot/src/extension/agents/vscode-node/planAgentProvider.ts:122
- The discovery text mixes
search_subagentandexplore_subagenttool names. As-is, the tool contributed in package.json issearch_subagent, andexplore_subagentis not a registered tool, so this prompt can lead the model to attempt calling a nonexistent tool. Make the instructions consistently reference the actual available tool name (or ensure the alias is truly registered/handled end-to-end).
discoverySection = `## 1. Discovery
Use the *search_subagent* tool to gather context, analogous existing features to use as implementation templates, and potential blockers or ambiguities. When the task spans multiple independent areas (e.g., frontend + backend, different features, separate repos), launch **2-3 *explore_subagent* tools in parallel** — one per area — to speed up discovery.
Update the plan with your findings.`;
- Files reviewed: 2/2 changed files
- Comments generated: 1
| e.affectsConfiguration('chat.planAgent.defaultModel') || | ||
| e.affectsConfiguration(ConfigKey.ImplementAgentModel.fullyQualifiedId)) { | ||
| e.affectsConfiguration(ConfigKey.ImplementAgentModel.fullyQualifiedId) || | ||
| e.affectsConfiguration(ConfigKey.ExploreAgentEnabled.fullyQualifiedId)) { |
There was a problem hiding this comment.
In the config-change listener, the Plan agent body now depends on ConfigKey.Advanced.SearchSubagentToolEnabled, but changes to that setting won't trigger _onDidChangeCustomAgents.fire() (only ExploreAgentEnabled was added). This can leave the cached agent definition stale until some other setting changes; include the search-subagent enablement key in this affectsConfiguration(...) set as well.
This issue also appears on line 118 of the same file.
| e.affectsConfiguration(ConfigKey.ExploreAgentEnabled.fullyQualifiedId)) { | |
| e.affectsConfiguration(ConfigKey.ExploreAgentEnabled.fullyQualifiedId) || | |
| e.affectsConfiguration(ConfigKey.Advanced.SearchSubagentToolEnabled.fullyQualifiedId)) { |
Update Plan Agent so it defaults to using search subagent if the explore subagent is disabled