Skip to content

ci: stop double-labelling issues and cancel superseded runs - #33

Merged
DerekCorniello merged 3 commits into
mainfrom
ci/pipeline-hygiene
Jul 31, 2026
Merged

ci: stop double-labelling issues and cancel superseded runs#33
DerekCorniello merged 3 commits into
mainfrom
ci/pipeline-hygiene

Conversation

@DerekCorniello

Copy link
Copy Markdown
Contributor

Part of the CI/CD rework (step 2 of the plan). Mechanical and independent of the
other six repo PRs in this batch - mergeable in any order.

What changes

Stop double-labelling new issues (#19). issue-triage.yml
applied needs triage unconditionally on every issues: opened, but all 15 issue
templates org-wide already set the label in their frontmatter, so the workflow
call was pure duplication. The file is byte-identical across 7 repos, so this same
diff lands in each.

ensureLabel is deliberately kept, and there is a comment saying why: GitHub
silently drops a label a template references if it does not exist in the repo, so
that call is what creates it. Removing both would quietly stop templates labelling
anything. Auto-assign and the documentation heuristic are untouched.

Cancel superseded PR runs. No concurrency group existed, so pushing three
commits in a row ran three full pipelines at once.

cancel-in-progress is scoped to pull requests rather than set to a blunt true:
cancelling a push to main would discard the authoritative run for that commit.

Verification

All workflow files in the repo still parse as valid YAML and remain ASCII-only.

🤖 Generated with Claude Code

- issue-triage: drop the unconditional `needs triage` application. Every
  issue template already sets the label in its frontmatter, so this was pure
  duplication. ensureLabel stays deliberately: GitHub silently drops a template
  label that does not exist in the repo, so that call is what creates it.

- add a concurrency group so a newer push supersedes an in-flight PR run.
  A push to main is never cancelled - that run is the authoritative record for
  the commit.
@greptile-apps

greptile-apps Bot commented Jul 31, 2026

Copy link
Copy Markdown

Greptile Summary

This PR refines issue-label recovery and prevents redundant SonarQube runs.

  • Recovers needs triage for every issue-opening run that observed the label as absent, including runs that lose a concurrent label-creation race.
  • Adds pull-request-scoped concurrency so newer SonarQube runs cancel superseded runs while push runs remain independent.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
.github/workflows/issue-triage.yml The updated return semantics complete the previously reported missing-label recovery path, including concurrent 422 label-creation races.
.github/workflows/sonar.yml The concurrency group isolates each pull request while assigning push runs unique groups, preventing accidental cancellation of main-branch runs.

Reviews (3): Last reviewed commit: "ci: close the label creation race and st..." | Re-trigger Greptile

Comment thread .github/workflows/issue-triage.yml Outdated
Review catch. Dropping the unconditional apply left one real gap: when `needs
triage` does not exist yet, GitHub silently drops it from the opening issue's
template frontmatter, and `ensureLabel` creating the label afterwards does not
retroactively label the issue that triggered the run. That issue would sit
outside triage until labelled by hand.

Restoring the unconditional apply would undo the point of the change, so apply
it only on the run that actually created the label - the exact case where the
template's request was already dropped. `ensureLabel` now reports whether it
created the label; every later issue gets the label from its own template.
Two review catches, both real.

Label creation race: when two issues open concurrently before `needs triage`
exists, both runs see it missing, one creates it and the other gets 422. The
losing run returned false and skipped the recovery apply - but its issue also
had the template label dropped, so it stayed outside triage. The meaningful
signal is "the label was absent when this run looked", not "this run won the
create race", so ensureLabel now reports that instead.

Pending-run eviction: a shared concurrency group keeps only ONE pending run and
cancels any earlier one, and that happens regardless of cancel-in-progress -
it applies to queued runs, not in-flight ones. Scoping cancel-in-progress to
pull requests therefore did not protect main: three rapid pushes would evict
the middle commit's queued run before it ever executed. Push runs now get a
unique group keyed on run_id, so they never share one and never displace each
other; PR runs still supersede by PR number.
@sonarqubecloud

Copy link
Copy Markdown

@DerekCorniello
DerekCorniello merged commit 2224609 into main Jul 31, 2026
3 checks passed
@DerekCorniello
DerekCorniello deleted the ci/pipeline-hygiene branch July 31, 2026 23:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant