From 8a986974bacff91f916e8a9615da814c7785205f Mon Sep 17 00:00:00 2001 From: Rob Lourens Date: Thu, 6 Nov 2025 06:43:28 +0000 Subject: [PATCH] Delete runSubagent tool (#1819) * Delete runSubagent tool Moving to the core version * Fix --- .../copilot/assets/agents/Plan.agent.md | 2 +- extensions/copilot/package.json | 27 ------- extensions/copilot/package.nls.json | 4 +- .../src/extension/prompt/node/subagentLoop.ts | 2 +- .../src/extension/tools/common/toolNames.ts | 4 +- .../src/extension/tools/node/allTools.ts | 2 - .../extension/tools/node/runSubagentTool.ts | 75 ------------------- 7 files changed, 5 insertions(+), 111 deletions(-) delete mode 100644 extensions/copilot/src/extension/tools/node/runSubagentTool.ts diff --git a/extensions/copilot/assets/agents/Plan.agent.md b/extensions/copilot/assets/agents/Plan.agent.md index 5fcbabf5057..9583b649b9f 100644 --- a/extensions/copilot/assets/agents/Plan.agent.md +++ b/extensions/copilot/assets/agents/Plan.agent.md @@ -2,7 +2,7 @@ name: Plan description: Researches and outlines multi-step plans argument-hint: Outline the goal or problem to research -tools: ['search', 'github/github-mcp-server/get_issue', 'github/github-mcp-server/get_issue_comments', 'runSubagent', 'runSubagent2', 'usages', 'problems', 'changes', 'testFailure', 'fetch', 'githubRepo', 'github.vscode-pull-request-github/issue_fetch', 'github.vscode-pull-request-github/activePullRequest'] +tools: ['search', 'github/github-mcp-server/get_issue', 'github/github-mcp-server/get_issue_comments', 'runSubagent', 'usages', 'problems', 'changes', 'testFailure', 'fetch', 'githubRepo', 'github.vscode-pull-request-github/issue_fetch', 'github.vscode-pull-request-github/activePullRequest'] handoffs: - label: Start Implementation agent: agent diff --git a/extensions/copilot/package.json b/extensions/copilot/package.json index 28eb886eb89..5d977d230d4 100644 --- a/extensions/copilot/package.json +++ b/extensions/copilot/package.json @@ -163,33 +163,6 @@ ] } }, - { - "name": "runSubagent", - "toolReferenceName": "runSubagent", - "displayName": "%copilot.tools.runSubagent.name%", - "canBeReferencedInPrompt": true, - "userDescription": "%copilot.tools.runSubagent.description%", - "modelDescription": "Launch a new agent to handle complex, multi-step tasks autonomously. This tool is good at researching complex questions, searching for code, and executing multi-step tasks. When you are searching for a keyword or file and are not confident that you will find the right match in the first few tries, use this agent to perform the search for you.\n\n- Agents do not run async or in the background, you will wait for the agent's result.\n- When the agent is done, it will return a single message back to you. The result returned by the agent is not visible to the user. To show the user the result, you should send a text message back to the user with a concise summary of the result.\n - Each agent invocation is stateless. You will not be able to send additional messages to the agent, nor will the agent be able to communicate with you outside of its final report. Therefore, your prompt should contain a highly detailed task description for the agent to perform autonomously and you should specify exactly what information the agent should return back to you in its final and only message to you.\n - The agent's outputs should generally be trusted\n - Clearly tell the agent whether you expect it to write code or just to do research (search, file reads, web fetches, etc.), since it is not aware of the user's intent", - "tags": [], - "when": "!config.chat.experimental.runSubagent2", - "inputSchema": { - "type": "object", - "properties": { - "prompt": { - "type": "string", - "description": "A detailed description of the task for the agent to perform" - }, - "description": { - "type": "string", - "description": "A short (3-5 word) description of the task" - } - }, - "required": [ - "prompt", - "description" - ] - } - }, { "name": "copilot_searchWorkspaceSymbols", "toolReferenceName": "symbols", diff --git a/extensions/copilot/package.nls.json b/extensions/copilot/package.nls.json index 559c73df08e..c6533c8f8fe 100644 --- a/extensions/copilot/package.nls.json +++ b/extensions/copilot/package.nls.json @@ -359,7 +359,5 @@ "github.copilot.command.cli.sessions.resumeInTerminal": "Resume Agent Session in Terminal", "github.copilot.cli.sessions.newTerminalSession": "New Agent Session in Terminal", "github.copilot.command.openCopilotAgentSessionsInBrowser": "Open in Browser", - "github.copilot.command.closeChatSessionPullRequest.title": "Close Pull Request", - "copilot.tools.runSubagent.name": "Run Subagent", - "copilot.tools.runSubagent.description": "Runs a task within an isolated subagent context. Enables efficient organization of tasks and context window management." + "github.copilot.command.closeChatSessionPullRequest.title": "Close Pull Request" } diff --git a/extensions/copilot/src/extension/prompt/node/subagentLoop.ts b/extensions/copilot/src/extension/prompt/node/subagentLoop.ts index 7d323625047..bdbad0e00fc 100644 --- a/extensions/copilot/src/extension/prompt/node/subagentLoop.ts +++ b/extensions/copilot/src/extension/prompt/node/subagentLoop.ts @@ -85,7 +85,7 @@ export class SubagentToolCallingLoop extends ToolCallingLoop { - const excludedTools = new Set([ToolName.RunSubagent, ToolName.CoreManageTodoList]); + const excludedTools = new Set([ToolName.CoreRunSubagent, ToolName.CoreManageTodoList]); return (await getAgentTools(this.instantiationService, this.options.request)) .filter(tool => !excludedTools.has(tool.name as ToolName)) // TODO can't do virtual tools at this level diff --git a/extensions/copilot/src/extension/tools/common/toolNames.ts b/extensions/copilot/src/extension/tools/common/toolNames.ts index be0fe81f593..a057a6a595d 100644 --- a/extensions/copilot/src/extension/tools/common/toolNames.ts +++ b/extensions/copilot/src/extension/tools/common/toolNames.ts @@ -66,7 +66,7 @@ export enum ToolName { CoreRunTest = 'runTests', ToolReplay = 'tool_replay', EditFilesPlaceholder = 'edit_files', - RunSubagent = 'runSubagent', + CoreRunSubagent = 'runSubagent', CoreConfirmationTool = 'vscode_get_confirmation', CoreTerminalConfirmationTool = 'vscode_get_terminal_confirmation' } @@ -173,7 +173,7 @@ export const toolCategories: Record = { [ToolName.FindFiles]: ToolCategory.Core, [ToolName.CreateDirectory]: ToolCategory.Core, [ToolName.ReadProjectStructure]: ToolCategory.Core, - [ToolName.RunSubagent]: ToolCategory.Core, + [ToolName.CoreRunSubagent]: ToolCategory.Core, [ToolName.Memory]: ToolCategory.Core, // already enabled only when tasks are enabled diff --git a/extensions/copilot/src/extension/tools/node/allTools.ts b/extensions/copilot/src/extension/tools/node/allTools.ts index 3e24bc88916..ea8d0162efc 100644 --- a/extensions/copilot/src/extension/tools/node/allTools.ts +++ b/extensions/copilot/src/extension/tools/node/allTools.ts @@ -29,7 +29,6 @@ import './readFileTool'; import './readProjectStructureTool'; import './replaceStringTool'; import './runNotebookCellTool'; -import './runSubagentTool'; import './scmChangesTool'; import './searchWorkspaceSymbolsTool'; import './simpleBrowserTool'; @@ -39,4 +38,3 @@ import './usagesTool'; import './userPreferencesTool'; import './vscodeAPITool'; import './vscodeCmdTool'; - diff --git a/extensions/copilot/src/extension/tools/node/runSubagentTool.ts b/extensions/copilot/src/extension/tools/node/runSubagentTool.ts deleted file mode 100644 index e12cec43b93..00000000000 --- a/extensions/copilot/src/extension/tools/node/runSubagentTool.ts +++ /dev/null @@ -1,75 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -import type * as vscode from 'vscode'; -import { ChatResponseStreamImpl } from '../../../util/common/chatResponseStreamImpl'; -import { IInstantiationService } from '../../../util/vs/platform/instantiation/common/instantiation'; -import { ChatPrepareToolInvocationPart, ChatResponseNotebookEditPart, ChatResponseTextEditPart, ExtendedLanguageModelToolResult, LanguageModelTextPart } from '../../../vscodeTypes'; -import { Conversation, Turn } from '../../prompt/common/conversation'; -import { IBuildPromptContext } from '../../prompt/common/intents'; -import { SubagentToolCallingLoop } from '../../prompt/node/subagentLoop'; -import { ToolName } from '../common/toolNames'; -import { CopilotToolMode, ICopilotTool, ToolRegistry } from '../common/toolsRegistry'; -import { ChatFetchResponseType } from '../../../platform/chat/common/commonTypes'; - -export interface IRunSubagentParams { - prompt: string; - description: string; -} - -class RunSubagentTool implements ICopilotTool { - public static readonly toolName = ToolName.RunSubagent; - private _inputContext: IBuildPromptContext | undefined; - - constructor( - @IInstantiationService private readonly instantiationService: IInstantiationService, - ) { } - - async invoke(options: vscode.LanguageModelToolInvocationOptions, token: vscode.CancellationToken) { - - const loop = this.instantiationService.createInstance(SubagentToolCallingLoop, { - toolCallLimit: 25, - conversation: new Conversation('', [new Turn('', { type: 'user', message: options.input.prompt })]), - request: this._inputContext!.request!, - location: this._inputContext!.request!.location, - promptText: options.input.prompt, - }); - - // I want to render this content as thinking blocks when we they include tool calls - const stream = this._inputContext?.stream && ChatResponseStreamImpl.filter( - this._inputContext.stream, - part => part instanceof ChatPrepareToolInvocationPart || part instanceof ChatResponseTextEditPart || part instanceof ChatResponseNotebookEditPart - ); - - const loopResult = await loop.run(stream, token); - // Return the text of the last assistant response from the tool calling loop, or request error - let subagentSummary = ''; - if (loopResult.response.type === ChatFetchResponseType.Success) { - subagentSummary = loopResult.toolCallRounds.at(-1)?.response ?? loopResult.round.response ?? ''; - } else { - subagentSummary = `The subagent request failed with this message:\n${loopResult.response.type}: ${loopResult.response.reason}`; - } - const result = new ExtendedLanguageModelToolResult([new LanguageModelTextPart(subagentSummary)]); - return result; - } - - prepareInvocation(options: vscode.LanguageModelToolInvocationPrepareOptions, token: vscode.CancellationToken): vscode.ProviderResult { - const { input } = options; - try { - return { - invocationMessage: input.description, - }; - } catch { - return; - } - } - - async resolveInput(input: IRunSubagentParams, promptContext: IBuildPromptContext, mode: CopilotToolMode): Promise { - this._inputContext = promptContext; - return input; - } -} - -ToolRegistry.registerTool(RunSubagentTool);