From 05c962af1f6355a9e300e468787b901bbc67302c Mon Sep 17 00:00:00 2001 From: anthony bushong Date: Wed, 24 Sep 2025 15:19:19 -0700 Subject: [PATCH] fix(core): update edit tool error type during llm judgements (#9510) --- packages/core/src/tools/smart-edit.test.ts | 8 ++++++-- packages/core/src/tools/smart-edit.ts | 4 ++-- packages/core/src/tools/tool-error.ts | 1 + 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/packages/core/src/tools/smart-edit.test.ts b/packages/core/src/tools/smart-edit.test.ts index cba9c4890f..f1bd9f14c6 100644 --- a/packages/core/src/tools/smart-edit.test.ts +++ b/packages/core/src/tools/smart-edit.test.ts @@ -390,8 +390,12 @@ describe('SmartEditTool', () => { const invocation = tool.build(params); const result = await invocation.execute(new AbortController().signal); - expect(result.error?.type).toBe(ToolErrorType.EDIT_NO_CHANGE); - expect(result.llmContent).toMatch(/A secondary check determined/); + expect(result.error?.type).toBe( + ToolErrorType.EDIT_NO_CHANGE_LLM_JUDGEMENT, + ); + expect(result.llmContent).toMatch( + /A secondary check by an LLM determined/, + ); expect(fs.readFileSync(filePath, 'utf8')).toBe(initialContent); // File is unchanged }); diff --git a/packages/core/src/tools/smart-edit.ts b/packages/core/src/tools/smart-edit.ts index cfd48e01f0..3f62301ead 100644 --- a/packages/core/src/tools/smart-edit.ts +++ b/packages/core/src/tools/smart-edit.ts @@ -305,8 +305,8 @@ class EditToolInvocation implements ToolInvocation { isNewFile: false, error: { display: `No changes required. The file already meets the specified conditions.`, - raw: `A secondary check determined that no changes were necessary to fulfill the instruction. Explanation: ${fixedEdit.explanation}. Original error with the parameters given: ${initialError.raw}`, - type: ToolErrorType.EDIT_NO_CHANGE, + raw: `A secondary check by an LLM determined that no changes were necessary to fulfill the instruction. Explanation: ${fixedEdit.explanation}. Original error with the parameters given: ${initialError.raw}`, + type: ToolErrorType.EDIT_NO_CHANGE_LLM_JUDGEMENT, }, originalLineEnding, }; diff --git a/packages/core/src/tools/tool-error.ts b/packages/core/src/tools/tool-error.ts index 8b1c63a0c8..3c1c9a8a77 100644 --- a/packages/core/src/tools/tool-error.ts +++ b/packages/core/src/tools/tool-error.ts @@ -33,6 +33,7 @@ export enum ToolErrorType { EDIT_NO_OCCURRENCE_FOUND = 'edit_no_occurrence_found', EDIT_EXPECTED_OCCURRENCE_MISMATCH = 'edit_expected_occurrence_mismatch', EDIT_NO_CHANGE = 'edit_no_change', + EDIT_NO_CHANGE_LLM_JUDGEMENT = 'edit_no_change_llm_judgement', // Glob-specific Errors GLOB_EXECUTION_ERROR = 'glob_execution_error',