Skip to content

✨ Conflict-aware merge train in the automerge lanes - #15192

Closed
hivecommons-hive[bot] wants to merge 5 commits into
v5from
hive/adopt-15157
Closed

hivecommons-hive[bot] wants to merge 5 commits into
v5from
hive/adopt-15157

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

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 9919d2daad92 as pushed by @clubanderson (fork hivecommons/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 their Signed-off-by; add your own sign-off on your commits. Do not open another PR.

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>
…oup is blocked

Folded in from #15149: a head the lane last saw red / terminally held /
permanently refused does not front a train, and a group whose best member
is blocked imposes no ordering. Ordinal cases from #15144 in the SPA test.

Signed-off-by: Andrew Anderson <andy@clubanderson.com>
Signed-off-by: Andrew Anderson <andy@clubanderson.com>
Signed-off-by: Andrew Anderson <andy@clubanderson.com>
@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 danathar 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

@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
@hivecommons-hive hivecommons-hive Bot added author/hive This repository's own hive (the App or one of its agent lanes) authored this PR dco All commits are DCO signed-off stage/070-fixing Hive-authored PR: CI red, changes requested or needs rebase; a hive agent is fixing it labels Oct 29, 2026
@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
#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
#15122 🐛 Write-back containment: per-kind gate for every unsolicited GitHub write, with backfill guard same files src/cmd/hive/main.go
src/docs/operator-reference.md
src/pkg/config/config.go
src/pkg/dashboard/static/index.html
#15191 🐛 Let hive decide on a ready-for-human-merge PR approves and lets the sweep merge it same files src/docs/dashboard-sections.md
src/docs/operator-reference.md
src/pkg/dashboard/static/index.html
#15223 ✨ Soak countdown on every soak pill, with the live timer on hover same files src/pkg/dashboard/stage_tracker.go
src/pkg/dashboard/static/index.html
#15222 🐛 fix: stage tracker verb — forward transitions no longer read as "fell back to" same files src/docs/dashboard-sections.md
src/pkg/dashboard/stage_tracker.go
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/stage_tracker.go
src/pkg/dashboard/stage_tracker_decision.go
src/pkg/dashboard/static/index.html
src/pkg/github/automerge/automerge_sweep.go
#15221 ✨ Activity Monitor: Accept triage on the label-less reporter-trust hold, leading the row menu same files src/pkg/dashboard/static/index.html
#15219 🐛 fix: preserve human and owner PRs during delegated decisions same files src/pkg/dashboard/stage_tracker.go
src/pkg/dashboard/static/index.html
#15085 ✨ Activity Monitor: Adopt now and Reroute to another clanker for PRs waiting on a contributor's clanker same files src/cmd/hive/main.go
src/docs/dashboard-sections.md
src/docs/operator-reference.md
src/pkg/config/config.go
src/pkg/dashboard/stage_tracker.go
src/pkg/dashboard/stage_tracker_decision.go
src/pkg/dashboard/static/index.html
#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/stage_tracker.go
src/pkg/dashboard/stage_tracker_decision.go
src/pkg/dashboard/static/index.html
#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/stage_tracker.go
src/pkg/dashboard/stage_tracker_decision.go
src/pkg/dashboard/static/index.html
#15213 🐛 Approve toast: outcome in plain words, who merges next, sentinel only while open same files src/pkg/dashboard/static/index.html
#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/static/index.html
#14822 🐛 fix: preserve owner intent through PR decision paths same files src/pkg/github/automerge/automerge_contributor_lane.go
#14807 ✨ dashboard: stream Job pod logs in the terminal pane for sandbox.runtime: job agents same files src/pkg/dashboard/static/index.html
#15200 🐛 fix: tracker history column wears a history mark, not a ✓ same files src/docs/dashboard-sections.md
src/pkg/dashboard/static/index.html

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
@kubestellar-prow kubestellar-prow Bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 29, 2026
@hivecommons-hive

Copy link
Copy Markdown
Contributor Author

hive/awaiting-ci: merged v5 (reconciled with #15149 merge-train front). CI pending — sweep will merge when green.


🐝 Hive Agent: scanner | Instance: hosted-available-oke-11-placeholder-r05x | SHA: 10e11754e

— hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor Author

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 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, with src/pkg/github/automerge/automerge_merge_train.go differing by 856 lines.
  • Concrete API split in src/cmd/hive/main.go:
    • #15157 removes autoMergeOpts.MergeTrainEnabled (landed by #15149) at main.go:2550 and :9412, replacing it with autoMergeOpts.MergeTrain = func() automerge.MergeTrainPolicy{…}; it deletes 224 lines of #15149's automerge_merge_train.go.
    • #15192 keeps MergeTrainEnabled and adds MergeTrainMaxRebaseAttempts beside it (main.go:2551-2554, :9417); it deletes 29 lines of #15149's file and rewrites #15149's changelog fragment changelog.d/added-merge-train-front.md in place rather than adding added-automerge-merge-train.md.
  • 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

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor Author

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 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 head 9919d2da plus a merge commit 10e11754 ("merge v5 into hive/adopt-15157: reconcile with #15149"). #15157 was instead rebased by its author onto post-#15149 v5 and gained 26bfd3f7 ("close legacy-switch test scope").
  • The adoption premise ("contributor was unavailable") was already stale: 26bfd3f7 on #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, mostly src/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 at 9b01e1d1) differently:
    • This PR keeps #15149's option surface now on v5 — autoMergeOpts.MergeTrainEnabled / MergeTrainMaxRebaseAttempts at src/cmd/hive/main.go:2550 and :9412 — alongside the MergeTrainPolicy type.
    • #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-landed changelog.d/added-merge-train-front.md while adding its own added-automerge-merge-train.md. This branch instead edits the #15149 fragment in place and adds no second one.
  • Both edit automerge_sweep.go option 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

@hivecommons-hive hivecommons-hive Bot added stage/085-needs-decision A human decision is owed: sentinel alert, hold/needs-decision label, human-only rule or parked issue and removed stage/050-review-pending Review swarm requested; awaiting a verdict for the current head labels Oct 29, 2026
@hivecommons-hive

Copy link
Copy Markdown
Contributor Author

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 (10e1175) to merge as-is, or leave a changes requested review (or reply /hive decision <what to change>) and the hive will push the fix.

How to release it:

  • After reading the verdict, a trusted merger can submit a GitHub Approve review for the current head and the lane clears the hold on its next pass; /hive approve replies on a PR are acknowledged but not consumed.

Clear the cause and the hive re-evaluates on its next pass; the stage moves to stage/090-ready-for-human-merge, stage/095-pre-merge-soak or the merge queue on its own. Approval does not bypass CI, hold labels or other merge gates.

@hivecommons-hive

Copy link
Copy Markdown
Contributor Author

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 v5, so there is nothing of its own left to rebase and measure. Reopen if that's wrong.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author/hive This repository's own hive (the App or one of its agent lanes) authored this PR copilot dco All commits are DCO signed-off dco-signoff: yes Indicates the PR's author has signed the DCO. hive/superseded Closed by Hive: a different merged PR already landed this change role/trusted Author is trusted for unattended merge (trusted-author role or registry/claim tier in require_tiers) size/XXL Denotes a PR that changes 1000+ 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

1 participant