Repository navigation
✨ Conflict-aware merge train in the automerge lanes - #15192
hivecommons-hive[bot] wants to merge 5 commits into
Conversation
Approved PRs to one base whose changed files overlap are grouped per
sweep; one front merges at a time, siblings wait at stage/080 as
merge_gate.state=queued-behind (never a human stage). After the front
merges the lane updates behind branches and asks the rebase-resolve hook
for dirty ones, bounded by auto_merge.merge_train.max_rebase_attempts
(default 2); past it the PR goes to stage/085 with the option
"Rebase, then merge as maintainer".
The Activity Monitor renders a train contiguously with a left rail and
a header chip, pills "Merging · front of train", "In merge train · 3rd
of 4", "Rebasing · attempt 1/2", "Needs human decision · rebase failed
twice"; tooltips list PRs ahead and overlapping files; items carry
merge_train{id,state,front,position,size,overlap_files,ahead}.
Fixes #15117
Signed-off-by: Andrew Anderson <andy@clubanderson.com>
Signed-off-by: Andrew Anderson <andy@clubanderson.com>
Signed-off-by: Andrew Anderson <andy@clubanderson.com>
|
[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
|
There was a problem hiding this comment.
Correctness review (read at head 9919d2d)
1. Siblings can park indefinitely behind a front the lane will never merge — src/pkg/github/automerge/automerge_merge_train.go:330, :585, :687; src/cmd/hive/main.go:2573
mergeTrainCandidate (automerge_merge_train.go:330) admits label:needs-rebase PRs into a train, and groupMergeTrains lets one lead it (clean-first, then oldest). But in all three lanes the lane's own prefilter still runs after the train check and skips that front with label:needs-rebase every cycle (automerge_sweep.go:1137, automerge_contributor_lane.go:446), so noteMergeTrainOutcome is never reached for it and nothing in the sweep removes the label. Meanwhile every sibling — including clean, fully approved ones — is parked as queued-behind at stage 080 (automerge_sweep.go:1068-1073). Before this PR those clean siblings merged; now they wait forever behind a label-skipped PR. That's a regression in the exact scenario #15117 targets.
The same hole exists for a dirty front: mergeTrainFront falls through when rebaseResolver == nil (:585), production wires no resolver (main.go:2573-2575), and mergeTrainBlockingReason deliberately excludes conflicting on the premise that "the train's own rebase step repairs it" (:685-687) — which is false when no resolver exists. The Blocked fail-open intent ("nobody waits behind a PR that is not moving", :111) is defeated, and the tracker state the issue asked to be "honest" shows dirty siblings as a hive-owned wait that nothing will advance. TestMergeTrainFrontNoResolverFallsThroughOnce asserts the fall-through but never checks what the sibling (#41) is shown as.
Requested fix: treat a front the lane cannot act on as Blocked so the group imposes no ordering — i.e. mark the head blocked when the lane prefilter returns label:needs-rebase (or stop admitting it via mergeTrainCandidate until a resolver is wired), and when rebaseResolver == nil treat a dirty front's conflicting/label:needs-rebase verdict as blocking in mergeTrainBlockingReason. Add a sweep-level test with a labelled/dirty front and a clean sibling asserting the sibling still merges.
2. Branch currently conflicts with v5 (tide: "PR has a merge conflict"); needs the rebase the PR body already calls for.
— hive: agent=adjudicator-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88
…ront One merge-train implementation: #15149's planner (planMergeTrains slots, blocked-head memory incl. conflicting, per-PR transition log, files cache via ListChangedFiles), config key auto_merge.merge_train.enabled and Options.MergeTrainEnabled stay canonical. Layered on top from this branch: max_rebase_attempts + Options.MergeTrainMaxRebaseAttempts, RebaseResolver hook, prstage merge-train stage reasons for siblings and rebasing fronts, after-front-merge update-branch/rebase follow-through, contributor-lane wiring, dashboard tracker/UI and docs. An exhausted front is marked blocked so it stops fronting. One changelog fragment covers the train. Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
|
hive/awaiting-ci: merged v5 (reconciled with #15149 merge-train front). CI pending — sweep will merge when green. 🐝 Hive Agent: — hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88 |
There was a problem hiding this comment.
Decision needed: @clubanderson should decide which merge-train head survives — #15157 (your rebase, replaces #15149's MergeTrainEnabled option with MergeTrain() MergeTrainPolicy) or this adopted copy #15192 (keeps MergeTrainEnabled, adds MergeTrainMaxRebaseAttempts) — and close the other; both are green on v5 and cannot both merge.
Conclusion: this PR and #15157 are two live, green, different reconciliations of the same feature against the now-merged #15149. One must be closed; I have not closed anything.
What I verified (both heads fetched, diffed against their shared merge-base f2c611b on v5):
- This copy was taken from #15157 at
9919d2d. Since then @clubanderson pushed 5 commits to #15157 (5f48e48…26bfd3f, a rebase onto v5 plus "blocked heads never front" / CSS tokens / prstage coverage), and CI on #15157 is now green — the "contributor unavailable, CI red" reason for the adoption has lapsed. - The two heads are not the same code:
git diff 10e1175 26bfd3f→ 12 files, +533/−907, withsrc/pkg/github/automerge/automerge_merge_train.godiffering by 856 lines. - Concrete API split in
src/cmd/hive/main.go:- #15157 removes
autoMergeOpts.MergeTrainEnabled(landed by #15149) atmain.go:2550and:9412, replacing it withautoMergeOpts.MergeTrain = func() automerge.MergeTrainPolicy{…}; it deletes 224 lines of #15149'sautomerge_merge_train.go. - #15192 keeps
MergeTrainEnabledand addsMergeTrainMaxRebaseAttemptsbeside it (main.go:2551-2554,:9417); it deletes 29 lines of #15149's file and rewrites #15149's changelog fragmentchangelog.d/added-merge-train-front.mdin place rather than addingadded-automerge-merge-train.md.
- #15157 removes
- Neither touches workflows, OWNERS or other trust surfaces.
So this is a conflict, not a duplicate: whichever lands second will fail to apply. The choice is an ownership/API call (rename-in-place vs additive on top of #15149's exported option), not a defect in either diff, so I'm routing it rather than scoring it. I have not done a line-level correctness read of either 2k-line head; that should happen on the survivor.
— hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88
There was a problem hiding this comment.
Decision needed: @clubanderson should decide which merge-train head survives — your rebased #15157 (26bfd3f) or this adoption #15192 (10e1175) — since both are green and they reconcile with #15149 differently.
Conclusion: this PR and #15157 are now two live, divergent heads of the same work, and both cannot merge. One should close; I have not closed anything.
What I verified (tree, not prose):
- Both branches carry the same four author commits (
✨ Conflict-aware merge train…,✨ blocked heads never front…,🌱 CSS tokens,🌱 prstage reason parsing). This branch is #15157's old head9919d2daplus a merge commit10e11754("merge v5 into hive/adopt-15157: reconcile with #15149"). #15157 was instead rebased by its author onto post-#15149 v5 and gained26bfd3f7("close legacy-switch test scope"). - The adoption premise ("contributor was unavailable") was already stale:
26bfd3f7on #15157 is timestamped 20:53 -0400, four minutes before this merge commit (20:57 -0400). - The heads diverge materially:
git diff 10e11754 26bfd3f7→ 12 files, +533/−907, mostlysrc/pkg/github/automerge/automerge_merge_train.go(856 lines) and its test. Same feature set in both (RebaseResolver, update-branch,queued-behind,rebase-exhausted, blocked-front fail-open), but they reconcile with #15149 (merged to v5 at9b01e1d1) differently:- This PR keeps #15149's option surface now on v5 —
autoMergeOpts.MergeTrainEnabled/MergeTrainMaxRebaseAttemptsatsrc/cmd/hive/main.go:2550and:9412— alongside theMergeTrainPolicytype. - #15157 drops those two wirings in favour of a single
autoMergeOpts.MergeTrain = func() automerge.MergeTrainPolicy{…}(src/cmd/hive/main.go~2573 and ~9420) and rewrites #15149's just-landedchangelog.d/added-merge-train-front.mdwhile adding its ownadded-automerge-merge-train.md. This branch instead edits the #15149 fragment in place and adds no second one.
- This PR keeps #15149's option surface now on v5 —
- Both edit
automerge_sweep.gooption fields differently, so whichever merges first dirties the other.
Recommendation: since the author kept working on #15157 after adoption and it is the canonical branch, the simplest path is to close this adoption in favour of #15157. If #15157 is preferred, note it removes #15149's MergeTrainEnabled wiring that landed on v5 an hour earlier — fine if intended, but it is a rename-not-add of a just-shipped option.
No correctness defect found in either head; this is purely an ownership/which-head question.
— hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88
|
Needs a decision, not a merge:
Head: verdict requires_human @10e1175, 66/66 checks green, DCO yes, soak 0s of 30m0s. What to do: approve this head ( How to release it:
Clear the cause and the hive re-evaluates on its next pass; the stage moves to |
|
Supersession sweep found that this PR's claimed issue is already closed by another merged PR.
Closing this hive-authored PR as superseded by #15157: every issue it closes is already closed and that merged PR closed #15117. Head 10e1175 conflicts with This comment is edited in place by the supersession sweep; it is not duplicated. |
Supersedes #15157 (adopted after CI went red and the contributor was unavailable; original commits by @clubanderson preserved).
Fixes #15117
Fixes #15141
Fixes #15143
Fixes #15144
This branch is #15157's head
9919d2daad92as pushed by @clubanderson (forkhivecommons/hive), unchanged. Last lane reason on the original:contributor-lane:decision-requested.Hive fix agent: rebase this branch on
v5, fix the failing checks / review asks, and push to THIS branch. Keep the original author's commits and theirSigned-off-by; add your own sign-off on your commits. Do not open another PR.