Skip to content

Commit fffebf1

Browse files
authored
Remove experiment for append block (#2738)
* Remove experiment for append block * Fix bugs in experiment lookups
1 parent b05c310 commit fffebf1

File tree

9 files changed

+63
-282
lines changed

9 files changed

+63
-282
lines changed

src/core/prompts/__tests__/__snapshots__/system.test.ts.snap

Lines changed: 42 additions & 258 deletions
Large diffs are not rendered by default.

src/core/prompts/sections/rules.ts

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,22 @@ function getEditingInstructions(diffStrategy?: DiffStrategy, experiments?: Recor
1313
} else {
1414
availableTools.push("write_to_file (for creating new files or complete file rewrites)")
1515
}
16+
17+
availableTools.push("append_to_file (for appending content to the end of files)")
18+
1619
if (experiments?.["insert_content"]) {
1720
availableTools.push("insert_content (for adding lines to existing files)")
1821
}
19-
if (experiments?.["append_to_file"]) {
20-
availableTools.push("append_to_file (for appending content to the end of files)")
21-
}
2222
if (experiments?.["search_and_replace"]) {
2323
availableTools.push("search_and_replace (for finding and replacing individual pieces of text)")
2424
}
2525

2626
// Base editing instruction mentioning all available tools
2727
if (availableTools.length > 1) {
28-
instructions.push(`- For editing files, you have access to these tools: ${availableTools.join(", ")}.`)
28+
instructions.push(
29+
`- For editing files, you have access to these tools: ${availableTools.join(", ")}.`,
30+
"- The append_to_file tool adds content to the end of files, such as appending new log entries or adding new data records. This tool will always add the content at the end of the file.",
31+
)
2932
}
3033

3134
// Additional details for experimental features
@@ -35,12 +38,6 @@ function getEditingInstructions(diffStrategy?: DiffStrategy, experiments?: Recor
3538
)
3639
}
3740

38-
if (experiments?.["append_to_file"]) {
39-
instructions.push(
40-
"- The append_to_file tool adds content to the end of files, such as appending new log entries or adding new data records. This tool will always add the content at the end of the file.",
41-
)
42-
}
43-
4441
if (experiments?.["search_and_replace"]) {
4542
instructions.push(
4643
"- The search_and_replace tool finds and replaces text or regex in files. This tool allows you to search for a specific regex pattern or text and replace it with another value. Be cautious when using this tool to ensure you are replacing the correct text. It can support multiple operations at once.",

src/core/prompts/tools/index.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,16 @@ export function getToolDescriptionsForMode(
7171
const toolGroup = TOOL_GROUPS[groupName]
7272
if (toolGroup) {
7373
toolGroup.tools.forEach((tool) => {
74-
if (isToolAllowedForMode(tool as ToolName, mode, customModes ?? [], experiments ?? {})) {
74+
if (
75+
isToolAllowedForMode(
76+
tool as ToolName,
77+
mode,
78+
customModes ?? [],
79+
undefined,
80+
undefined,
81+
experiments ?? {},
82+
)
83+
) {
7584
tools.add(tool)
7685
}
7786
})

src/exports/roo-code.d.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,6 @@ type GlobalSettings = {
286286
search_and_replace: boolean
287287
insert_content: boolean
288288
powerSteering: boolean
289-
append_to_file: boolean
290289
}
291290
| undefined
292291
language?:

src/exports/types.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,6 @@ type GlobalSettings = {
289289
search_and_replace: boolean
290290
insert_content: boolean
291291
powerSteering: boolean
292-
append_to_file: boolean
293292
}
294293
| undefined
295294
language?:

src/schemas/index.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ export type CustomSupportPrompts = z.infer<typeof customSupportPromptsSchema>
276276
* ExperimentId
277277
*/
278278

279-
export const experimentIds = ["search_and_replace", "insert_content", "powerSteering", "append_to_file"] as const
279+
export const experimentIds = ["search_and_replace", "insert_content", "powerSteering"] as const
280280

281281
export const experimentIdsSchema = z.enum(experimentIds)
282282

@@ -290,7 +290,6 @@ const experimentsSchema = z.object({
290290
search_and_replace: z.boolean(),
291291
insert_content: z.boolean(),
292292
powerSteering: z.boolean(),
293-
append_to_file: z.boolean(),
294293
})
295294

296295
export type Experiments = z.infer<typeof experimentsSchema>

src/shared/__tests__/experiments.test.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ describe("experiments", () => {
1616
powerSteering: false,
1717
search_and_replace: false,
1818
insert_content: false,
19-
append_to_file: false,
2019
}
2120
expect(Experiments.isEnabled(experiments, EXPERIMENT_IDS.POWER_STEERING)).toBe(false)
2221
})
@@ -26,7 +25,6 @@ describe("experiments", () => {
2625
powerSteering: true,
2726
search_and_replace: false,
2827
insert_content: false,
29-
append_to_file: false,
3028
}
3129
expect(Experiments.isEnabled(experiments, EXPERIMENT_IDS.POWER_STEERING)).toBe(true)
3230
})
@@ -36,7 +34,6 @@ describe("experiments", () => {
3634
search_and_replace: false,
3735
insert_content: false,
3836
powerSteering: false,
39-
append_to_file: false,
4037
}
4138
expect(Experiments.isEnabled(experiments, EXPERIMENT_IDS.POWER_STEERING)).toBe(false)
4239
})

src/shared/experiments.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ export const EXPERIMENT_IDS = {
77
INSERT_BLOCK: "insert_content",
88
SEARCH_AND_REPLACE: "search_and_replace",
99
POWER_STEERING: "powerSteering",
10-
APPEND_BLOCK: "append_to_file",
1110
} as const satisfies Record<string, ExperimentId>
1211

1312
type _AssertExperimentIds = AssertEqual<Equals<ExperimentId, Values<typeof EXPERIMENT_IDS>>>
@@ -22,7 +21,6 @@ export const experimentConfigsMap: Record<ExperimentKey, ExperimentConfig> = {
2221
INSERT_BLOCK: { enabled: false },
2322
SEARCH_AND_REPLACE: { enabled: false },
2423
POWER_STEERING: { enabled: false },
25-
APPEND_BLOCK: { enabled: false },
2624
}
2725

2826
export const experimentDefault = Object.fromEntries(

src/shared/modes.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import * as vscode from "vscode"
22

3-
import { GroupOptions, GroupEntry, ModeConfig, PromptComponent, CustomModePrompts } from "../schemas"
3+
import { GroupOptions, GroupEntry, ModeConfig, PromptComponent, CustomModePrompts, ExperimentId } from "../schemas"
44
import { TOOL_GROUPS, ToolGroup, ALWAYS_AVAILABLE_TOOLS } from "./tools"
55
import { addCustomInstructions } from "../core/prompts/sections/custom-instructions"
6-
6+
import { EXPERIMENT_IDS } from "./experiments"
77
export type Mode = string
88

99
export type { GroupOptions, GroupEntry, ModeConfig, PromptComponent, CustomModePrompts }
@@ -161,8 +161,7 @@ export function isToolAllowedForMode(
161161
if (ALWAYS_AVAILABLE_TOOLS.includes(tool as any)) {
162162
return true
163163
}
164-
165-
if (experiments && tool in experiments) {
164+
if (experiments && Object.values(EXPERIMENT_IDS).includes(tool as ExperimentId)) {
166165
if (!experiments[tool]) {
167166
return false
168167
}

0 commit comments

Comments
 (0)