Skip to content

πŸ› Let hive decide on a ready-for-human-merge PR approves and lets the sweep merge it - #15191

Closed
clubanderson wants to merge 1 commit into
v5from
fix/delegate-human-merge-approves
Closed

clubanderson wants to merge 1 commit into
v5from
fix/delegate-human-merge-approves

Conversation

@clubanderson

Copy link
Copy Markdown
Member

Fixes #15173

Stacked on #15156 (fix/owner-approve-admits-untrusted-pr, needs admitPullRequestHead); 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):

  • review good (approve / merge-eligible, nothing for a person; no recorded verdict counts as good at 090 β€” the lane itself found nothing wrong) and CI green and not conflicting and no missing sign-off β†’ human-merge-approve: the Approve β€” let hive merge path (APPROVE review + automerge label), head admitted as operator-approval:<login> so the contributor lane merges it under its own number after soak and adoption refuses. Never a hive-owned copy.
  • otherwise β†’ human-merge-adopt: adopt in supersede mode, reasons listed (review not good, CI red, conflicting, needs rebase, sign-off missing).
  • the plain-words hand-back remains only for hive-authored PRs or when adoption is off and the head can't merge as-is.
  • Decision.Path is 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.

@kubestellar-prow kubestellar-prow Bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Oct 29, 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

github-actions Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Open PR overlap check

Base branch: v5

This PR conflicts with v5 itself. Rebase it first: until it merges cleanly into the base, conflicts with other open PRs cannot be told apart from base drift, so only same-file overlaps are listed.

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
#15085 ✨ Activity Monitor: Adopt now and Reroute to another clanker for PRs waiting on a contributor's clanker same files src/docs/dashboard-sections.md
src/docs/operator-reference.md
src/pkg/dashboard/api_repo_item_decide_delegated.go
src/pkg/dashboard/operator_actions.go
src/pkg/dashboard/static/index.html
src/pkg/delegatedecision/policy.go
#15186 πŸ› Activity Monitor: one coherent post-decision state for Let hive decide rows; 060 reviewed in CI / Review same files src/docs/dashboard-sections.md
src/docs/operator-reference.md
src/pkg/dashboard/api_repo_item_decide_delegated.go
src/pkg/dashboard/api_repo_item_decide_delegated_test.go
src/pkg/dashboard/operator_actions.go
src/pkg/dashboard/static/index.html
src/pkg/delegatedecision/decision_glossary.go
src/pkg/delegatedecision/decision_glossary_test.go
#15206 πŸ› Activity Monitor: delegated adopt-supersede reports executing β†’ adopted/could-not-adopt, routes workflow-path to the workflows blocker, re-adoption survives the mutation journal same files src/pkg/dashboard/api_repo_item_decide_delegated.go
src/pkg/dashboard/api_repo_item_decide_delegated_test.go
src/pkg/dashboard/operator_actions.go
src/pkg/dashboard/static/index.html
src/pkg/delegatedecision/decision_glossary.go
src/pkg/delegatedecision/policy.go
#15228 ✨ tracker: waiting-on chip shows human or bot icon instead of text qualifier same files src/pkg/dashboard/static/index.html
#15219 πŸ› fix: preserve human and owner PRs during delegated decisions same files src/pkg/dashboard/api_repo_item_decide_delegated.go
src/pkg/dashboard/api_repo_item_decide_delegated_test.go
src/pkg/dashboard/delegated_decision_human_merge.go
src/pkg/dashboard/static/index.html
src/pkg/delegatedecision/decision_glossary.go
src/pkg/delegatedecision/policy.go
#15200 πŸ› fix: tracker history column wears a history mark, not a βœ“ same files src/docs/dashboard-sections.md
src/pkg/dashboard/static/index.html
#15122 πŸ› Write-back containment: per-kind gate for every unsolicited GitHub write, with backfill guard same files src/docs/operator-reference.md
src/pkg/dashboard/static/index.html
#15104 πŸ› Activity Monitor: Rebase, then merge as maintainer; fixer owns parked conflicting PRs; dismiss self-inflicted changes_requested same files src/docs/dashboard-sections.md
src/docs/operator-reference.md
src/pkg/dashboard/static/index.html
#14807 ✨ dashboard: stream Job pod logs in the terminal pane for sandbox.runtime: job agents same files src/pkg/dashboard/static/index.html
#15208 πŸ› fix: decidePR answers capability-gap, not adopt-supersede, for heads the App cannot adopt same files src/pkg/delegatedecision/decision_glossary.go
src/pkg/delegatedecision/policy.go
#15216 πŸ› Sentinel: a dashboard Approve releases the head for good; skip Prow-rejected /lgtm + /approve same files src/docs/dashboard-sections.md
src/docs/operator-reference.md
#15134 πŸ› Delegated decision on a capability gap: model the blocker, stop the un-park/re-park loop, name the missing App permission same files src/docs/dashboard-sections.md
src/docs/operator-reference.md
src/pkg/dashboard/api_repo_item_decide_delegated.go
src/pkg/dashboard/static/index.html
src/pkg/delegatedecision/decision_glossary.go
src/pkg/delegatedecision/decision_glossary_test.go
#15223 ✨ Soak countdown on every soak pill, with the live timer on hover same files src/pkg/dashboard/static/index.html
#15221 ✨ Activity Monitor: Accept triage on the label-less reporter-trust hold, leading the row menu same files src/pkg/dashboard/static/index.html

