Skip to content

Commit 720ec9d

Browse files
authored
🤖 Disable file_edit_replace_lines tool (#219)
Disables the `file_edit_replace_lines` tool by removing it from the available tools list. ## Why This tool frequently causes models (particularly GPT-5-Codex) to leave the repository in a broken state. Models struggle with line-based edits when: - Files are modified concurrently - Line numbers are miscalculated - They don't account for previous edits in the same session ## Changes - Commented out tool creation in `getToolsForModel()` baseTools - Commented out tool name in `getAvailableTools()` list - Commented out import (no longer used) ## Backwards Compatibility Tool definition and implementation remain intact so old history messages continue to render correctly. The tool simply won't be available for new messages. ## Alternatives Models should use: - `file_edit_replace_string` - More reliable, based on exact text matching - `file_edit_insert` - Simpler for adding new content _Generated with `cmux`_
1 parent 3da59b2 commit 720ec9d

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/utils/tools/toolDefinitions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ export function getAvailableTools(modelString: string): string[] {
186186
"bash",
187187
"file_read",
188188
"file_edit_replace_string",
189-
"file_edit_replace_lines",
189+
// "file_edit_replace_lines", // DISABLED: causes models to break repo state
190190
"file_edit_insert",
191191
"propose_plan",
192192
"compact_summary",

src/utils/tools/tools.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { google } from "@ai-sdk/google";
55
import { createFileReadTool } from "@/services/tools/file_read";
66
import { createBashTool } from "@/services/tools/bash";
77
import { createFileEditReplaceStringTool } from "@/services/tools/file_edit_replace_string";
8-
import { createFileEditReplaceLinesTool } from "@/services/tools/file_edit_replace_lines";
8+
// DISABLED: import { createFileEditReplaceLinesTool } from "@/services/tools/file_edit_replace_lines";
99
import { createFileEditInsertTool } from "@/services/tools/file_edit_insert";
1010
import { createProposePlanTool } from "@/services/tools/propose_plan";
1111
import { createCompactSummaryTool } from "@/services/tools/compact_summary";
@@ -45,7 +45,10 @@ export function getToolsForModel(
4545
// Use snake_case for tool names to match what seems to be the convention.
4646
file_read: createFileReadTool(config),
4747
file_edit_replace_string: createFileEditReplaceStringTool(config),
48-
file_edit_replace_lines: createFileEditReplaceLinesTool(config),
48+
// DISABLED: file_edit_replace_lines - causes models (particularly GPT-5-Codex)
49+
// to leave repository in broken state due to issues with concurrent file modifications
50+
// and line number miscalculations. Use file_edit_replace_string or file_edit_insert instead.
51+
// file_edit_replace_lines: createFileEditReplaceLinesTool(config),
4952
file_edit_insert: createFileEditInsertTool(config),
5053
bash: createBashTool(config),
5154
propose_plan: createProposePlanTool(config),

0 commit comments

Comments
 (0)