From 14ac4f5a39e8244981d213cc4c5ae4a3b7eba71d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 21 Feb 2026 04:01:23 +0000 Subject: [PATCH 1/2] Initial plan From e9cb8fd401dd66b7bd071058d497b49cf42fcbae Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 21 Feb 2026 04:11:53 +0000 Subject: [PATCH 2/2] fix: use 6-backtick fences in summaries to prevent escaping breakage Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> --- actions/setup/js/log_parser_shared.cjs | 4 +- actions/setup/js/safe_output_summary.cjs | 4 +- actions/setup/js/safe_output_summary.test.cjs | 47 +++++++++++++++++++ 3 files changed, 51 insertions(+), 4 deletions(-) diff --git a/actions/setup/js/log_parser_shared.cjs b/actions/setup/js/log_parser_shared.cjs index b88fc1e5682..e94300d7d65 100644 --- a/actions/setup/js/log_parser_shared.cjs +++ b/actions/setup/js/log_parser_shared.cjs @@ -1524,9 +1524,9 @@ function formatSafeOutputsPreview(safeOutputsContent, options = {}) { preview.push("
"); preview.push("Preview"); preview.push(""); - preview.push("```"); + preview.push("``````"); preview.push(bodyPreview); - preview.push("```"); + preview.push("``````"); preview.push("
"); preview.push(""); } diff --git a/actions/setup/js/safe_output_summary.cjs b/actions/setup/js/safe_output_summary.cjs index 7e3055379be..5b98cf9c1ba 100644 --- a/actions/setup/js/safe_output_summary.cjs +++ b/actions/setup/js/safe_output_summary.cjs @@ -64,7 +64,7 @@ function generateSafeOutputSummary(options) { // Truncate body if too long const maxBodyLength = 500; const bodyPreview = message.body.length > maxBodyLength ? message.body.substring(0, maxBodyLength) + "..." : message.body; - summary += `**Body Preview:**\n\`\`\`\n${bodyPreview}\n\`\`\`\n\n`; + summary += `**Body Preview:**\n\`\`\`\`\`\`\n${bodyPreview}\n\`\`\`\`\`\`\n\n`; } if (message.labels && Array.isArray(message.labels)) { summary += `**Labels:** ${message.labels.join(", ")}\n\n`; @@ -76,7 +76,7 @@ function generateSafeOutputSummary(options) { // Add original message details for debugging if (message) { - summary += `**Message Details:**\n\`\`\`json\n${JSON.stringify(message, null, 2).substring(0, 1000)}\n\`\`\`\n\n`; + summary += `**Message Details:**\n\`\`\`\`\`\`json\n${JSON.stringify(message, null, 2).substring(0, 1000)}\n\`\`\`\`\`\`\n\n`; } } diff --git a/actions/setup/js/safe_output_summary.test.cjs b/actions/setup/js/safe_output_summary.test.cjs index 96a4473413c..02370e41ddf 100644 --- a/actions/setup/js/safe_output_summary.test.cjs +++ b/actions/setup/js/safe_output_summary.test.cjs @@ -104,6 +104,53 @@ describe("safe_output_summary", () => { expect(summary.length).toBeLessThan(longBody.length + 1000); }); + it("should use 6-backtick fences for body content containing backticks", () => { + const bodyWithBackticks = "Here is some code:\n```javascript\nconsole.log('hello');\n```\nEnd of body."; + + const options = { + type: "create_issue", + messageIndex: 1, + success: true, + result: { + repo: "owner/repo", + number: 123, + }, + message: { + title: "Issue with code", + body: bodyWithBackticks, + }, + }; + + const summary = generateSafeOutputSummary(options); + + // Should use 6-backtick fences to avoid breaking when body contains triple backticks + expect(summary).toContain("``````\n"); + expect(summary).toContain("Body Preview"); + expect(summary).toContain("```javascript"); + }); + + it("should use 6-backtick fences for error message details containing backticks", () => { + const messageWithBackticks = { + title: "Test Issue", + body: "Code: ```\nconsole.log('test');\n```", + }; + + const options = { + type: "create_issue", + messageIndex: 1, + success: false, + result: null, + message: messageWithBackticks, + error: "Failed to create issue", + }; + + const summary = generateSafeOutputSummary(options); + + // Should use 6-backtick fences for message details JSON to avoid rendering issues + expect(summary).toContain("``````json\n"); + expect(summary).toContain("Message Details"); + }); + it("should handle project-specific results", () => { const options = { type: "create_project",