@kubestellar-prow kubestellar-prow Bot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Oct 29, 2026
… 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>
@hivecommons-hive hivecommons-hive Bot added author/human A person pushed this PR themselves dco All commits are DCO signed-off stage/071-needs-author Human-authored PR: CI red, changes requested or conflicting; diagnosis posted, the author must act labels Oct 29, 2026
@clubanderson
clubanderson force-pushed the fix/delegate-human-merge-approves branch from 149cae6 to ad572a1 Compare October 29, 2026 00:26
@kubestellar-prow kubestellar-prow Bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Oct 29, 2026
@github-actions github-actions Bot added conflicts-with-open-pr Open PR has a merge conflict with another open PR and removed conflicts-with-open-pr Open PR has a merge conflict with another open PR labels Oct 29, 2026
@hivecommons-hive hivecommons-hive Bot added the role/trusted Author is trusted for unattended merge (trusted-author role or registry/claim tier in require_tiers) label Oct 29, 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.

Why:

  • the branch conflicts with the base and needs a rebase

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

Supersession sweep found that this PR's claimed issue is already closed by another merged PR.

  • Claimed issue: hive#15173
  • Closing PR: #15181

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: changelog.d/fixed-delegate-human-merge-approves.md, src/docs/dashboard-sections.md, src/pkg/dashboard/stage_tracker_acted_path_test.go, src/pkg/dashboard/static/index.html, src/pkg/delegatedecision/decision_glossary.go and 4 more.

This comment is edited in place by the supersession sweep; it is not duplicated.

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

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) applies ApplyRails with the hold rail like the other delegated paths.
  • src/pkg/dashboard/api_repo_item_decide_delegated.go:490-493 overrides the owner-delegate decision only when delegatedHumanMergeDecision says ok, and delegated_decision_human_merge.go:65-77 returns 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) reads stageTrackerVerdictLookup (stage_tracker_decision.go:119) and Record.DCOFor (stagelabels/store.go:357) with their real signatures; admitPullRequestHead at :770-776 is 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:770 admits the head for every !TrustedAuthor approve, 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=dirty against v5 and needs a rebase before anything else.

β€” hive: agent=reviewer-2 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.

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

@hivecommons-hive

Copy link
Copy Markdown
Contributor

/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.
Why: The author's hive hasn't been connected since the nudge.
What happens next: The hive closes this PR and opens a fresh hive-authored PR with the same commits and sign-off, then finishes that one β€” expected within 30 min.
If it doesn't happen: A maintainer can merge this PR by hand, re-run the decision, close it as superseded, or send it back for a new commit.

Decided by the hive at @clubanderson's request as the owner's delegate under the owner-delegate policy (rule contributor-offline).

@hivecommons-hive

Copy link
Copy Markdown
Contributor

@clubanderson the hive has adopted this PR (stage/074-adopted-by-hive): your hive has been offline since the nudge. It is being finished as #15211, which carries your commits (and sign-off) unchanged; the hive will rebase and fix CI there. This PR is closed automatically once #15211 merges. If you would rather finish it yourself, push a new head here and say so on #15211.

@hivecommons-hive

Copy link
Copy Markdown
Contributor

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: 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

@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 (stage/072-returned-to-contributor), and the hive nudges or adopts again from here if CI stays red.

@clubanderson

Copy link
Copy Markdown
Member Author

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.

clubanderson added a commit that referenced this pull request Oct 29, 2026
… 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>
clubanderson added a commit that referenced this pull request Oct 29, 2026
… 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>
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. hive/supersession-pending needs-human role/trusted Author is trusted for unattended merge (trusted-author role or registry/claim tier in require_tiers) size/L Denotes a PR that changes 100-499 lines, ignoring generated files. stage/085-needs-decision A human decision is owed: sentinel alert, hold/needs-decision label, human-only rule or parked issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Let hive decide on a ready-for-human-merge PR should approve and let the sweep merge it, not answer "I can't merge this" or adopt

1 participant