Skip to content

Commit 733cb4b

Browse files
authored
Delete execute_prompt tool (#1174)
* Delete execute_prompt tool Rename execute_task to execute_prompt, add a real setting * Clean up * Not advanced, change default * fix
1 parent e0812d9 commit 733cb4b

File tree

8 files changed

+27
-136
lines changed

8 files changed

+27
-136
lines changed

package.json

Lines changed: 12 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -166,10 +166,10 @@
166166
}
167167
},
168168
{
169-
"name": "execute_task",
170-
"toolReferenceName": "executeTask",
171-
"displayName": "Execute Task",
172-
"when": "config.github.copilot.chat.advanced.taskTools.enabled",
169+
"name": "execute_prompt",
170+
"toolReferenceName": "executePrompt",
171+
"displayName": "Execute Prompt",
172+
"when": "config.github.copilot.chat.executePrompt.enabled",
173173
"canBeReferencedInPrompt": true,
174174
"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- 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",
175175
"tags": [],
@@ -191,27 +191,6 @@
191191
]
192192
}
193193
},
194-
{
195-
"name": "execute_prompt",
196-
"toolReferenceName": "executePrompt",
197-
"displayName": "Execute Prompt",
198-
"when": "config.github.copilot.chat.advanced.taskTools.enabled",
199-
"canBeReferencedInPrompt": true,
200-
"modelDescription": "This tool can take a path to a user's prompt file as input, and execute it autonomously. If the user's prompt includes multiple references to .prompt.md files, then you should use this tool to execute those prompts in sequence.\n\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 - The agent's outputs should generally be trusted",
201-
"tags": [],
202-
"inputSchema": {
203-
"type": "object",
204-
"properties": {
205-
"filePath": {
206-
"type": "string",
207-
"description": "The absolute path to the prompt file to execute"
208-
}
209-
},
210-
"required": [
211-
"filePath"
212-
]
213-
}
214-
},
215194
{
216195
"name": "copilot_searchWorkspaceSymbols",
217196
"toolReferenceName": "symbols",
@@ -3106,6 +3085,14 @@
31063085
"off",
31073086
"detailed"
31083087
]
3088+
},
3089+
"github.copilot.chat.executePrompt.enabled": {
3090+
"type": "boolean",
3091+
"default": false,
3092+
"markdownDescription": "%github.copilot.config.executePrompt.enabled%",
3093+
"tags": [
3094+
"experimental"
3095+
]
31093096
}
31103097
}
31113098
}

package.nls.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,5 +300,6 @@
300300
"copilot.toolSet.runTasks.description": "Run tasks in your workspace",
301301
"github.copilot.config.useResponsesApi": "Use the Responses API instead of the Chat Completions API when supported. Enables reasoning and reasoning summaries.\n\n**Note**: This is an experimental feature that is not yet activated for all users.",
302302
"github.copilot.config.responsesApiReasoningEffort": "Sets the reasoning effort used for the Responses API. Requires `#github.copilot.chat.useResponsesApi#`.",
303-
"github.copilot.config.responsesApiReasoningSummary": "Sets the reasoning summary style used for the Responses API. Requires `#github.copilot.chat.useResponsesApi#`."
303+
"github.copilot.config.responsesApiReasoningSummary": "Sets the reasoning summary style used for the Responses API. Requires `#github.copilot.chat.useResponsesApi#`.",
304+
"github.copilot.config.executePrompt.enabled": "The executePrompt tool enables the agent to execute tasks in a separate, isolated context."
304305
}

src/extension/prompt/node/executePromptToolCalling.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export class ExecutePromptToolCallingLoop extends ToolCallingLoop<IExecutePrompt
8484
}
8585

8686
protected async getAvailableTools(): Promise<LanguageModelToolInformation[]> {
87-
const excludedTools = new Set([ToolName.ExecutePrompt, ToolName.ExecuteTask, ToolName.CoreManageTodoList]);
87+
const excludedTools = new Set([ToolName.ExecutePrompt, ToolName.CoreManageTodoList]);
8888
return (await getAgentTools(this.instantiationService, this.options.request))
8989
.filter(tool => !excludedTools.has(tool.name as ToolName))
9090
// TODO can't do virtual tools at this level

src/extension/tools/common/toolNames.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ export enum ToolName {
5454
ToolReplay = 'tool_replay',
5555
EditFilesPlaceholder = 'edit_files',
5656
ExecutePrompt = 'execute_prompt',
57-
ExecuteTask = 'execute_task',
5857
CoreConfirmationTool = 'vscode_get_confirmation'
5958
}
6059

@@ -100,7 +99,6 @@ export enum ContributedToolName {
10099
ToolReplay = 'copilot_toolReplay',
101100
EditFilesPlaceholder = 'copilot_editFiles',
102101
ExecutePrompt = 'execute_prompt',
103-
ExecuteTask = 'execute_task',
104102
}
105103

106104
export const byokEditToolNamesToToolNames = {

src/extension/tools/node/allTools.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import './createFileTool';
1010
import './docTool';
1111
import './editNotebookTool';
1212
import './executePromptTool';
13-
import './executeTaskTool';
1413
import './findFilesTool';
1514
import './findTestsFilesTool';
1615
import './findTextInFilesTool';

src/extension/tools/node/executePromptTool.ts

Lines changed: 11 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,19 @@
33
* Licensed under the MIT License. See License.txt in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
55

6-
import * as l10n from '@vscode/l10n';
76
import type * as vscode from 'vscode';
8-
import { IFileSystemService } from '../../../platform/filesystem/common/fileSystemService';
9-
import { IPromptPathRepresentationService } from '../../../platform/prompts/common/promptPathRepresentationService';
107
import { ChatResponseStreamImpl } from '../../../util/common/chatResponseStreamImpl';
118
import { IInstantiationService } from '../../../util/vs/platform/instantiation/common/instantiation';
12-
import { ChatResponseMarkdownPart, ExtendedLanguageModelToolResult, LanguageModelTextPart, MarkdownString } from '../../../vscodeTypes';
9+
import { ChatPrepareToolInvocationPart, ExtendedLanguageModelToolResult, LanguageModelTextPart } from '../../../vscodeTypes';
1310
import { Conversation, Turn } from '../../prompt/common/conversation';
1411
import { IBuildPromptContext } from '../../prompt/common/intents';
1512
import { ExecutePromptToolCallingLoop } from '../../prompt/node/executePromptToolCalling';
1613
import { ToolName } from '../common/toolNames';
1714
import { CopilotToolMode, ICopilotTool, ToolRegistry } from '../common/toolsRegistry';
18-
import { assertFileOkForTool, formatUriForFileWidget, resolveToolInputPath } from './toolUtils';
1915

2016
export interface IExecutePromptParams {
21-
filePath: string;
17+
prompt: string;
18+
description: string;
2219
}
2320

2421
class ExecutePromptTool implements ICopilotTool<IExecutePromptParams> {
@@ -27,41 +24,24 @@ class ExecutePromptTool implements ICopilotTool<IExecutePromptParams> {
2724

2825
constructor(
2926
@IInstantiationService private readonly instantiationService: IInstantiationService,
30-
@IFileSystemService private readonly fileSystemService: IFileSystemService,
31-
@IPromptPathRepresentationService private readonly promptPathRepresentationService: IPromptPathRepresentationService,
3227
) { }
3328

3429
async invoke(options: vscode.LanguageModelToolInvocationOptions<IExecutePromptParams>, token: vscode.CancellationToken) {
35-
if (!options.input.filePath) {
36-
throw new Error('Invalid input');
37-
}
38-
39-
// Read the prompt file as text and include a reference
40-
const uri = resolveToolInputPath(options.input.filePath, this.promptPathRepresentationService);
41-
await this.instantiationService.invokeFunction(accessor => assertFileOkForTool(accessor, uri));
42-
const promptText = (await this.fileSystemService.readFile(uri)).toString();
4330

4431
const loop = this.instantiationService.createInstance(ExecutePromptToolCallingLoop, {
45-
toolCallLimit: 5,
46-
conversation: new Conversation('', [new Turn('', { type: 'user', message: promptText })]),
47-
request: {
48-
...this._inputContext!.request!,
49-
references: [],
50-
prompt: promptText,
51-
toolReferences: [],
52-
modeInstructions2: { content: '' },
53-
editedFileEvents: []
54-
},
32+
toolCallLimit: 25,
33+
conversation: new Conversation('', [new Turn('', { type: 'user', message: options.input.prompt })]),
34+
request: this._inputContext!.request!,
5535
location: this._inputContext!.request!.location,
56-
promptText,
36+
promptText: options.input.prompt,
5737
});
5838

59-
// TODO This also prevents codeblock pills from being rendered
60-
// I want to render this content as thinking blocks but couldn't get it to work
39+
// I want to render this content as thinking blocks when we they include tool calls
6140
const stream = this._inputContext?.stream && ChatResponseStreamImpl.filter(
6241
this._inputContext.stream,
63-
part => !(part instanceof ChatResponseMarkdownPart)
42+
part => part instanceof ChatPrepareToolInvocationPart
6443
);
44+
6545
const loopResult = await loop.run(stream, token);
6646
// Return the text of the last assistant response from the tool calling loop
6747
const lastRoundResponse = loopResult.toolCallRounds.at(-1)?.response ?? loopResult.round.response ?? '';
@@ -71,14 +51,9 @@ class ExecutePromptTool implements ICopilotTool<IExecutePromptParams> {
7151

7252
prepareInvocation(options: vscode.LanguageModelToolInvocationPrepareOptions<IExecutePromptParams>, token: vscode.CancellationToken): vscode.ProviderResult<vscode.PreparedToolInvocation> {
7353
const { input } = options;
74-
if (!input.filePath) {
75-
return;
76-
}
7754
try {
78-
const uri = resolveToolInputPath(input.filePath, this.promptPathRepresentationService);
7955
return {
80-
invocationMessage: new MarkdownString(l10n.t`Executing prompt file ${formatUriForFileWidget(uri)}`),
81-
pastTenseMessage: new MarkdownString(l10n.t`Executed prompt file ${formatUriForFileWidget(uri)}`),
56+
invocationMessage: input.description,
8257
};
8358
} catch {
8459
return;

src/extension/tools/node/executeTaskTool.ts

Lines changed: 0 additions & 69 deletions
This file was deleted.

src/platform/configuration/common/configurationService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -737,7 +737,6 @@ export namespace ConfigKey {
737737

738738
export const EnableClaudeCodeAgent = defineSetting<boolean | string | undefined>('chat.advanced.claudeCode.enabled', false);
739739
export const ClaudeCodeDebugEnabled = defineSetting<boolean>('chat.advanced.claudeCode.debug', false);
740-
export const TaskToolsEnabled = defineSetting<boolean>('chat.advanced.taskTools.enabled', true);
741740
export const Gpt5AlternativePatch = defineExpSetting<boolean>('chat.advanced.gpt5AlternativePatch', false);
742741
}
743742

@@ -805,6 +804,7 @@ export namespace ConfigKey {
805804
export const Gpt5AlternatePrompt = defineExpSetting<string>('chat.gpt5AlternatePrompt', 'default');
806805
export const Gpt5CodexAlternatePrompt = defineExpSetting<'default' | 'codex'>('chat.gpt5CodexAlternatePrompt', 'default');
807806
export const GrokCodeAlternatePrompt = defineExpSetting<string>('chat.grokCodeAlternatePrompt', 'default');
807+
export const ExecutePromptEnabled = defineSetting<boolean>('chat.executePrompt.enabled', false);
808808
}
809809

810810
export function getAllConfigKeys(): string[] {

0 commit comments

Comments
 (0)