Skip to content

fix(safeoutputs): render applyable PR suggestions correctly#1104

Draft
Copilot wants to merge 4 commits into
mainfrom
copilot/add-pr-comment-render-suggestions
Draft

fix(safeoutputs): render applyable PR suggestions correctly#1104
Copilot wants to merge 4 commits into
mainfrom
copilot/add-pr-comment-render-suggestions

Conversation

Copilot AI commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Summary

add-pr-comment was creating inline suggestion threads that Azure DevOps treated as zero-width insertion points, and shared sanitization was escaping </> inside markdown code. The result was non-applyable suggestions and HTML entities being written back into suggested code.

  • Thread anchoring

    • add-pr-comment now anchors inline threads to the full selected line range instead of offset: 1offset: 1.
    • The end offset is computed from the last target line’s UTF-16 length, matching ADO’s thread API semantics for single-line and multi-line suggestions.
  • Markdown-aware sanitization

    • Shared HTML escaping now skips matched inline code spans and fenced code blocks, including ```suggestion bodies.
    • Escaping still applies outside code spans/fences, and unmatched backticks do not disable escaping.
  • Focused coverage

    • Added unit coverage for UTF-16 end-offset calculation, multiline thread spans, fenced suggestion blocks, inline code spans, and unmatched-backtick behavior.
"rightFileStart": { "line": start_line, "offset": 1 },
"rightFileEnd": { "line": end_line, "offset": target_line.encode_utf16().count() as i32 + 1 }

Test plan

Covered by focused unit tests for:

  • inline thread end-offset computation
  • multiline thread anchoring
  • fenced suggestion preservation
  • inline code preservation
  • unmatched-backtick safety

Copilot AI and others added 3 commits June 18, 2026 16:40
Co-authored-by: jamesadevine <4742697+jamesadevine@users.noreply.github.com>
Co-authored-by: jamesadevine <4742697+jamesadevine@users.noreply.github.com>
Co-authored-by: jamesadevine <4742697+jamesadevine@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix rendering of inline threads as applyable suggestions fix(safeoutputs): render applyable PR suggestions correctly Jun 18, 2026
Copilot AI requested a review from jamesadevine June 18, 2026 16:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants