Disable engine-level concurrency for workflow_dispatch-only workflows#18172
Disable engine-level concurrency for workflow_dispatch-only workflows#18172
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR changes default agent job concurrency generation so that workflows triggered only by workflow_dispatch no longer receive an additional engine-level concurrency group (relying on the top-level workflow concurrency instead).
Changes:
- Add
isWorkflowDispatchOnly()and treatworkflow_dispatch-only workflows as “special triggers” to skip engine-level concurrency. - Update unit + integration tests to expect no agent job
concurrency:forworkflow_dispatch-only workflows, while keeping it for mixed triggers. - Regenerate WASM golden outputs for affected fixtures.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| pkg/workflow/concurrency.go | Adds detection for workflow_dispatch-only workflows to skip engine-level job concurrency. |
| pkg/workflow/concurrency_test.go | Updates expectations and adds a mixed-trigger test case. |
| pkg/workflow/engine_concurrency_integration_test.go | Updates integration expectations to assert absence of job concurrency: for workflow_dispatch-only. |
| pkg/workflow/testdata/wasm_golden/TestWasmGolden_CompileFixtures/basic-copilot.golden | Removes agent job concurrency from golden output. |
| pkg/workflow/testdata/wasm_golden/TestWasmGolden_CompileFixtures/with-imports.golden | Removes agent job concurrency from golden output. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| func isWorkflowDispatchOnly(on string) bool { | ||
| if !strings.Contains(on, "workflow_dispatch") { | ||
| return false | ||
| } | ||
| // If any other common trigger is present as a YAML key, this is not a | ||
| // workflow_dispatch-only workflow. We check for the trigger name followed by | ||
| // ':' (YAML key in object form) or as the sole inline value to avoid false | ||
| // matches from input parameter names (e.g., "push_branch" ≠ "push" trigger). | ||
| otherTriggers := []string{ | ||
| "push", "pull_request", "pull_request_review", "pull_request_review_comment", | ||
| "pull_request_target", "issues", "issue_comment", "discussion", | ||
| "discussion_comment", "schedule", "repository_dispatch", "workflow_run", | ||
| "create", "delete", "release", "deployment", "fork", "gollum", | ||
| "label", "milestone", "page_build", "public", "registry_package", | ||
| "status", "watch", "merge_group", "check_run", "check_suite", | ||
| } | ||
| for _, trigger := range otherTriggers { | ||
| // Trigger in object format: "push:" / " push:" | ||
| if strings.Contains(on, trigger+":") { | ||
| return false | ||
| } | ||
| // Trigger in inline format: "on: push" (no colon, trigger is the last token) | ||
| if strings.HasSuffix(strings.TrimSpace(on), " "+trigger) { | ||
| return false | ||
| } |
There was a problem hiding this comment.
isWorkflowDispatchOnly() relies on string matching for trigger+":" and a suffix check, which does not detect additional triggers when the on section uses array/flow style (e.g. "on": [workflow_dispatch, schedule]). In that case this function would incorrectly return true and skip engine-level concurrency. It also omits valid triggers like workflow_call, so workflow_dispatch + workflow_call would be misclassified as dispatch-only. Consider unmarshaling workflowData.On (or using workflowData.RawFrontmatter["on"]) and treating it as dispatch-only only when the parsed trigger set is exactly {workflow_dispatch}; add unit tests for the array form and for workflow_call mixed with workflow_dispatch.
workflow_dispatchworkflows represent explicit user intent — the top-level group concurrency (gh-aw-${{ github.workflow }}) is already sufficient. Adding an engine-level group on top is redundant and prevents users from intentionally running multiple instances.Changes
concurrency.go: AddedisWorkflowDispatchOnly()that detectsworkflow_dispatchas the sole trigger using precise YAML key matching (trigger:for object form, trailingtriggerfor inline) — avoids false positives from input param names likepush_branchhasSpecialTriggers(): Returnstrueforworkflow_dispatch-only workflows, skipping engine-level concurrency generationworkflow_dispatch + schedule) to confirm those still get engine-level concurrencybasic-copilotandwith-importsfixtures (bothworkflow_dispatch-only)Behavior
workflow_dispatchonlyworkflow_dispatch+schedulepush,issues,pull_request,discussionschedule,repository_dispatch, etc.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/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 GO111MODULE 64/bin/go git t-40�� k/gh-aw/gh-aw/.github/workflows/blog-auditor.md config /usr/bin/git remote.origin.urgit GO111MODULE 64/bin/go git(http block)/usr/bin/gh gh repo view --json owner,name --jq .owner.login + "/" + .name /usr/bin/git -json GO111MODULE x_amd64/vet git rev-�� --show-toplevel x_amd64/vet /usr/bin/git -json GO111MODULE 64/bin/go git(http block)/usr/bin/gh gh repo view --json owner,name --jq .owner.login + "/" + .name /usr/bin/infocmp go GO111MODULE x_amd64/vet infocmp -1 xterm-color x_amd64/vet /usr/bin/git -json GO111MODULE 64/bin/go git(http block)https://api.github.com/repos/actions/ai-inference/git/ref/tags/v1/usr/bin/gh gh api /repos/actions/ai-inference/git/ref/tags/v1 --jq .object.sha -json l 0/x64/bin/node GOINSECURE GOMOD GOMODCACHE go t-ha�� ithub/workflows/ai-moderator.md GO111MODULE 0/x64/bin/node GOINSECURE GOMOD GOMODCACHE 0/x64/bin/node(http block)/usr/bin/gh gh api /repos/actions/ai-inference/git/ref/tags/v1 --jq .object.sha --show-toplevel git 64/pkg/tool/linux_amd64/vet --get remote.origin.urrev-parse ache/node/24.13.--show-toplevel 64/pkg/tool/linux_amd64/vet rev-�� --show-toplevel ache/node/24.13.0/x64/bin/node /usr/bin/git ere node /usr/bin/git git(http block)/usr/bin/gh gh api /repos/actions/ai-inference/git/ref/tags/v1 --jq .object.sha --oneline -10 64/bin/git --show-toplevel git ache/go/1.25.0/x--show-toplevel git rev-�� --show-toplevel ache/go/1.25.0/x--package-lock-only 64/bin/bash --show-toplevel git bash git(http block)https://api.github.com/repos/actions/checkout/git/ref/tags/v3/usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v3 --jq .object.sha -json GO111MODULE ache/go/1.25.0/x64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE .cfg GOINSECURE GOMOD GOMODCACHE go(http block)/usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v3 --jq .object.sha --show-toplevel go /usr/bin/git ithub-script/gitgit GO111MODULE 3139337/b411/rep--show-toplevel git stat�� GOMODCACHE 3139337/b411/repoutil.test /usr/bin/git t0 GO111MODULE(http block)/usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v3 --jq .object.sha --show-toplevel git-upload-pack /usr/bin/git GOMODCACHE go /usr/bin/git git rev-�� --show-toplevel git /home/REDACTED/go/bin/node --show-toplevel /usr/bin/git x_amd64/link node(http block)https://api.github.com/repos/actions/checkout/git/ref/tags/v4/usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v4 --jq .object.sha se 3139337/b125/vet.cfg /opt/hostedtoolcache/go/1.25.0/x-nilfunc GOINSECURE GOMOD GOMODCACHE go env 4042-27042/test-250572209 GO111MODULE /opt/hostedtoolcache/go/1.25.0/x64/bin/go GOINSECURE GOMOD GOMODCACHE go(http block)/usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v4 --jq .object.sha g_.a GO111MODULE /opt/hostedtoolcache/go/1.25.0/x64/bin/go GOINSECURE GOMOD GOMODCACHE go env sAOsG8WsF GO111MODULE 3139337/b347/vet.cfg l GOMOD GOMODCACHE go(http block)/usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v4 --jq .object.sha user.email test@example.com /usr/bin/git 8801625/b336/embgit GOPROXY nch,headSha,disp--show-toplevel git rev-�� --show-toplevel /opt/hostedtoolcache/go/1.25.0/xGO111MODULE 3139337/b433/vet.cfg ub/workflows sh 64/bin/go git(http block)https://api.github.com/repos/actions/checkout/git/ref/tags/v5/usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v5 --jq .object.sha 1420661794/.github/workflows GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE 64/pkg/tool/linux_amd64/compile GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linuREDACTED(http block)/usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v5 --jq .object.sha 3139337/b425/_pkg_.a -buildtags 3139337/b425=> -errorsas b/gh-aw/pkg/time-c -nilfunc git -C bW5I/-pOH6J5YoELjpq_JbW5I config /usr/bin/git remote.origin.urgit GO111MODULE 64/bin/go 3139337/b425/importcfg(http block)/usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v5 --jq .object.sha --show-toplevel node /usr/bin/git --check scripts/**/*.js 64/bin/go git rev-�� --show-toplevel go /usr/bin/git m/workflows GO111MODULE 64/bin/go git(http block)https://api.github.com/repos/actions/github-script/git/ref/tags/v8/usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v8 --jq .object.sha GOSUMDB GOWORK 64/bin/go GOINSECURE GOMOD GOMODCACHE erignore env e=false GO111MODULE 64/bin/go GOINSECURE %H %ct %D 8cab2cf150a9d828-json go(http block)/usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v8 --jq .object.sha ck 'scripts/**/*GOINSECURE GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE sh(http block)/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 sh(http block)https://api.github.com/repos/actions/setup-go/git/ref/tags/v4/usr/bin/gh gh api /repos/actions/setup-go/git/ref/tags/v4 --jq .object.sha /ref/tags/v8 GO111MODULE /opt/hostedtoolcache/go/1.25.0/x64/bin/go GOINSECURE GOMOD GOMODCACHE go env runs/20260224-154042-27042/test-3811335638/.github/workflows GO111MODULE 3139337/b291/vet.cfg GOINSECURE GOMOD GOMODCACHE go(http block)/usr/bin/gh gh api /repos/actions/setup-go/git/ref/tags/v4 --jq .object.sha --show-toplevel git /usr/bin/git --show-toplevel -goversion /usr/bin/git git rev-�� --show-toplevel git /usr/bin/git --get remote.origin.urrev-parse /usr/bin/git git(http block)/usr/bin/gh gh api /repos/actions/setup-go/git/ref/tags/v4 --jq .object.sha --show-toplevel git /usr/bin/git g/workflow/wasm_git git 0/x64/bin/bash git stat�� e/git git /usr/bin/git --show-toplevel e/git p/bin/bash git(http block)https://api.github.com/repos/actions/setup-node/git/ref/tags/v4/usr/bin/gh gh api /repos/actions/setup-node/git/ref/tags/v4 --jq .object.sha 1 GO111MODULE /opt/hostedtoolcache/go/1.25.0/x-test.short=true GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE 0/x64/bin/node GOINSECURE GOMOD GOMODCACHE go(http block)/usr/bin/gh gh api /repos/actions/setup-node/git/ref/tags/v4 --jq .object.sha --show-toplevel git /usr/bin/git /tmp/gh-aw-test-git rev-parse /usr/bin/git git rev-�� --show-toplevel git /usr/bin/git user.name Test User /opt/hostedtoolc--show-toplevel git(http block)/usr/bin/gh gh api /repos/actions/setup-node/git/ref/tags/v4 --jq .object.sha --show-toplevel git /usr/bin/git g/workflow/wasm_git git p/bin/bash git bran�� --show-current git 86_64/git --show-toplevel node rgo/bin/bash git(http block)https://api.github.com/repos/github/gh-aw/actions/runs/1/artifacts/usr/bin/gh gh run download 1 --dir test-logs/run-1 GO111MODULE x_amd64/link GOINSECURE GOMOD GOMODCACHE x_amd64/link env y-test.md GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE uV/nLUya0DMdbzlh8afRszc/J-5ptimqTest User(http block)https://api.github.com/repos/github/gh-aw/actions/runs/12345/artifacts/usr/bin/gh gh run download 12345 --dir test-logs/run-12345 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/actions/runs/12346/artifacts/usr/bin/gh gh run download 12346 --dir test-logs/run-12346 GO111MODULE x_amd64/compile GOINSECURE GOMOD GOMODCACHE x_amd64/compile env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go(http block)https://api.github.com/repos/github/gh-aw/actions/runs/2/artifacts/usr/bin/gh gh run download 2 --dir test-logs/run-2 GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go estl�� -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go(http block)https://api.github.com/repos/github/gh-aw/actions/runs/3/artifacts/usr/bin/gh gh run download 3 --dir test-logs/run-3 GO111MODULE x_amd64/compile GOINSECURE GOMOD GOMODCACHE x_amd64/compile env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go(http block)https://api.github.com/repos/github/gh-aw/actions/runs/4/artifacts/usr/bin/gh gh run download 4 --dir test-logs/run-4 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/actions/runs/5/artifacts/usr/bin/gh gh run download 5 --dir test-logs/run-5 GO111MODULE x_amd64/compile GOINSECURE GOMOD GOMODCACHE x_amd64/compile env -json GO111MODULE x_amd64/link GOINSECURE GOMOD GOMODCACHE x_amd64/link(http block)https://api.github.com/repos/github/gh-aw/actions/workflows/usr/bin/gh gh workflow list --json name,state,path fe68414098bc4b22GOINSECURE GO111MODULE 64/bin/go r code style"; tgo GOMOD GOMODCACHE ache/go/1.25.0/xGO111MODULE env 8801625/b405/_pkGOINSECURE GO111MODULE 64/bin/go GOINSECURE b/gh-aw/pkg/stri-c GOMODCACHE go(http block)/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 6dkx/L4HBt62iC3gGOSUMDB GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE 8801625/b417/importcfg(http block)/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 64/bin/go GOINSECURE GOMOD GOMODCACHE go(http block)https://api.github.com/repos/github/gh-aw/contents/.github/workflows/shared/reporting.md/tmp/go-build3693139337/b381/cli.test /tmp/go-build3693139337/b381/cli.test -test.testlogfile=/tmp/go-build3693139337/b381/testlog.txt -test.paniconexit0 -test.v=true -test.parallel=4 -test.timeout=10m0s -test.run=^Test -test.short=true GOINSECURE GOMOD GOMODCACHE go m/_n�� -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go(http block)https://api.github.com/repos/github/gh-aw/git/ref/tags/v1.0.0/usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v1.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)/usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v1.0.0 --jq .object.sha --show-toplevel QaOsozRER3G3MIniHc/GufYOpZ-nZgV6X4DmJOt/koqjVT7pz4U_34s9HZ9T /usr/bin/git -json GO111MODULE g_.a git rev-�� --show-toplevel go /usr/bin/git -json GO111MODULE ache/go/1.25.0/x--noprofile git(http block)/usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v1.0.0 --jq .object.sha --show-toplevel git /usr/bin/git --show-toplevel go /usr/bin/git git 1/ --show-toplevel git ache/node/24.13.0/x64/bin/node --show-toplevel ache/go/1.25.0/xrev-parse /usr/bin/git git(http block)https://api.github.com/repos/nonexistent/action/git/ref/tags/v999.999.999/usr/bin/gh gh api /repos/nonexistent/action/git/ref/tags/v999.999.999 --jq .object.sha y-test.md GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env 1859274249/.github/workflows GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go(http block)/usr/bin/gh gh api /repos/nonexistent/action/git/ref/tags/v999.999.999 --jq .object.sha --show-toplevel go e/git RZCu4XIr0 GO111MODULE ache/go/1.25.0/x--noprofile e/git rev-�� --show-toplevel go /usr/bin/git archie.md stmain.go 0/x64/bin/node git(http block)/usr/bin/gh gh api /repos/nonexistent/action/git/ref/tags/v999.999.999 --jq .object.sha ACCEPT git /usr/bin/git --show-toplevel go /usr/bin/git git rev-�� --show-toplevel git ache/node/24.13.0/x64/bin/npm --show-toplevel go /usr/bin/git ache/node/24.13.security(http block)https://api.github.com/repos/nonexistent/repo/actions/runs/12345/usr/bin/gh gh run view 12345 --repo nonexistent/repo --json status,conclusion GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go(http block)https://api.github.com/repos/owner/repo/actions/workflows/usr/bin/gh gh workflow list --json name,state,path --repo owner/repo 64/bin/go GOINSECURE GOMOD GOMODCACHE ache/go/1.25.0/xGO111MODULE env 8801625/b409/_pkGOINSECURE GO111MODULE 64/bin/go GOINSECURE b/gh-aw/pkg/testconfig GOMODCACHE go(http block)/usr/bin/gh gh workflow list --json name,state,path --repo owner/repo 64/bin/go GOINSECURE GOMOD ode-gyp-bin/sh ache/go/1.25.0/xGO111MODULE env 8801625/b411/_pkGOINSECURE GO111MODULE 64/bin/go GOINSECURE b/gh-aw/pkg/timefor-each-ref GOMODCACHE go(http block)/usr/bin/gh gh workflow list --repo owner/repo --json name,path,state 64/bin/node -json GO111MODULE 64/bin/go | tr '\n' ':')$PATH"; [ -n "$GOROOT" ] && expo 0/x6�� --show-toplevel go /usr/bin/git ub/workflows GO111MODULE 64/bin/go git(http block)https://api.github.com/repos/owner/repo/contents/file.md/tmp/go-build3693139337/b381/cli.test /tmp/go-build3693139337/b381/cli.test -test.testlogfile=/tmp/go-build3693139337/b381/testlog.txt -test.paniconexit0 -test.v=true -test.parallel=4 -test.timeout=10m0s -test.run=^Test -test.short=true GOINSECURE GOMOD GOMODCACHE go m/_n�� -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go(http block)https://api.github.com/repos/test-owner/test-repo/actions/secrets/usr/bin/gh gh api /repos/test-owner/test-repo/actions/secrets --jq .secrets[].name dad15df454799415GOINSECURE GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE ache/go/1.25.0/xGO111MODULE env 8801625/b403/_pkGOINSECURE GO111MODULE 64/bin/go GOINSECURE b/gh-aw/pkg/slic-c GOMODCACHE go(http block)https://api.github.com/repos/test/repo/usr/bin/gh gh api /repos/test/repo --jq .default_branch Secret: ${{ secrets.TOKEN }} go /usr/bin/git -json GO111MODULE 64/bin/go git rev-�� --show-toplevel go /usr/bin/git -json GO111MODULE 64/bin/go git(http block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.