Repository navigation
🐛 Close the hive's own empty-diff PRs as superseded instead of asking a person - #15584
Conversation
A hive-authored adoption whose fix had already landed through another PR sat a day at "needs decision" (#15499) while the swarm asked the owner "close as a no-op?" on six heads in a row. Root cause: the adoption's dispatch records carried no author_agent, so the verdict relay judged the App's own PR non-hive and routed its decision down the contributor lane. Dispatch records now carry hive_authored and the relay falls back to the PR author's login against the hive identity. Then three fixes on top: - Empty-diff auto-close. A hive-authored PR with changed_files == 0, confirmed by the base...head compare, is closed through the writeback gate as superseded by the PR the reviewer named (hive-redundant-of), with the sweep's edited-in-place comment and hive/superseded label. Same guards as the superseded rule (L6, held, keep-open, draft, parked by a person) plus a 15-minute head age. A person's empty PR is never closed by the hive. supersededCheckWarranted now runs for a decision verdict that carries hive-redundant-of; the aggregate never self-approves such a question. - Decision-question dedupe. writeback.DecisionKey identifies a question by its hive-redundant-of PR, else its normalised words; content dedupe collapses reworded bodies to it. The relay refreshes the hive's standing COMMENTED review in place instead of posting again, and the 085 entry comment is not repeated across heads or 50<->85 flaps. A PR with no diff against its base re-stamps its prior verdict on every new head (delta re-review), so a merge-from-base no longer draws a review round. - Tracker decision_needed. A row parked on a reviewer decision quotes the newest decision-requested verdict on any head (the current head has none during a re-review), carries redundant_of, shows a "redundant of #N" chip and leads with "Close as superseded". Signed-off-by: Andrew Anderson <andy@clubanderson.com>
|
[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 |
Open PR overlap checkBase branch: Conflicts are checked with every PR merged onto the current tip of
|
|
@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. |
|
stage 080-awaiting-merge-admission → 071-needs-author: optional-check-failing:relative links and anchors resolve |
…nds on it Signed-off-by: Andrew Anderson <andy@clubanderson.com>
|
@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. |
|
stage 080-awaiting-merge-admission → 071-needs-author: optional-check-failing:relative links and anchors resolve |
Signed-off-by: Andrew Anderson <andy@clubanderson.com>
|
stage 080-awaiting-merge-admission → 050-review-pending: required-check-missing:build-and-test |
|
@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. |
…generates byte-exact Signed-off-by: Andrew Anderson <andy@clubanderson.com>
|
stage 080-awaiting-merge-admission → 050-review-pending: check-pending |
There was a problem hiding this comment.
Correctness review — read at head 0af7642.
1. Decision dedupe collapses different perspectives on the same head (medium). findOwnOpenDecisionReview (src/pkg/github/review_revise.go:166-196) matches any of the App's COMMENTED reviews with the same DecisionKey, with no head or perspective filter, and handleOneReviewRequest (src/pkg/github/review_request_watcher.go:532-540) then UpdateReviews it with the new body. The #15499 case had ~2–3 perspectives per head carrying the same hive-redundant-of: #15427; with this change the second perspective's review on a head overwrites the first's body, so any findings the first perspective reported alongside the question disappear from GitHub (the artifact still has them, the person does not). The PR body scopes this to "an earlier head"; the code does not. Suggested: only refresh reviews from a previous head.
--- a/src/pkg/github/review_request_watcher.go
+++ b/src/pkg/github/review_request_watcher.go
- } else if existing := c.findOwnOpenDecisionReview(ctx, owner, repoName, req.Number, req.Body); existing != nil && apiEvent == "COMMENT" {
+ } else if existing := c.findOwnOpenDecisionReview(ctx, owner, repoName, req.Number, req.Body, c.reviewedPRSnapshotFunc(ctx, req)().Head); existing != nil && apiEvent == "COMMENT" {
--- a/src/pkg/github/review_revise.go
+++ b/src/pkg/github/review_revise.go
-func (c *Client) findOwnOpenDecisionReview(ctx context.Context, owner, repoName string, number int, reqBody string) *gh.PullRequestReview {
+func (c *Client) findOwnOpenDecisionReview(ctx context.Context, owner, repoName string, number int, reqBody, currentHead string) *gh.PullRequestReview {
...
if !strings.EqualFold(safeGetLogin(r.GetUser()), login) || !strings.EqualFold(r.GetState(), "COMMENTED") {
continue
}
+ // Same head: another perspective's review, not a re-ask on a new head.
+ if currentHead != "" && strings.EqualFold(strings.TrimSpace(r.GetCommitID()), currentHead) {
+ continue
+ }2. In-place edit bypasses the review.revise_repos allowlist (medium). reviseReview refuses to edit a standing review outside review.revise_repos as a terminal policy denial (src/pkg/github/review_revise.go:117-119, :94-96; watcher denies at review_request_watcher.go:565-571). refreshDecisionReview (review_revise.go:201-213) calls PullRequests.UpdateReview on any repo with no allowlist check, and also outside the effects.ExecuteReconciling mutation boundary the normal post uses (review_request_watcher.go:542-560). Suggested minimal fix — honour the allowlist and fall through to the ordinary path when not granted:
} else if existing := c.findOwnOpenDecisionReview(ctx, owner, repoName, req.Number, req.Body); existing != nil && apiEvent == "COMMENT" && reviseReviewAllowed(req.Repo, c.reviseRepos) {
3. Review-link ledger records the old head after a refresh (low). After the dedupe path created is the updated (or, when the body is unchanged, the untouched) existing review, and RecordReviewLink stores created.GetCommitID() (review_request_watcher.go:606-616) — the previous head's SHA, since UpdateReview does not move commit_id. perHeadReviewRefusal compares that against the live head (:884), so the per-head cap is silently off for the new head and the ledger misreports which head was reviewed. Record the current head instead when decisionDeduped is true.
Advisory (no change requested): emptyDiffHeadAge (src/pkg/github/pr_empty_diff_hive_autoclose.go:244-253) measures from updated_at, which GitHub bumps on every label/comment, not from the head commit; the docs call it "a head at least 15 minutes old". It only delays the close, never mis-fires, so just noting the drift.
— hive: agent=adjudicator backend=copilot model=claude-fable-5.1 copilot=1.0.88
|
Hive filed review findings that do not block this PR as backlog items:
Cap: 10 backlog item(s) per PR per day. |
|
stage 080-awaiting-merge-admission → 050-review-pending: required-check-pending:build-and-test |
|
Thank you for your contribution! Your PR has been merged. We'd love to hear how your experience was: share feedback |
Why
Hive's adoption of @Karibhou's #15400 (#15499) sat a day at stage 085 "needs decision". Its tree is identical to
v5— #15427/#15449 already landed the fix — and the reviewer swarm asked @clubanderson "close as a no-op?" on six heads in a row (~16 "Decision needed" reviews + 085 entry comments). The owner's question: "hive adopted by hive agent — why does hive need me?"Exact block: reviewer
requires_human/ decision-requested verdict with<!-- hive-redundant-of: #15427 -->, surfaced to the owner ascontributor-lane:decision-requestedwith the generic "handed to a person without a specific question" prompt.Root cause (bug, not policy)
The adoption's dispatch records carried no
author_agent, soreview_verdict_relayjudged the App's own PR non-hive → aggregateHiveAuthoredKnown=true, HiveAuthored=false→ contributor-lane routing to a person. Dispatch records now carryhive_authored; the relay also falls back to the PR author's login against the hive identity.Fixes
pkg/github/pr_empty_diff_hive_autoclose.go): hive-authored PR withchanged_files == 0, confirmed bybase...headcompare → closed through the writeback gate as superseded by thehive-redundant-ofPR (sweep comment edited in place,hive/supersededlabel, terminal superseded stage). Guards:auto_close_supersededon, ACMM L6, not held/keep-open/draft/parked-by-person, head ≥15 min old. Never closes a person's PR — they keep the prompt. Hooked from the self-authored sweep and the 085 route;supersededCheckWarrantednow fires for a decision verdict carryinghive-redundant-of; the aggregate never self-approves such a question.writeback.DecisionKey=hive-redundant-ofPR, else normalised question words (mentions/item refs/digits/punctuation stripped — content dedupe missed these because a model reworded each). Relay refreshes the standingCOMMENTEDreview in place rather than posting again; 085 entry comment not repeated across heads or 50↔85 flaps; a PR with no diff against its base re-stamps its prior verdict on each new head (delta re-review), so a merge-from-base no longer draws a review round.decision_needed: a row parked on a reviewer decision quotes the newest decision-requested verdict on any head (the current head has none during a re-review), carriesredundant_of, shows a redundant of #N chip and leads with Close as superseded.Invariants kept: never auto-merge⚠️ /needs-owner-merge; never auto-merge a human-authored PR without trust; never auto-close a human-authored PR.
Tests
DecideHiveEmptyDiffAutoClose,PRChangedFilesClaimsEmpty, close-comment markers,dispatchRecordHiveAuthored,reviewRedundantOfNumber,DecisionKey/content dedupe,EntryCommentRepeatsDecision,planDeltaempty-base-diff restamp, aggregate keepsRedundantOfdecision,supersededCheckWarranted, tracker lookup fallback + lead option.Docs:
hive-merge.md(new "Empty-diff PRs of the hive's own"),review-swarm.md; changelog fragment.Refs #15499