Skip to content

Comments

Fix concurrency helpers to correctly handle synthetic events (slash_command, schedule)#18184

Merged
pelikhan merged 2 commits intomainfrom
copilot/review-concurrency-logic-helpers
Feb 24, 2026
Merged

Fix concurrency helpers to correctly handle synthetic events (slash_command, schedule)#18184
pelikhan merged 2 commits intomainfrom
copilot/review-concurrency-logic-helpers

Conversation

Copy link
Contributor

Copilot AI commented Feb 24, 2026

Concurrency helpers operated on workflowData.On without understanding synthetic events (slash_command) that exist only in input YAML before compile-time expansion to their GitHub Actions equivalents.

Bugs fixed

isWorkflowDispatchOnly — false positive for slash_command

Input YAML on: slash_command + workflow_dispatch was incorrectly classified as dispatch-only because slash_command wasn't in otherTriggers. Since slash_command expands to issue_comment + workflow_dispatch, its presence means the workflow is not dispatch-only.

hasSpecialTriggers — no slash_command path

Relied on isWorkflowDispatchOnly returning true for slash_command workflows (the wrong reason). Now has an explicit isSlashCommandWorkflow check.

buildConcurrencyGroupKeys — wrong group key for slash_command input YAML

When isCommandTrigger=false and on still contained slash_command:, the issue/PR number key was skipped, producing a generic group instead of ${{ github.event.issue.number || github.event.pull_request.number }}.

applyDefaults — slash_command shorthand on: /cmd-name not detected

Re-read the raw file to detect command triggers, but the shorthand form is a plain string in the file (on: /cmd-name), while parseOnSection had already expanded it to the slash_command map in memory and populated data.Command. Fixed by checking data.Command first.

Changes

  • concurrency.go — adds slash_command to isWorkflowDispatchOnly's otherTriggers; adds isSlashCommandWorkflow helper; updates hasSpecialTriggers and buildConcurrencyGroupKeys to handle slash_command explicitly
  • tools.go (applyDefaults) — checks data.Command before re-reading the file to detect command trigger, covering the shorthand form
  • concurrency_test.go — adds TestIsWorkflowDispatchOnly and TestHasSpecialTriggers; extends TestGenerateConcurrencyConfig, TestGenerateJobConcurrencyConfig, TestBuildConcurrencyGroupKeys, and TestConcurrencyRules with slash_command (both map and shorthand form) cases

Copilot AI and others added 2 commits February 24, 2026 16:23
…hedule)

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

@copilot recompile

Copy link
Contributor Author

Copilot AI commented Feb 24, 2026

@copilot recompile

