From 03b7d1d8640a0f825bc03ec04aee2d531a4eae91 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 13 Jun 2026 14:25:39 +0000 Subject: [PATCH 1/2] Initial plan From f2771564eff55633058499d7ae8207baf9a3d894 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 13 Jun 2026 14:31:06 +0000 Subject: [PATCH 2/2] fix: add noop fallback for smoke copilot workflows when no PR context Update Output sections in all smoke-copilot* workflow prompts to handle schedule/workflow_dispatch triggers gracefully. When the workflow is not triggered by a pull request, the agent now calls `noop` instead of attempting to add a comment/label to a non-existent PR. Fixes the "missing required data: pull request number" error reported when smoke-copilot-byok-aoai-apikey runs on a scheduled trigger. Also adds a test (smoke-copilot-workflow.test.ts) that enforces the noop fallback pattern across all five copilot smoke workflows. --- .../smoke-copilot-byok-aoai-apikey.md | 7 +++-- .../smoke-copilot-byok-aoai-entra.md | 7 +++-- .github/workflows/smoke-copilot-byok.md | 7 +++-- .github/workflows/smoke-copilot-pat.md | 7 +++-- .github/workflows/smoke-copilot.md | 7 +++-- scripts/ci/smoke-copilot-workflow.test.ts | 29 +++++++++++++++++++ 6 files changed, 54 insertions(+), 10 deletions(-) create mode 100644 scripts/ci/smoke-copilot-workflow.test.ts diff --git a/.github/workflows/smoke-copilot-byok-aoai-apikey.md b/.github/workflows/smoke-copilot-byok-aoai-apikey.md index 321804a3a..c9a7fcbd5 100644 --- a/.github/workflows/smoke-copilot-byok-aoai-apikey.md +++ b/.github/workflows/smoke-copilot-byok-aoai-apikey.md @@ -166,11 +166,14 @@ ${{ steps.smoke-data.outputs.SMOKE_PR_DATA }} ## Output -Add a **very brief** comment (max 5-10 lines) to the current pull request with: +**If triggered by a pull request**, call `add_comment` to post a **very brief** comment (max 5-10 lines) on the current pull request with: - PR titles only (no descriptions) - ✅ or ❌ for each test result - Note: "Running in direct BYOK mode (COPILOT_PROVIDER_API_KEY + COPILOT_PROVIDER_BASE_URL) via api-proxy → Azure OpenAI (Foundry, o4-mini-aw)" - Overall status: PASS or FAIL - Mention the pull request author and any assignees -If all tests pass, add the label `smoke-copilot-byok-aoai-apikey` to the pull request. +If all tests pass on a pull request trigger: +- Use the `add_labels` safe-output tool to add the label `smoke-copilot-byok-aoai-apikey` to the pull request + +**If triggered by workflow_dispatch or schedule** (no PR context), call `noop` with a concise PASS/FAIL summary instead. Do NOT attempt to add pull request comments or labels when there is no pull request. diff --git a/.github/workflows/smoke-copilot-byok-aoai-entra.md b/.github/workflows/smoke-copilot-byok-aoai-entra.md index be5c55d59..d3c81348c 100644 --- a/.github/workflows/smoke-copilot-byok-aoai-entra.md +++ b/.github/workflows/smoke-copilot-byok-aoai-entra.md @@ -202,11 +202,14 @@ ${{ steps.smoke-data.outputs.SMOKE_PR_DATA }} ## Output -Add a **very brief** comment (max 5-10 lines) to the current pull request with: +**If triggered by a pull request**, call `add_comment` to post a **very brief** comment (max 5-10 lines) on the current pull request with: - PR titles only (no descriptions) - ✅ or ❌ for each test result - Note: "Running in direct BYOK mode (AWF_AUTH_TYPE=github-oidc + AWF_AUTH_AZURE_* + COPILOT_PROVIDER_BASE_URL) via api-proxy → Azure OpenAI (Foundry, o4-mini-aw) authenticated via Microsoft Entra" - Overall status: PASS or FAIL - Mention the pull request author and any assignees -If all tests pass, add the label `smoke-copilot-byok-aoai-entra` to the pull request. +If all tests pass on a pull request trigger: +- Use the `add_labels` safe-output tool to add the label `smoke-copilot-byok-aoai-entra` to the pull request + +**If triggered by workflow_dispatch or schedule** (no PR context), call `noop` with a concise PASS/FAIL summary instead. Do NOT attempt to add pull request comments or labels when there is no pull request. diff --git a/.github/workflows/smoke-copilot-byok.md b/.github/workflows/smoke-copilot-byok.md index 651f0ad95..c61022cee 100644 --- a/.github/workflows/smoke-copilot-byok.md +++ b/.github/workflows/smoke-copilot-byok.md @@ -156,14 +156,17 @@ You are running in direct BYOK mode right now. The fact that you can read this p ## Output -Add a **very brief** comment (max 5-10 lines) to the current pull request with: +**If triggered by a pull request**, call `add_comment` to post a **very brief** comment (max 5-10 lines) on the current pull request with: - PR titles only (no descriptions) - ✅ or ❌ for each test result - Note: "Running in direct BYOK mode (COPILOT_PROVIDER_API_KEY) via api-proxy → api.githubcopilot.com" - Overall status: PASS or FAIL - Mention the pull request author and any assignees -If all tests pass, add the label `smoke-copilot-byok` to the pull request. +If all tests pass on a pull request trigger: +- Use the `add_labels` safe-output tool to add the label `smoke-copilot-byok` to the pull request + +**If triggered by workflow_dispatch or schedule** (no PR context), call `noop` with a concise PASS/FAIL summary instead. Do NOT attempt to add pull request comments or labels when there is no pull request. ## Pre-Fetched Data diff --git a/.github/workflows/smoke-copilot-pat.md b/.github/workflows/smoke-copilot-pat.md index d7c63914a..2728ff191 100644 --- a/.github/workflows/smoke-copilot-pat.md +++ b/.github/workflows/smoke-copilot-pat.md @@ -134,11 +134,14 @@ ${{ steps.smoke-data.outputs.SMOKE_PR_DATA }} ## Output -Add a **very brief** comment (max 5-10 lines) to the current pull request with: +**If triggered by a pull request**, call `add_comment` to post a **very brief** comment (max 5-10 lines) on the current pull request with: - PR titles only (no descriptions) - ✅ or ❌ for each test result - Overall status: PASS or FAIL - Mention the pull request author and any assignees - Note: "Auth mode: PAT (COPILOT_GITHUB_TOKEN)" -If all tests pass, add the label `smoke-copilot-pat` to the pull request. +If all tests pass on a pull request trigger: +- Use the `add_labels` safe-output tool to add the label `smoke-copilot-pat` to the pull request + +**If triggered by workflow_dispatch or schedule** (no PR context), call `noop` with a concise PASS/FAIL summary instead. Do NOT attempt to add pull request comments or labels when there is no pull request. diff --git a/.github/workflows/smoke-copilot.md b/.github/workflows/smoke-copilot.md index 334c15d70..b6816c4d2 100644 --- a/.github/workflows/smoke-copilot.md +++ b/.github/workflows/smoke-copilot.md @@ -127,10 +127,13 @@ ${{ steps.smoke-data.outputs.SMOKE_PR_DATA }} ## Output -Add a **very brief** comment (max 5-10 lines) to the current pull request with: +**If triggered by a pull request**, call `add_comment` to post a **very brief** comment (max 5-10 lines) on the current pull request with: - PR titles only (no descriptions) - ✅ or ❌ for each test result - Overall status: PASS or FAIL - Mention the pull request author and any assignees -If all tests pass, add the label `smoke-copilot` to the pull request. \ No newline at end of file +If all tests pass on a pull request trigger: +- Use the `add_labels` safe-output tool to add the label `smoke-copilot` to the pull request + +**If triggered by workflow_dispatch or schedule** (no PR context), call `noop` with a concise PASS/FAIL summary instead. Do NOT attempt to add pull request comments or labels when there is no pull request. \ No newline at end of file diff --git a/scripts/ci/smoke-copilot-workflow.test.ts b/scripts/ci/smoke-copilot-workflow.test.ts new file mode 100644 index 000000000..1bcd245f2 --- /dev/null +++ b/scripts/ci/smoke-copilot-workflow.test.ts @@ -0,0 +1,29 @@ +import * as fs from 'fs'; +import * as path from 'path'; + +const workflowsDir = path.resolve(__dirname, '../../.github/workflows'); + +const copilotSmokeWorkflows = [ + { name: 'smoke-copilot-byok-aoai-apikey', file: 'smoke-copilot-byok-aoai-apikey.md' }, + { name: 'smoke-copilot-byok-aoai-entra', file: 'smoke-copilot-byok-aoai-entra.md' }, + { name: 'smoke-copilot-byok', file: 'smoke-copilot-byok.md' }, + { name: 'smoke-copilot', file: 'smoke-copilot.md' }, + { name: 'smoke-copilot-pat', file: 'smoke-copilot-pat.md' }, +]; + +describe('smoke copilot workflow output requirements', () => { + for (const workflow of copilotSmokeWorkflows) { + it(`${workflow.name}: requires noop fallback when no pull request context exists`, () => { + const source = fs.readFileSync(path.join(workflowsDir, workflow.file), 'utf-8'); + + expect(source).toContain('**If triggered by a pull request**, call `add_comment`'); + expect(source).toContain('If all tests pass on a pull request trigger:'); + expect(source).toContain( + '**If triggered by workflow_dispatch or schedule** (no PR context), call `noop`' + ); + expect(source).toContain( + 'Do NOT attempt to add pull request comments or labels when there is no pull request.' + ); + }); + } +});