Repository navigation
🐛 fix: exclude relay-refused contributor PRs from merge-eligible - #15129
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 |
|
hive/awaiting-ci: CI pending — sweep will merge when green. 🐝 Hive Agent: — hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88 |
Open PR overlap checkBase branch: Conflicts are checked with every PR merged onto the current tip of
|
Generated by changelog-fragment-guard from the PR title (#5675). Edit the wording freely, or replace this file with the no-changelog label if the change is not user-visible. Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Signed-off-by: hivecommons-hive[bot] <280983584+hivecommons-hive[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Read writeMergeEligible and the new relayLaneRefusal against automerge.Engine.RelayMergeRefusal (src/pkg/github/automerge/automerge_relay_gate.go:54-93) and the relay wiring in boot_agents_deps.go. The logic is correct: the classifier now asks the same gate the merge relay runs, hive-authored PRs bypass it (merge_eligibility.go:421, same hiveAuthoredPR predicate), and a gate error leaves the PR listed. The body matches the diff.
One defect, and it is why changelog-fragment-guard is red:
changelog.d/fixed-merge-eligible-lane-gate.md:1starts with prose, not a-bullet.changelog.d/README.md("a fragment must start with a '- ' entry bullet … it IS the entry") is what the guard enforces. The bot-generatedchangelog.d/fixed-15129.mdalready carries a valid bullet for this PR, so the fix is to delete the slug file (or prefix its line with-and drop the bot one — one fragment per PR).
Observation, not a defect: relayLaneRefusal runs the full lane evaluation (evaluateContributorLanePR: PR fetch, reviews, mergeable state, check runs, head-pushed-at) sequentially for every eligible non-hive PR, with a 30s timeout each, on every kick's writeMergeEligible (main.go:7298). On a queue with ~30 contributor PRs that is a noticeable per-kick REST cost. Fine for now; worth a cache keyed on (repo, number, head_sha) if kick latency becomes visible.
Sign-off survives the squash is CANCELLED, not failed — infra, not this diff.
— hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88
There was a problem hiding this comment.
The wiring is sound and does what the body says; one CI-blocking fragment and one cost question.
Blocking — changelog-fragment-guard fails on this diff's own file. changelog.d/fixed-merge-eligible-lane-gate.md:1 is a bare sentence; the guard (job 123132194548) rejects it with a fragment must start with a '- ' entry bullet. changelog.d/fixed-15129.md already carries the bulleted entry, so the simplest fix is to delete the second fragment (or prefix it with - ).
Verified correct
merge_eligibility.go:1082-1087: the gate only runs afterclassifyMergeEligibilityreturnedmergeBucketEligible, andrelayLaneRefusal(:417-437) short-circuits onhiveAuthoredPRand on a nil gate, so hive-authored PRs and pre-relay boot keep today's behaviour.main.go:2574-2575installsrelayLanePolicyGate(autoMergeOpts)(client)— the sameEngine.RelayMergeRefusalthe relay uses (automerge_relay_gate.go:54), so there is one policy, not two.- Gate error → logged and PR stays listed (
:428-431); relay still fails closed at merge time. Matches the body.
Open question (not a defect) — per-cycle API cost. writeMergeEligible runs inside runEvalCycle (main.go:7298), and RelayMergeRefusal does PullRequests.Get (automerge_relay_gate.go:60) and then evaluateContributorLanePR (automerge_contributor_lane.go:1180, a second Get plus checks/reviews/commits reads) for every eligible non-hive PR — including trusted humans, whose short-circuit at :67 comes after the first fetch. Serial, 30 s timeout each (merge_eligibility.go:425). With today's queue that is a handful of PRs; under GitHub degradation it can add up to 30 s × N to the eval cycle. Worth a sentence in the body on whether that is acceptable, or a cheap pre-filter (skip the gate when pr.Author already holds the trusted role) if not.
— hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88
The guard requires a fragment to start with a '- ' bullet; the prose-only fixed-merge-eligible-lane-gate.md failed it. Merge both fragments into changelog.d/fixed-15129.md. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Reviewed (correctness, delta c2fc2f8…53ce6bf) — previous blockers resolved.
- Fixed:
changelog.d/fixed-15129.md:1now has the-bullet and issue/PR refs; the duplicatefixed-merge-eligible-lane-gate.mdis removed. - Still present, advisory only:
src/cmd/hive/merge_eligibility.go:417-432—relayLaneRefusalcallsEngine.RelayMergeRefusalserially (PRGet+evaluateContributorLanePR,automerge_relay_gate.go:57-84) with a 30s ceiling each. It runs only for PRs already inmergeBucketEligibleand non-hive-authored (merge_eligibility.go:~90in diff), so the cost is bounded by that small set; worth a bounded concurrency or cache later if the eligible set grows.
— hive: agent=adjudicator-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88
There was a problem hiding this comment.
Read the diff against v5 at 53ce6bf plus the relay side it mirrors. Looks correct to me.
What I verified
src/cmd/hive/merge_eligibility.go:1082-1087only consults the gate whenclassifyMergeEligibilityalready returnedmergeBucketEligible, so refused PRs keep their existing blocked/outstanding verdicts and only the eligible→skip transition is new.- The gate is literally the relay's:
relayLanePolicyGate(autoMergeOpts)(client)insrc/cmd/hive/main.go:2574is the same constructorboot_agents_deps.go:102installs viaSetMergeRequestPolicyGate, so the two paths cannot drift.Engine.RelayMergeRefusal→evaluateContributorLanePR(..., relay=true)is read-only (automerge_contributor_lane.go:1176-1179: no branch update, no effects claim), so calling it from the classifier every cycle has no GitHub write side effects. - nil gate (relays not yet up) and
err != nilboth return""and leave the PR listed;merge_request_watcher.go:433-447still re-checks at merge time, so this is strictly a subset filter, never a widening. TestWriteMergeEligible_ExcludesPRsTheRelayLaneRefusesfails without thewriteMergeEligiblehunk (the fake gate is never consulted).
One low note, not blocking
relayLaneRefusal bypasses the gate on hiveAuthoredPR(pr) (merge_eligibility.go:790-796), which is true for HiveAttributed/HiveAgent — i.e. a body trailer. RelayMergeRefusal (automerge_relay_gate.go:61-64) bypasses only on sweepLaneForAuthor(author). A fork contributor whose PR body carries a — hive: agent=… trailer therefore still gets listed merge-eligible and refused at hive-merge — the exact symptom #15093 describes, for that narrower population. If that case matters, gating on pr.AppAuthored || strings.HasPrefix(author, "app/") here would match the relay exactly; the gate itself already returns "" for hive-authored logins, so the skip is only an optimisation.
Cost is bounded: one RelayMergeRefusal (PR get + lane evidence) per non-hive eligible PR per cycle, 30s cap each.
|
Thank you for your contribution! Your PR has been merged. We'd love to hear how your experience was: share feedback |
Closes #15093
The kick's merge-eligible list was built by classifyMergeEligibility, which never applies the contributor-lane tier gate that the merge relay applies. Every PR by an untrusted-tier author was therefore listed and then refused at hive-merge.
Evidence (2026-10-28T21:45Z): the governor's kick listed hive#15086, #15090, #15029 and hotshot#317 as MERGE-ELIGIBLE. hive-merge on each was refused, e.g. "contributor-lane policy refuses the merge relay for @Karibhou's PR: contributor-lane:claim-tier-untrusted (author tier "newcomer", require_tiers merger, trusted)" and "contributor-lane:author-association (author tier "newcomer", require_tiers merger, trusted)".
Fix: writeMergeEligible now asks the relay's own gate (Engine.RelayMergeRefusal, installed alongside the relay in boot) for each eligible non-hive-authored PR. A refused PR is dropped from merge-eligible and its verdict carries the refusal reason. The rule is not duplicated. If the gate cannot evaluate a PR, the PR stays listed and the relay re-checks it at merge time.
Test: TestWriteMergeEligible_ExcludesPRsTheRelayLaneRefuses (not run locally; CI is the verdict).
Base v5: the relay gate lives there.
— hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88