mirror of
https://github.com/microsoft/vscode.git
synced 2026-06-01 21:24:50 +01:00
Fix using the wrong runTest tool reference for prompt hints (#2066)
* Fix using the wrong runTest tool reference * Update test snapshot
This commit is contained in:
@@ -90,7 +90,7 @@ export const getAgentTools = (instaService: IInstantiationService, request: vsco
|
||||
}
|
||||
}
|
||||
|
||||
allowTools[ToolName.RunTests] = await testService.hasAnyTests();
|
||||
allowTools[ToolName.CoreRunTest] = await testService.hasAnyTests();
|
||||
allowTools[ToolName.CoreRunTask] = tasksService.getTasks().length > 0;
|
||||
|
||||
if (model.family === 'gpt-5-codex' || model.family.includes('grok-code')) {
|
||||
|
||||
@@ -34,7 +34,7 @@ class Gpt51CodexPrompt extends PromptElement<DefaultAgentPromptProps> {
|
||||
</Tag>
|
||||
<Tag name='tool_use'>
|
||||
- You have access to many tools. If a tool exists to perform a specific task, you MUST use that tool instead of running a terminal command to perform that task.<br />
|
||||
{tools[ToolName.RunTests] && <>- Use the {ToolName.RunTests} tool to run tests instead of running terminal commands.<br /></>}
|
||||
{tools[ToolName.CoreRunTest] && <>- Use the {ToolName.CoreRunTest} tool to run tests instead of running terminal commands.<br /></>}
|
||||
{tools[ToolName.CoreManageTodoList] && <>
|
||||
<br />
|
||||
## {ToolName.CoreManageTodoList} tool<br />
|
||||
|
||||
@@ -158,7 +158,7 @@ class Gpt51Prompt extends PromptElement<DefaultAgentPromptProps> {
|
||||
- Do not use one-letter variable names unless explicitly requested.<br />
|
||||
- NEVER output inline citations like "【F:README.md†L5-L14】" in your outputs. The UI is not able to render these so they will just be broken in the UI. Instead, if you output valid filepaths, users will be able to click on them to open the files in their editor.<br />
|
||||
- You have access to many tools. If a tool exists to perform a specific task, you MUST use that tool instead of running a terminal command to perform that task.<br />
|
||||
{tools[ToolName.RunTests] && <>- Use the {ToolName.RunTests} tool to run tests instead of running terminal commands.<br /></>}
|
||||
{tools[ToolName.CoreRunTest] && <>- Use the {ToolName.CoreRunTest} tool to run tests instead of running terminal commands.<br /></>}
|
||||
</Tag>
|
||||
<Tag name='validating_work'>
|
||||
If the codebase has tests or the ability to build or run, consider using them to verify changes once your work is complete.<br />
|
||||
|
||||
@@ -29,7 +29,7 @@ class CodexStyleGpt5CodexPrompt extends PromptElement<DefaultAgentPromptProps> {
|
||||
<br />
|
||||
## Tool use<br />
|
||||
- You have access to many tools. If a tool exists to perform a specific task, you MUST use that tool instead of running a terminal command to perform that task.<br />
|
||||
{tools[ToolName.RunTests] && <>- Use the {ToolName.RunTests} tool to run tests instead of running terminal commands.<br /></>}
|
||||
{tools[ToolName.CoreRunTest] && <>- Use the {ToolName.CoreRunTest} tool to run tests instead of running terminal commands.<br /></>}
|
||||
{tools[ToolName.CoreManageTodoList] && <>
|
||||
<br />
|
||||
## {ToolName.CoreManageTodoList} tool<br />
|
||||
|
||||
@@ -23,7 +23,6 @@ export enum ToolName {
|
||||
Codebase = 'semantic_search',
|
||||
VSCodeAPI = 'get_vscode_api',
|
||||
TestFailure = 'test_failure',
|
||||
RunTests = 'run_tests',
|
||||
FindFiles = 'file_search',
|
||||
FindTextInFiles = 'grep_search',
|
||||
ReadFile = 'read_file',
|
||||
@@ -211,7 +210,6 @@ export const toolCategories: Record<ToolName, ToolCategory> = {
|
||||
[ToolName.CoreTerminalLastCommand]: ToolCategory.VSCodeInteraction,
|
||||
|
||||
// Testing
|
||||
[ToolName.RunTests]: ToolCategory.Testing,
|
||||
[ToolName.TestFailure]: ToolCategory.Testing,
|
||||
[ToolName.FindTestFiles]: ToolCategory.Testing,
|
||||
[ToolName.CoreRunTest]: ToolCategory.Testing,
|
||||
|
||||
@@ -91,7 +91,7 @@ suite('TestFailureTool', () => {
|
||||
test('returns a message when no failures exist', async () => {
|
||||
failures = [];
|
||||
const result = await resolver.invoke({ input: {}, toolInvocationToken: '' as any });
|
||||
expect(await toolResultToString(accessor, result)).toMatchInlineSnapshot(`"No test failures were found yet, call the tool run_tests to run tests and find failures."`);
|
||||
expect(await toolResultToString(accessor, result)).toMatchInlineSnapshot(`"No test failures were found yet, call the tool runTests to run tests and find failures."`);
|
||||
});
|
||||
|
||||
test('formats stack frames', async () => {
|
||||
@@ -129,7 +129,7 @@ suite('TestFailureTool', () => {
|
||||
## Rules:
|
||||
- Always try to find an error in the implementation code first. Don't suggest any changes in my test cases unless I tell you to.
|
||||
- If you need more information about anything in the codebase, use a tool like read_file, list_dir, or file_search to find and read it. Never ask the user to provide it themselves.
|
||||
- If you make changes to fix the test, call run_tests to run the tests and verify the fix.
|
||||
- If you make changes to fix the test, call runTests to run the tests and verify the fix.
|
||||
- Don't try to make the same changes you made before to fix the test. If you're stuck, ask the user for pointers.
|
||||
"
|
||||
`);
|
||||
@@ -165,7 +165,7 @@ suite('TestFailureTool', () => {
|
||||
## Rules:
|
||||
- Always try to find an error in the implementation code first. Don't suggest any changes in my test cases unless I tell you to.
|
||||
- If you need more information about anything in the codebase, use a tool like read_file, list_dir, or file_search to find and read it. Never ask the user to provide it themselves.
|
||||
- If you make changes to fix the test, call run_tests to run the tests and verify the fix.
|
||||
- If you make changes to fix the test, call runTests to run the tests and verify the fix.
|
||||
- Don't try to make the same changes you made before to fix the test. If you're stuck, ask the user for pointers.
|
||||
"
|
||||
`);
|
||||
@@ -264,7 +264,7 @@ suite('TestFailureTool', () => {
|
||||
## Rules:
|
||||
- Always try to find an error in the implementation code first. Don't suggest any changes in my test cases unless I tell you to.
|
||||
- If you need more information about anything in the codebase, use a tool like read_file, list_dir, or file_search to find and read it. Never ask the user to provide it themselves.
|
||||
- If you make changes to fix the test, call run_tests to run the tests and verify the fix.
|
||||
- If you make changes to fix the test, call runTests to run the tests and verify the fix.
|
||||
- Don't try to make the same changes you made before to fix the test. If you're stuck, ask the user for pointers.
|
||||
"
|
||||
`);
|
||||
|
||||
@@ -58,7 +58,7 @@ export class TestFailureTool implements ICopilotTool<{}> {
|
||||
const failures = Array.from(this.testProvider.getAllFailures());
|
||||
if (failures.length === 0) {
|
||||
return new LanguageModelToolResult([
|
||||
new LanguageModelTextPart(`No test failures were found yet, call the tool ${ToolName.RunTests} to run tests and find failures.`),
|
||||
new LanguageModelTextPart(`No test failures were found yet, call the tool ${ToolName.CoreRunTest} to run tests and find failures.`),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -118,7 +118,7 @@ export class TestFailureList extends PromptElement<TestFailureListElementProps>
|
||||
## Rules:<br />
|
||||
- Always try to find an error in the implementation code first. Don't suggest any changes in my test cases unless I tell you to.<br />
|
||||
- If you need more information about anything in the codebase, use a tool like {ToolName.ReadFile}, {ToolName.ListDirectory}, or {ToolName.FindFiles} to find and read it. Never ask the user to provide it themselves.<br />
|
||||
- If you make changes to fix the test, call {ToolName.RunTests} to run the tests and verify the fix.<br />
|
||||
- If you make changes to fix the test, call {ToolName.CoreRunTest} to run the tests and verify the fix.<br />
|
||||
- Don't try to make the same changes you made before to fix the test. If you're stuck, ask the user for pointers.<br />
|
||||
</TextChunk>
|
||||
</>;
|
||||
|
||||
Reference in New Issue
Block a user