Skip to content

✨ review: gate PR reviews on an approval label (review.require_labels) - #14987

Merged
hivecommons-hive[bot] merged 2 commits into
v5from
review-label-gate
Oct 28, 2026
Merged

hivecommons-hive[bot] merged 2 commits into
v5from
review-label-gate

Conversation

@clubanderson

Copy link
Copy Markdown
Member

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 of project.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)

Where Behaviour
Cadence reviewer kick (prListItemsForAgent, reviewer base) unlabelled PRs withheld from ${PR_LIST}; REVIEW LABEL GATE notice in the prompt; log review label gate withheld PRs from reviewer kick
Fan-out dispatch planner (planReviewDispatchWith) unlabelled PRs never become candidates (covers webhook-triggered dispatch too); log review label gate withheld PRs from review dispatch
hive-review relay (handleOneReviewRequest) re-reads PR labels with the App token; unlabelled → .denied + audit review_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 a review.* key survives it (checked api_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 + AdmitsPRLabels
  • pkg/scheduler: TestFormatPRList_ReviewRequireLabelsGate
  • pkg/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 pass
  • go test ./pkg/config ./pkg/scheduler ./pkg/github ./pkg/dashboard ./cmd/hive green locally; check-inline-js.js green.

@kubestellar-prow kubestellar-prow Bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Oct 28, 2026
@kubestellar-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign hanthor for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@github-actions

Copy link
Copy Markdown
Contributor

Changelog: this PR changes code but carries no changelog entry
(no changelog.d/ fragment and no CHANGELOG.md edit).

If it is user-visible — a feature, a fix an operator would notice, a
security change, a migration, a deprecation, or anything breaking —
please add a fragment file changelog.d/<category>-<pr-or-slug>.md
containing exactly your entry (see changelog.d/README.md; the
category is one of added/changed/deprecated/fixed/security). Please
do not append to CHANGELOG.md's ## Unreleased directly — that
shared section is the merge-conflict generator fragments replaced
(#5675). If it is a refactor, a test-only change, or dependency
churn, no entry is needed and you can ignore this.

This is a reminder, not a gate; it never blocks a merge.

@kubestellar-prow kubestellar-prow Bot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Oct 28, 2026
@github-actions

github-actions Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Open PR overlap check

Base branch: v5

Conflicts are checked with every PR merged onto the current tip of v5, so a PR that only needs a rebase is not reported as conflicting with its siblings.

PR Title Relation Files
#14524 ✨ feat(hub,agent): Hub-coordinated live CLI session pool for multi-tenant runner capacity same files src/cmd/hive/main.go
#14807 ✨ dashboard: stream Job pod logs in the terminal pane for sandbox.runtime: job agents same files src/pkg/dashboard/static/index.html
#14921 ✨ feature: inline the linked Linear issue into review kicks same files src/cmd/hive/main.go
#14989 ✨ feat: let a sandboxed reviewer post reviews through a workspace spool same files src/pkg/github/review_request_watcher.go
#15016 ✨ Adoption: maintainer_policy adopt|ask|never (default adopt); 072 row says why and offers Adopt same files src/docs/dashboard-sections.md
src/pkg/config/config.go
src/pkg/dashboard/static/index.html
#14992 ✨ Activity monitor: decision badge shows what you chose and what hive did next same files src/docs/dashboard-sections.md
src/pkg/dashboard/static/index.html
#15003 ✨ feature: show Activity Monitor operator decision trails same files src/pkg/dashboard/static/index.html

@hivecommons-hive

Copy link
Copy Markdown
Contributor

@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.

@hivecommons-hive hivecommons-hive Bot added author/human A person pushed this PR themselves dco All commits are DCO signed-off role/trusted Author is trusted for unattended merge (trusted-author role or registry/claim tier in require_tiers) stage/050-review-pending Review swarm requested; awaiting a verdict for the current head labels Oct 28, 2026
@hivecommons-hive hivecommons-hive Bot added stage/071-needs-author Human-authored PR: CI red, changes requested or conflicting; diagnosis posted, the author must act and removed stage/050-review-pending Review swarm requested; awaiting a verdict for the current head labels Oct 28, 2026
@hivecommons-hive

Copy link
Copy Markdown
Contributor

@clubanderson this PR is held at stage/071-needs-author and the hive will not merge it yet.

Failing checks:

  • test (dashboard 1/4)
  • test (dashboard shuffle 2/3)
  • test (rest 3/4)

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.

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Triage of the red checks at 37029d0 (all PR-local; the base is not implicated):

  1. changelog-fragment-guard — fragment is under src/. Fix: git mv src/changelog.d/added-review-require-labels.md changelog.d/added-review-require-labels.md
  2. test (dashboard 1/4) and (dashboard shuffle 2/3) — pkg/dashboard.TestFeaturesTabControlsAllHaveTooltips: the new Features-tab control(s) for review.require_labels need a tooltip/title like the sibling controls.
  3. test (rest 3/4) — pkg/dashboard/webstatic.TestSettingsSearchIndexResolvesToControls (the new setting must be registered in the settings search index so it resolves to a control id) and webstatic.TestStyleRatchet (new inline style / class count exceeds the ratchet baseline — reuse existing classes or bump the baseline deliberately).

The hive does not push to author branches; a new head re-runs CI and the review swarm automatically.


🐝 Hive Agent: scanner | Instance: hosted-available-oke-11-placeholder-r05x | SHA: unknown

— hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Read the gate end to end at 37029d0; the enforcement is correct and matches #14983.

  • pkg/scheduler/kickmessage.go:718 — prListItemsForAgent returns actionable.PRs.Items unchanged for any non-reviewer base before the new AdmitsPRLabels check, 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 / labelMatches in issue_filter.go:295 — same exact, case-insensitive matcher as project.issue_filter.require_labels, so approved-for-review does not admit under approved.
  • 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 to retryOrQuarantineReview, not .denied. With the gate off (reviewRequireLabels() nil) no extra GET is made.
  • pkg/dashboard/api_config_review.go:525 — PUT with "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

@hivecommons-hive

Copy link
Copy Markdown
Contributor

hive/awaiting-ci: pushed 9656cf0 — moved the changelog fragment to changelog.d/, gave the label input its own help mark (dropping the duplicate yamlHint that made two rows match review.require_labels[]), and replaced the two new inline styles with the .config-toggle gap plus a [hidden] rule so the style ratchet holds at 1427. CI pending — sweep will merge when green.


🐝 Hive Agent: scanner | Instance: hosted-available-oke-11-placeholder-r05x | SHA: unknown

— hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88

@hivecommons-hive

Copy link
Copy Markdown
Contributor

1 of 2 commits on 9656cf07e5cf are the hive's, signed off as the hive App, and the rest are @clubanderson's with their own sign-off. A squash would land the hive's commits under @clubanderson's name with the App's sign-off, so the hive will merge this PR with a merge commit instead (merge-method/merge): every commit lands as it is, each with its own author's sign-off. Nothing is rewritten and nobody needs to act. Maintainers merging by hand: use gh pr merge --merge, not squash.

@hivecommons-hive hivecommons-hive Bot added merge-method/merge Hive merges this PR with a merge commit (mixed authorship, each commit self-signed); never squash stage/050-review-pending Review swarm requested; awaiting a verdict for the current head and removed stage/071-needs-author Human-authored PR: CI red, changes requested or conflicting; diagnosis posted, the author must act labels Oct 28, 2026
clubanderson and others added 2 commits October 28, 2026 13:08
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>
@hivecommons-hive
hivecommons-hive Bot merged commit a0fad68 into v5 Oct 28, 2026
78 of 79 checks passed
@kubestellar-prow
kubestellar-prow Bot deleted the review-label-gate branch October 28, 2026 17:43
@hivecommons-hive

Copy link
Copy Markdown
Contributor
Evidence bundle `#14987b7249f9` sha256:dfd73226fc94da13d85798d76bccfd72885cbd1befb89335973fc1c8b6ac4af9 — download from the dashboard or `hivectl review evidence #14987`.

@hivecommons-hive

Copy link
Copy Markdown
Contributor

merged by Hive trusted-author auto-merge: author @clubanderson holds role owner and GitHub permission admin on repo; CI green at b7249f9.

@github-actions

Copy link
Copy Markdown
Contributor

Thank you for your contribution! Your PR has been merged.

We'd love to hear how your experience was: share feedback

@hivecommons-hive hivecommons-hive Bot removed role/trusted Author is trusted for unattended merge (trusted-author role or registry/claim tier in require_tiers) stage/050-review-pending Review swarm requested; awaiting a verdict for the current head labels Oct 28, 2026

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 AdmitsPRLabels skip inside prListItemsForAgent sits below the existing BaseAgentName(agentName) != "reviewer" early return (src/pkg/scheduler/kickmessage.go:702 on v5), so templates.go:335 rendering ${PR_LIST} for scanner/fix/ci lanes is untouched — matching the non-reviewer lists are not gated test. I checked this specifically because the filter itself has no agent check; the scoping comes from the pre-existing guard.
  • Planner. review.PlanDispatch has one caller (src/cmd/hive/main.go:10893); the diff filters its candidate slice with the same cfg.Review.AdmitsPRLabels(pr.Labels) before the call, so the "fan-out dispatch planner" claim in the changelog/docs is backed by code.
  • Relay. reviewLabelGateAdmits re-fetches labels with the App token and returns the error on fetch failure; handleOneReviewRequest routes that to the existing retryOrQuarantineReview (review_request_watcher.go:693) rather than denying, and a non-admitted PR goes to denyReviewRequest with an audit row. labelNames (automerge_desk.go:11) and splitRepo (client.go:1697) already exist. With the gate off, no extra PullRequests.Get is made.
  • Default preserved. NormalizedRequireLabels returns nil for empty/blank lists, so an absent key keeps every PR reviewable; anyLabelMatches is 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author/human A person pushed this PR themselves dco All commits are DCO signed-off dco-signoff: yes Indicates the PR's author has signed the DCO. merge-method/merge Hive merges this PR with a merge commit (mixed authorship, each commit self-signed); never squash size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

✨ review.require_labels: review only PRs carrying an approval label (Features → Review Gate)

1 participant