fix(ci): skip maintainer, bot, and closed PRs in the ready-for-review gate - #4190
Conversation
… gate The gate had no author check, so it labelled maintainer PRs. Half the in-window PRs are the team's own work, so labelling them halves the signal the label exists to create: maintainers land their own changes and do not need routing into a review queue. The nudge already exempts maintainers for the same reason, and the gate should match it. Two of the four PRs labelled on the first enforcing run were MEMBER-authored. Detection uses both signals, like the nudge: a maintainer whose org membership is private reads as CONTRIBUTOR, and one with write access may be missing from .github/MAINTAINER. The file is read from the API rather than the checked-out tree, so a PR cannot self-grant by editing it. Bots are skipped too. Also skip closed and merged PRs. `is:open` in the search is index-backed and lags, so a PR that closed in the last few minutes still comes back; the state we are handed is now checked before writing. Verified against production: 13 maintainer PRs now skip, and the two community PRs already carrying the label keep it. Co-authored-by: Isaac Signed-off-by: Dhruv Gupta <dhruv.gupta@databricks.com>
|
🏷️ Doc impact: Changes only to a CI GitHub Actions script (ready-for-review.js) and its tests for internal PR-labelling logic, which is not a user-facing surface or integration. Auto-classified on merge. Set the label manually before merging to override. · run |
|
… gate (omnigent-ai#4190) The gate had no author check, so it labelled maintainer PRs. Half the in-window PRs are the team's own work, so labelling them halves the signal the label exists to create: maintainers land their own changes and do not need routing into a review queue. The nudge already exempts maintainers for the same reason, and the gate should match it. Two of the four PRs labelled on the first enforcing run were MEMBER-authored. Detection uses both signals, like the nudge: a maintainer whose org membership is private reads as CONTRIBUTOR, and one with write access may be missing from .github/MAINTAINER. The file is read from the API rather than the checked-out tree, so a PR cannot self-grant by editing it. Bots are skipped too. Also skip closed and merged PRs. `is:open` in the search is index-backed and lags, so a PR that closed in the last few minutes still comes back; the state we are handed is now checked before writing. Verified against production: 13 maintainer PRs now skip, and the two community PRs already carrying the label keep it. Co-authored-by: Isaac Signed-off-by: Dhruv Gupta <dhruv.gupta@databricks.com> Co-authored-by: Dhruv Gupta <dhruv0811@gmail.com>
… gate (omnigent-ai#4190) The gate had no author check, so it labelled maintainer PRs. Half the in-window PRs are the team's own work, so labelling them halves the signal the label exists to create: maintainers land their own changes and do not need routing into a review queue. The nudge already exempts maintainers for the same reason, and the gate should match it. Two of the four PRs labelled on the first enforcing run were MEMBER-authored. Detection uses both signals, like the nudge: a maintainer whose org membership is private reads as CONTRIBUTOR, and one with write access may be missing from .github/MAINTAINER. The file is read from the API rather than the checked-out tree, so a PR cannot self-grant by editing it. Bots are skipped too. Also skip closed and merged PRs. `is:open` in the search is index-backed and lags, so a PR that closed in the last few minutes still comes back; the state we are handed is now checked before writing. Verified against production: 13 maintainer PRs now skip, and the two community PRs already carrying the label keep it. Co-authored-by: Isaac Signed-off-by: Dhruv Gupta <dhruv.gupta@databricks.com> Co-authored-by: Dhruv Gupta <dhruv0811@gmail.com> Co-authored-by: Nick Isaacs <nick.isaacs@datadoghq.com>
Related issue
Part of OMNI-2214 / OMNI-2315. Fixes the gate enabled in #4188; this PR declares
Test / CI below, which is one of the exempt types.
Summary
Three exclusions the gate was missing.
Maintainer and bot PRs
The gate had no author check at all, so it labelled the team's own work. Two of the
four PRs labelled on the first enforcing run were
MEMBER-authored (#4187, #4113).That halves the signal the label exists to create.
waiting-for-reviewis meant toroute incoming contributions into a review queue; maintainers land their own changes
and do not need routing. Half the in-window PRs are maintainer PRs (12 of 24
non-draft), so leaving them in makes the queue no more useful than the open-PR list.
The nudge already exempts maintainers for exactly this reason, and the two checks
should agree.
Detection uses both signals, matching the nudge:
authorAssociationcatches mostcases, and
.github/MAINTAINERcatches a maintainer whose org membership is privateand therefore reads as
CONTRIBUTOR. The file is read from the API rather than thechecked-out tree, so a PR cannot self-grant by editing it. Bots are skipped too.
Closed and merged PRs
is:openin the search query is index-backed and lags, so a PR closed or merged inthe last few minutes still comes back from the search and would be labelled. The gate
now checks the
stateit was handed before writing. Drafts were already skipped.Test Plan
node .github/workflows/ready-for-review.test.jspasses, with new cases for eachexclusion:
MEMBER/OWNER/COLLABORATOR/ bot authors are skipped; amaintainer found only via
.github/MAINTAINERis skipped; a genuine outsidecontributor is still labelled; and
CLOSED/MERGEDPRs are skipped.Verified against production with the label write rigged to throw:
The two already-labelled are the community PRs (fix(pi-native): carry catalog token limits into the pi-native model list #4178, Persist custom agent reasoning effort for bundled sessions #4128), which correctly keep
the label. No write attempted.
Note on the two maintainer PRs already labelled
#4187 and #4113 were labelled before this fix. The gate will not remove a label it
already applied, so those two keep it until someone takes it off by hand. That is
deliberate: the sweep never removes
waiting-for-review, and teaching it to wouldrisk fighting a maintainer who applied it on purpose.
Demo
N/A. CI label mechanics, no user-visible UI.
Type of change
Test coverage
Coverage notes
Unit tests cover every new exclusion. Manual verification was running the fixed gate
against live GitHub with the label write rigged to throw.