Repository navigation
🐛 automerge: hold same-issue PRs across lanes until a decision is recorded - #15812
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. |
|
stage 080-awaiting-merge-admission → 071-needs-author: required-check-failing:coverage |
There was a problem hiding this comment.
Intent alignment vs #15810 — the gate matches the issue's contract (hold in every lane, decision admits, Supersedes pair/Refs exempt, 085 + tracker + recommend-only plan), but one lane path can still admit a conflicted PR.
Claim gate is blind on a targeted (webhook-nudged) pass when no forge-state source is wired — src/pkg/github/automerge/automerge_merge_train_duplicate.go:216-226 (claimantsForConflicts) returns the lane's prs unchanged when c.openPRs == nil. But on that same no-source path openPullRequests narrows prs to targets (automerge_forgestate.go:266-277), and the non-forgestate ticker loop does run targeted passes on sweepTrigger nudges ("evaluate only those now", automerge_sweep.go:1636-1641 → Targets: targets at :1693/:1713/:1732). So a CI-green nudge for #15793 alone yields byIssue with a single claimant, held stays empty, and the trusted lane admits #15793 while the undecided conflict with #15783 stands — the exact "marching toward merge" the issue says must stop in every lane. The comment on :219-221 assumes a scheduled pass fills the list; the event path does not. Suggested fix — list the repo on the no-source path too (one /pulls call per lane per targeted pass; openPullRequests(…, nil) already does exactly that):
func (c *Engine) claimantsForConflicts(ctx context.Context, owner, repo string, prs []*gh.PullRequest) []*gh.PullRequest {
if c == nil {
return prs
}
all, skip, err := c.openPullRequests(ctx, owner, repo, nil)
if err != nil || skip != "" || len(all) == 0 {
return prs
}
return all
}
Advisory (no change requested): recordedDecisionFor → review.DecisionAnswerFor (src/pkg/review/human_change_request.go:392-401) is true for any trusted-human decision on the head, not only an approval, so a /hive decision instruction asking for changes also lifts this hold. Downstream gates still block the merge, so this matches the issue's "a recorded operator decision … admits that PR"; just noting it so the docs' "Approve … is what lifts the gate" (src/docs/hive-merge.md) is read loosely.
— 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 46c12ca)
1. Gate fails open on targeted (webhook) passes when no forge-state source is wired — src/pkg/github/automerge/automerge_merge_train_duplicate.go:214-223 (claimantsForConflicts)
When c.openPRs == nil the function returns prs unchanged. But prs is the lane's list from openPullRequests(ctx, owner, repoName, opts.Targets) (automerge_sweep.go:1131, :1372), and in the legacy (no-OpenPRSource) branch that list is narrowed to the webhook-named PRs (automerge_forgestate.go:266-277). Targeted passes still run in that configuration: the ticker loop selects on sweepTrigger regardless of forge-state (automerge_sweep.go:448-454, :1637-1641), fed by SweepTrigger.NotifyPullRequests (automerge_forgestate.go:128).
So a CI-passed nudge for #15793 alone yields prs == [#15793]; byIssue[15773] contains only itself; planClaimConflicts finds no other claimant and admits it — the exact outcome #15810 is meant to prevent, and contrary to the PR body's "Held in every lane, so neither PR is admitted." The comment on claimantsForConflicts ("the lane's list, which a scheduled pass fills with every open PR") only covers tick passes. Neither new test exercises a narrowed list.
Fix: list the whole repository in the legacy branch too (guarded on c.gh so the unit tests that build a bare Engine{} keep the current path):
func (c *Engine) claimantsForConflicts(ctx context.Context, owner, repo string, prs []*gh.PullRequest) []*gh.PullRequest {
- if c == nil || c.openPRs == nil {
+ if c == nil || (c.openPRs == nil && c.gh == nil) {
return prs
}
- all, skip, err := c.openPullRequests(ctx, owner, repo, nil)
+ all, skip, err := c.openPullRequests(ctx, owner, repo, nil) // nil targets: every open PR, from the snapshot or /pulls
if err != nil || skip != "" || len(all) == 0 {
return prs
}
return all
}If the extra /pulls list per lane on legacy tick passes is unwanted, thread opts.Targets != nil into planMergeTrains and only re-list when the pass was narrowed. Either way, please add a test that passes a one-PR prs list with a fake openPRs/lister holding the other claimant and asserts the hold.
Everything else I traced (recordedDecisionFor nil-safety automerge_decision_carry.go:39-41, snapshot items carrying Body automerge_forgestate.go:231, skip ordering in the three lane loops, claim-conflict reason round-trip and 085 classification) checks out.
— hive: agent=ci-maintainer backend=copilot model=claude-fable-5.1 copilot=1.0.88
|
CI triage (scanner): the dashboard test shards all fail on one test, The node eval dies with:
jsConstLine(t, html, "STAGE_TRACKER_GATE_DUPLICATE_PREFIX"),
jsFunc(t, html, "stageTrackerGateDuplicateOf"),
jsConstLine(t, html, "STAGE_TRACKER_GATE_CLAIM_CONFLICT_PREFIX"),
jsFunc(t, html, "stageTrackerGateClaimConflictOf"),
jsFunc(t, html, "stageTrackerMergeGateStateWord"),Log: https://github.com/hivecommons/hive/actions/runs/41086300767/job/124169023362 Not pushing to your branch (author-owned); happy to apply it if you'd like. 🐝 Hive Agent: — hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88 |
…orded Two open PRs closing one issue in different lanes (hive self lane vs trusted-author lane) both marched toward merge because the one-PR-per- issue pick only sees its own lane. Every lane now holds its candidate with merge-train:claim-conflict#<other>:<issue> while another open PR claims the issue and no decision is recorded; the stage engine parks it at 085, the tracker reads 'held · duplicate of #B · needs decision' with options naming both PRs, and the delegate plan recommends 'keep #B, close #A — or the reverse' instead of 'all 2 PRs'. Closes #15810 Signed-off-by: Andrew Anderson <andy@clubanderson.com>
…PA gate word self-contained Review: a webhook-targeted pass without a forge-state source handed the lane only the nudged PR, so the gate saw one claimant and admitted it. openPullRequests now remembers the full /pulls list per repo before narrowing and the gate groups against it. The merge-gate word reads the claim-conflict prefix inline so the node-lifted function test passes. Signed-off-by: Andrew Anderson <andy@clubanderson.com>
46c12ca to
48cf9be
Compare
|
Addressed the review in 48cf9be: on the legacy (no forge-state source) path |
|
Thank you for your contribution! Your PR has been merged. We'd love to hear how your experience was: share feedback |
Closes #15810
Problem
Issue #15773 got two open PRs: the hive's own #15783 (self lane) and a trusted human's #15793 (trusted-author lane). Both were labelled
conflicts-with-open-prand both marched toward merge — #15793 in the merge queue, #15783 "Ready for auto merge" — because the merge queue's one-PR-per-issue pick (planDuplicateHolds) groups candidates within one lane and each lane only sees its own PRs.Fix (safety gate only — no auto-resolution policy)
automerge_merge_train_duplicate.go): before the trains are grouped, every lane runsplanClaimConflictsover the repository's open PRs (forge-state snapshot when wired, else the lane's list). A candidate whose closing issue another open PR also claims — one this lane does not evaluate — is held with lane reasonmerge-train:claim-conflict#<other>:<issue>/0:0/0:and the INFO linesame-issue claim conflict undecided: #A vs #B. Held in every lane, so neither PR is admitted. A recorded decision on the candidate's head (recordedDecisionFor) admits it; an adoption pair (Supersedes #N) is not a conflict;Refsis not a claim. Same-lane pairs keep the existing winner/duplicate-ofrule (which already sees both). Wired into the self, trusted and contributor lane loops with skip bucketmerge-train-claim-conflict.claim-conflict→ 085 needs-decision (human), likerebase-exhausted.claim-conflict:<other>, captionheld · duplicate of #B · needs decision, needs-decision modifier, no train; decision options name the concrete PRs ("Keep 🐛 stage tracker: Let hive decide shows it is working, covered issues drop the PR's chip, 👤 says why #15783 — admit it to the merge queue", "Close 🐛 stage tracker: Let hive decide shows it is working, covered issues drop the PR's chip, 👤 says why #15783 as superseded by 🐛 stage tracker: 'Let hive decide' shows it is working and answers faster #15793"). SPA gate word/tooltip for the new state.same-issue-claim-conflict; plan text "Hold both: 🐛 stage tracker: Let hive decide shows it is working, covered issues drop the PR's chip, 👤 says why #15783 and 🐛 stage tracker: 'Let hive decide' shows it is working and answers faster #15793 claim issue stage tracker: 'Let hive decide' gives no feedback and answers slowly; covered issues inherit the PR's chip; 👤 chevrons never say why #15773. Keep 🐛 stage tracker: 'Let hive decide' shows it is working and answers faster #15793, close 🐛 stage tracker: Let hive decide shows it is working, covered issues drop the PR's chip, 👤 says why #15783 — or keep 🐛 stage tracker: Let hive decide shows it is working, covered issues drop the PR's chip, 👤 says why #15783, close 🐛 stage tracker: 'Let hive decide' shows it is working and answers faster #15793; the hive will not pick." instead of "all 2 PRs".Tests
TestPlanClaimConflictsHoldsCrossLanePair— both lanes hold, log line, reason round-trip, not aduplicate-of.TestPlanClaimConflictsDecidedOrAdoptionAdmits— recorded decision admits that side only;Supersedespair andRefsare not conflicts; same-lane pair stays with the winner rule.TestMergeTrainClaimConflictSentence, classify → 085,TestStageTrackerApplyClaimConflict,TestDelegatedPlanWordingClaimConflictNamesPRs.Docs:
hive-merge.md,operator-reference.md(one paragraph each). Changelog fragment at repo root.Live #15783/#15793 are not touched by this PR.