Repository navigation
🐛 tracker: PRs under repair leave the merge train - #15616
Conversation
A PR being fixed (070), waiting on its author (071) or contributor
(072), parked on a human decision (085), or with a red required check
is not a merge-train member. The planner (mergeTrainUnderRepair) skips
it; the tracker (stageTrackerTrainUnderRepair) drops it — the front
included — with left_train {why, note} and a muted hover line, the
survivors close ranks (size, position, front, ahead, members), and a
train left with one member renders no header and no ordinal. The
rebase-exhausted 085 tail stays: the train put it there.
Hive's own #15405 led a header as "1st: #15405" while its chevron
read "Fixing".
Fixes #15615
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
|
The lone survivor of a train that shrank to one member reads the 080 row's own gate (ready), not an empty state. Signed-off-by: Andrew Anderson <andy@clubanderson.com>
|
stage 080-awaiting-merge-admission → 050-review-pending: required-check-missing:build-and-test |
There was a problem hiding this comment.
The mechanism is right and matches the screenshot in the body; one low aliasing issue in the close-ranks loop is worth a one-line fix.
Verified at the head (stage_tracker_merge_train.go):
- Under-repair members leave in the first pass (
:347-352) beforemembersis built, so they never contribute toidx; the front — which carries noMergeTrainof its own — is checked separately (:360-364) and recorded asLeftTrain{position: 1}so it lands indropped. A train shrinking below two members strips everyone withwhy == ""(:392-396), so no header survives for a train of one.stageTrackerLeaveMergeTrainrestores the stage's own gate state (readyat 080,pendingat 060) and the 080 caption, so a row that left does not keep "waiting its turn … behind #N". - Rebase-exhausted 085 tails are exempted (
:346) — correct, since that stage is the train's own doing, not a repair. - Planner side:
mergeTrainUnderRepair(automerge_merge_train.go:484) widens the 072-only check to 070/071/072/085 by label then store record, same precedence as before. - JS:
stageTrackerLeftTrainNotereturns''wheneverstageTrackerTrain(item)is truthy, so a staleleft_traincan never show alongside a live ordinal.
Low — sample is mutated mid-loop (stage_tracker_merge_train.go:398-406). sample := items[idx[0]].MergeTrain is a pointer, and idx[0] is the first member the size loop visits, so after that iteration sample.Size already holds the reduced size. Every later member then computes sample.Size - len(dropped) against the already reduced value — subtracting dropped twice. The max(…, len(idx)) floor hides this whenever every surviving member is present in items, but when the view has fewer members than the planner counted (a member whose stage record has not yet picked up the merge_train reason this sweep, for instance), survivors report different sizes: with Size=4, one dropped and idx=[#2, front], #2 says "2 of 3" and the front says "1st of 2". Fix: read size := sample.Size - len(dropped) once before the for _, i := range idx loop and assign mt.Size = max(size, len(idx)). Cosmetic in effect (header vs. chip disagree), no behavioural impact on the planner.
— hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88
There was a problem hiding this comment.
The tracker side reads correct to me (traced the post-pass and type-checked go build ./pkg/dashboard/ ./pkg/github/automerge/ at 7e93f0f). One verified mismatch between the stated exception and the planner, which I think needs a decision before this lands.
Planner drops the rebase-exhausted 085 tail that the body and docs say stays — medium
src/pkg/github/automerge/automerge_merge_train.go:476listsstagelabels.NeedsDecisioninmergeTrainUnderRepairStageswith no reason check, and:386/:498skip any PR wearing that label or stage-store record. A front the train itself parked at 085 viamergeTrainFrontReason(…, MergeTrainStateRebaseExhausted, …)(:693) is therefore excluded from the next plan, and the survivors re-form the train without it.- The tracker makes the opposite choice:
src/pkg/dashboard/stage_tracker_merge_train.go:347keeps a member whoseMergeTrain.State == MergeGateStateRebaseExhausted, anddocs/dashboard-sections.md:923says "The exception is therebase-exhaustedtail at 085: the train put it there, and it stays so the person who rebases it sees where it merges." TestPlanMergeTrainsExcludesUnderRepair(automerge_merge_train_test.go:642-653) pins the planner behaviour: it observes #15407 atNeedsDecisionwith reasonrebase-failed-twiceand asserts it is out of every train.
Consequence: the dashboard row keeps showing the exhausted PR as "1st of N" from its stale stage-record reason while the planner has already promoted the next member and will merge around it, so the ordinal the person sees is no longer the order the lane will merge in. It is also a merge-policy change rather than a display fix — before this PR an exhausted front held its train until someone rebased; after it the train proceeds. That may well be the better behaviour, but the body says the opposite, so one of the two should change: either exempt a record whose reason parses as a rebase-exhausted train from mergeTrainUnderRepair (and flip the test expectation for #15407), or drop the exception from stageTrackerMergeTrainPostPass:347 and the docs so both halves agree.
Everything else I checked holds: stageTrackerLeaveMergeTrain (:272-308) only resets a gate state the train wrote; the dropped slot recompute (:384-411) shifts positions only for slots below each survivor and collapses a one-member remainder with why "" so no stray note appears; the promoted front re-words via stageTrackerMergeTrainFrontGate(…, promoted=true); stageTrackerLeftTrainNote in the SPA returns '' whenever a merge_train is present, so a row can never show both.
— hive: agent=reviewer 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. |
There was a problem hiding this comment.
Traced stageTrackerMergeTrainPostPass on this head rather than only the diff. The flow holds together: an under-repair member leaves in the first loop with its slot remembered in LeftTrain.position; a front under repair is caught on the sample.Front lookup and sets frontLeft; dropped slots shift survivors' Position, the slot-1 survivor is promoted through stageTrackerMergeTrainFrontGate(..., promoted=true) and Front is rewritten for every member; a train that shrinks below two members collapses with no note. Rebase-exhausted tails are explicitly kept, which matches the comment.
Engine side: mergeTrainUnderRepair returns st.Slug(), and ReturnedToContributor.Slug() is "returned-to-contributor" (stagelabels.go:273), so the skip-log reason for the existing case is unchanged; the new reasons are fixing, needs-author, needs-decision.
Looks correct to me. No findings.
— hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88
|
Thank you for your contribution! Your PR has been merged. We'd love to hear how your experience was: share feedback |
|
@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. |
There was a problem hiding this comment.
Read stage_tracker_merge_train.go, automerge_merge_train.go, derive_pr_classify.go and the new tests at 8405aaf. The view-side mechanism (drop under-repair members, close ranks, promote the next front) is right and the three Go cases pin it. Two things I could verify, one defect and one body/code mismatch:
1. Close-ranks Size is computed through a pointer it mutates (stage_tracker_merge_train.go:410-421) — medium.
sample := items[idx[0]].MergeTrain is a *StageTrackerMergeTrain. The loop does mt.Size = max(sample.Size-len(dropped), len(idx)) for every i in idx; on the first iteration mt == sample, so sample.Size becomes S-d, and every later member gets max(S-2d, len(idx)). The len(idx) floor hides it whenever all surviving members are in the view — which is every case in TestStageTrackerMergeTrainUnderRepairLeaves (3 members, 1 dropped, 2 visible → floor 2 == correct 2). With a member off-view (planner size 4, one dropped, two visible) the first row says "of 3" and the others "of 2". Fix: size := sample.Size before the loop and use size-len(dropped).
2. The planner now drops the rebase-exhausted 085 front the body says "stays" — medium, needs the author's call.
The body: "The rebase-exhausted 085 tail stays — the train put it there." That exemption exists only in the tracker (stage_tracker_merge_train.go:348, State != MergeGateStateRebaseExhausted). The engine's new mergeTrainUnderRepair (automerge_merge_train.go:485-504) matches stagelabels.NeedsDecision by label or store record with no such exemption, and derive_pr_classify.go:367-368 is what puts a rebase-exhausted front at 085. So on the next planMergeTrains tick the exhausted front is no longer a candidate, the train re-plans without it, and the member behind it fronts and merges — whereas before this PR the train parked behind it until a person rebased (mergeTrainFront, automerge_merge_train.go:682). TestPlanMergeTrainsExcludesUnderRepair does not cover a rebase-exhausted 085. That may well be the behaviour you want (a train should not stall indefinitely behind a human rebase), but it is a merge-order change, not a display fix, and the view will then show the exhausted PR as a member of a train the engine no longer counts it in. Either exempt 085 whose stage reason parses as MergeTrainStateRebaseExhausted in mergeTrainUnderRepair, or say in the body/changelog that exhausted fronts now yield the train.
Not a defect, just noting: when a 2-member train loses its front, the survivor is made trainless via stageTrackerLeaveMergeTrain(it, "") but the departed front keeps left_train.note = "rejoins when green" for a train that no longer exists — cosmetic.
— hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88
…nto stage_tracker_caption.go Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
…#15611 prior-head note into the split tracker-words files Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
Fixes #15615
Owner screenshot: header merge train · 2 PRs · 1st: #15405 · overlapping: operator-reference.md while #15405's chevron read Fixing (a maintainer had just requested changes).
Root cause
stageTrackerMergeTrainPostPassattached the front from its siblings' train reasons onstage < mergedalone, so a front that regressed to 070 still led the header; regressed members kept themerge_trainthe lane's reason encoded. The planner only excluded 072.Fix
pkg/github/automerge):mergeTrainReturnedToContributor→mergeTrainUnderRepair, skipping 070 fixing / 071 needs-author / 072 returned / 085 needs-decision by label or stage store (why=<slug>skip log).pkg/dashboard/stage_tracker_merge_train.go):stageTrackerTrainUnderRepair(stage, reason)names those stages or a red required check (required-check-failing:/check-failing:/ci-red). Such a member — the front included — leaves the train (stageTrackerLeaveMergeTrain):merge_traingone, train gate words gone,left_train: {why, note}set. Survivors close ranks (size,position,front,ahead,members; the next in line fronts and takes the front's gate words), and a train left with one member is no train (no header, no ordinal; the 080 caption goes back to "Green and approved; waiting for the automerge lane to admit it"). Therebase-exhausted085 tail stays — the train put it there. Provisional 050/060 members (🐛 tracker: chevron and caption agree — queue slot is a suffix until the PR is ready #15581) keep their slot.tracker-words.js):stageTrackerLeftTrainNote/STAGE_TRACKER_LEFT_TRAIN_NOTE; the row hover ends with the muted line Merge train: left the merge train while being fixed; rejoins when green.Tests
TestStageTrackerMergeTrainUnderRepairLeaves(train of 2, front at 070 → both rows trainless, note on the dropped one; train of 3 with the middle at 072 → 2 of 2; front at 071 → next in line promoted),TestPlanMergeTrainsExcludesUnderRepair.TestStageTrackerTrainTagOnTwoTrainsextended — dropped row + lone survivor: no header, no ordinal, no rail, hover note; lift helpers updated.Docs: dashboard-sections.md ("PRs under repair leave the train"), dashboard-copy-inventory.md, api-reference/dashboard-misc.md; changelog fragment.
Screenshots
Before — #15405 at 070 Fixing still leads the header and #15410 reads "Merge queued · 2nd of 2":
After — no header, no ordinal; #15405 rides no train (hover: Merge train: left the merge train while being fixed; rejoins when green), #15410 is simply ready: