From e0557d64f439b9da0188a7bf1a0fb4096d5314ca Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 3 Jun 2026 17:32:45 +0000 Subject: [PATCH 1/3] fix route slash command handling Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> --- actions/setup/js/route_slash_command.cjs | 23 +++++++++-- actions/setup/js/route_slash_command.test.cjs | 39 +++++++++++++++++-- 2 files changed, 55 insertions(+), 7 deletions(-) diff --git a/actions/setup/js/route_slash_command.cjs b/actions/setup/js/route_slash_command.cjs index cd1ddf59918..9a5693a49f2 100644 --- a/actions/setup/js/route_slash_command.cjs +++ b/actions/setup/js/route_slash_command.cjs @@ -24,11 +24,22 @@ async function appendRoutingSummary(existingCommands, selectedCommand) { .map(command => `/${command.trim()}`) .sort(); - const existingCommandsText = normalizedCommands.length ? normalizedCommands.join(", ") : ""; - const selectedCommandText = selectedCommand ? `/${selectedCommand}` : ""; + const selectedCommandText = selectedCommand ? `\`/${selectedCommand}\`` : ""; + const existingCommandsList = normalizedCommands.map(command => `- \`${command}\``).join("\n"); try { - summary.addHeading("Agentic Commands Router", 3).addRaw(`- Existing commands: ${existingCommandsText}`, true).addEOL().addRaw(`- Selected command: ${selectedCommandText}`, true).addEOL(); + summary + .addHeading("Agentic Commands Router", 3) + .addRaw(`- Selected command: ${selectedCommandText}`, true) + .addEOL() + .addRaw(`- Configured commands: ${normalizedCommands.length}`, true) + .addEOL(); + if (existingCommandsList) { + summary + .addEOL() + .addRaw(`
Configured commands\n\n${existingCommandsList}\n\n
`, true) + .addEOL(); + } await summary.write({ overwrite: false }); } catch (error) { core.warning(`Failed to write centralized routing details to step summary: ${String(error)}`); @@ -286,7 +297,11 @@ function isDisabledWorkflowDispatchError(error) { return false; } - return message.includes("workflow is disabled") || message.includes("workflow was disabled"); + return ( + message.includes("workflow is disabled") || + message.includes("workflow was disabled") || + message.includes("disabled workflow") + ); } async function main() { diff --git a/actions/setup/js/route_slash_command.test.cjs b/actions/setup/js/route_slash_command.test.cjs index 23ad16adaaf..d970e3a8df8 100644 --- a/actions/setup/js/route_slash_command.test.cjs +++ b/actions/setup/js/route_slash_command.test.cjs @@ -160,8 +160,9 @@ describe("route_slash_command", () => { const awContext = JSON.parse(dispatchCalls[0].inputs.aw_context); expect(awContext.command_name).toBe("archie"); expect(awContext.desired_ai_reaction).toBe("eyes"); - expect(summaryMock.addRaw).toHaveBeenCalledWith("- Existing commands: /archie", true); - expect(summaryMock.addRaw).toHaveBeenCalledWith("- Selected command: /archie", true); + expect(summaryMock.addRaw).toHaveBeenCalledWith("- Selected command: `/archie`", true); + expect(summaryMock.addRaw).toHaveBeenCalledWith("- Configured commands: 1", true); + expect(summaryMock.addRaw).toHaveBeenCalledWith("
Configured commands\n\n- `/archie`\n\n
", true); expect(summaryMock.write).toHaveBeenCalledWith({ overwrite: false }); }); @@ -170,8 +171,9 @@ describe("route_slash_command", () => { await main(); - expect(summaryMock.addRaw).toHaveBeenCalledWith("- Existing commands: /archie", true); expect(summaryMock.addRaw).toHaveBeenCalledWith("- Selected command: ", true); + expect(summaryMock.addRaw).toHaveBeenCalledWith("- Configured commands: 1", true); + expect(summaryMock.addRaw).toHaveBeenCalledWith("
Configured commands\n\n- `/archie`\n\n
", true); expect(summaryMock.write).toHaveBeenCalledWith({ overwrite: false }); }); @@ -347,6 +349,37 @@ describe("route_slash_command", () => { expect(globals.core.info).toHaveBeenCalledWith(expect.stringContaining("Skipping workflow 'ci-doctor.lock.yml' because it is disabled.")); }); + it("ignores disabled workflow_dispatch failures for disabled label routes", async () => { + globals.github.rest.actions.createWorkflowDispatch = vi.fn(async params => { + if (params.workflow_id === "smoke-otel-backends.lock.yml") { + throw Object.assign(new Error("Cannot trigger a 'workflow_dispatch' on a disabled workflow"), { + status: 422, + response: { status: 422, data: { message: "Cannot trigger a 'workflow_dispatch' on a disabled workflow" } }, + }); + } + dispatchCalls.push(params); + }); + globals.context.eventName = "pull_request"; + globals.context.payload = { + action: "labeled", + label: { name: "smoke" }, + pull_request: { number: 23 }, + }; + process.env.GH_AW_LABEL_ROUTING = JSON.stringify({ + smoke: [ + { workflow: "smoke-copilot", events: ["pull_request"] }, + { workflow: "smoke-otel-backends", events: ["pull_request"] }, + ], + }); + + await main(); + + expect(dispatchCalls).toHaveLength(1); + expect(dispatchCalls[0].workflow_id).toBe("smoke-copilot.lock.yml"); + expect(globals.core.info).toHaveBeenCalledWith(expect.stringContaining("Skipping workflow 'smoke-otel-backends.lock.yml' because it is disabled.")); + expect(globals.core.info).toHaveBeenCalledWith(expect.stringContaining("Completed decentralized label routing for 'smoke'.")); + }); + it("skips centralized routing when PR is closed at workflow start", async () => { globals.context.eventName = "pull_request"; globals.context.payload = { action: "ready_for_review", pull_request: { number: 12, state: "closed" } }; From 859c500afee158d34654020854a22386f59a8592 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 3 Jun 2026 17:33:18 +0000 Subject: [PATCH 2/3] style: format route slash command changes Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> --- actions/setup/js/route_slash_command.cjs | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/actions/setup/js/route_slash_command.cjs b/actions/setup/js/route_slash_command.cjs index 9a5693a49f2..effe99f1dbe 100644 --- a/actions/setup/js/route_slash_command.cjs +++ b/actions/setup/js/route_slash_command.cjs @@ -28,17 +28,9 @@ async function appendRoutingSummary(existingCommands, selectedCommand) { const existingCommandsList = normalizedCommands.map(command => `- \`${command}\``).join("\n"); try { - summary - .addHeading("Agentic Commands Router", 3) - .addRaw(`- Selected command: ${selectedCommandText}`, true) - .addEOL() - .addRaw(`- Configured commands: ${normalizedCommands.length}`, true) - .addEOL(); + summary.addHeading("Agentic Commands Router", 3).addRaw(`- Selected command: ${selectedCommandText}`, true).addEOL().addRaw(`- Configured commands: ${normalizedCommands.length}`, true).addEOL(); if (existingCommandsList) { - summary - .addEOL() - .addRaw(`
Configured commands\n\n${existingCommandsList}\n\n
`, true) - .addEOL(); + summary.addEOL().addRaw(`
Configured commands\n\n${existingCommandsList}\n\n
`, true).addEOL(); } await summary.write({ overwrite: false }); } catch (error) { @@ -297,11 +289,7 @@ function isDisabledWorkflowDispatchError(error) { return false; } - return ( - message.includes("workflow is disabled") || - message.includes("workflow was disabled") || - message.includes("disabled workflow") - ); + return message.includes("workflow is disabled") || message.includes("workflow was disabled") || message.includes("disabled workflow"); } async function main() { From 448ad572aa7e079551b105a209d5d1b33a9b3edc Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 3 Jun 2026 17:34:22 +0000 Subject: [PATCH 3/3] refine route summary placeholder formatting Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> --- actions/setup/js/route_slash_command.cjs | 2 +- actions/setup/js/route_slash_command.test.cjs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/actions/setup/js/route_slash_command.cjs b/actions/setup/js/route_slash_command.cjs index effe99f1dbe..b89c6daf977 100644 --- a/actions/setup/js/route_slash_command.cjs +++ b/actions/setup/js/route_slash_command.cjs @@ -24,7 +24,7 @@ async function appendRoutingSummary(existingCommands, selectedCommand) { .map(command => `/${command.trim()}`) .sort(); - const selectedCommandText = selectedCommand ? `\`/${selectedCommand}\`` : ""; + const selectedCommandText = selectedCommand ? `\`/${selectedCommand}\`` : "``"; const existingCommandsList = normalizedCommands.map(command => `- \`${command}\``).join("\n"); try { diff --git a/actions/setup/js/route_slash_command.test.cjs b/actions/setup/js/route_slash_command.test.cjs index d970e3a8df8..caa22ffcb73 100644 --- a/actions/setup/js/route_slash_command.test.cjs +++ b/actions/setup/js/route_slash_command.test.cjs @@ -171,7 +171,7 @@ describe("route_slash_command", () => { await main(); - expect(summaryMock.addRaw).toHaveBeenCalledWith("- Selected command: ", true); + expect(summaryMock.addRaw).toHaveBeenCalledWith("- Selected command: ``", true); expect(summaryMock.addRaw).toHaveBeenCalledWith("- Configured commands: 1", true); expect(summaryMock.addRaw).toHaveBeenCalledWith("
Configured commands\n\n- `/archie`\n\n
", true); expect(summaryMock.write).toHaveBeenCalledWith({ overwrite: false });