fix: remove HTML entity unescaping from tool content processing#12265
Draft
roomote-v0[bot] wants to merge 1 commit intomainfrom
Draft
fix: remove HTML entity unescaping from tool content processing#12265roomote-v0[bot] wants to merge 1 commit intomainfrom
roomote-v0[bot] wants to merge 1 commit intomainfrom
Conversation
Removes unescapeHtmlEntities() calls from ApplyDiffTool, WriteToFileTool, and ExecuteCommandTool. Since all tool calls now use native JSON parsing, HTML entities in parsed content are intentional (e.g. Go code doing HTML escaping) rather than encoding artifacts. The lossy unescaping was causing apply_diff failures and file content corruption when working with code that legitimately contains HTML entities. Fixes #12264
|
Works very well now, apply_diff executed correctly on the first try extracting duplicated code with HTML entities! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Related GitHub Issue
Closes: #12264
Description
This PR attempts to address Issue #12264. Feedback and guidance are welcome.
Root cause: The
unescapeHtmlEntities()function was called unconditionally on tool content for non-Claude models inApplyDiffTool.ts,WriteToFileTool.ts, andExecuteCommandTool.ts. This was originally added to handle XML-based tool calls where HTML entities were encoding artifacts. However, since Roo Code now exclusively uses native JSON tool calls, HTML entities in parsed content are intentional literal strings (e.g., Go code doing HTML escaping likestrings.ReplaceAll(htmlText, "&", "&")) rather than encoding artifacts.Changes:
unescapeHtmlEntities()call fromApplyDiffTool.tsunescapeHtmlEntities()call fromWriteToFileTool.tsunescapeHtmlEntities()call fromExecuteCommandTool.tsunescapeHtmlEntitiesavailable intext-normalization.ts(no deletion) since it may still be useful for other contextsTest Procedure
npx vitest runfor all three affected test files (executeCommandTool.spec.ts, writeToFileTool.spec.ts, text-normalization.spec.ts) -- all 49 tests passturbo lintandturbo check-types)&,<,>) and confirm they are preserved as-isPre-Submission Checklist
Documentation Updates
No documentation updates needed. This is a bug fix that removes incorrect HTML entity unescaping from tool content processing.
Interactively review PR in Roo Code Cloud