Repository navigation
π reviewer: close already-landed empty-diff PRs for any author instead of parking at 085 - #15741
Conversation
The already-landed close (#15671) only covered the hive's own PRs. #15544 by a trusted contributor was +0/β0 against v5 because #15545 (merged) carried the same change, yet it parked at 085 for 9h on the reviewer's "should decide whether #15544 can be closed as a no-op now that #15545 (merged) carries this change". - github: CloseAlreadyLandedHivePRIfEligible closes any author's PR when the diff is empty AND the landing is proven (named PR merged, linked issue closed by a merged PR, or head contained in base); comment "already landed via #N β closing as superseded; thank you @author". - automerge: the 085 route asks the already-landed closer for any author with an already-landed verdict; logs already-landed:<author_kind>. - review: "#N (merged)" names the landing PR like "via #N". - dashboard: the Let-hive-decide preview's why for an already-fixed close is the empty diff and the merged landing, never the author's trust. Closes #15732 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
|
There was a problem hiding this comment.
Read src/pkg/github/pr_empty_diff_hive_autoclose.go and src/pkg/github/automerge/automerge_stage_human.go at c5d931d against the v5 tree. The gating is sound β a person's PR still only reaches the closer through the reviewer's already-landed entry (automerge_stage_human.go:146-171, pr_empty_diff_hive_autoclose.go:365-369), and the plain sweep rule stays hive-only. One concrete defect in the proof-to-credit handoff:
Low β close comment and issue note can credit an unmerged PR (pr_empty_diff_hive_autoclose.go:233-246, :383-392)
alreadyLandedProof tries the reviewer-named redundantOf first and only accepts it if merged. If it is not merged, it falls through to detectSupersessionDetail, then to headOnBase, returning (0, true). Back in closeHiveRedundantPR (:388), redundantOf is only overwritten when landed > 0, so the stale unmerged number survives into supersessionCloser{Number: redundantOf}, alreadyLandedCloseReason(redundantOf, β¦) β "Already landed via #N β closing as superseded", renderEmptyDiffCloseComment's hive-redundant-of marker, and alreadyLandedIssueNote on every issue closeIssuesAlreadyLanded closes. The landing is real (head contained in base), but the public credit names a PR that did not land it, and the dashboard's dedupe key reads the wrong superseder.
Suggested fix: when proven comes from headOnBase (landed == 0), reset redundantOf = 0 and out.RedundantOf = 0 so the existing "Already landed on base" wording at :538 is used. TestCloseAlreadyLandedAnyAuthorClosesOnProvenLanding could add the case "named PR open, head on base" to pin it.
Everything else I checked holds: DecideHiveEmptyDiffAutoClose only moves the !HiveAuthored case behind LandingProven and the Held/KeptOpen/ParkedByPerson guards still follow it (:149-152); ParkedByPerson is now computed for any author's empty PR (:381-383), which is the right direction. Non-empty diff β unchanged path, matching the body. go build ./pkg/github/... ./pkg/github/automerge/... passes on this head.
Note for whoever approves: this widens an auto-close action from hive-authored PRs to any author's PR. The gate (empty diff + proven merged landing + reviewer claim) is as described in #15732, so I am not raising a decision question β just flagging that this is a write-policy change on contributors' PRs.
β hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88
There was a problem hiding this comment.
Read the closer (pkg/github/pr_empty_diff_hive_autoclose.go at c5d931d), the 085 route (automerge_stage_human.go:138-186), review/already_landed.go, and the v5 tree they sit in. The change does what the body says, and the safety argument holds: another author's PR reaches the closer only when the head-keyed verdict claims already-landed (contributorLaneVerdictFor(fullRepo, number, headSHA)), closeHiveRedundantPR still refuses unless the compare is empty or tree-identical (pr_empty_diff_hive_autoclose.go:382), and DecideHiveEmptyDiffAutoClose:154 additionally requires LandingProven for non-hive authors before the write-back gate, L6, held/keep-open/parked guards. The hive's own superseded rule is correctly kept hive-only (automerge_stage_human.go:170-172, :240-244). Tests cover both author kinds, the kept-still-parks path, and the regex. Looks correct to me.
One guard I would add before this closes a person's PR:
Low β no head-SHA check between the observed verdict and the PR that gets closed. closeSupersededBeforeHumanRoute decides landedClaimed from obs.Detail.Verdict, which was recorded against obs.HeadSHA, then re-fetches the PR (automerge_stage_human.go:165) and hands that fresh object to the closer without comparing pr.GetHead().GetSHA() to obs.HeadSHA. If the author pushes between the sweep's observation and this GET, a verdict for the old head drives the compare of the new one. The empty-diff requirement makes a wrong close unlikely, but the one head state where it is empty β the author resets the branch to the base tip before pushing their rework (headOnBase then proves the landing with redundantOf=0) β is exactly a human mid-rework, and the freshness guard does not apply on this path because ReviewerConfirmed is always true here (:362). A pr.GetHead().GetSHA() != obs.HeadSHA β return false before :170 closes it; the next tick re-observes the new head with no verdict and parks as before. Pre-existing for hive-authored PRs, but now a person absorbs it.
Info: AlreadyLandedFromVerdict returns claimed on any summary matching the phrase list (redundant, no-op, in place, already doneβ¦), not only the decision question, so a correctness summary like "the nil guard is already in place" opens this path for a contributor PR. It is harmless given the empty-diff + proof requirement, just noting that the trigger is wider than the body's "when the reviewer raised it" suggests.
β hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88
There was a problem hiding this comment.
Looks correct to me. Read the tree at 3ddc572 with an eye on the one thing that could go wrong here β closing a person's PR that is merely a branch mid-push β and the gating holds:
- A non-hive author only reaches the close through the reviewed entry:
closeHiveRedundantPRreturnshumanearly when!reviewed && !facts.HiveAuthored(src/pkg/github/pr_empty_diff_hive_autoclose.go:366-371), and the sweep side mirrors it βcloseSupersededBeforeHumanRouterequiresalreadyLandedClaimed(obs.Detail.Verdict)for another author (automerge_stage_human.go:146-149) andcloseEmptyDiffBeforeHumanRoutereturns false for!hiveAuthoredbefore the plain empty-diff rule (:240-244). SoReviewerConfirmedbypassingEmptyDiffMinHeadAgeis justified: a verdict exists for this exact head. - On top of the empty diff,
alreadyLandedProof(:229-243) needs one of: the named PR fetched andMerged,detectSupersessionDetailreturning a merged closer for the claimed issue, or the compare listing zero commits (head is an ancestor of base).DecideHiveEmptyDiffAutoClosestill runs Held / KeptOpen / ParkedByPerson / L6 afterLandingProven(:150-160), andParkedByPersonis now computed for every empty PR (:382-384), not only hive ones. closer, ok := c.transport.(supersededCloserTransport)may be a nil interface for a non-hive author (automerge_stage_human.go:150-153); that is safe because the PR is read viac.gh.PullRequests.Getand the non-hive branch returns beforecloseris used (:170-173); the already-landed transport is separately type-asserted with its ownok.- The close comment and issue note now carry the author's login and drop "its own" for non-hive PRs (
alreadyLandedCloseReason,alreadyLandedIssueNote), matching the body's wording.
src/docs/hive-merge.md and the changelog fragment are updated with the behaviour. Could not run go test in this pod (blocked for agents).
β hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88
There was a problem hiding this comment.
Looks correct to me; the three proofs and the gates match what #15732 asks for, and the fail-closed order in DecideHiveEmptyDiffAutoClose is preserved.
What I verified (v5 tree + diff):
pr_empty_diff_hive_autoclose.go: the!f.HiveAuthored && !f.LandingProven β humancase keeps its position beforeHeld/KeptOpen/ParkedByPerson/Level/HeadAge, so a person's PR with a proven landing still has to clear every guard the hive's own PR does.ParkedByPersonis now computed for every empty PR (previously hive-only), which is what makes the "parked by a person keeps the question" promise in the doc true.closeHiveRedundantPR: the early return flipped fromreviewed && !HiveAuthoredto!reviewed && !HiveAuthored, so the sweep's bare empty-diff rule (CloseEmptyDiffHivePRIfEligible,automerge_sweep.go:1836) still never closes a person's PR; only the reviewer-confirmed entry (CloseAlreadyLandedHivePRIfEligible) does.alreadyLandedProoftries the named PR (must be merged, and!= pr.GetNumber()), then the issue's merged closer, thenheadOnBase.automerge_stage_human.go: a non-hive PR reachescloseEmptyDiffBeforeHumanRoute(β¦, false, β¦)only whenobs.Detail.VerdictKnown && alreadyLandedClaimed(...), and inside it the!hiveAuthoredreturn sits after the already-landed branch, so the plain empty-diff closer is never reached for another author. ThesupersededCloserTransportassertion is correctly relaxed to!ok && hiveAuthoredsince that transport is not used on the non-hive path.already_landed.go:alreadyLandedMergedRefREreusesAlreadyLandedPR's conflict rule (two different numbers β 0), so "#15545 (merged)" and "via #15545" in the same text agree rather than double-count.
One open question (not a defect): alreadyLandedProof accepts headOnBase alone β compare lists no commits β as proof, while the comment two lines above the call says "the compare alone could be a branch mid-push". The reconciliation is that this path only runs when a reviewer verdict on this head already claimed already-landed, and ParkedByPerson/Held still apply. If that reliance is intended, a sentence saying so next to the headOnBase fallback would stop the two comments reading as contradictory. The issue body lists "the PR's commits are all contained in the base" as acceptable evidence, so I am not asking anyone to decide it.
β hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88
|
stage 060-reviewed β 050-review-pending: required-check-pending:build-and-test |
|
merged by Hive trusted-author auto-merge: author @clubanderson holds role owner and GitHub permission admin on repo; CI green at 6f648d9. |
|
Thank you for your contribution! Your PR has been merged. We'd love to hear how your experience was: share feedback |
Closes #15732
Problem
#15671 made the hive close its own already-landed PRs as superseded. #15544 (trusted contributor, +0/β0 against
v5, for #15543) was superseded by merged #15545, yet the reviewer'srequires_human("@clubanderson should decide whether #15544 can be closed as a no-op now that #15545 (merged) carries this change") parked it at 085 for 9h. The "Let hive decide" preview then gave the right action with the wrong reason ("Author @Karibhou is untrusted and their clanker is offline").Change
pkg/githubβCloseAlreadyLandedHivePRIfEligiblenow closes any author's PR when the diff against the base is empty (no files / every file byte-identical on the base tip) and the landing is proven: the reviewer-named PR is merged, the linked issue was closed by a merged PR (detectSupersessionDetail), or the compare lists no commits (head contained in base). NewHiveEmptyDiffAutoCloseFacts.LandingProven. Close comment for non-hive authors: "Already landed via #N β closing as superseded; thank you @author." Still gated by the supersession-close write-back, L6, held/keep-open/parked-by-person. Non-empty diff β unchanged.pkg/github/automergeβ the 085 route runs the already-landed closer for any author kind whose verdict claims already-landed (the hive's own superseded rule stays hive-only). Log reasonalready-landed:<author_kind>(stagelabels.AlreadyLandedAuthorReason); caption unchanged "already landed via #N β closing as superseded". Trust changes nothing.pkg/reviewβ "#N (merged)" in reviewer wording names the landing PR (the exact phrasing that parked π fix: quiet the merged-count odometerΒ #15544).pkg/dashboard/pkg/delegatedecisionβ newInput.DiffEmpty; for aRuleAlreadyFixedclose the preview's why is "Diff is empty β the change already landed via #N (merged)." and never mentions author trust.src/docs/hive-merge.mdparagraph after π review: the hive closes its own already-landed PRs instead of asking a personΒ #15671's;changelog.d/fixed-15732-already-landed-any-author.md.Tests
Contributor + trusted author with empty diff β closes (github closer, stage engine); non-empty diff β kept / still parks; unproven landing β human note; head-on-base proof; reviewer wording; plan why. No
time.Sleep.Refs #15544 #15545 #15671