Repository navigation
fix: encode angle brackets in Markdown work item comments - #1641
Merged
Dan Hellem (danhellem) merged 3 commits intoOct 1, 2026
Merged
Dan Hellem (danhellem) merged 3 commits into
Dan Hellem (danhellem) merged 3 commits into
Conversation
Markdown comments sent through wit_work_item_comment_write lose text inside < and >, for example `<LeftNav />` is stored as an empty code span. The REST API does this when it stores a Markdown comment. microsoft#500 compensated for the same behavior in Markdown fields; comments were not covered. Encode &, < and > once for Markdown comment add and update, after mention resolution. @<GUID> and resolved @<email> mention tokens are kept. HTML-format comments are unchanged. Fixes microsoft#1634 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Contributor
Author
|
@microsoft-github-policy-service agree |
Dan Hellem (danhellem)
approved these changes
Oct 1, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1641 +/- ##
=======================================
Coverage ? 99.91%
=======================================
Files ? 23
Lines ? 2327
Branches ? 721
=======================================
Hits ? 2325
Misses ? 0
Partials ? 2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Contributor
Author
|
Dan Hellem (@danhellem) Thanks for reviewing and merging this :) Is a 2.11.0 release planned soon? We'd like to move our team's setup to a stable version that includes this fix, and we'll use the nightly until then. No rush, I'm just asking so we can plan. |
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.
Follow-up to #1634, as suggested there.
When a Markdown comment is stored, the Azure DevOps REST API drops text inside
<and>. For example,`<LeftNav />`becomes an empty code span. The MCP server is not at fault, but agents often write this text, and the server is the one place that can compensate for all callers. #500 (#508) did the same for Markdown work-item fields withencodeFormattedValue.wit_work_item_comment_writeis the remaining Markdown path on work items without it.The change encodes
&,<and>once for Markdown comment add and update, after mention resolution:@<GUID>tokens and resolved@<email>mentions are kept as mention tokens.@<email>text is encoded like other text.&is also encoded, so an intentional literal entity such as<survives.encodeFormattedValueencodes only<and>. If you prefer the two paths to match, I can switch comments to that helper.GitHub issue number
Fixes #1634
Associated Risks
A caller who puts raw HTML in a Markdown comment now sees it as literal text instead of rendered HTML. This matches the field behavior since #500. Callers who need HTML can use
format: "Html", which is unchanged.✅ PR Checklist
🧪 How did you test it?
npm run build, ESLint and Prettier on the changed files.`<LeftNav />`showed an empty code span, and the same comment with encoded brackets showed<LeftNav />correctly. A live write through the patched build has not been run yet.