Repository navigation
✨ review: gate PR reviews on an approval label (review.require_labels) - #14987
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Changelog: this PR changes code but carries no changelog entry If it is user-visible — a feature, a fix an operator would notice, a This is a reminder, not a gate; it never blocks a merge. |
Open PR overlap checkBase branch: Conflicts are checked with every PR merged onto the current tip of
|
|
@clubanderson is auto-promoted for contributor-lane merging on this PR: the last 5 merged PRs by this author in this hive's repositories have no revert or sentinel-alert evidence. CI, reviewer verdict, diff fences, soak, holds and branch protection still apply. |
|
@clubanderson this PR is held at Failing checks:
Next: the hive does not push to your branch. Push a new head (or reply here); CI and the review swarm re-run automatically and the PR returns to the normal path. |
|
Triage of the red checks at 37029d0 (all PR-local; the base is not implicated):
The hive does not push to author branches; a new head re-runs CI and the review swarm automatically. 🐝 Hive Agent: — hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88 |
There was a problem hiding this comment.
Read the gate end to end at 37029d0; the enforcement is correct and matches #14983.
pkg/scheduler/kickmessage.go:718—prListItemsForAgentreturnsactionable.PRs.Itemsunchanged for any non-reviewerbase before the newAdmitsPRLabelscheck, so fix/scanner/docs lanes still see unlabelled PRs. The gate is reviewer-only, as the issue scopes it.pkg/config/review_require_labels.go:46→anyLabelMatches/labelMatchesinissue_filter.go:295— same exact, case-insensitive matcher asproject.issue_filter.require_labels, soapproved-for-reviewdoes not admit underapproved.pkg/github/review_request_watcher.go:366— the relay check sits after the repo-pause check and before the thread-reply / record-verdict branches, so every event type is refused for an unlabelled PR; fetch errors go toretryOrQuarantineReview, not.denied. With the gate off (reviewRequireLabels()nil) no extra GET is made.pkg/dashboard/api_config_review.go:525—PUTwith"require_labels": []normalises to nil and turns the gate off; omitting the key leaves it unchanged.
Only blockers are the PR-local red checks the hive already triaged above (fragment under src/changelog.d/, Features-tab tooltip test). Once those are pushed this looks correct to me.
— hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88
|
hive/awaiting-ci: pushed 9656cf0 — moved the changelog fragment to 🐝 Hive Agent: — hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88 |
|
1 of 2 commits on |
Add review.require_labels, the PR-side counterpart of project.issue_filter.require_labels. When set, a PR is reviewed only if it carries at least one of the labels (case-insensitive exact match). Enforced server-side in the cadence reviewer kick list, the fan-out review dispatch planner and the hive-review relay (which re-reads the PR's labels with the App token and denies posts on an unlabelled PR, audit action review_label_gate_refused), so a prompt cannot bypass it. Dashboard: Settings -> Features -> Review Gate gains an "Only review labelled PRs" toggle plus label list, saved through PUT /api/config/review and persisted in the dashboard overlay. ACMM pack re-apply only reconciles agent blocks, so the setting survives it. Fixes #14983 Reported-by: @joerunde (a1-vllm-spyre spoke) Signed-off-by: Andrew Anderson <andy@clubanderson.com>
Move the changelog fragment to the repository-root changelog.d/, give the label input its own help mark and drop its duplicate yamlHint so the search index resolves to one row, and replace the two new inline styles with the .config-toggle spacing and a [hidden] rule so the style ratchet stays at its baseline. Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
9656cf0 to
b7249f9
Compare
|
merged by Hive trusted-author auto-merge: author @clubanderson holds role owner and GitHub permission admin on repo; CI green at b7249f9. |
|
Thank you for your contribution! Your PR has been merged. We'd love to hear how your experience was: share feedback |
There was a problem hiding this comment.
Read the diff against v5 (8e26835), including the callers of the three enforcement points the body names. The gate is where it says it is; looks correct to me.
What I verified:
- Kick list is reviewer-only. The new
AdmitsPRLabelsskip insideprListItemsForAgentsits below the existingBaseAgentName(agentName) != "reviewer"early return (src/pkg/scheduler/kickmessage.go:702on v5), sotemplates.go:335rendering${PR_LIST}for scanner/fix/ci lanes is untouched — matching thenon-reviewer lists are not gatedtest. I checked this specifically because the filter itself has no agent check; the scoping comes from the pre-existing guard. - Planner.
review.PlanDispatchhas one caller (src/cmd/hive/main.go:10893); the diff filters its candidate slice with the samecfg.Review.AdmitsPRLabels(pr.Labels)before the call, so the "fan-out dispatch planner" claim in the changelog/docs is backed by code. - Relay.
reviewLabelGateAdmitsre-fetches labels with the App token and returns the error on fetch failure;handleOneReviewRequestroutes that to the existingretryOrQuarantineReview(review_request_watcher.go:693) rather than denying, and a non-admitted PR goes todenyReviewRequestwith an audit row.labelNames(automerge_desk.go:11) andsplitRepo(client.go:1697) already exist. With the gate off, no extraPullRequests.Getis made. - Default preserved.
NormalizedRequireLabelsreturns nil for empty/blank lists, so an absent key keeps every PR reviewable;anyLabelMatchesis the same helper the issue gate already uses (config/issue_filter.go:295), so case handling is consistent between the two allow-lists.
No findings.
— hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88
Fixes #14983
Reported by @joerunde (a1-vllm-spyre spoke): "I see reviews but the team wants those GATED — can reviews run only when a label is added to a PR?"
What
New
review.require_labels: [..]— the PR-side counterpart ofproject.issue_filter.require_labels. Empty (default) = every open PR is reviewable. Set = a PR is reviewed only if it carries at least one of the labels (case-insensitive exact match). Labels are never created by the hive.Enforced server-side (three places)
prListItemsForAgent,reviewerbase)${PR_LIST};REVIEW LABEL GATEnotice in the prompt; logreview label gate withheld PRs from reviewer kickplanReviewDispatchWith)review label gate withheld PRs from review dispatchhive-reviewrelay (handleOneReviewRequest).denied+ auditreview_label_gate_refused; fetch error → retry (never posts blind)Dashboard
Settings → Features → Review Gate → Only review labelled PRs toggle + comma-separated label list, next to the existing priority-labels toggle. Saved through
PUT /api/config/review(require_labels), persisted in/data/hive.yaml.dashboard. Hub pack / ACMM re-apply only reconciles per-agent blocks, so areview.*key survives it (checkedapi_packs.go).Docs / changelog
docs/review-swarm.md(new section),docs/agent-configuration.md(label policy),docs/dashboard.md,docs/dashboard-sections.md;changelog.d/added-review-require-labels.md.Tests
pkg/config: normalisation +AdmitsPRLabelspkg/scheduler:TestFormatPRList_ReviewRequireLabelsGatepkg/github:TestReviewRelay_RequireLabelsGate(refused/.denied/audited, labelled passes, gate off never fetches, fetch failure retried)pkg/dashboard:TestReviewConfigPut_RequireLabels; settings-parity and section-help coverage passgo test ./pkg/config ./pkg/scheduler ./pkg/github ./pkg/dashboard ./cmd/hivegreen locally;check-inline-js.jsgreen.