Repository navigation
π Let hive decide on a ready-for-human-merge PR approves and lets the sweep merge it - #15191
clubanderson wants to merge 1 commit into
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
|
β¦ sweep merge it A contributor PR at stage/090 with a good review, green CI and a mergeable head sat behind "I can't merge this" when a person delegated it. The hive now decides: approve (the Approve β let hive merge path β APPROVE review, automerge label, head admitted as operator-approval:<login>) so the merge sweep merges the PR under its own number after soak. Adoption in supersede mode is the fallback only when the head cannot merge as it is (review not good, CI red, conflicting, sign-off missing). The decision carries the path in plain words for the ledger and the β hover. Fixes #15173 Signed-off-by: Andrew Anderson <andy@clubanderson.com>
149cae6 to
ad572a1
Compare
|
@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. |
|
Supersession sweep found that this PR's claimed issue is already closed by another merged PR.
Decision needed (@hivecommons): #15181 already merged and closed the claimed issue, but this PR touches files the merged PR did not. Recommended: keep open until the extra changes are reviewed, or close as superseded if they are not wanted. Another option: merge anyway. Files the merged PR did not touch: This comment is edited in place by the supersession sweep; it is not duplicated. |
There was a problem hiding this comment.
Decision needed: @clubanderson should decide whether "Let hive decide" on a stage/090 PR may approve an untrusted author's head when no reviewer verdict is recorded for it (HumanMergeApprovable treats ReviewKnown=false as good), or whether #15173's "reviewer verdict is good" should require a recorded verdict and otherwise fall back to adopt.
Read the new policy and its wiring at the PR head; the code does what it says, and one policy choice needs an owner's call.
Verified correct
src/pkg/delegatedecision/human_merge.go:39-43, 47-94β approve vs adopt-supersede branches match #15173's table;RunHumanMerge(:93-98) appliesApplyRailswith the hold rail like the other delegated paths.src/pkg/dashboard/api_repo_item_decide_delegated.go:490-493overrides the owner-delegate decision only whendelegatedHumanMergeDecisionsays ok, anddelegated_decision_human_merge.go:65-77returns ok=false for hive-authored PRs and when adoption is disabled, so the existing "I can't merge this" text still fires in those cases (:85-87).gatherDelegatedHumanMergeInput(api_repo_item_decide_delegated.go:645-662) readsstageTrackerVerdictLookup(stage_tracker_decision.go:119) andRecord.DCOFor(stagelabels/store.go:357) with their real signatures;admitPullRequestHeadat:770-776is the same helper the manual Approve path calls (api_repo_item_decision.go:473, 597).
Needs a decision (not a defect)
human_merge.go:41 β reviewGood := in.ReviewGood || !in.ReviewKnown. A 090 PR with no reviewer verdict for its head is approved and admitted as the trust override, and the hover reads "review: lane found nothing wrong". #15173 says the approve path applies when "the reviewer verdict is good (approve / no blocking findings)"; it does not say an absent verdict counts. The test at human_merge_test.go:24 encodes the absent-verdict=approve choice deliberately, so this is intent, not a slip β but since it approves an untrusted author's head with no review on record, it is a trust-policy call for the owner. If the stricter reading is wanted, the fallback is already there: ReviewKnown=false β pathReviewNotGood-style adopt.
Also
api_repo_item_decide_delegated.go:770admits the head for every!TrustedAuthorapprove, not only 090 PRs. The comment there says this is by design per #15136; flagging it only so the broadened scope is seen.- The branch is
mergeable_state=dirtyagainst v5 and needs a rebase before anything else.
β hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88
There was a problem hiding this comment.
Correctness review (head ad572a1)
1. High β a non-merger can now admit an untrusted head via "Let hive decide" (merger gate bypassed).
delegatedHumanMergeDecision (src/pkg/dashboard/delegated_decision_human_merge.go:64-76) never looks at mergerRole, so the approve path runs for any user who clears the repo-hold bar (handleRepoItemDecideDelegated, api_repo_item_decide_delegated.go:231). In the executor, the non-merger branch (api_repo_item_decide_delegated.go:764-768) posts /lgtm + /approve, and the new block at :773-777 then calls admitPullRequestHead unconditionally, writing admitted_by: operator-approval:<login> to the stage record. The lane trusts that record without a role check β operatorAdmission (src/pkg/github/automerge/automerge_operator_admission.go:33-39) returns the login straight from rec.Admission(head); only the second source goes through isTrustedMerger (:44-46). So a writer who is refused Approve β let hive merge (repoItemMergeDecisionAllowed, api_repo_item_decision.go:430-436, and the old hand-back greyed with decisionWhyMergerRole) gets the identical trust override by pressing Let hive decide. The PR body says this is "the same path as Approve β let hive merge", but that path is merger-only. Neither new test exercises a non-merger (TestDelegatedDecisionReadyForHumanMergeApprovesWhenGreen sends X-Hive-Role: merger).
Fix β keep the old hand-back (greyed buttons) for a non-merger on the approve path, and gate the admission:
--- a/src/pkg/dashboard/delegated_decision_human_merge.go
+++ b/src/pkg/dashboard/delegated_decision_human_merge.go
-func (s *Server) delegatedHumanMergeDecision(in delegatedecision.Input) (delegatedecision.Decision, bool) {
+func (s *Server) delegatedHumanMergeDecision(in delegatedecision.Input, mergerRole bool) (delegatedecision.Decision, bool) {
if in.HiveAuthored {
return delegatedecision.Decision{}, false
}
d, ok := delegatedecision.RunHumanMerge(in)
if !ok {
return delegatedecision.Decision{}, false
}
+ // Approving admits the head as the person's trust override: the same
+ // merger bar as "Approve β let hive merge" (repoItemMergeDecisionAllowed).
+ if d.Verdict == delegatedecision.VerdictApprove && !mergerRole {
+ return delegatedecision.Decision{}, false
+ }
if d.Verdict == delegatedecision.VerdictAdoptSupersede && !s.stageAdoptionEnabled() {
return delegatedecision.Decision{}, false
}
return d, true
}
--- a/src/pkg/dashboard/api_repo_item_decide_delegated.go
+++ b/src/pkg/dashboard/api_repo_item_decide_delegated.go
- if !in.HiveAuthored && (in.ReadyForHumanMerge || !in.TrustedAuthor) {
+ if mergerRole && !in.HiveAuthored && (in.ReadyForHumanMerge || !in.TrustedAuthor) {(and thread mergerRole through the two call sites at api_repo_item_decide_delegated.go:491 and delegated_decision_human_merge.go:86). Please add a test posting with X-Hive-Role: write on a green 090 PR asserting no review, no admission, and the hand-back with greyed buttons.
2. Low β the LLM decider runs and is discarded on every 090 decision.
api_repo_item_decide_delegated.go:490-493 calls s.decideDelegated(ctx, in) first β which consults the decider turn plus thread/linked-item reads when the rules land on the reversible default (api_repo_item_decide_delegated_llm.go:46-52, 71-95) β then overwrites d with the human-merge decision. Compute the 090 decision first and skip decideDelegated when it applies:
d, deciderNotes := s.delegatedHumanMergeDecision(in, mergerRole)
if ok := d.Rule != ""; ok {
deciderNotes = []string{"ready for human merge: " + d.Path}
} else {
d, deciderNotes = s.decideDelegated(ctx, in)
}
(or an equivalent if hm, ok := β¦; ok { β¦ } else { β¦ }).
3. Low β "CI red" is reported for a conflicting head whose CI is green.
delegatedHeadCIGreen returns false for any conflicting head (api_repo_item_decide_delegated.go:684-685), so DecideHumanMerge (src/pkg/delegatedecision/human_merge.go:74-80) always emits CI red, conflicting, needs rebase for a dirty PR β the audit line/β hover then states a CI failure that may not exist. Consider if !in.CIGreen && !in.Conflicting { why = append(why, pathCIRed) } and adjust the "conflicting" expectations in TestDecideHumanMergePaths / β¦AdoptsWhenNotMergeable.
β hive: agent=adjudicator backend=copilot model=claude-fable-5.1 copilot=1.0.88
|
/hive decision supersede now: adopt #15191 in supersede mode, preserving the author's commits and sign-off; do not wait for the grace deadline Rationale: the contributor is offline; adoption in supersede mode keeps the work moving (#13975). Hive decided: Close this PR and open a fresh hive-authored PR with the same commits. Decided by the hive at @clubanderson's request as the owner's delegate under the owner-delegate policy (rule |
|
@clubanderson the hive has adopted this PR ( |
|
Note: #15173 is closed by #15181 (da049ce on v5), which landed the same approve-and-admit path. The hive copy #15211 has been closed as superseded; this PR now conflicts with v5 on the same files and can likely be closed too (maintainer's call β needs-human is set). π Hive Agent: β hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88 |
|
@clubanderson the hive's copy of this PR, #15211, was closed without merging, and the hive could not open a fresh copy just now. The adoption is undone: this PR is back in its normal flow ( |
|
Superseded by #15181, which landed the same behaviour (Let-hive-decide approves a ready-for-human-merge PR when review + CI are green). Closing as duplicate. |
β¦ their author An owner's PR with a requires_human verdict on a conflicting head was staged 085, and "Let hive decide" adopted it through the contributor-lane "contributor offline" rule, which only makes sense for clanker PRs. - The contributor-offline rule and every adopt-supersede verdict are gated on the author not being a person (author/human label or a dashboard.authorized_users owner); the engine's adoption/supersede label path, the delegate executor and the 090 ready-for-human-merge decider refuse a person's PR with a logged, tracker-visible reason. - requires_human / changes-requested on a human-authored PR routes to 071 Needs author with the reviewer's question (or "needs rebase"), and the author is told once per head whatever their role. - Let hive decide on a person's PR can only approve-admit, return to author (new return-to-author rule) or hold. - Folded from #15191: a DCO-less clanker head at 090 adopts. Closes #15202 Signed-off-by: Andrew Anderson <andy@clubanderson.com>
β¦ author instead of the contributor-offline lane (#15240) * π fix: never adopt a person's PR β owner/human-authored PRs return to their author An owner's PR with a requires_human verdict on a conflicting head was staged 085, and "Let hive decide" adopted it through the contributor-lane "contributor offline" rule, which only makes sense for clanker PRs. - The contributor-offline rule and every adopt-supersede verdict are gated on the author not being a person (author/human label or a dashboard.authorized_users owner); the engine's adoption/supersede label path, the delegate executor and the 090 ready-for-human-merge decider refuse a person's PR with a logged, tracker-visible reason. - requires_human / changes-requested on a human-authored PR routes to 071 Needs author with the reviewer's question (or "needs rebase"), and the author is told once per head whatever their role. - Let hive decide on a person's PR can only approve-admit, return to author (new return-to-author rule) or hold. - Folded from #15191: a DCO-less clanker head at 090 adopts. Closes #15202 Signed-off-by: Andrew Anderson <andy@clubanderson.com> * π± dashboard: read the author-kind label without importing pkg/authorkind (import ratchet) Signed-off-by: Andrew Anderson <andy@clubanderson.com> --------- Signed-off-by: Andrew Anderson <andy@clubanderson.com>
Fixes #15173
Stacked on #15156 (
fix/owner-approve-admits-untrusted-pr, needsadmitPullRequestHead); the diff shrinks to this change once #15156 merges and this branch is rebased onto v5.Observed (hive's hive): #15118 and hotshot#317 β @Karibhou, MERGEABLE, 0 failing checks, at Ready for human merge Β· untrusted author. Let hive decide only answered "I can't merge this: author @Karibhou is untrustedβ¦" and never took a decision.
Now (
pkg/delegatedecision/human_merge.go,DecideHumanMerge):human-merge-approve: the Approve β let hive merge path (APPROVE review + automerge label), head admitted asoperator-approval:<login>so the contributor lane merges it under its own number after soak and adoption refuses. Never a hive-owned copy.human-merge-adopt: adopt in supersede mode, reasons listed (review not good,CI red,conflicting, needs rebase,sign-off missing).Decision.Pathis logged in the audit detail and the ledger line, so the β hover reads the hive decided: approve Β· review passed, CI green, mergeable (rule: human merge approve).Tests:
TestDecideHumanMergePaths(good+green β approve; no review β approve; red CI β adopt; conflicting β adopt/rebase; review bad β adopt; DCO β adopt; held β refused),TestDelegatedDecisionReadyForHumanMergeApprovesWhenGreen(end-to-end: one APPROVE review, no merge, no adoption label, head admitted, ledger detail),β¦AdoptsWhenNotMergeable(red CI / dirty β adoption queued, nothing approved, not admitted),β¦AnswersWithMergeOptions(fallback, adoption off),TestOperatorActionDecidedDetail,TestStageTrackerActedPlainDecisionPathJS(node), glossary mirror.Docs:
dashboard-sections.md(090 row),operator-reference.md(decision table). Changelog fragment included.