Repository navigation
✨ Auto-merge hive-authored superseding PRs without operator decision - #15757
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
|
|
@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. |
|
hive/ci-report: From job 124067735377: The additions to or apply: in 🐝 Hive Agent: — hive: agent=scanner 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. |
|
@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. |
|
@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. |
|
@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 |
There was a problem hiding this comment.
Decision needed: @clubanderson should decide whether the sentinel hard-stop for hive-authored superseding PRs may key off the alert label (which the sentinel does not apply to the Hive App under the default sentinel.trusted_authors_block: false), or must read the recorded sentinel findings so a superseding copy of a contributor PR that touches workflows/OWNERS cannot auto-merge unseen.
Read the aggregate route (src/pkg/review/review.go), the hard-stop list (automerge_hive_superseder.go:62-77) and the sentinel sweep on v5. The owner rule is implemented as described, and the reject-stays-reject and fix-cap paths are sound. One gap in the "sentinel is the exception" guarantee, which is the trust question above.
The sentinel hard-stop does not fire for the Hive App by default — high, src/pkg/github/automerge/automerge_hive_superseder.go:64.
- The stop is
e.Sentinel && sentinelAckBy == "", andstagelabels.Evidence.Sentinelis documented as "true when the sentinel alert label is on the PR" (src/pkg/stagelabels/human.go:102-103). - The sentinel only applies that label when
decision.Blockis true, andDecideSentinelActionsetsBlock: !trust.Trusted || trustedAuthorsBlock(src/pkg/github/sentinel_sweep.go:137). The Hive App is a trusted author (src/pkg/config/sentinel.go:50-53: "Trusted authors (Hive App, …) … The default false still evaluates and comments, but only as an informational notice"). - So on a default config, a sentinel finding on a hive-authored superseding PR is recorded and commented but not labelled,
e.Sentinelstays false, and none of the hard-stops at:64-76match. - Meanwhile
hiveSupersedingFixRoute(review.go) turns the reviewer'srequires_human— including a security-sensitive finding, per theHiveSupersedingfield comment — intochanges_requested+FixCycle; the only remaining park is the fix cap.
Why this matters more than for other hive PRs: adoption supersedes a contributor PR with a hive-authored copy of the contributor's head (AdoptionPRBody writes the Supersedes #N line this detector keys on, pr_hive_superseding.go:5-8). So the contributor's workflow/OWNERS edit arrives in a PR this rule auto-merges, with the one named exception silently off unless the operator has set trusted_authors_block: true.
Two ways to close it, for whoever decides: (a) have the hard-stop consult the review-evidence sentinel findings (recordReviewEvidenceSentinel, sentinel_sweep.go:390) rather than the label, or (b) have hiveSupersederHardStop also stop on agg.DecisionFinding being a security finding (it is already computed at the route site via securityFindingAcross). I have no finding on the rest of the diff; the relative links and anchors resolve failure is a docs-link check on src/docs/hive-merge.md I did not trace.
— hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88
|
@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. |
|
stage 080-awaiting-merge-admission → 071-needs-author: conflicting |
|
hive/awaiting-ci: merged origin/v5 into this branch (f004002) to clear the conflict in src/docs/hive-merge.md — both additive doc blocks kept (v5's same-issue claim gate paragraph, then this PR's superseding-PR section); author commits untouched. CI pending — sweep will merge when green. 🐝 Hive Agent: — hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88 |
|
stage 080-awaiting-merge-admission → 050-review-pending: required-check-pending:build-and-test |
1 similar comment
|
stage 080-awaiting-merge-admission → 050-review-pending: required-check-pending: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. |
|
hive/awaiting-ci (scanner): failing on 53e432b: 🐝 Hive Agent: — hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88 |
There was a problem hiding this comment.
Style (delta re-review @ 53e432b) — one new finding in the delta; nothing else from this perspective.
permissionsTighteningGuidance lost its doc comment — src/pkg/review/prompts_publish.go:99-112. The new hiveSupersedingGuidance comment + const were inserted directly under the existing six-line comment for permissionsTighteningGuidance with no blank line, so godoc now attaches the #13068 pluk#305 explanation to hiveSupersedingGuidance, and permissionsTighteningGuidance (line 112) has no doc at all. Move the new block below:
// The relay proves the same property structurally (WorkflowPermissionsTighteningOnly)
// and suppresses the permissions classes; this text keeps the model's verdict
// consistent with that code path instead of fighting it.
-// hiveSupersedingGuidance tells the reviewer how its verdict is routed on
-// the hive's own superseding copy of another PR (owner rule: those
-// auto-merge; a requires_human there becomes a fix request, not a park).
-const hiveSupersedingGuidance = "When a Hive-authored PR supersedes another PR (its body says `Supersedes #N`), it auto-merges once CI and review are clean and no operator decides on it: a requires_human you raise there — security-sensitive or not — is routed to the fixer as a concrete fix request, so state the remediation, not the question. Only the sentinel or an emergent problem with the head parks such a PR.\n"
-
const permissionsTighteningGuidance = "Narrowing GitHub Actions permissions is not a security risk a human must own: ..."
+
+// hiveSupersedingGuidance tells the reviewer how its verdict is routed on
+// the hive's own superseding copy of another PR (owner rule: those
+// auto-merge; a requires_human there becomes a fix request, not a park).
+const hiveSupersedingGuidance = "When a Hive-authored PR supersedes another PR (its body says `Supersedes #N`), it auto-merges once CI and review are clean and no operator decides on it: a requires_human you raise there — security-sensitive or not — is routed to the fixer as a concrete fix request, so state the remediation, not the question. Only the sentinel or an emergent problem with the head parks such a PR.\n"Prior findings at this head: docs-currency (escalate escape hatch undocumented next to the knob — review.go hiveSupersedingFixRoute still returns false under SelfAuthoredDecisionPolicy: escalate, no mention in hive-merge.md/operator-reference.md/config.go) — still present; security (detection keyed on the Supersedes #N body line, pr_hive_superseding.go:24, relay review_verdict_relay.go uses snap.Supersedes from the body) — still present. Neither is this perspective's to re-file.
— hive: agent=adjudicator-4 backend=copilot model=claude-fable-5.1 copilot=1.0.88
There was a problem hiding this comment.
docs-currency (delta re-review at 53e432b; the delta vs 0dfbc6a is a v5 base refresh — the PR's only doc change against merge-base is the new section src/docs/hive-merge.md:997-1051, unchanged since the last head)
Still present — review.self_authored_decision_policy: escalate silently disables the superseder rule, undocumented. src/pkg/review/review.go:929-931 returns false from hiveSupersedingFixRoute whenever the policy is escalate, so a hive superseding PR parks at 085 exactly as before. None of the three places that describe the knob mention this: src/docs/hive-merge.md:1044-1046 ("auto_merge.hive_superseding.auto_merge: false turns the rule off…" as the only off-switch), src/docs/operator-reference.md:448, src/docs/review-swarm.md:99. An operator who set escalate for issue-style decision questions will see "requires_human parked" and conclude the knob is broken.
`auto_merge.hive_superseding.auto_merge: false` turns the rule off and
restores the previous behaviour (a `requires_human` parks the superseding
PR at 085 like any hive-authored PR). `review.self_authored_decision_policy:
escalate` has the same effect for the review aggregate: with it set, a
superseding PR's `requires_human` parks at 085 regardless of this knob.
(replacing src/docs/hive-merge.md:1044-1046; add the same clause to the operator-reference.md:448 row.)
— hive: agent=adjudicator-5 backend=copilot model=claude-fable-5.1 copilot=1.0.88
There was a problem hiding this comment.
HUMAN DECISION NEEDED — @clubanderson confirm the superseder auto-merge may key on the author-controlled Supersedes #N body line (src/pkg/github/pr_hive_superseding.go:25-31) rather than the hive's adoption record — unchanged since the last head and still unanswered.
Security (delta re-review @ 53e432b; the delta vs 0dfbc6a is a v5 base refresh — pr_hive_superseding.go, automerge_hive_superseder.go and the relay hunk are byte-identical to the prior head)
Still present: the prior finding at src/pkg/github/pr_hive_superseding.go:24 (superseder identity bound to the body line, not rec.AdoptedBy/superseded_by). No owner reply on #15757 or #15756; the decision question stands.
New — reviewer-supplied hive_superseding survives the relay on non-requires_human verdicts. src/pkg/github/review_verdict_relay.go:430-448: report.HiveAuthored, report.Head and report.Decided are overwritten unconditionally from the dispatch record, but report.HiveSuperseding is only assigned inside if prSnapshot != nil && (report.DecisionRequested || report.Verdict == review.VerdictRequiresHuman). A reviewer JSON carrying "hive_superseding": true with verdict approve/changes_requested (or any verdict when prSnapshot == nil) is stored as-is, contradicting the field's own doc (src/pkg/review/review.go:132-134: "stamped by the verdict relay from the PR, never from the reviewer's JSON"). reportsHiveSuperseding (review.go:937-944) ORs across reports, so on any hive-authored, non-superseding PR one prompt-injected perspective flips agg.HiveSuperseding, and hiveSupersedingFixRoute (review.go:926-933) then routes another perspective's security-sensitive requires_human to the fixer instead of 085 — the exact gate this PR means to keep for non-superseders. No relay test covers a reviewer-supplied flag.
Fix — mirror HiveAuthored and reset before the conditional:
report.HiveAuthored = auth.HiveAuthored
report.HiveSuperseding = false
if prSnapshot != nil && (report.DecisionRequested || report.Verdict == review.VerdictRequiresHuman) {
— hive: agent=adjudicator-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88
Owner rule: a PR the hive App creates to supersede another PR auto-merges with no operator decision; the only exceptions are the sentinel or an emergent problem with the PR. - pkg/github: PullRequest.Supersedes, HiveSupersedingPR / IsHiveSupersedingPR; the verdict relay stamps hive_superseding on requires_human reports. - pkg/review: hiveSupersedingFixRoute turns a requires_human (risk / security-sensitive included) on a hive superseding PR into changes_requested for the fixer; fix cap and reject still hold. - pkg/stagelabels + pkg/github/automerge: one hard-stop list (hiveSupersederHardStop: sentinel-unacknowledged, hold, fix-attempts-exhausted, ci-red-after-fixes, base-conflict-unresolved); RouteHuman names the stop in the 085 reason, else captions the head as auto-merging once CI/review are clean. - pkg/delegatedecision + dashboard: RuleHiveSuperseder releases without a stop, recommends-only naming the stop; tracker caption names the stop. - Config knob auto_merge.hive_superseding.auto_merge (default on), reviewer prompt guidance, docs (hive-merge, review-swarm, operator-reference) and changelog fragment. Closes #15756 Signed-off-by: Andrew Anderson <andy@clubanderson.com>
53e432b to
1ee7a3f
Compare
|
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 |
Closes #15756
Owner rule
What changes
Detection —
github.PullRequest.Supersedes(parsed fromSupersedes #N),github.HiveSupersedingPR(hiveAuthored, body)/IsHiveSupersedingPR(pr). The verdict relay stampshive_supersedingonrequires_human/ decision reports when the PR author is the hive App login and the body declares a supersession.Review aggregate (
pkg/review/review.go, extending the self-authored resolution path, not a parallel one) —hiveSupersedingFixRoute: on a hive superseding PR arequires_human(risk-class question, security-sensitive finding, unresolved escalation) becomeschanges_requested+FixCycle, so the existing fix dispatch picks it up and the swarm re-reviews. Arejectis not converted; the fix cap still parks it (fix cycle cap reached (n/m)).Hard stops (
automerge.hiveSupersederHardStop(e, verdict, sentinelAckBy) (reason, ok)) — the one exception list, in order:sentinel-unacknowledged(sentinel label on and nosentinel_acknowledgedin the review evidence bundle),hold,ci-red-after-fixes/base-conflict-unresolved/fix-attempts-exhausted(fix cap reached),base-conflict-unresolved(rebase failed twice).stagelabels.RouteHumanparks at 085 with lane reasonhive-superseder-hard-stop:<token>and a caption naming the stop; otherwise arequires_humanis captioned "hive-authored superseding PR — auto-merging once CI/review are clean" (hive-superseder:fixer) and the head stays on the fixing stage.Dashboard / delegate —
decisionForPRreads the hard-stop reason and asks "The hive's superseding PR would auto-merge (owner rule), but …";delegatedecision.RuleHiveSupersederreleases without a stop, recommends-only naming the stop.Knob —
auto_merge.hive_superseding.auto_merge(defaulttrue; yaml-only, allowlisted in settings parity, golden updated); wired to the review sweep, the automerge Engine (Options.HiveSupersedingAutoMerge,Options.SentinelAcknowledgedByhook) and the dashboard.Prompts / docs —
hiveSupersedingGuidancein the single, combined and decision reviewer prompts; new section indocs/hive-merge.md, note indocs/review-swarm.md, row indocs/operator-reference.md;changelog.d/changed-hive-superseding-automerge.md.Tests (no
time.Sleep)pkg/review: hive superseding + security finding → fixer; plain requires_human → fixer; contributor / non-superseding hive PR → still 085; knob off → old behaviour; fix cap → parks; reject not converted.pkg/stagelabels: fixer caption route; every hard-stop token → 085 with its lane reason + prose; non-superseder still parks.pkg/github/automerge: everyhiveSupersederHardStopbranch incl. acknowledged sentinel, first conflict, pending/red-before-fixes not stops;hiveSupersedingPRincl. knob off; sentinel-ack hook.pkg/github,pkg/delegatedecision,pkg/dashboard,pkg/configaccessor.go vetandgo test ./pkg/github/... ./pkg/review/... ./pkg/dashboard/... ./pkg/stageengine/... ./pkg/stagelabels/... ./pkg/config/... ./pkg/delegatedecision/...pass.Not duplicated here: head-carry of operator approvals across v5 refreshes (agent b1db9704), also-landed/empty-diff closing (#15741).