Repository navigation
π review: the hive closes its own already-landed PRs instead of asking a person - #15671
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 |
Open PR overlap checkBase branch: Conflicts are checked with every PR merged onto the current tip of
|
|
stage 080-awaiting-merge-admission β 050-review-pending: required-check-pending:build-and-test |
|
@clubanderson this PR is held at Why:
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. |
b439e63 to
3e4a0dc
Compare
β¦g a person A hive-authored PR (an adoption included) whose reviewer verdict says the change is already on the base β the hive-redundant-of marker, or wording that names the landing PR explicitly β is closed as superseded on the 085 route instead of parked for a person. The empty-diff closer's freshness guard read updated_at, which the hive's own labels bump every pass, so the head was always "too fresh"; the already-landed entry waives it (a reviewer confirmed this head), measures head age from the compare's commits, counts files byte-identical on the base tip as empty, settles the adopted originals' lineage and closes the parent issue. Logged once as self-authored:already-landed. Fixes #15670 Signed-off-by: Andrew Anderson <andy@clubanderson.com>
β¦onst Signed-off-by: Andrew Anderson <andy@clubanderson.com>
3e4a0dc to
7d4537c
Compare
There was a problem hiding this comment.
Reviewed (security) β no blocking findings; one advisory.
Low / advisory β the reviewer-confirmed freshness waiver is not bound to the reviewed head. closeEmptyDiffBeforeHumanRoute takes the already-landed entry from obs.Detail.Verdict, which contributorLaneVerdictFor keys on obs.HeadSHA (automerge_stage_human.go:217-227, :346), but the pr it passes was re-fetched in closeSupersededBeforeHumanRoute (automerge_stage_human.go:159) and may already carry a newer head. closeHiveRedundantPR then sets ReviewerConfirmed: reviewed and skips the head-too-fresh guard for that head (pr_empty_diff_hive_autoclose.go:305,150). Redundancy is still measured on the actual head (prFilesIdenticalOnBase), so this cannot close a PR that has a real diff β hence advisory, not blocking β but the "a reviewer read this head" premise should be checked before it waives a guard:
if claimed && !strings.EqualFold(strings.TrimSpace(pr.GetHead().GetSHA()), obs.HeadSHA) {
c.debug("stage labels: already-landed verdict is for an older head; ordinary route", "repo", obs.Display, "pr", obs.Number, "verdict_head", obs.HeadSHA, "head", pr.GetHead().GetSHA())
claimed = false
}
if claimed {
Out of scope (not security): closeIssuesAlreadyLanded posts the "this issue is done" note before CloseIssue's gates run (pr_empty_diff_hive_autoclose.go:395-403), so a refused close leaves a misleading note on an open issue.
β hive: agent=ci-maintainer 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. |
There was a problem hiding this comment.
Correctness review (head 3e4a0dc)
1. [medium] Bare in #N in alreadyLandedRefRE attributes the landing to issues and lineage mentions β src/pkg/review/already_landed.go:30. The preposition list includes bare in, which is how reviewers reference anything (issues, originals, discussions). Ran the regex at head against plausible decision questions:
"β¦whether the adoption is redundant; the original is tracked in #15324."βAlreadyLandedPR= 15324 (the superseded original)"β¦the test is already there in #15324 (the original adoption)."β 15324"β¦NOT redundant with #15506; the fix in #15500 is different."β 15500
The close itself stays safe (redundancy is still measured by prFilesIdenticalOnBase), but the attribution leaks into user-facing text and persisted state: hive-redundant-of: #N on the close comment (pr_empty_diff_hive_autoclose.go renderEmptyDiffCloseComment), the issue note "already on v5 via #15324" (pr_empty_diff_hive_autoclose.go:394), the original's close note naming itself as the landing PR (automerge_stage_human.go:306), and the relay now persists this guess as redundantOf in the verdict report where every other reader treats it as marker-grade (review_verdict_relay.go:86). None of the tests rely on bare in (the two real texts use via / since), so dropping it keeps them green:
alreadyLandedRefRE = regexp.MustCompile(`(?i)\b(via|through|by|since|landed in|merged (?:in|as|via|through))\s+(?:[\w.-]+/[\w.-]+)?#(\d+)\b`)
Add the "tracked in #15324" text above as a want: 0 case in TestAlreadyLandedPRFromReviewerWording.
2. [low] Issue note is posted before CloseIssue's gates run β pr_empty_diff_hive_autoclose.go:394-401. "β¦so this issue is done. Reopen if that's wrong." lands on the issue, then CloseIssue may refuse (tracking issue β ErrTrackingIssue; human-filed bug β it posts its own reporter-confirmation request and returns ErrReporterConfirmationRequired, issue_close.go:66-98). Result: an open issue with two contradictory hive comments back to back. Swap the order β close first, post the note only on success (comments on closed issues are fine).
3. [low, test adequacy] prFilesIdenticalOnBase (pr_empty_diff_hive_autoclose.go:216) and the reviewed=true path of closeHiveRedundantPR (compare β tree-match β Supersedes/IssuesClosed) have no HTTP-level test; only the pure DecideHiveEmptyDiffAutoClose table gained rows. The status switch (404 vs other error, removed, rename β not proved, alreadyLandedMaxFiles) is the piece that decides whether a hive PR with a non-empty compare gets closed, so it deserves one httptest case.
β hive: agent=adjudicator-4 backend=copilot model=claude-fable-5.1 copilot=1.0.88
|
@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:test (rest 2/4) |
β¦write ratchet Signed-off-by: Andrew Anderson <andy@clubanderson.com>
There was a problem hiding this comment.
Decision needed: @clubanderson should decide which head-age fix for #15603 survives β this PR's compare-derived commit date (prDiffAgainstBase, no extra call) or #15621's GetCommit β since both rewrite emptyDiffHeadAge in src/pkg/github/pr_empty_diff_hive_autoclose.go and the second to land must drop its copy.
Two things, both on src/pkg/github/pr_empty_diff_hive_autoclose.go (head 42b55f3); the rest of the PR I only skimmed, see the scope note at the end.
1. This PR and #15621 both fix #15603, differently β they conflict, not just textually.
prDiffAgainstBase here (:189-212) now returns the newest commit's committer date from comparison.Commits and closeHiveRedundantPR overrides facts.HeadAge = now.Sub(headAt) (:318-321). #15621 does the same job with a separate Repositories.GetCommit on the head SHA and a new emptyDiffHeadAge(pr, headCommitAt, now) signature. The overlap bot already flags the file conflict; the semantic point is that whichever lands second should drop its head-age change rather than merge both. This version is cheaper (the compare is already paid for), but note the compare's commit list is capped at 250 and ordered oldest-first, so on a very long branch the head commit can be absent and the "newest" date is older than the real head β the error is in the less-conservative direction (looks older β closes sooner). #15621's direct head GET has no such cap.
2. Commit date alone removes the grace EmptyDiffMinHeadAge exists for (same finding I left on #15621).
:66-69 documents the guard as "a just-opened PR whose commits are still arriving". A committer date is set at local commit time, before push and before pr create; agents routinely commit, run checks for 20+ minutes, then open the PR, and hive/adopt-N branches carry days-old fork commits. With HeadAge taken from the commit date, the non-reviewed path (ReviewerConfirmed == false, :149) is eligible on the first sweep for any such PR. #15603 described the old updated_at measure as "conservative only"; this flips it. Suggested: headAt = max(headAt, pr.created_at) before facts.HeadAge = now.Sub(headAt) at :320 β still immune to label/comment bumps, still honours the documented wait. The reviewed path is unaffected (:149 waives the guard there by design).
Verified, no action: prFilesIdenticalOnBase (:219-254) compares the contents API blob SHA on the base tip to CommitFile.sha (the head blob) β that is a valid byte-identity proof for added/modified/changed; removed β 404 on base; renames and >25 files fall through as unproved (false, true / false, false) and keep the PR. DecideHiveEmptyDiffAutoClose (:137, :152-155) only reaches the already-landed close when TreeMatchesBase is true, which is only set when known && reviewed (:322-325).
Scope note: I read the autoclose file fully and the decision function; I did not review automerge/automerge_stage_human.go (+149), review/already_landed.go (+108) or stagelabels/human.go β those need a second reader before this merges, given the PR closes issues as well as PRs (closeIssuesAlreadyLanded, :380-408, gated through WritebackAllowed and CloseIssue).
β hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88
|
Thank you for your contribution! Your PR has been merged. We'd love to hear how your experience was: share feedback |
β¦tCommit The head-commit measurement landed on v5 via #15671 (the compare's newest commit sets HeadAge). What this PR still adds is the created_at floor: a PR just opened from an old branch is a just-opened PR whose commits may be arriving, so its age never exceeds the PR's own age. The redundant headCommitTime GetCommit round-trip is gone; emptyDiffHeadAge takes the compare's headAt directly. Refs #15603 Hive-Fix-Attempt: 2/6 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
β¦from the merge base (#15621) * π fix: measure empty-diff head age from the head commit, not updated_at Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> * fix: floor empty-diff head age at the PR's created_at Measuring from the head commit's committer date dropped the implicit just-opened grace period: a PR opened from a branch whose head commit was already older than EmptyDiffMinHeadAge was eligible for autoclose on the first sweep. The age is now never older than the PR itself. Also drop the dead HeadAge seed before the cheap guards (no guard there reads it) and log when the head commit cannot be read, so the updated_at fallback is visible instead of silently masking the regression this rule fixes. Hive-Fix-Attempt: 1/6 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> * π fix: floor the empty-diff head age at created_at; drop the extra GetCommit The head-commit measurement landed on v5 via #15671 (the compare's newest commit sets HeadAge). What this PR still adds is the created_at floor: a PR just opened from an old branch is a just-opened PR whose commits may be arriving, so its age never exceeds the PR's own age. The redundant headCommitTime GetCommit round-trip is gone; emptyDiffHeadAge takes the compare's headAt directly. Refs #15603 Hive-Fix-Attempt: 2/6 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> * π fix: measure an on-base head's age from the merge-base commit When base...head lists no commits the head is already on the base, so the compare's merge_base_commit is the head; use its committer date instead of falling back to updated_at. Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> --------- Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> Co-authored-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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> Co-authored-by: hivecommons-hive[bot] <280983584+hivecommons-hive[bot]@users.noreply.github.com>
Fixes #15670
Hive-authored adoption PRs #15647 / #15648 sat at 085 asking the owner whether to close them as "already landed via #15506 / #15341". The empty-diff closer (#15499) ran but its freshness guard read
updated_at, which the hive's own labels/comments bump every pass, so the head was "too fresh" forever.review.AlreadyLandedPR/AlreadyLandedFromVerdict: conservative detection of an already-landed claim in the decision question (marker wins; else an already-landed phrase plus exactly one explicit landing ref "via/in/by #N"; ambiguous or lineage-only mentions name nothing). Relay falls back to it forredundantOf.CloseAlreadyLandedHivePRIfEligible: head age from the compare's commits, no freshness guard when a reviewer confirmed the head, files byte-identical on the base tip count as empty, closes parent issues, reportsSupersedes.supersededCheckWarrantedaccepts the worded claim; the 085 route takes the already-landed entry, logs once withself-authored:already-landed, and settles the adopted originals (note,MarkSupersededso orphan recovery does not re-adopt, close; 403/404 tolerated).stagelabels.AlreadyLandedCaption: "already landed via #N β closing as superseded".hive-merge.md; changelog fragment.Composes with #15641 (contributor-lane
IsSecuritySensitiveFindinggating); no overlapping hunks.