Skip to content

fix: use 6-backtick fences in summaries to prevent escaping breakage#17384

Merged
pelikhan merged 2 commits intomainfrom
copilot/fix-summary-escaping
Feb 21, 2026
Merged

fix: use 6-backtick fences in summaries to prevent escaping breakage#17384
pelikhan merged 2 commits intomainfrom
copilot/fix-summary-escaping

Conversation

Copy link
Contributor

Copilot AI commented Feb 21, 2026

Step summaries broke when safe-output body content (issue/PR bodies, error details) contained triple-backtick code fences — the inner ``` prematurely closed the outer fence, leaking raw content including XML-like tags into the rendered summary.

Changes

  • safe_output_summary.cjs: Change 3→6 backtick fences for body preview and message details JSON
  • log_parser_shared.cjs: Change 3→6 backtick fences for safe-outputs body preview
  • safe_output_summary.test.cjs: Add tests for body content containing triple backticks

Before / After

// Before — breaks if bodyPreview contains ```
summary += `**Body Preview:**\n\`\`\`\n${bodyPreview}\n\`\`\`\n\n`;

// After — matches the existing pattern already used in log_parser_shared.cjs
summary += `**Body Preview:**\n\`\`\`\`\`\`\n${bodyPreview}\n\`\`\`\`\`\`\n\n`;

The 6-backtick convention was already established in log_parser_shared.cjs (line 962: "Use 6 backticks to avoid conflicts with content that may contain 3 or 5 backticks"); these changes bring the remaining callsites in line with it.

Original prompt

This section details on the original issue you should resolve

<issue_title>Summary Escaping Broken</issue_title>
<issue_description>The ./actions/setup/md/markdown.md looks like this

<markdown-generation>
<instruction>When generating markdown text, use 4 backticks instead of 3 to avoid creating unbalanced code regions where the text looks broken because the code regions are opening and closing out of sync. Use GitHub Flavored Markdown.</instruction>
<example>
<correct>
````markdown
# Example
```javascript
console.log('hello');
```
````
</correct>
<incorrect>
```markdown
# Example
```javascript
console.log('hello');
```
```
</incorrect>
</example>
</markdown-generation>

I believe that the first triple backtick after the last console.log('hello'); closes the entire block and then that leaves a stray hanging ```

Image

which results in broken summary formatting</issue_description>

Comments on the Issue (you are @copilot in this section)


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix summary escaping issue in markdown generation fix: use 6-backtick fences in summaries to prevent escaping breakage Feb 21, 2026
@pelikhan pelikhan marked this pull request as ready for review February 21, 2026 04:23
Copilot AI review requested due to automatic review settings February 21, 2026 04:23
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a markdown rendering bug where content containing triple backticks would break GitHub Actions step summaries by prematurely closing outer code fences.

Changes:

  • Updated code fence delimiters from 3 to 6 backticks in summary generation functions
  • Added test coverage for content containing triple backticks
  • Aligned all callsites with the existing 6-backtick convention established in log_parser_shared.cjs

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
actions/setup/js/safe_output_summary.cjs Changed body preview and message details code fences from 3 to 6 backticks
actions/setup/js/log_parser_shared.cjs Changed safe-outputs body preview code fences from 3 to 6 backticks
actions/setup/js/safe_output_summary.test.cjs Added tests for body content and error messages containing triple backticks

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@pelikhan pelikhan merged commit 26b6572 into main Feb 21, 2026
118 checks passed
@pelikhan pelikhan deleted the copilot/fix-summary-escaping branch February 21, 2026 04:38
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.

Summary Escaping Broken

3 participants