From c2d7fa61a1139955bd4f04250bf3d8d4e4b05c5e Mon Sep 17 00:00:00 2001 From: Ammar Date: Mon, 3 Nov 2025 01:56:37 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=A4=96=20refactor:=20make=20file=20edit?= =?UTF-8?q?=20tool=20warnings=20more=20prominent?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Move critical warning to first line with ⚠️ emoji for all file edit tools: - file_edit_replace_string - file_edit_replace_lines - file_edit_insert This addresses the issue where agents stream optimistic text about edits succeeding before tool results return. The prominent warning at the start of the description should help agents check results before proceeding with dependent operations like commits, pushes, or builds. Generated with `cmux` --- src/utils/tools/toolDefinitions.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/utils/tools/toolDefinitions.ts b/src/utils/tools/toolDefinitions.ts index c9fea0587..90746cd84 100644 --- a/src/utils/tools/toolDefinitions.ts +++ b/src/utils/tools/toolDefinitions.ts @@ -70,8 +70,8 @@ export const TOOL_DEFINITIONS = { }, file_edit_replace_string: { description: - "Apply one or more edits to a file by replacing exact text matches. All edits are applied sequentially. Each old_string must be unique in the file unless replace_count > 1 or replace_count is -1. " + - `IMPORTANT: Edits may fail if old_string is not found or not unique. ${TOOL_EDIT_WARNING}`, + "⚠️ CRITICAL: Always check tool results - edits WILL fail if old_string is not found or unique. Do not proceed with dependent operations (commits, pushes, builds) until confirming success.\n\n" + + "Apply one or more edits to a file by replacing exact text matches. All edits are applied sequentially. Each old_string must be unique in the file unless replace_count > 1 or replace_count is -1.", schema: z.object({ file_path: z.string().describe("The absolute path to the file to edit"), old_string: z @@ -91,8 +91,8 @@ export const TOOL_DEFINITIONS = { }, file_edit_replace_lines: { description: - "Replace a range of lines in a file. Use this for line-based edits when you know the exact line numbers to modify. " + - `IMPORTANT: Edits may fail if line numbers are invalid or file content has changed. ${TOOL_EDIT_WARNING}`, + "⚠️ CRITICAL: Always check tool results - edits WILL fail if line numbers are invalid or file content has changed. Do not proceed with dependent operations (commits, pushes, builds) until confirming success.\n\n" + + "Replace a range of lines in a file. Use this for line-based edits when you know the exact line numbers to modify.", schema: z.object({ file_path: z.string().describe("The absolute path to the file to edit"), start_line: z.number().int().min(1).describe("1-indexed start line (inclusive) to replace"),