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 5de66b4908
commit 76bbbac7ff
2 changed files with 44 additions and 6 deletions

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,