Skip to content

Conversation

elianiva
Copy link

@elianiva elianiva commented Oct 4, 2025

Related GitHub Issue

Closes: #8069

Roo Code Task Context (Optional)

Description

This PR adds a new setting to preserve html entities. Previously only Claude models does this, now the user has the option whether to preserve them or not.

Test Procedure

Check the difference when we enable/disable the option

image image

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.

Screenshots / Videos

We have this new setting in the auto-approve section.

image

Documentation Updates

Additional Notes

Get in Touch

@elianiva


Important

Adds a setting to control HTML entity preservation in file edits and commands, with UI updates and tests.

  • Behavior:
    • Adds preserveHtmlEntities boolean setting to control HTML entity preservation in global-settings.ts.
    • Updates applyDiffToolLegacy(), executeCommandTool(), applyDiffTool(), and writeToFileTool() to respect preserveHtmlEntities setting.
    • Claude models always preserve HTML entities regardless of setting.
  • UI:
    • Adds checkbox for preserveHtmlEntities in AutoApproveSettings.tsx and SettingsView.tsx.
    • Updates i18n files for multiple languages to include preserveHtmlEntities setting.
  • Tests:
    • Adds html-entity-preservation.spec.ts to test HTML entity handling.
  • Misc:
    • Updates ClineProvider and webviewMessageHandler to handle preserveHtmlEntities state.

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

@elianiva elianiva requested review from cte, jr and mrubens as code owners October 4, 2025 06:40
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. enhancement New feature or request labels Oct 4, 2025
@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Oct 4, 2025
Copy link

@roomote roomote bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found some issues that need attention:

  • executeCommandTool does not implement the "Claude always preserve" exception that other tools use. This makes behavior inconsistent with the description and could cause unintended unescaping for Claude. See inline comment for a minimal fix.
  • The "Preserve HTML entities" checkbox is only rendered when "Always allow write" is enabled. This setting affects file edits and commands regardless of auto-approve write, so it should be accessible even when auto-approve write is off. See inline note.

Non-blocking suggestion: consider adding integration tests that assert applyDiff/writeToFile/executeCommand honor preserveHtmlEntities across models (Claude vs non-Claude) and both true/false states.

Copy link

@roomote roomote bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found some issues that need attention:

  • SettingsView doesn’t persist the preserveHtmlEntities flag via the Save action. The checkbox posts immediately, which bypasses the Save/Discard flow. Recommend posting this value from handleSubmit as well.
  • The immediate post in AutoApproveSettings causes Save/Discard inconsistency. Consider deferring persistence to Save for consistency.

Copy link

@roomote roomote bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One maintainability suggestion identified; no additional blocking issues beyond existing comments.

// Only unescape HTML entities if:
// 1. The setting is not explicitly set to preserve them, AND
// 2. The model is not Claude (Claude handles entities correctly by default)
if (diffContent && !preserveHtmlEntities && !cline.api.getModel().id.includes("claude")) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P3] The HTML-entity handling condition is duplicated across multiple tools (applyDiffTool, multiApplyDiffTool, writeToFileTool, executeCommandTool). Consider extracting a small shared helper, e.g., shouldUnescapeHtmlEntities({ preserveHtmlEntities, modelId }), to keep behavior consistent and prevent drift.

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

Labels

enhancement New feature or request Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. size:L This PR changes 100-499 lines, ignoring generated files.

Projects

Status: Triage

Development

Successfully merging this pull request may close these issues.

[BUG] Diff/search/replace alters HTML entities (unexpected code changes)

2 participants