fix: preserve HTML entities in apply_diff tool to avoid false identical content errors #9564
+207
−6
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR attempts to address Issue #9563. Feedback and guidance are welcome.
Problem
The
apply_difftool was incorrectly identifying HTML entities (like') as identical to their decoded characters (like') when processing JSX files. This caused valid diff operations to fail with "Search and replace content are identical" errors, preventing agents from fixing ESLint warnings about unescaped entities.Root Cause
The issue was caused by the
unescapeHtmlEntitiesfunction being applied to diff content for non-Claude models, which converted HTML entities to their literal characters before the comparison. This madedoesn'tanddoesn'tappear identical to the diff strategy.Solution
ApplyDiffTool.tsTesting
applyDiffTool.htmlentities.spec.tsImpact
This fix enables agents to properly escape special characters in JSX files when addressing ESLint warnings about unescaped entities.
Fixes #9563
Important
Fixes HTML entity handling in
apply_difftool to prevent false identical content errors in JSX files.unescapeHtmlEntitieslogic fromApplyDiffTool.tsto preserve HTML entities in diff content.applyDiffTool.htmlentities.spec.tsto test HTML entity handling.This description was created by
for 6609a39. You can customize this summary. It will automatically update as commits are pushed.