Repository navigation
[BUG]: actions/labeler interference with restricted-paths-guard.yml workflow #1967
Description
This note summarizes the investigation into why PR #1965 showed:
github-actions[bot]addedNeeds-Restricted-Paths-Review- then immediately removed
Needs-Restricted-Paths-Review - while also adding
cuda.bindingsandcuda.core
Bottom line
There is no code path in .github/workflows/restricted-paths-guard.yml that removes Needs-Restricted-Paths-Review.
The workflow still has the intended sticky behavior:
- if review is needed and the label is absent, it adds the label
- if the label is already present, it leaves it in place
- it does not call
gh pr edit --remove-label
So the removal appears to be coming from a different label-managing workflow, most likely .github/workflows/pr-auto-label.yml, which uses actions/labeler.
Evidence
1. restricted-paths-guard.yml does not remove the label
The live main copy of .github/workflows/restricted-paths-guard.yml only adds the label or leaves it in place:
- it sets
LABEL_ACTION="added"aftergh pr edit ... --add-label - or it sets
LABEL_ACTION="left in place (manual removal required)" - there is no
--remove-labelanywhere in that workflow
That means the sticky-label behavior was not accidentally removed there.
2. The issue events show add, then remove, then module labels
For PR #1965, GitHub issue events show this exact sequence at 2026-04-22T20:46:11Z:
labeled->Needs-Restricted-Paths-Reviewunlabeled->Needs-Restricted-Paths-Reviewlabeled->cuda.bindingslabeled->cuda.core
All four events were attributed to github-actions[bot].
The ordering matters: the Needs-Restricted-Paths-Review add happened first, and the remove happened immediately afterward in the same second.
3. The workflows running at that exact time were:
CI: Restricted Paths Guardrun24801785023CI: Auto-label PRs by pathrun24801785008CI: Enforce assignee/label/milestone on PRsrun24801785059
Of those three:
restricted-paths-guard.ymlcan addNeeds-Restricted-Paths-Reviewpr-metadata-check.ymldoes not edit labelspr-auto-label.ymlapplies labels usingactions/labeler
This leaves pr-auto-label.yml / actions/labeler as the likely source of the removal.
4. pr-auto-label.yml uses actions/labeler
The workflow is:
- file:
.github/workflows/pr-auto-label.yml - action:
actions/labeler@634933edcd8ababfe52f92936142cc22ac488b1b(v6.0.1)
Its label rules live in .github/labeler.yml, and for this PR they match:
cuda.bindingsforcuda_bindings/**cuda.coreforcuda_core/**
That lines up exactly with the labels that were added at the same time the restricted-paths label disappeared.
5. The actions/labeler log says sync-labels: false
The CI: Auto-label PRs by path run log includes:
sync-labels: false
In theory, that setting should mean labeler does not remove labels.
However, there are historical reports/issues against actions/labeler where labels were still removed despite sync-labels: false, or where labels not defined in labeler.yml were still affected.
So the observed behavior is surprising, but not unprecedented.
Current conclusion
My current best explanation is:
restricted-paths-guard.ymlcorrectly addedNeeds-Restricted-Paths-Reviewpr-auto-label.yml/actions/labelerthen removed it while applying the module labels
So this looks like interference from actions/labeler, not a bug in the sticky-label logic inside restricted-paths-guard.yml.
Practical implication
If we want Needs-Restricted-Paths-Review to remain sticky and avoid interference from unrelated label automation, then actions/labeler in .github/workflows/pr-auto-label.yml is the first place I would look to change or replace.
The safest direction would likely be to use an add-only module-labeling step that never removes labels it does not own.
Activity
leofang commentedon Apr 24, 2026
What's puzzling is that the labeler's default for
sync-labelsis false, so it should not remove any label either. It's likely a race condition but still unclear which workflow has the capability to remove labels.leofang commentedon Apr 24, 2026
I think actions/labeler#917 might help. Let's pin our action to a more recent commit...
Update actions/labeler pin to include actions/labeler#917
rwgk commentedon Apr 24, 2026
Generated with Cursor GPT-5.4 Extra High Fast, from the same agent chat I used to develop restricted-paths-guard.yml
One idea: combine
.github/workflows/pr-auto-label.ymland.github/workflows/restricted-paths-guard.ymlinto a single workflow.Right now we have two separate
pull_request_targetworkflows mutating labels at nearly the same time:CI: Auto-label PRs by pathCI: Restricted Paths GuardEven if both workflows are individually reasonable, that setup makes it hard to reason about ordering, and it leaves room for cross-workflow races.
If we combine them into one workflow, then we can make the ordering explicit:
That way, if the path-labeling step is going to interfere with other labels, the restricted-paths step still runs last and can re-assert
Needs-Restricted-Paths-Review.I see two plausible versions of this:
Option 1: minimal change
actions/labeleropened,synchronize,reopened,ready_for_review)This is probably the smallest change and may already be enough to eliminate the race we are seeing.
Option 2: more robust
actions/labelercuda.bindings/cuda.core/cuda.pathfinderpath checks directly in shellThis adds a bit more code, but it would avoid both cross-workflow races and any
actions/labeler-specific label sync behavior.So my current thought is: combining the workflows seems like a good direction either way. The minimal version is probably worth trying first; the add-only custom labeling version is the cleaner long-term solution if we want fully predictable behavior.
Update actions/labeler pin to include actions/labeler#917 (#1971)
leofang commentedon Apr 24, 2026
I actually like the unified workflow idea. #1971 only reduces the chance of hitting the race, but not eliminating it. Both Claude and Codex warned me while I was pondering about it.
That said, we should hold off and see if the Runner team figures out the app-based solution... Maybe this would become moot once the other solution is online.
rwgk commentedon May 2, 2026
It's still an issue: #2011
I don't think is urgent at all, but we should combine the workflows when we get a chance.