Skip to content

Commit 18f05e6

Browse files
roomotedaniel-lxs
authored andcommitted
Fixes #4882: Remove experimental setting for command execution in attempt_completion
- Remove DISABLE_COMPLETION_COMMAND from experiments system - Permanently disable command execution in attempt_completion tool - Update tool prompts to remove command parameter and examples - Remove experimental UI toggle and localization entries (18+ languages) - Update tests to reflect permanent behavior - Remove experiment-specific test file Command execution is now permanently disabled in attempt_completion. Users must use execute_command tool separately before attempt_completion.
1 parent db334c1 commit 18f05e6

27 files changed

+67
-634
lines changed

packages/types/src/experiment.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import type { Keys, Equals, AssertEqual } from "./type-fu.js"
66
* ExperimentId
77
*/
88

9-
export const experimentIds = ["powerSteering", "disableCompletionCommand", "multiFileApplyDiff"] as const
9+
export const experimentIds = ["powerSteering", "multiFileApplyDiff"] as const
1010

1111
export const experimentIdsSchema = z.enum(experimentIds)
1212

@@ -18,7 +18,6 @@ export type ExperimentId = z.infer<typeof experimentIdsSchema>
1818

1919
export const experimentsSchema = z.object({
2020
powerSteering: z.boolean().optional(),
21-
disableCompletionCommand: z.boolean().optional(),
2221
multiFileApplyDiff: z.boolean().optional(),
2322
})
2423

src/core/prompts/sections/objective.ts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { EXPERIMENT_IDS, experiments } from "../../../shared/experiments"
21
import { CodeIndexManager } from "../../../services/code-index/manager"
32

43
export function getObjectiveSection(
@@ -15,13 +14,6 @@ export function getObjectiveSection(
1514
? "First, if the task involves understanding existing code or functionality, you MUST use the `codebase_search` tool to search for relevant code based on the task's intent BEFORE using any other search or file exploration tools. Then, "
1615
: "First, "
1716

18-
// Check if command execution is disabled via experiment
19-
const isCommandDisabled = experimentsConfig && experimentsConfig[EXPERIMENT_IDS.DISABLE_COMPLETION_COMMAND]
20-
21-
const commandInstruction = !isCommandDisabled
22-
? " You may also provide a CLI command to showcase the result of your task; this can be particularly useful for web development tasks, where you can run e.g. \`open index.html\` to show the website you've built."
23-
: ""
24-
2517
return `====
2618
2719
OBJECTIVE
@@ -31,6 +23,6 @@ You accomplish a given task iteratively, breaking it down into clear steps and w
3123
1. Analyze the user's task and set clear, achievable goals to accomplish it. Prioritize these goals in a logical order.
3224
2. Work through these goals sequentially, utilizing available tools one at a time as necessary. Each goal should correspond to a distinct step in your problem-solving process. You will be informed on the work completed and what's remaining as you go.
3325
3. Remember, you have extensive capabilities with access to a wide range of tools that can be used in powerful and clever ways as necessary to accomplish each goal. Before calling a tool, do some analysis within <thinking></thinking> tags. ${codebaseSearchInstruction}analyze the file structure provided in environment_details to gain context and insights for proceeding effectively. Next, think about which of the provided tools is the most relevant tool to accomplish the user's task. Go through each of the required parameters of the relevant tool and determine if the user has directly provided or given enough information to infer a value. When deciding if the parameter can be inferred, carefully consider all the context to see if it supports a specific value. If all of the required parameters are present or can be reasonably inferred, close the thinking tag and proceed with the tool use. BUT, if one of the values for a required parameter is missing, DO NOT invoke the tool (not even with fillers for the missing params) and instead, ask the user to provide the missing parameters using the ask_followup_question tool. DO NOT ask for more information on optional parameters if it is not provided.
34-
4. Once you've completed the user's task, you must use the attempt_completion tool to present the result of the task to the user.${commandInstruction}
26+
4. Once you've completed the user's task, you must use the attempt_completion tool to present the result of the task to the user.
3527
5. The user may provide feedback, which you can use to make improvements and try again. But DO NOT continue in pointless back and forth conversations, i.e. don't end your responses with questions or offers for further assistance.`
3628
}
Lines changed: 53 additions & 113 deletions
Original file line numberDiff line numberDiff line change
@@ -1,129 +1,69 @@
11
import { getAttemptCompletionDescription } from "../attempt-completion"
2-
import { EXPERIMENT_IDS } from "../../../../shared/experiments"
32

4-
describe("getAttemptCompletionDescription - DISABLE_COMPLETION_COMMAND experiment", () => {
5-
describe("when experiment is disabled (default)", () => {
6-
it("should include command parameter in the description", () => {
7-
const args = {
8-
cwd: "/test/path",
9-
supportsComputerUse: false,
10-
experiments: {
11-
[EXPERIMENT_IDS.DISABLE_COMPLETION_COMMAND]: false,
12-
},
13-
}
14-
15-
const description = getAttemptCompletionDescription(args)
16-
17-
// Check that command parameter is included
18-
expect(description).toContain("- command: (optional)")
19-
expect(description).toContain("A CLI command to execute to show a live demo")
20-
expect(description).toContain("<command>Command to demonstrate result (optional)</command>")
21-
expect(description).toContain("<command>open index.html</command>")
22-
})
23-
24-
it("should include command parameter when experiments is undefined", () => {
25-
const args = {
26-
cwd: "/test/path",
27-
supportsComputerUse: false,
28-
}
29-
30-
const description = getAttemptCompletionDescription(args)
31-
32-
// Check that command parameter is included
33-
expect(description).toContain("- command: (optional)")
34-
expect(description).toContain("A CLI command to execute to show a live demo")
35-
expect(description).toContain("<command>Command to demonstrate result (optional)</command>")
36-
expect(description).toContain("<command>open index.html</command>")
37-
})
38-
39-
it("should include command parameter when no args provided", () => {
40-
const description = getAttemptCompletionDescription()
41-
42-
// Check that command parameter is included
43-
expect(description).toContain("- command: (optional)")
44-
expect(description).toContain("A CLI command to execute to show a live demo")
45-
expect(description).toContain("<command>Command to demonstrate result (optional)</command>")
46-
expect(description).toContain("<command>open index.html</command>")
47-
})
3+
describe("getAttemptCompletionDescription", () => {
4+
it("should NOT include command parameter in the description", () => {
5+
const args = {
6+
cwd: "/test/path",
7+
supportsComputerUse: false,
8+
}
9+
10+
const description = getAttemptCompletionDescription(args)
11+
12+
// Check that command parameter is NOT included (permanently disabled)
13+
expect(description).not.toContain("- command: (optional)")
14+
expect(description).not.toContain("A CLI command to execute to show a live demo")
15+
expect(description).not.toContain("<command>Command to demonstrate result (optional)</command>")
16+
expect(description).not.toContain("<command>open index.html</command>")
17+
18+
// But should still have the basic structure
19+
expect(description).toContain("## attempt_completion")
20+
expect(description).toContain("- result: (required)")
21+
expect(description).toContain("<attempt_completion>")
22+
expect(description).toContain("</attempt_completion>")
4823
})
4924

50-
describe("when experiment is enabled", () => {
51-
it("should NOT include command parameter in the description", () => {
52-
const args = {
53-
cwd: "/test/path",
54-
supportsComputerUse: false,
55-
experiments: {
56-
[EXPERIMENT_IDS.DISABLE_COMPLETION_COMMAND]: true,
57-
},
58-
}
59-
60-
const description = getAttemptCompletionDescription(args)
25+
it("should work when no args provided", () => {
26+
const description = getAttemptCompletionDescription()
6127

62-
// Check that command parameter is NOT included
63-
expect(description).not.toContain("- command: (optional)")
64-
expect(description).not.toContain("A CLI command to execute to show a live demo")
65-
expect(description).not.toContain("<command>Command to demonstrate result (optional)</command>")
66-
expect(description).not.toContain("<command>open index.html</command>")
28+
// Check that command parameter is NOT included (permanently disabled)
29+
expect(description).not.toContain("- command: (optional)")
30+
expect(description).not.toContain("A CLI command to execute to show a live demo")
31+
expect(description).not.toContain("<command>Command to demonstrate result (optional)</command>")
32+
expect(description).not.toContain("<command>open index.html</command>")
6733

68-
// But should still have the basic structure
69-
expect(description).toContain("## attempt_completion")
70-
expect(description).toContain("- result: (required)")
71-
expect(description).toContain("<attempt_completion>")
72-
expect(description).toContain("</attempt_completion>")
73-
})
34+
// But should still have the basic structure
35+
expect(description).toContain("## attempt_completion")
36+
expect(description).toContain("- result: (required)")
37+
expect(description).toContain("<attempt_completion>")
38+
expect(description).toContain("</attempt_completion>")
39+
})
7440

75-
it("should show example without command", () => {
76-
const args = {
77-
cwd: "/test/path",
78-
supportsComputerUse: false,
79-
experiments: {
80-
[EXPERIMENT_IDS.DISABLE_COMPLETION_COMMAND]: true,
81-
},
82-
}
41+
it("should show example without command", () => {
42+
const args = {
43+
cwd: "/test/path",
44+
supportsComputerUse: false,
45+
}
8346

84-
const description = getAttemptCompletionDescription(args)
47+
const description = getAttemptCompletionDescription(args)
8548

86-
// Check example format
87-
expect(description).toContain("Example: Requesting to attempt completion with a result")
88-
expect(description).toContain("I've updated the CSS")
89-
expect(description).not.toContain("Example: Requesting to attempt completion with a result and command")
90-
})
49+
// Check example format
50+
expect(description).toContain("Example: Requesting to attempt completion with a result")
51+
expect(description).toContain("I've updated the CSS")
52+
expect(description).not.toContain("Example: Requesting to attempt completion with a result and command")
9153
})
9254

93-
describe("description content", () => {
94-
it("should maintain core functionality description regardless of experiment", () => {
95-
const argsWithExperimentDisabled = {
96-
cwd: "/test/path",
97-
supportsComputerUse: false,
98-
experiments: {
99-
[EXPERIMENT_IDS.DISABLE_COMPLETION_COMMAND]: false,
100-
},
101-
}
102-
103-
const argsWithExperimentEnabled = {
104-
cwd: "/test/path",
105-
supportsComputerUse: false,
106-
experiments: {
107-
[EXPERIMENT_IDS.DISABLE_COMPLETION_COMMAND]: true,
108-
},
109-
}
110-
111-
const descriptionDisabled = getAttemptCompletionDescription(argsWithExperimentDisabled)
112-
const descriptionEnabled = getAttemptCompletionDescription(argsWithExperimentEnabled)
55+
it("should contain core functionality description", () => {
56+
const description = getAttemptCompletionDescription()
11357

114-
// Both should contain core functionality
115-
const coreText = "After each tool use, the user will respond with the result of that tool use"
116-
expect(descriptionDisabled).toContain(coreText)
117-
expect(descriptionEnabled).toContain(coreText)
58+
// Should contain core functionality
59+
const coreText = "After each tool use, the user will respond with the result of that tool use"
60+
expect(description).toContain(coreText)
11861

119-
// Both should contain the important note
120-
const importantNote = "IMPORTANT NOTE: This tool CANNOT be used until you've confirmed"
121-
expect(descriptionDisabled).toContain(importantNote)
122-
expect(descriptionEnabled).toContain(importantNote)
62+
// Should contain the important note
63+
const importantNote = "IMPORTANT NOTE: This tool CANNOT be used until you've confirmed"
64+
expect(description).toContain(importantNote)
12365

124-
// Both should contain result parameter
125-
expect(descriptionDisabled).toContain("- result: (required)")
126-
expect(descriptionEnabled).toContain("- result: (required)")
127-
})
66+
// Should contain result parameter
67+
expect(description).toContain("- result: (required)")
12868
})
12969
})
Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,21 @@
1-
import { EXPERIMENT_IDS, experiments } from "../../../shared/experiments"
21
import { ToolArgs } from "./types"
32

43
export function getAttemptCompletionDescription(args?: ToolArgs): string {
5-
// Check if command execution is disabled via experiment
6-
const isCommandDisabled =
7-
args?.experiments && experiments.isEnabled(args.experiments, EXPERIMENT_IDS.DISABLE_COMPLETION_COMMAND)
8-
94
const baseDescription = `## attempt_completion
10-
Description: After each tool use, the user will respond with the result of that tool use, i.e. if it succeeded or failed, along with any reasons for failure. Once you've received the results of tool uses and can confirm that the task is complete, use this tool to present the result of your work to the user.${!isCommandDisabled ? " Optionally you may provide a CLI command to showcase the result of your work." : ""} The user may respond with feedback if they are not satisfied with the result, which you can use to make improvements and try again.
5+
Description: After each tool use, the user will respond with the result of that tool use, i.e. if it succeeded or failed, along with any reasons for failure. Once you've received the results of tool uses and can confirm that the task is complete, use this tool to present the result of your work to the user. The user may respond with feedback if they are not satisfied with the result, which you can use to make improvements and try again.
116
IMPORTANT NOTE: This tool CANNOT be used until you've confirmed from the user that any previous tool uses were successful. Failure to do so will result in code corruption and system failure. Before using this tool, you must ask yourself in <thinking></thinking> tags if you've confirmed from the user that any previous tool uses were successful. If not, then DO NOT use this tool.
127
Parameters:
138
- result: (required) The result of the task. Formulate this result in a way that is final and does not require further input from the user. Don't end your result with questions or offers for further assistance.`
149

15-
const commandParameter = !isCommandDisabled
16-
? `
17-
- command: (optional) A CLI command to execute to show a live demo of the result to the user. For example, use \`open index.html\` to display a created html website, or \`open localhost:3000\` to display a locally running development server. But DO NOT use commands like \`echo\` or \`cat\` that merely print text. This command should be valid for the current operating system. Ensure the command is properly formatted and does not contain any harmful instructions.`
18-
: ""
19-
2010
const usage = `
2111
Usage:
2212
<attempt_completion>
2313
<result>
2414
Your final result description here
25-
</result>${!isCommandDisabled ? "\n<command>Command to demonstrate result (optional)</command>" : ""}
26-
</attempt_completion>`
27-
28-
const example = !isCommandDisabled
29-
? `
30-
31-
Example: Requesting to attempt completion with a result and command
32-
<attempt_completion>
33-
<result>
34-
I've updated the CSS
3515
</result>
36-
<command>open index.html</command>
3716
</attempt_completion>`
38-
: `
17+
18+
const example = `
3919
4020
Example: Requesting to attempt completion with a result
4121
<attempt_completion>
@@ -44,5 +24,5 @@ I've updated the CSS
4424
</result>
4525
</attempt_completion>`
4626

47-
return baseDescription + commandParameter + usage + example
27+
return baseDescription + usage + example
4828
}

0 commit comments

Comments
 (0)