Skip to content

Fix: Escape HTML special characters to prevent VSCode crash on Windows #6042

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

roomote[bot]
Copy link

@roomote roomote bot commented Jul 22, 2025

Fixes #6041

This PR implements HTML escaping for all messages sent to the webview to prevent special characters from breaking the webview parser and crashing VSCode on Windows.

Problem

VSCode crashes on Windows when the Roo Code extension attempts to display apply_diff content containing special characters like <<<<<<< SEARCH. These characters are not properly escaped before being sent to the webview.

Solution

  • Created HTML escaping utility (src/utils/htmlEscape.ts)
  • Applied escaping to all ClineMessage content in ClineProvider and Task
  • Added comprehensive tests for the escaping functionality

Testing

  • All new tests pass (15/15)
  • Existing tests continue to pass
  • The specific crash scenario with apply_diff markers is now handled correctly

Important

Implement HTML escaping for webview messages to prevent VSCode crashes on Windows due to unescaped special characters.

  • Behavior:
    • Implement HTML escaping for all messages sent to the webview to prevent VSCode crashes on Windows.
    • Escape applied to ClineMessage content in Task and ClineProvider.
  • Utilities:
    • New utility functions escapeHtml, escapeHtmlInObject, and escapeClineMessage in htmlEscape.ts.
  • Testing:
    • Added tests in htmlEscape.spec.ts to verify escaping functionality for various cases, including special characters and diff markers.

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

- Created htmlEscape utility to convert special characters to HTML entities
- Applied escaping to all ClineMessage content before sending to webview
- Added comprehensive tests for the escaping functionality
- Fixes issue where apply_diff markers containing < and > caused crashes

Fixes #6041
@roomote roomote bot requested review from mrubens, cte and jr as code owners July 22, 2025 03:06
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. bug Something isn't working labels Jul 22, 2025
@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Jul 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working 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.

Once file/code editing starts, vscode crashes and closes immediately
2 participants