From a6afcdd706be0d11861a2bc43a80cb143992910d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 29 Jun 2026 18:02:34 +0000 Subject: [PATCH 1/3] Initial plan From 6d6370d5df91d57c1694cb49dd796a9b2aa78944 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 29 Jun 2026 18:10:59 +0000 Subject: [PATCH 2/3] Plan mention sanitizer fix Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> --- .../agentic-workflows-dashboard/dashboard-cli.mjs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/extensions/agentic-workflows-dashboard/dashboard-cli.mjs b/.github/extensions/agentic-workflows-dashboard/dashboard-cli.mjs index b61fddf1bde..4def562f138 100644 --- a/.github/extensions/agentic-workflows-dashboard/dashboard-cli.mjs +++ b/.github/extensions/agentic-workflows-dashboard/dashboard-cli.mjs @@ -29,12 +29,18 @@ function spawnExecFile(file, args, options, callback) { proc.stdout.on("data", chunk => { stdoutLen += chunk.length; - if (stdoutLen > maxBuffer) { overflowed = true; return; } + if (stdoutLen > maxBuffer) { + overflowed = true; + return; + } stdoutChunks.push(chunk); }); proc.stderr.on("data", chunk => { stderrLen += chunk.length; - if (stderrLen > maxBuffer) { overflowed = true; return; } + if (stderrLen > maxBuffer) { + overflowed = true; + return; + } stderrChunks.push(chunk); }); From 378b8e6c1006cedefde9d2132cc5f3b9c7450926 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 29 Jun 2026 18:13:43 +0000 Subject: [PATCH 3/3] Honor resolved add-comment mentions Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> --- actions/setup/js/add_comment.cjs | 4 ++- actions/setup/js/add_comment.test.cjs | 36 +++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/actions/setup/js/add_comment.cjs b/actions/setup/js/add_comment.cjs index 16ce9cd0c1e..7f85c86c74d 100644 --- a/actions/setup/js/add_comment.cjs +++ b/actions/setup/js/add_comment.cjs @@ -435,6 +435,8 @@ async function main(config = {}) { const requiredLabels = Array.isArray(config.required_labels) ? config.required_labels : []; const requiredTitlePrefix = config.required_title_prefix || ""; const mentionsDisabled = config.mentions === false || config.mentions?.enabled === false; + const preResolvedMentionAliases = + !mentionsDisabled && Array.isArray(config.allowedMentionAliases) ? config.allowedMentionAliases.map(alias => (typeof alias === "string" ? alias.trim().replace(/^@+/, "") : "")).filter(alias => alias.length > 0) : []; const configuredMentionAliases = !mentionsDisabled && Array.isArray(config.mentions?.allowed) ? config.mentions.allowed.map(alias => (typeof alias === "string" ? alias.trim().replace(/^@+/, "") : "")).filter(alias => alias.length > 0) : []; @@ -656,7 +658,7 @@ async function main(config = {}) { } } } - const allowedMentionAliases = deduplicateCaseInsensitive([...parentAuthors, ...configuredMentionAliases]); + const allowedMentionAliases = deduplicateCaseInsensitive([...parentAuthors, ...preResolvedMentionAliases, ...configuredMentionAliases]); if (allowedMentionAliases.length > 0) { core.info(`[MENTIONS] Allowing aliases in comment: ${allowedMentionAliases.join(", ")}`); diff --git a/actions/setup/js/add_comment.test.cjs b/actions/setup/js/add_comment.test.cjs index 82a9541e4b3..400fd851dba 100644 --- a/actions/setup/js/add_comment.test.cjs +++ b/actions/setup/js/add_comment.test.cjs @@ -2849,6 +2849,42 @@ describe("add_comment", () => { expect(capturedBody).not.toContain("`@copilot`"); }); + it("should preserve pre-resolved allowed mentions from handler manager", async () => { + const addCommentScript = fs.readFileSync(path.join(__dirname, "add_comment.cjs"), "utf8"); + + mockContext.payload = { + pull_request: { + number: 8535, + user: { login: "PRAuthor", type: "User" }, + }, + }; + + let capturedBody = null; + mockGithub.rest.issues.createComment = async params => { + capturedBody = params.body; + return { + data: { + id: 12345, + html_url: "https://github.com/owner/repo/issues/8535#issuecomment-12345", + }, + }; + }; + + const handler = await eval(`(async () => { ${addCommentScript}; return await main({ mentions: { allowedTeams: ["myorg/eng"] }, allowedMentionAliases: ["TeamMate"] }); })()`); + + const message = { + type: "add_comment", + body: "@TeamMate thanks for taking a look", + }; + + const result = await handler(message, {}); + + expect(result.success).toBe(true); + expect(capturedBody).toBeDefined(); + expect(capturedBody).toContain("@TeamMate"); + expect(capturedBody).not.toContain("`@TeamMate`"); + }); + it("should escape all mentions when mentions.enabled is false", async () => { const addCommentScript = fs.readFileSync(path.join(__dirname, "add_comment.cjs"), "utf8");