bug(core): Fix for "no changes" edits. (#6836)

This commit is contained in:
joshualitt
2025-08-22 10:43:19 -07:00
committed by GitHub
parent f0b9e6d03a
commit e5bc15e5cd
2 changed files with 44 additions and 6 deletions
+17 -6
View File
@@ -204,12 +204,23 @@ class EditToolInvocation implements ToolInvocation<EditToolParams, ToolResult> {
};
}
const newContent = applyReplacement(
currentContent,
finalOldString,
finalNewString,
isNewFile,
);
const newContent = !error
? applyReplacement(
currentContent,
finalOldString,
finalNewString,
isNewFile,
)
: (currentContent ?? '');
if (!error && fileExists && currentContent === newContent) {
error = {
display:
'No changes to apply. The new content is identical to the current content.',
raw: `No changes to apply. The new content is identical to the current content in file: ${params.file_path}`,
type: ToolErrorType.EDIT_NO_CHANGE,
};
}
return {
currentContent,