Skip to content

Conversation

@roomote
Copy link
Contributor

@roomote roomote bot commented Jan 17, 2026

Related GitHub Issue

Closes: #10804

Description

This PR removes the unescapeHtmlEntities function calls from all tool files that write content to files or execute commands. The function was converting HTML entities like ', <, >, &, and " to their character equivalents, which broke HTML, JSX, and TSX files that needed to contain actual HTML entities.

Key changes:

  • Remove unescapeHtmlEntities import and usage from WriteToFileTool.ts
  • Remove unescapeHtmlEntities import and usage from ApplyDiffTool.ts
  • Remove unescapeHtmlEntities import and usage from ExecuteCommandTool.ts
  • Remove unescapeHtmlEntities import and usage from MultiApplyDiffTool.ts
  • Update tests to verify HTML entities are preserved (not converted)
  • Remove obsolete text-normalization mocks from integration tests

This implementation follows the patch provided by @Lissanro in the issue comments, with the additional improvement of adding tests that verify HTML entities are preserved rather than just removing old tests.

Test Procedure

  1. All existing tests continue to pass
  2. New tests added to verify HTML entities are preserved:
    • writeToFileTool.spec.ts: Tests that content like ' and <div> is preserved as-is
    • executeCommandTool.spec.ts: Tests that commands with HTML entities are passed through unchanged
  3. Run tests:
    • cd src && npx vitest run core/tools/tests/writeToFileTool.spec.ts
    • cd src && npx vitest run core/tools/tests/executeCommandTool.spec.ts
    • cd src && npx vitest run core/tools/tests/executeCommandTimeout.integration.spec.ts

Pre-Submission Checklist

  • Issue Linked: This PR is linked to an approved GitHub Issue (see "Related GitHub Issue" above).
  • Scope: My changes are focused on the linked issue (one major feature/fix per PR).
  • Self-Review: I have performed a thorough self-review of my code.
  • Testing: New and/or updated tests have been added to cover my changes (if applicable).
  • Documentation Impact: I have considered if my changes require documentation updates (see "Documentation Updates" section below).
  • Contribution Guidelines: I have read and agree to the Contributor Guidelines.

Documentation Updates

  • No documentation updates are required.

Additional Notes

This is an attempt to address Issue #10804. Feedback and guidance are welcome.

The fix ensures that all models (including open-weight models like K2 Thinking) can properly write HTML entities to files without corruption. The previous behavior was causing syntax errors and agentic loop failures when models tried to write actual HTML entities.


Important

Remove unescapeHtmlEntities to preserve HTML entities in file content and commands, updating tests accordingly.

  • Behavior:
    • Remove unescapeHtmlEntities from WriteToFileTool.ts, ApplyDiffTool.ts, ExecuteCommandTool.ts, and MultiApplyDiffTool.ts to preserve HTML entities in file content and commands.
    • Update tests in writeToFileTool.spec.ts and executeCommandTool.spec.ts to verify HTML entities are preserved.
  • Tests:
    • Remove obsolete text-normalization mocks from executeCommandTimeout.integration.spec.ts.
    • Add tests in writeToFileTool.spec.ts and executeCommandTool.spec.ts to ensure HTML entities are not converted.
  • Misc:
    • Remove unescapeHtmlEntities import from affected files.

This description was created by Ellipsis for 3ec4371. You can customize this summary. It will automatically update as commits are pushed.

Removes unescapeHtmlEntities function calls from all tool files.
This function was converting HTML entities to their character
equivalents, breaking files that needed actual HTML entities.

- Remove unescapeHtmlEntities from WriteToFileTool.ts
- Remove unescapeHtmlEntities from ApplyDiffTool.ts
- Remove unescapeHtmlEntities from ExecuteCommandTool.ts
- Remove unescapeHtmlEntities from MultiApplyDiffTool.ts
- Add tests verifying HTML entities are preserved
- Remove obsolete text-normalization mocks

Fixes #10804
@roomote
Copy link
Contributor Author

roomote bot commented Jan 17, 2026

Rooviewer Clock   See task on Roo Cloud

Review complete. No issues found.

The implementation correctly removes unescapeHtmlEntities calls from all tool files, preserving HTML entities as-is. Test coverage is adequate with new tests verifying entity preservation.

Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Triage

2 participants