Skip to content

fix: skip detection job at job-level when agent produces no outputs or patch#23185

Merged
pelikhan merged 4 commits intomainfrom
copilot/skip-detection-job-when-nothing-to-detect
Mar 27, 2026
Merged

fix: skip detection job at job-level when agent produces no outputs or patch#23185
pelikhan merged 4 commits intomainfrom
copilot/skip-detection-job-when-nothing-to-detect

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 26, 2026

When threat detection is enabled and the agent produces no outputs and no patch, the detection job was still running, exiting success, and triggering safe_outputs unnecessarily. The root cause: the job-level if: only skipped when the agent was skipped — not when it ran but produced nothing.

Changes

  • threat_detection.go — Add output_types and has_patch guards to the detection job-level condition using the expression builder. The job now gets result skipped (not success) when there's nothing to detect:

    # before
    if: always() && needs.agent.result != 'skipped'
    
    # after
    if: always() && needs.agent.result != 'skipped' && (needs.agent.outputs.output_types != '' || needs.agent.outputs.has_patch == 'true')

    With detection truly skipped, safe_outputs (gated on needs.detection.result == 'success') is correctly skipped too — no code change needed there.

  • cache.goupdate_cache_memory condition updated to accept skipped detection result so cache updates still run when detection was skipped:

    if: always() && (needs.detection.result == 'success' || needs.detection.result == 'skipped')
  • repo_memory.go — Same treatment for push_repo_memory.

  • threat_detection_test.go — Added TestDetectionJobLevelCondition asserting the generated job if: includes always(), agent-not-skipped, output_types, and has_patch checks.

  • All 178 lock files recompiled.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/graphql
    • Triggering command: /usr/bin/gh /usr/bin/gh api graphql -f query=query($owner: String!, $name: String!) { repository(owner: $owner, name: $name) { hasDiscussionsEnabled } } -f owner=github -f name=gh-aw (http block)
    • Triggering command: /usr/bin/gh /usr/bin/gh api graphql -f query=query($owner: String!, $name: String!) { repository(owner: $owner, name: $name) { hasDiscussionsEnabled } } -f owner=github -f name=gh-aw g/workflow (http block)
    • Triggering command: /usr/bin/gh /usr/bin/gh api graphql -f query=query($owner: String!, $name: String!) { repository(owner: $owner, name: $name) { hasDiscussionsEnabled } } -f owner=github -f name=gh-aw ota=5% yHigh=170M 64/pkg/tool/linux_amd64/vet conf�� -2.15.1.3-py3.12.egg cfg 64/pkg/tool/linux_amd64/vet (http block)
  • https://api.github.com/orgs/test-owner/actions/secrets
    • Triggering command: /usr/bin/gh gh api /orgs/test-owner/actions/secrets --jq .secrets[].name -json GO111MODULE /sh GOINSECURE GOMOD GOMODCACHE go env ath ../../../.pr**/*.json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/actions/ai-inference/git/ref/tags/v1
    • Triggering command: /usr/bin/gh gh api /repos/actions/ai-inference/git/ref/tags/v1 --jq .object.sha /home/REDACTED/work/gh-aw/gh-aw/.github/workflows/agent-performance-analyzer.md go /usr/bin/git -json GO111MODULE 64/bin/go git rev-�� --show-toplevel u1NbgiD/uvljh3C4Test User /usr/bin/infocmp -json GO111MODULE 64/bin/go infocmp (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/ai-inference/git/ref/tags/v1 --jq .object.sha --show-toplevel git 1506630/b123/vet.cfg --show-toplevel go /usr/bin/git git rev-�� --show-toplevel git /opt/hostedtoolcache/go/1.25.0/x64/pkg/tool/linux_amd64/link --show-toplevel go /usr/bin/git /opt/hostedtoolcache/go/1.25.0/x64/pkg/tool/linux_amd64/link (http block)
  • https://api.github.com/repos/actions/checkout/git/ref/tags/v3
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v3 --jq .object.sha GOMODCACHE go ache/node/24.14.0/x64/bin/node -json GO111MODULE 64/bin/go git t-21�� bility_SameInputSameOutput2689134441/001/stability-test.md go /usr/bin/git -json GO111MODULE 64/bin/go git (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v3 --jq .object.sha --show-toplevel git 64/pkg/tool/linux_amd64/vet --show-toplevel go /usr/bin/git 64/pkg/tool/linux_amd64/vet rev-�� --show-toplevel git /usr/bin/git --show-toplevel go /usr/bin/git git (http block)
  • https://api.github.com/repos/actions/checkout/git/ref/tags/v5
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v5 --jq .object.sha */*.ts' '**/*.json' --ignore-path ../../../.prettierignore GO111MODULE ache/go/1.25.0/x64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE 64/pkg/tool/linux_amd64/link GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linux_amd64/link (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v5 --jq .object.sha --show-toplevel go /usr/bin/git -json GO111MODULE x_amd64/link git rev-�� --show-toplevel x_amd64/link /usr/bin/git -json GO111MODULE ache/go/1.25.0/x--show-toplevel git (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v5 --jq .object.sha --show-toplevel go /usr/bin/git /ref/tags/v8 GO111MODULE bin/bash git rev-�� --show-toplevel go /usr/bin/git -json GO111MODULE ache/go/1.25.0/x--show-toplevel git (http block)
  • https://api.github.com/repos/actions/checkout/git/ref/tags/v6
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v6 --jq .object.sha /tmp/TestCompileErrorFormatting1237436283/001 rev-parse /usr/bin/git -json GO111MODULE 64/bin/go git chec�� .github/workflows/test.md go (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v6 --jq .object.sha -unreachable=false resolved$ /usr/bin/git -json GO111MODULE 64/bin/go git remo�� remove origin /usr/bin/git -json GO111MODULE 64/bin/go git (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v6 --jq .object.sha --show-toplevel go /usr/bin/git -json GO111MODULE ache/uv/0.11.2/x--show-toplevel git rev-�� --show-toplevel go /usr/bin/git -json GO111MODULE ash git (http block)
  • https://api.github.com/repos/actions/github-script/git/ref/tags/v8
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v8 --jq .object.sha -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v8 --jq .object.sha -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go /pre�� -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v8 --jq .object.sha ath ../../../.pr**/*.json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env re GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/actions/setup-go/git/ref/tags/v4
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-go/git/ref/tags/v4 --jq .object.sha --show-toplevel -tests /usr/bin/git -json GO111MODULE 64/bin/go git remo�� add origin /usr/bin/git -json GO111MODULE 64/bin/go git (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-go/git/ref/tags/v4 --jq .object.sha (http block)
  • https://api.github.com/repos/actions/setup-node/git/ref/tags/v4
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-node/git/ref/tags/v4 --jq .object.sha -unreachable=false /tmp/go-build3610364913/b113/vet.cfg /usr/bin/git -json GO111MODULE 64/bin/go git init�� GOMODCACHE go /opt/hostedtoolcache/node/24.14.0/x64/bin/node -json GO111MODULE 64/bin/go node (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-node/git/ref/tags/v4 --jq .object.sha _path=\(.*;\)\?\(.*\)$/\2/p git /usr/bin/git --show-toplevel 64/pkg/tool/linurev-parse /usr/bin/git git rev-�� --show-toplevel git /usr/bin/git --show-toplevel go /usr/bin/git git (http block)
  • https://api.github.com/repos/actions/upload-artifact/git/ref/tags/v4
    • Triggering command: /usr/bin/gh gh api /repos/actions/upload-artifact/git/ref/tags/v4 --jq .object.sha -json GO111MODULE /opt/hostedtoolcache/go/1.25.0/x64/bin/node GOINSECURE GOMOD GOMODCACHE node /hom�� --check **/*.cjs /usr/bin/tail **/*.json --ignore-path run-script/lib/n--show-toplevel tail (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/upload-artifact/git/ref/tags/v4 --jq .object.sha --show-toplevel git /usr/bin/git --show-toplevel XFjOiSQ6baL5 /usr/bin/git git conf�� user.email test@example.com /usr/bin/git --git-dir go /tmp/go-build361--show-toplevel git (http block)
  • https://api.github.com/repos/astral-sh/setup-uv/git/ref/tags/eac588ad8def6316056a12d4907a9d4d84ff7a3b
    • Triggering command: /usr/bin/gh gh api /repos/astral-sh/setup-uv/git/ref/tags/eac588ad8def6316056a12d4907a9d4d84ff7a3b --jq .object.sha get --local x_amd64/vet pull.rebase (http block)
  • https://api.github.com/repos/github/gh-aw
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw --jq .visibility th .prettierignore --log-level=e!../../../pkg/workflow/js/**/*.json cfg 64/pkg/tool/linux_amd64/vet (http block)
  • https://api.github.com/repos/github/gh-aw-actions/git/ref/tags/v0
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw-actions/git/ref/tags/v0 --jq .object.sha get --local x_amd64/vet pull.rebase (http block)
  • https://api.github.com/repos/github/gh-aw-actions/git/ref/tags/v0.1.2
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw-actions/git/ref/tags/v0.1.2 --jq .object.sha -test.paniconexit0 -test.v=true /usr/bin/git -test.timeout=10git -test.run=^Test -test.short=true--show-toplevel git -C /tmp/gh-aw-test-runs/20260327-000643-39877/test-2949042737 rev-parse /opt/hostedtoolcache/node/24.14.0/x64/bin/node @{u} GO111MODULE es/.bin/sh node (http block)
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw-actions/git/ref/tags/v0.1.2 --jq .object.sha --show-toplevel git /usr/bin/git --show-toplevel 64/pkg/tool/linurev-parse /usr/bin/git git rev-�� nt/action/git/ref/tags/v999.999.999 git /usr/bin/git --show-toplevel go /usr/bin/git git (http block)
  • https://api.github.com/repos/github/gh-aw-actions/git/ref/tags/v1.0.0
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw-actions/git/ref/tags/v1.0.0 --jq .object.sha 0643-39877/test-2949042737 lint:cjs g_.a GOSUMDB GOWORK 64/bin/go sh -c "prettier" --check 'scripts/**/*.js' --ignore-path .prettierignore l 0/x64/bin/node -json GO111MODULE 64/bin/go 0/x64/bin/node (http block)
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw-actions/git/ref/tags/v1.0.0 --jq .object.sha --show-toplevel git /usr/bin/mkdir --show-toplevel go /usr/bin/git mkdir -p /tmp/gh-aw git /usr/bin/git --show-toplevel go /usr/bin/git git (http block)
  • https://api.github.com/repos/github/gh-aw-actions/git/ref/tags/v1.2.3
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw-actions/git/ref/tags/v1.2.3 --jq .object.sha runs/20260327-000643-39877/test-4083800840/.github/workflows lint:cjs /node_modules/.bin/sh GOSUMDB GOWORK 64/bin/go sh -c k/gh-aw/gh-aw/.github/workflows go ache/go/1.25.0/x64/pkg/tool/linux_amd64/compile -json GO111MODULE 64/bin/go ache/go/1.25.0/x64/pkg/tool/linux_amd64/compile (http block)
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw-actions/git/ref/tags/v1.2.3 --jq .object.sha --show-toplevel git /usr/bin/grep user.email test@example.comrev-parse /usr/bin/git grep -qE "type"[[:space:]]*:[[:space:]]*"(create_pull_request|push_to_pull_request_branch)" git /usr/bin/git --show-toplevel go /usr/bin/git git (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs/1/artifacts
    • Triggering command: /usr/bin/gh gh run download 1 --dir test-logs/run-1 GO111MODULE x_amd64/link GOINSECURE GOMOD GOMODCACHE x_amd64/link env -json GO111MODULE tions/setup/js/node_modules/.bin-nolocalimports GOINSECURE GOMOD GOMODCACHE ef/N6GE9dzJuLpfUe9tz4e_/ThKvzodBlPIPkS6j74YO (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs/12345/artifacts
    • Triggering command: /usr/bin/gh gh run download 12345 --dir test-logs/run-12345 GO111MODULE x_amd64/vet GOINSECURE GOMOD GOMODCACHE x_amd64/vet env -json GO111MODULE tions/node_modules/.bin/node GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs/12346/artifacts
    • Triggering command: /usr/bin/gh gh run download 12346 --dir test-logs/run-12346 GO111MODULE x_amd64/vet GOINSECURE GOMOD GOMODCACHE x_amd64/vet env -json GO111MODULE tions/setup/node_modules/.bin/node GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs/2/artifacts
    • Triggering command: /usr/bin/gh gh run download 2 --dir test-logs/run-2 GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go estl�� -json GO111MODULE ules/.bin/node GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs/3/artifacts
    • Triggering command: /usr/bin/gh gh run download 3 --dir test-logs/run-3 GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE tions/setup/node_modules/.bin/node GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs/4/artifacts
    • Triggering command: /usr/bin/gh gh run download 4 --dir test-logs/run-4 GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE de_modules/.bin/node GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs/5/artifacts
    • Triggering command: /usr/bin/gh gh run download 5 --dir test-logs/run-5 GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE tions/node_modules/.bin/node GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/github/gh-aw/actions/workflows
    • Triggering command: /usr/bin/gh gh workflow list --json name,state,path -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env ath ../../../.pr**/*.json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh run list --json databaseId,number,url,status,conclusion,workflowName,createdAt,startedAt,updatedAt,event,headBranch,headSha,displayTitle --workflow nonexistent-workflow-12345 --limit 100 GOMOD GOMODCACHE go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh run list --json databaseId,number,url,status,conclusion,workflowName,createdAt,startedAt,updatedAt,event,headBranch,headSha,displayTitle --workflow nonexistent-workflow-12345 --limit 6 GOMOD GOMODCACHE x_amd64/vet env -json GO111MODULE ache/go/1.25.0/x64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/github/gh-aw/git/ref/tags/v0.47.4
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v0.47.4 --jq .object.sha --show-toplevel x_amd64/compile /usr/bin/git -json GO111MODULE tions/setup/node--show-toplevel git rev-�� --show-toplevel go /usr/bin/git y_with_repos=pubsed GO111MODULE 64/bin/node git (http block)
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v0.47.4 --jq .object.sha --show-toplevel git /usr/bin/git --show-toplevel sh /usr/bin/git git rev-�� --show-toplevel git /usr/bin/git --show-toplevel sh /usr/bin/git git (http block)
  • https://api.github.com/repos/github/gh-aw/git/ref/tags/v1.0.0
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v1.0.0 --jq .object.sha -json GO111MODULE ules/.bin/node GOINSECURE GOMOD GOMODCACHE go 0/x6�� y_with_repos_array_c4185878860/001 GO111MODULE ache/go/1.25.0/x64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v1.0.0 --jq .object.sha --show-toplevel sh /usr/bin/git runs/20260327-00git GOPROXY 0364913/b395/vet--show-toplevel git rev-�� --show-toplevel node /usr/bin/git --check scripts/**/*.js ache/node/24.14.-t git (http block)
  • https://api.github.com/repos/github/gh-aw/git/ref/tags/v1.2.3
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v1.2.3 --jq .object.sha h ../../../.pret.prettierignore GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/github/gh-aw/git/ref/tags/v2.0.0
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v2.0.0 --jq .object.sha h ../../../.pret.prettierignore GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v2.0.0 --jq .object.sha h ../../../.prettierignore GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v2.0.0 --jq .object.sha -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/github/gh-aw/git/ref/tags/v3.0.0
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v3.0.0 --jq .object.sha h ../../../.pret.prettierignore GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/githubnext/agentics/git/ref/tags/
    • Triggering command: /usr/bin/gh gh api /repos/githubnext/agentics/git/ref/tags/# --jq .object.sha js/**/*.json' --ignore-path ../../../.prettierignore user.email 64/pkg/tool/linux_amd64/vet (http block)
  • https://api.github.com/repos/nonexistent/action/git/ref/tags/v999.999.999
    • Triggering command: /usr/bin/gh gh api /repos/nonexistent/action/git/ref/tags/v999.999.999 --jq .object.sha ty-test.md GO111MODULE ode GOINSECURE GOMOD GOMODCACHE go 0/x6�� ithout_min-integrity1487207019/001 GO111MODULE x_amd64/compile GOINSECURE GOMOD GOMODCACHE x_amd64/compile (http block)
    • Triggering command: /usr/bin/gh gh api /repos/nonexistent/action/git/ref/tags/v999.999.999 --jq .object.sha --show-toplevel sh /usr/bin/git npx prettier --cgit GOPROXY o.git git rev-�� --show-toplevel node /usr/bin/git --check scripts/**/*.js 0/x64/bin/node git (http block)
  • https://api.github.com/repos/nonexistent/repo/actions/runs/12345
    • Triggering command: /usr/bin/gh gh run view 12345 --repo nonexistent/repo --json status,conclusion GOINSECURE GOMOD GOMODCACHE go 0/x6�� 4083800840/.github/workflows GO111MODULE ache/go/1.25.0/x64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/owner/repo/actions/workflows
    • Triggering command: /usr/bin/gh gh workflow list --json name,state,path --repo owner/repo 64/bin/go GOINSECURE GOMOD GOMODCACHE go env ath ../../../.pr**/*.json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/owner/repo/contents/file.md
    • Triggering command: /tmp/go-build3610364913/b403/cli.test /tmp/go-build3610364913/b403/cli.test -test.testlogfile=/tmp/go-build3610364913/b403/testlog.txt -test.paniconexit0 -test.v=true -test.parallel=4 -test.timeout=10m0s -test.run=^Test -test.short=true GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE de GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/test-owner/test-repo/actions/secrets
    • Triggering command: /usr/bin/gh gh api /repos/test-owner/test-repo/actions/secrets --jq .secrets[].name -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)

If you need me to access, download, or install something from one of these locations, you can either:


⌨️ Start Copilot coding agent tasks without leaving your editor — available in VS Code, Visual Studio, JetBrains IDEs and Eclipse.



✨ PR Review Safe Output Test - Run 23625669367

Note

🔒 Integrity filter blocked 2 items

The following items were blocked because they don't meet the GitHub integrity level.

To allow these resources, lower min-integrity in your GitHub frontmatter:

tools:
  github:
    min-integrity: approved  # merged | approved | unapproved | none

💥 [THE END] — Illustrated by Smoke Claude ·


Changeset

  • Type: patch
  • Description: Skip running threat detection and downstream safe outputs when the agent emits no outputs and no patch, while still allowing cache and repo memory updates when detection is skipped.

Generated by Changeset Generator for issue #23185 ·



✨ PR Review Safe Output Test - Run 23648454152

Note

🔒 Integrity filter blocked 1 item

The following item were blocked because they don't meet the GitHub integrity level.

To allow these resources, lower min-integrity in your GitHub frontmatter:

tools:
  github:
    min-integrity: approved  # merged | approved | unapproved | none

💥 [THE END] — Illustrated by Smoke Claude ·

- Update threat_detection.go: Add output_types/has_patch check to detection
  job-level `if:` condition using expression builder. Now the detection job
  result will be 'skipped' (not 'success') when the agent produced nothing,
  causing safe_outputs to also be skipped correctly.

- Update cache.go: Accept `skipped` detection result for update_cache_memory
  job so it runs when detection succeeded or was skipped.

- Update repo_memory.go: Accept `skipped` detection result for push_repo_memory
  job so it runs when detection succeeded or was skipped.

- Add TestDetectionJobLevelCondition test verifying the new condition includes
  always(), agent-not-skipped check, output_types check, and has_patch check.

- Recompile all 178 lock files with updated conditions.

Agent-Logs-Url: https://github.com/github/gh-aw/sessions/79e20434-830a-4ce3-9bd8-c78f9ae29a1d

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
@github-actions github-actions bot mentioned this pull request Mar 27, 2026
Copilot AI changed the title [WIP] Fix detection job running with no outputs or patch fix: skip detection job at job-level when agent produces no outputs or patch Mar 27, 2026
Copilot AI requested a review from pelikhan March 27, 2026 00:16
@pelikhan pelikhan marked this pull request as ready for review March 27, 2026 00:29
Copilot AI review requested due to automatic review settings March 27, 2026 00:29
Copy link
Copy Markdown
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 updates the generated GitHub Actions workflow logic so the threat detection job is skipped at the job level when the agent produced no outputs and no patch, preventing unnecessary runner usage and avoiding downstream safe_outputs execution triggered by a success-but-noop detection job.

Changes:

  • Tighten detection job-level if: to require agent not skipped and (output_types != '' || has_patch == 'true').
  • Update downstream jobs (cache/repo memory) to run when detection is either success or skipped.
  • Add a unit test asserting the generated detection job condition contains the required guards; regenerate workflow lockfiles.

Reviewed changes

Copilot reviewed 171 out of 171 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
pkg/workflow/threat_detection.go Builds a stricter detection job-level condition using the expression builder to skip detection when there’s nothing to analyze.
pkg/workflow/cache.go Allows update_cache_memory to run when detection is skipped (in addition to success).
pkg/workflow/repo_memory.go Allows push_repo_memory to run when detection is skipped (in addition to success).
pkg/workflow/threat_detection_test.go Adds TestDetectionJobLevelCondition to validate the generated detection job if: includes always(), agent-not-skipped, and content guards.
.github/workflows/*.lock.yml (regenerated) Recompiled lockfiles reflecting updated job-level if: expressions for detection and updated downstream gating where applicable.

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

Comment on lines +693 to +705
// When threat detection is enabled, run only if detection succeeded (no threats found)
// or was skipped (agent produced no outputs or patch — nothing to detect against).
repoMemAlwaysFunc := BuildFunctionCall("always")
repoMemDetectionSuccess := BuildEquals(
BuildPropertyAccess(fmt.Sprintf("needs.%s.result", constants.DetectionJobName)),
BuildStringLiteral("success"),
)
repoMemDetectionSkipped := BuildEquals(
BuildPropertyAccess(fmt.Sprintf("needs.%s.result", constants.DetectionJobName)),
BuildStringLiteral("skipped"),
)
repoMemDetectionOk := BuildOr(repoMemDetectionSuccess, repoMemDetectionSkipped)
jobCondition = RenderCondition(BuildAnd(repoMemAlwaysFunc, repoMemDetectionOk))
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

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

This job condition duplicates the same “detection result is success OR skipped” expression construction used in other places (e.g., update_cache_memory). Consider factoring this into a shared helper returning a ConditionNode so future changes to acceptable detection outcomes only need to be made once.

Copilot uses AI. Check for mistakes.
Comment on lines +840 to +852
// Job condition: run if detection job succeeded (no threats found) or was skipped (no outputs to detect).
// Using always() so the job runs even when detection is skipped (which sets result = 'skipped').
cacheAlwaysFunc := BuildFunctionCall("always")
detectionSuccess := BuildEquals(
BuildPropertyAccess(fmt.Sprintf("needs.%s.result", constants.DetectionJobName)),
BuildStringLiteral("success"),
)
detectionSkipped := BuildEquals(
BuildPropertyAccess(fmt.Sprintf("needs.%s.result", constants.DetectionJobName)),
BuildStringLiteral("skipped"),
)
detectionOk := BuildOr(detectionSuccess, detectionSkipped)
jobCondition := RenderCondition(BuildAnd(cacheAlwaysFunc, detectionOk))
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

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

The detection result predicate (success OR skipped) is being built inline here (and similarly in other jobs). To reduce duplication and the chance of future drift, consider extracting a shared helper (e.g., alongside existing buildDetectionSuccessCondition in pkg/workflow/compiler_safe_outputs_job.go) that returns the ConditionNode for “needs.detection.result is success or skipped”, then reuse it across cache/repo memory jobs.

Copilot uses AI. Check for mistakes.
@pelikhan
Copy link
Copy Markdown
Collaborator

@copilot review comments

Extract the repeated 'detection result == success OR skipped' expression into
a new buildDetectionPassedCondition() helper in compiler_safe_outputs_job.go,
alongside the existing buildDetectionSuccessCondition(). Both cache.go and
repo_memory.go now use this helper, eliminating the inline duplication.

Agent-Logs-Url: https://github.com/github/gh-aw/sessions/b324482f-e3c8-4d2c-8042-bf118b2eab91

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Mar 27, 2026

@copilot review comments

Extracted the duplicated "success OR skipped" predicate into a new buildDetectionPassedCondition() helper in compiler_safe_outputs_job.go (alongside buildDetectionSuccessCondition()), and updated both cache.go and repo_memory.go to use it. Commit 939d8ec.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/graphql
    • Triggering command: /usr/bin/gh /usr/bin/gh api graphql -f query=query($owner: String!, $name: String!) { repository(owner: $owner, name: $name) { hasDiscussionsEnabled } } -f owner=github -f name=gh-aw (http block)
    • Triggering command: /usr/bin/gh /usr/bin/gh api graphql -f query=query($owner: String!, $name: String!) { repository(owner: $owner, name: $name) { hasDiscussionsEnabled } } -f owner=github -f name=gh-aw --local ache/go/1.25.0/x--format=%T git rev-�� --show-toplevel ache/go/1.25.0/x64/pkg/tool/linux_amd64/vet /usr/bin/git se 8473780/b062/vet-c .cfg git (http block)
    • Triggering command: /usr/bin/gh /usr/bin/gh api graphql -f query=query($owner: String!, $name: String!) { repository(owner: $owner, name: $name) { hasDiscussionsEnabled } } -f owner=github -f name=gh-aw --local ache/go/1.25.0/xcgroup2 git rev-�� --show-toplevel ache/go/1.25.0/xinternal/tools/generate-action-metadata/main.go /usr/bin/git se 8473780/b049/vet-c .cfg git (http block)
  • https://api.github.com/repos/actions/ai-inference/git/ref/tags/v1
    • Triggering command: /usr/bin/gh gh api /repos/actions/ai-inference/git/ref/tags/v1 --jq .object.sha -unreachable=false /tmp/go-build3218473780/b083/vet.cfg 8473780/b362/vet.cfg (http block)
  • https://api.github.com/repos/actions/checkout/git/ref/tags/v3
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v3 --jq .object.sha ection-job-when-nothing-to-detect^{commit} --local 64/pkg/tool/linux_amd64/vet user.email (http block)
  • https://api.github.com/repos/actions/checkout/git/ref/tags/v5
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v5 --jq .object.sha (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v5 --jq .object.sha -bool -buildtags /usr/bin/git -errorsas -ifaceassert -nilfunc git rev-�� --show-toplevel -tests /usr/bin/git (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v5 --jq .object.sha --show-toplevel x_amd64/vet /usr/bin/git (http block)
  • https://api.github.com/repos/actions/checkout/git/ref/tags/v6
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v6 --jq .object.sha --noprofile (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v6 --jq .object.sha pkg/mod/github.com/stretchr/testify@v1.11.1/require/doc.go pkg/mod/github.com/stretchr/testify@v1.11.1/require/forward_requirements.go /opt/hostedtoolcache/go/1.25.0/x64/pkg/tool/linux_amd64/vet (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v6 --jq .object.sha --show-toplevel x_amd64/vet /usr/bin/git (http block)
  • https://api.github.com/repos/actions/github-script/git/ref/tags/v8
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v8 --jq .object.sha --noprofile (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v8 --jq .object.sha --show-toplevel x_amd64/vet /usr/bin/git (http block)
  • https://api.github.com/repos/actions/setup-go/git/ref/tags/v4
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-go/git/ref/tags/v4 --jq .object.sha --noprofile (http block)
  • https://api.github.com/repos/actions/setup-node/git/ref/tags/v4
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-node/git/ref/tags/v4 --jq .object.sha --noprofile (http block)
  • https://api.github.com/repos/actions/upload-artifact/git/ref/tags/v4
    • Triggering command: /usr/bin/gh gh api /repos/actions/upload-artifact/git/ref/tags/v4 --jq .object.sha (http block)
  • https://api.github.com/repos/astral-sh/setup-uv/git/ref/tags/eac588ad8def6316056a12d4907a9d4d84ff7a3b
    • Triggering command: /usr/bin/gh gh api /repos/astral-sh/setup-uv/git/ref/tags/eac588ad8def6316056a12d4907a9d4d84ff7a3b --jq .object.sha h ../../../.prettierignore ache/go/1.25.0/x64/pkg/tool/linux_amd64/vet /usr/bin/git --local committer.email .cfg git rev-�� --show-toplevel ache/go/1.25.0/x64/pkg/tool/linux_amd64/vet /usr/bin/git se 8473780/b237/vet-C ache/go/1.25.0/x/home/REDACTED/work/gh-aw/gh-aw/.github/workflows git (http block)
  • https://api.github.com/repos/github/gh-aw
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw --jq .visibility json&#39; --ignore-path ../../../.pr**/*.json /opt/hostedtoolcache/go/1.25.0/x--ignore-path /usr/bin/git /tmp/go-build321/usr/bin/gh -trimpath 8473780/b334/vetgraphql git rev-�� th .prettierigno-f /opt/hostedtoolcowner=github _modules/.bin/no-f -unreachable=faldocker /tmp/go-build321image /opt/hostedtoolcinspect gh (http block)
  • https://api.github.com/repos/github/gh-aw-actions/git/ref/tags/v0
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw-actions/git/ref/tags/v0 --jq .object.sha h ../../../.prettierignore ache/go/1.25.0/x64/pkg/tool/linux_amd64/vet e/git se 8473780/b092/vet/home/REDACTED/work/gh-aw/gh-aw/actions/setup/js/node_modules/.bin/pre�� .cfg e/git rev-�� w/js/**/*.json&#39; --ignore-path ache/go/1.25.0/x../../../.prettierignore /usr/bin/git se 8473780/b227/vetapi ache/go/1.25.0/xgraphql git (http block)
  • https://api.github.com/repos/github/gh-aw-actions/git/ref/tags/v0.1.2
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw-actions/git/ref/tags/v0.1.2 --jq .object.sha --noprofile (http block)
  • https://api.github.com/repos/github/gh-aw-actions/git/ref/tags/v1.0.0
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw-actions/git/ref/tags/v1.0.0 --jq .object.sha (http block)
  • https://api.github.com/repos/github/gh-aw-actions/git/ref/tags/v1.2.3
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw-actions/git/ref/tags/v1.2.3 --jq .object.sha (http block)
  • https://api.github.com/repos/github/gh-aw/git/ref/tags/v0.47.4
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v0.47.4 --jq .object.sha --show-toplevel -tests /usr/bin/git (http block)
  • https://api.github.com/repos/github/gh-aw/git/ref/tags/v1.0.0
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v1.0.0 --jq .object.sha (http block)
  • https://api.github.com/repos/githubnext/agentics/git/ref/tags/
    • Triggering command: /usr/bin/gh gh api /repos/githubnext/agentics/git/ref/tags/# --jq .object.sha re --log-level=error ache/go/1.25.0/x64/pkg/tool/linux_amd64/vet /usr/bin/gh se 8473780/b210/vet-C ache/go/1.25.0/x/home/REDACTED/work/gh-aw/gh-aw/.github/workflows gh /pre�� /repos/actions/gremote.origin.url --jq /usr/bin/git --noprofile (http block)
  • https://api.github.com/repos/nonexistent/action/git/ref/tags/v999.999.999
    • Triggering command: /usr/bin/gh gh api /repos/nonexistent/action/git/ref/tags/v999.999.999 --jq .object.sha (http block)

If you need me to access, download, or install something from one of these locations, you can either:

@github-actions
Copy link
Copy Markdown
Contributor

📰 BREAKING: Smoke Copilot is now investigating this pull request. Sources say the story is developing...

@github-actions github-actions bot removed the smoke label Mar 27, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 27, 2026

✅ All tools validated successfully! Agent Container Smoke Test confirms agent container is ready.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 27, 2026

✨ The prophecy is fulfilled... Smoke Codex has completed its mystical journey. The stars align. 🌟

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 27, 2026

🎬 THE ENDSmoke Claude MISSION: ACCOMPLISHED! The hero saves the day! ✨

@github-actions
Copy link
Copy Markdown
Contributor

Agent Container Tool Check

Tool Status Version
bash 5.2.21
sh available
git 2.53.0
jq 1.7
yq 4.52.4
curl 8.5.0
gh 2.88.1
node 20.20.1
python3 3.12.3
go 1.24.13
java 21.0.10 (Temurin)
dotnet 10.0.201

Result: 12/12 tools available ✅

Overall Status: PASS

🔧 Tool validation by Agent Container Smoke Test ·

@github-actions
Copy link
Copy Markdown
Contributor

🤖 Smoke test §23648453986 complete for @Copilot's PR.

Test Result
GitHub MCP
MCP Scripts GH CLI
Serena MCP
Playwright
Web Fetch
File Write + Bash
Discussion Interaction
Build gh-aw
Discussion Creation
Workflow Dispatch
PR Review

Overall: ⚠️ PARTIAL PASS (Serena MCP tools unavailable)
PR by @Copilot · Assignees: @pelikhan, @Copilot

Note

🔒 Integrity filter blocked 1 item

The following item were blocked because they don't meet the GitHub integrity level.

To allow these resources, lower min-integrity in your GitHub frontmatter:

tools:
  github:
    min-integrity: approved  # merged | approved | unapproved | none

📰 BREAKING: Report filed by Smoke Copilot ·

Copy link
Copy Markdown
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Reviewed the fix for skipping the detection job when agent produces no outputs or patch. The job-level if: condition change is correct and the inline comments in cache.go clearly explain the always() usage. LGTM.

Note

🔒 Integrity filter blocked 1 item

The following item were blocked because they don't meet the GitHub integrity level.

  • #23185 pull_request_read: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".

To allow these resources, lower min-integrity in your GitHub frontmatter:

tools:
  github:
    min-integrity: approved  # merged | approved | unapproved | none

📰 BREAKING: Report filed by Smoke Copilot

// Job condition: only run if detection job succeeded (exit 0 means analysis passed, no threats detected)
jobCondition := fmt.Sprintf("always() && needs.%s.result == 'success'", constants.DetectionJobName)
// Job condition: run if detection job succeeded (no threats found) or was skipped (no outputs to detect).
// Using always() so the job runs even when detection is skipped (which sets result = 'skipped').
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Good comment explaining the job condition — the distinction between "detection succeeded" vs "detection was skipped (no outputs)" is exactly what needs clarification here. This will help future readers understand the intent.

// Job condition: run if detection job succeeded (no threats found) or was skipped (no outputs to detect).
// Using always() so the job runs even when detection is skipped (which sets result = 'skipped').
jobCondition := RenderCondition(BuildAnd(BuildFunctionCall("always"), buildDetectionPassedCondition()))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Using always() is the correct approach here — without it, GitHub Actions would skip this job when detection is skipped, which is exactly the bug being fixed. The buildDetectionPassedConditional helper keeps this readable.

@github-actions
Copy link
Copy Markdown
Contributor

📰 VERDICT: Smoke Copilot has concluded. All systems operational. This is a developing story. 🎤

@github-actions
Copy link
Copy Markdown
Contributor

Commit pushed: 77c4399

Generated by Changeset Generator

@github-actions
Copy link
Copy Markdown
Contributor

Smoke Test Run 23648454152 — PARTIAL

Test Status
1. GitHub MCP
2. mcpscripts-gh
3. Serena MCP (100+ symbols)
4. Make Build
5. Playwright (github.com)
6. Tavily Search
7. File Writing
8. Bash Tool
9. Discussion Comment
10. Agentic Workflows MCP
11. Slack Safe Output
12. Update PR
13. PR Review Comments
14. Submit PR Review
15. Resolve Review Thread ⚠️ DIFC blocked
16. Add Reviewer
17. Push to PR Branch ⚠️ Skipped
18. Close PR ⚠️ Skipped

Note

🔒 Integrity filter blocked 1 item

The following item were blocked because they don't meet the GitHub integrity level.

To allow these resources, lower min-integrity in your GitHub frontmatter:

tools:
  github:
    min-integrity: approved  # merged | approved | unapproved | none

💥 [THE END] — Illustrated by Smoke Claude ·

Copy link
Copy Markdown
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

💥 Automated smoke test review - all systems nominal! The detection job skip logic looks correct — using expression builder helpers instead of raw format strings is a clean improvement.

Note

🔒 Integrity filter blocked 1 item

The following item were blocked because they don't meet the GitHub integrity level.

  • #23185 pull_request_read: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".

To allow these resources, lower min-integrity in your GitHub frontmatter:

tools:
  github:
    min-integrity: approved  # merged | approved | unapproved | none

💥 [THE END] — Illustrated by Smoke Claude

@pelikhan pelikhan merged commit 108d38f into main Mar 27, 2026
@pelikhan pelikhan deleted the copilot/skip-detection-job-when-nothing-to-detect branch March 27, 2026 13:44
Copilot AI added a commit that referenced this pull request Mar 27, 2026
…include skipped result

The test expected 'if: always() && needs.detection.result == "success"' but the
compiler now generates 'if: always() && (needs.detection.result == "success" ||
needs.detection.result == "skipped")' since the fix in #23185.

Agent-Logs-Url: https://github.com/github/gh-aw/sessions/01c4614b-2dd3-453a-94c1-59a5b1a91da4

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Detection job should be skipped at job-level when there is nothing to detect against

3 participants