fix(core): update edit tool error type during llm judgements (#9510)

This commit is contained in:
anthony bushong
2025-09-24 15:19:19 -07:00
committed by GitHub
parent 74447fcff2
commit 05c962af1f
3 changed files with 9 additions and 4 deletions

View File

@@ -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
});

View File

@@ -305,8 +305,8 @@ class EditToolInvocation implements ToolInvocation<EditToolParams, ToolResult> {
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,
};

View File

@@ -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',