Repository navigation
Description
Opening a pull request with gh pr create --label comments produces a run whose allow-comments input is false, so the prose gate fails on comment-added even though the label is on the pull request from the moment it exists. The next push then passes. Every comments-labelled pull request opened this way burns one failed run, and the runbook's own advice cannot be followed through the flag that looks like it follows it.
Measured
Both runs on the same branch, same label, taken from #1702:
| Run | Head | Event | allow-comments |
Result |
|---|---|---|---|---|
| 35468603217 | 732953da |
pull_request (opened) |
false |
fail, 24 comment-added |
| 35469712245 | 128dbf06 |
pull_request (synchronize) |
true |
pass |
gh pr view 1702 --json labels reported comments throughout, and the pull request was created at 20:50:08 with the run starting at 20:50:11.
Cause
The caller computes the input from the event payload:
allow-comments: ${{ contains(github.event.pull_request.labels.*.name, 'comments') || ... }}gh pr create --label creates the pull request and applies labels as a separate call, so the opened event is emitted before the label exists on the object. github.event.pull_request.labels is a snapshot taken at event time, so it is empty on that first run and correct on every run after it.
Why the documented remedy does not reach this
comment-and-doc-style states the constraint accurately and then gives advice that the obvious mechanism defeats:
The label is read off the event that started the run, so a label added after a run fails applies to the next push rather than to a re-run of that one, and labeling the pull request when it is opened is what avoids the round trip.
An agent reading that reaches for gh pr create --label, which is labelling at open in every sense the reader can act on, and still gets the failing run. The sentence is true about events and misleading about mechanisms.
Candidate fixes
- Read the label live rather than off the event. The caller queries the pull request's current labels in the job instead of using the payload snapshot. It costs one API read and removes the class, including a label added while a run is queued.
- Change the advice to match the mechanism. Document that the label must exist before the event, which in practice means creating the pull request against a branch with no commits to review, labelling, then pushing, or labelling and then re-pushing. This keeps the cost and moves it onto the author.
- Re-trigger on
labeled. Adding that event type re-runs the gate when the label lands. It doubles runs on any labelling action and does not help a run already in flight.
The first is the only one that removes the failed run rather than relocating it.
Scope
The caller is hub-hosted, so every repository reaching the gate through it meets this. The gate itself is correct: it reports what its input tells it, and the input is wrong.
Found while driving #1702, whose first run is the failure in the table.
Activity
ptr727 commentedon Sep 20, 2026
A second variant, where the advice cannot be followed at all
The issue above is about labelling at open. The same class fires when the need for the
label arises after the pull request already exists, and there the remedy the skill
offers has nothing to say, because there was no moment at open when the author could
have known to label.
#1705 is a measurement of it. The pull request opened at 22:40:08 carrying no comment
change, so its first run passed and no label was warranted. A later push added comments
to
prose_lint.py, and that push's run failed.allow-comments0779f884pull_request(opened)d8cc0120pull_request(synchronize)falsecomment-added4f482acfpull_request(synchronize)trueThe
commentslabel was applied at 23:08:08, two minutes and seventeen seconds afterthe failing run started and while it was still in flight. It changed nothing about that
run.
The pass is attributable to the label rather than to the content.
d8cc0120to4f482acfis a two-line comment-wrap fix, so every comment the failing run reported wasstill present in the passing one. The only input that differed was
allow-comments,which the logs confirm directly:
falseon the failing run andtrueon the passingone, with the stand-down line printing on the second.
What this changes about the candidate fixes
The three candidates above are not equivalent once this variant is counted.
Candidate 1, reading the label live in the job, removes both variants and is the only
one that does. The live read would have seen the label at 23:08:08 for a run that was
still executing, which is precisely the two-minute window this measurement sits in.
Candidate 2, changing the advice, cannot address this variant. There is no earlier
moment to move the labelling to. The advice would have to become "push an empty commit
after labelling", which is the round trip the failure already costs, written down.
Candidate 3, re-triggering on
labeled, does address this variant, and the issue textabove is right that it does not help a run already in flight. Worth noting that it would
have helped here anyway, since a re-triggered run would have started after the label
landed and superseded the failed one. It still doubles runs on every labelling action.
So the ordering stands, and candidate 1's margin over candidate 3 is narrower for this
variant than for the first one.
ptr727 commentedon Oct 3, 2026
Recurred on 2026-10-03 on two KiCadLibrary pull requests that call the hub validate-task.yml by pin (2.0.806). One opened with
gh pr create --label commentsfailed its first lint run oncomment-added. The other passed only because the label landed first. Closing and reopening each one cleared it, since a re-run reuses the opened payload. A duplicate filed by mistake as #2305 is closed in favor of this issue.Read the Comments Label Live Rather Than off the Event Payload (#2356)