Skip to content

Preserve label_command activation guards when frontmatter defines a custom if: - #48105

Merged
pelikhan merged 9 commits into
mainfrom
copilot/fix-custom-if-condition
Jul 26, 2026
Merged

Preserve label_command activation guards when frontmatter defines a custom if:#48105
pelikhan merged 9 commits into
mainfrom
copilot/fix-custom-if-condition

Conversation

Copilot AI commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

label_command workflows were dropping their compiler-derived label match guard whenever the workflow also defined a top-level frontmatter if:. That caused activation to widen from “matching label only” to “any label event that satisfies the custom condition”.

  • Compiler behavior

    • Change label_command compilation to always AND-combine the derived label-trigger condition with any existing workflow if:.
    • Preserve the intended activation shape:
      • pre-activation gate
      • trigger-derived label match
      • user-authored custom condition
  • Regression coverage

    • Add a focused test for a label_command workflow with a custom top-level if:.
    • Assert the compiled activation job still contains both the label-name check and the custom predicate.
  • Result

    • Custom workflow conditions now refine label_command activation instead of replacing it.

Example of the compiled behavior after this change:

if: >-
  ${{ needs.pre_activation.outputs.activated == 'true'
      && (github.event_name == 'issues' && github.event.label.name == 'state:approved')
      && (github.event.issue.state == 'open') }}

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 10.9 AIC · ⌖ 8.52 AIC · ⊞ 7.1K ·
Comment /souschef to run again


Generated by 👨‍🍳 PR Sous Chef · gpt54 · 14 AIC · ⌖ 8.18 AIC · ⊞ 7.1K ·
Comment /souschef to run again

Copilot AI and others added 2 commits July 26, 2026 03:35
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix custom frontmatter if condition handling Preserve label_command activation guards when frontmatter defines a custom if: Jul 26, 2026
Copilot AI requested a review from pelikhan July 26, 2026 03:44
@pelikhan
pelikhan marked this pull request as ready for review July 26, 2026 03:48
Copilot AI review requested due to automatic review settings July 26, 2026 03:48

Copilot AI left a comment

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.

Pull request overview

Fixes label_command compilation so custom conditions refine rather than replace label guards.

Changes:

  • AND-combines label and custom conditions.
  • Adds regression coverage.
  • Registers the release-workflow guidance file.
Show a summary per file
File Description
pkg/workflow/tools.go Combines label guards with existing conditions.
pkg/workflow/label_command_test.go Tests compiled activation conditions.
.github/skills/agentic-workflows/SKILL.md Adds release-workflow guidance.

Review details

Tip

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

  • Files reviewed: 3/3 changed files
  • Comments generated: 1
  • Review effort level: Medium

Comment thread pkg/workflow/tools.go
}
data.If = RenderCondition(labelConditionTree)
}
data.If = RenderCondition(BuildConditionTree(data.If, labelConditionTree.Render()))
@github-actions

Copy link
Copy Markdown
Contributor

🤖 PR Triage — §30192186368

Field Value
Category bug
Risk 🟡 medium
Score 68 / 100 (impact 38 + urgency 18 + quality 12)
Action ⚡ fast_track

Why: Fixes #47594label_command custom if: silently replaced the compiler-derived label match guard instead of AND-combining, widening activation beyond intent. Copilot reviewer check passing, focused regression test added.

Next: Full CI confirmation, then fast-track merge.

Generated by 🔧 PR Triage Agent · sonnet46 · 48.8 AIC · ⌖ 8.75 AIC · ⊞ 5.7K ·

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot please run the pr-finisher skill, address the unresolved review feedback below, and rerun checks once the branch is up to date.

Unresolved review feedback:

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 10.9 AIC · ⌖ 8.52 AIC · ⊞ 7.1K ·
Comment /souschef to run again

Copilot AI and others added 3 commits July 26, 2026 07:43
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>

Copilot AI commented Jul 26, 2026

Copy link
Copy Markdown
Contributor Author

@copilot please run the pr-finisher skill, address the unresolved review feedback below, and rerun checks once the branch is up to date.

Unresolved review feedback:...

Addressed the unresolved thread in commit c9974aea1a (plus bde56a1236).

Changes made:

  • pkg/workflow/tools.go: always AND-combine user if: with the derived command/label trigger guard in applyCommandTriggerOnSection (including mixed slash_command + label_command workflows).
  • pkg/workflow/label_command_test.go: added mixed-trigger regression coverage with a custom top-level if: and assertion for both slash and label guards.

Checks rerun locally: targeted workflow tests pass; make fmt, make lint, make test-unit, and make recompile were run. make test still has a pre-existing unrelated failure in TestFallbackAWFilesMatchesLocalAWDirectory (fallback list drift). Since cloud-agent pushes do not trigger CI, a maintainer re-trigger is still required for fresh PR checks on the new HEAD.

Copilot AI requested a review from gh-aw-bot July 26, 2026 08:08
@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot please run the pr-finisher skill, confirm the unresolved review feedback is fully addressed on the latest head, and rerun checks once the branch is up to date.

Unresolved review feedback:

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 14 AIC · ⌖ 8.18 AIC · ⊞ 7.1K ·
Comment /souschef to run again

Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>

Copilot AI commented Jul 26, 2026

Copy link
Copy Markdown
Contributor Author

@copilot please run the pr-finisher skill, confirm the unresolved review feedback is fully addressed on the latest head, and rerun checks once the branch is up to date.

Unresolved review feedback:...

Confirmed on latest HEAD (634474d) that the unresolved Copilot review feedback is fully addressed:

  • applyCommandTriggerOnSection now AND-combines custom if: with the derived mixed trigger guard (slash_command OR label_command) in /home/runner/work/gh-aw/gh-aw/pkg/workflow/tools.go.
  • Mixed-trigger regression coverage with custom top-level if: is present in /home/runner/work/gh-aw/gh-aw/pkg/workflow/label_command_test.go (TestSlashAndLabelCommandWorkflowCompileCombinesCustomIf).

Checks rerun locally on this branch:

  • make fmt
  • make lint
  • make test-unit
  • make test
  • make recompile

I also reviewed prior PR CI logs via GitHub MCP. The historical failure was the known fallback AW file drift test; current PR-head CI runs are stale/action_required after agent push and require a maintainer-triggered rerun.

@pelikhan
pelikhan merged commit cf9c64a into main Jul 26, 2026
23 checks passed
@pelikhan
pelikhan deleted the copilot/fix-custom-if-condition branch July 26, 2026 09:24
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v0.83.4

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.

Custom frontmatter if: replaces the label_command-derived condition instead of combining with it

4 participants