Recompiled all 158 workflow files — no changes needed, lock files were already up to date.

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 ,short (http block)
  • https://api.github.com/repos/actions/checkout/git/ref/tags/11bd71901bbe5b1630ceea73d27597364c9af683
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/11bd71901bbe5b1630ceea73d27597364c9af683 --jq .object.sha (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 (http block)
  • https://api.github.com/repos/actions/github-script/git/ref/tags/v7
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v7 --jq .object.sha (http block)
  • https://api.github.com/repos/actions/setup-go/git/ref/tags/4dc6199c7b1a012772edbd06daecab0f50c9053c
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-go/git/ref/tags/4dc6199c7b1a012772edbd06daecab0f50c9053c --jq .object.sha (http block)
  • https://api.github.com/repos/actions/setup-go/git/ref/tags/v5
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-go/git/ref/tags/v5 --jq .object.sha (http block)
  • https://api.github.com/repos/actions/setup-go/git/ref/tags/v6
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-go/git/ref/tags/v6 --jq .object.sha (http block)
  • https://api.github.com/repos/actions/setup-node/git/ref/tags/v6
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-node/git/ref/tags/v6 --jq .object.sha (http block)
  • https://api.github.com/repos/anchore/sbom-action/git/ref/tags/v0
    • Triggering command: /usr/bin/gh gh api /repos/anchore/sbom-action/git/ref/tags/v0 --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 (http block)
  • https://api.github.com/repos/docker/build-push-action/git/ref/tags/v6
    • Triggering command: /usr/bin/gh gh api /repos/docker/build-push-action/git/ref/tags/v6 --jq .object.sha (http block)
  • https://api.github.com/repos/docker/login-action/git/ref/tags/v3
    • Triggering command: /usr/bin/gh gh api /repos/docker/login-action/git/ref/tags/v3 --jq .object.sha (http block)
  • https://api.github.com/repos/docker/metadata-action/git/ref/tags/v5
    • Triggering command: /usr/bin/gh gh api /repos/docker/metadata-action/git/ref/tags/v5 --jq .object.sha (http block)
  • https://api.github.com/repos/docker/setup-buildx-action/git/ref/tags/v3
    • Triggering command: /usr/bin/gh gh api /repos/docker/setup-buildx-action/git/ref/tags/v3 --jq .object.sha (http block)
  • https://api.github.com/repos/github/gh-aw/git/ref/tags/a70c5eada06553e3510ac27f2c3bda9d3705bccb
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/a70c5eada06553e3510ac27f2c3bda9d3705bccb --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 (http block)

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

@pelikhan pelikhan marked this pull request as ready for review February 24, 2026 17:07
Copilot AI review requested due to automatic review settings February 24, 2026 17:07
Copy link
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 fixes concurrency helper functions to correctly handle synthetic events (slash_command) that exist only in input YAML before compile-time expansion. The fixes ensure that slash_command workflows get the correct concurrency configuration regardless of when the concurrency helpers are called (before or after event expansion).

Changes:

  • Fixed isWorkflowDispatchOnly to recognize slash_command as a non-dispatch-only trigger by adding it to the otherTriggers list
  • Added isSlashCommandWorkflow helper function to detect slash_command in YAML
  • Updated hasSpecialTriggers to explicitly check for slash_command workflows
  • Updated buildConcurrencyGroupKeys to include issue/PR number for slash_command workflows
  • Fixed applyDefaults to detect command triggers from shorthand form by checking data.Command before re-reading the file
  • Added comprehensive test coverage for all slash_command scenarios

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
pkg/workflow/concurrency.go Adds slash_command handling to concurrency helper functions; introduces isSlashCommandWorkflow helper; updates documentation
pkg/workflow/tools.go Fixes command trigger detection in applyDefaults to handle slash_command shorthand by checking data.Command first
pkg/workflow/concurrency_test.go Adds comprehensive test coverage for slash_command workflows including TestIsWorkflowDispatchOnly, TestHasSpecialTriggers, and tests for both map and shorthand formats

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

@pelikhan pelikhan merged commit fad43e3 into main Feb 24, 2026
88 of 89 checks passed
@pelikhan pelikhan deleted the copilot/review-concurrency-logic-helpers branch February 24, 2026 17:25
@github-actions github-actions bot added the lgtm label Feb 24, 2026
@github-actions
Copy link
Contributor

Hey @Copilot 👋 — great work tracking down and fixing these concurrency edge cases for slash_command workflows! The four distinct bugs addressed here — the false positive in isWorkflowDispatchOnly, the missing path in hasSpecialTriggers, the wrong group key in buildConcurrencyGroupKeys, and the shorthand detection gap in applyDefaults — are all clearly explained, well-scoped, and correctly fixed.

This PR is aligned with the project's contribution guidelines:

  • ✅ Opened by the Copilot coding agent and assigned to a core team member — exactly the intended agentic development workflow
  • ✅ Focused entirely on concurrency helper logic; no unrelated changes mixed in
  • ✅ No new dependencies added
  • ✅ Comprehensive tests: 274 new lines across brand-new TestIsWorkflowDispatchOnly and TestHasSpecialTriggers suites, plus slash_command cases added to TestGenerateConcurrencyConfig, TestGenerateJobConcurrencyConfig, TestBuildConcurrencyGroupKeys, and TestConcurrencyRules
  • ✅ Detailed PR description linking each bug to its root cause and specific fix

Verdict: 🟢 Aligned — Quality: lgtm

This looks ready for maintainer review. 🚀

Generated by Contribution Check

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants