Skip to content

πŸ› merge train: ready PRs lead; odometer rolls only after the bee lands - #15763

Merged
clubanderson merged 4 commits into
v5from
fix/train-readiness-order-odometer
Oct 30, 2026
Merged

clubanderson merged 4 commits into
v5from
fix/train-readiness-order-odometer

Conversation

@clubanderson

Copy link
Copy Markdown
Member

Closes #15761, closes #15762

Two owner-reported stage-tracker / merge UX bugs, one commit each.

πŸ› Merge train: ready PRs lead (#15761)

if 15471 is in ci/review, how can it be first in a train? isn't that clogging up the train? and why is ci/review in the merge queue column?

Root cause. groupMergeTrains ordered members by Blocked β†’ GitHub mergeable_state β†’ age β†’ number. Hive's own readiness was never a key, so the oldest overlapping PR fronted the train even while still at 050 CI/Review, and green 080 members waited behind it (live: train 1st:#15741 at 050 holding #15748/#15755 at 080).

Fix (lane, pkg/github/automerge). Members carry a readiness tier β€” ready (080 admitted / soaking / merge-queue reason), unknown (never evaluated), unready (CI pending, no verdict, review gate) β€” learned from the lane's last verdict for that head SHA or, failing that, the stage store. The sort is now Blocked last β†’ readiness β†’ mergeable state β†’ age β†’ number, re-run every pass, so a member going green moves up and one going red moves back. A train with no ready member has a provisional front. After the ready front merges mergeTrainAfterFrontMerge still refreshes the others' base (require_current_base) and the next pass re-sorts.

Fix (dashboard). A below-queue member's overlap hint points at the riding front (the one the lane will actually merge first) and renders in its real column as train Β· joins behind #N when green; only 080/095 members get Merge-queue chips. Header stays merge train Β· N PRs Β· 1st: #<ready front>. An all-unready train says so plainly.

Tests: ordering table cases (ready-before-unready, unknown between, all-unready age tiebreak, blocked trails), readiness memory, column placement for the live scenario, chip wording under node. Docs: hive-merge.md "Merge train: ready PRs lead", operator-reference row.

πŸ› Odometer rolls only after the bee lands (#15762)

the odometer still updates before the bee animation lands on it. I think the odometer is updating on 'merge landed' and not waiting until after the bee animation.

Root cause. The merge-gate hold (#15245) masks a landed merge as still "Merging" for the banner's lifetime (30 s); the bee launches only when the hold ends. The Merged chip held its number back only for merges with a glyph pending or in flight (#15568). The poll that reports the merge also brings the server's raised merged.all_time β€” during the hold nothing is pending, stageTrackerMergedInFlight() is false, and stageTrackerMergedCountDraw rolled the drum to the new total immediately. Thirty seconds later the bee landed and stageTrackerCelebrateTick had nothing left to roll.

Fix. Masked merges are tracked (_stageTrackerMergedHeld) and treated as flights to come: stageTrackerMergedHoldback subtracts them from the shown count and stageTrackerMergedInFlight keeps the drum and the day/week line still while any is held. The number rolls once, on the landing (animationend; fallback timer when the glyph exits off-screen; after the fade under reduced motion). Successive merges each wait for their own bee; the final displayed value equals the server's; a reload shows the server's number at once.

Test: TestStageTrackerOdometerWaitsForMergingHoldNode runs the SPA under node with the real hold functions (the other celebration tests stub them off, which is why this path was uncovered). Verified it fails on the old code at "the total waits for the bee (it used to roll here, a full hold early)".

Note: a headless capture against the live spoke was not useful for verification β€” the spoke runs add671f (pre-fix), so it reproduces the bug rather than the fix; the node harness is the JS-level check.

Validation

go vet + go test ./pkg/dashboard/... ./pkg/github/automerge/... ./pkg/stageengine/... green, including the webstatic style ratchet and TestIndexHTMLIsGenerated (static-src edited, index.html regenerated). No new time.Sleep in tests. Changelog fragments: changelog.d/fixed-merge-train-readiness-order.md, changelog.d/fixed-odometer-rolls-after-bee-lands.md.

@kubestellar-prow kubestellar-prow Bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Oct 30, 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 clubanderson 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 the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Oct 30, 2026
@github-actions

github-actions Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Open PR overlap check

Base branch: v5

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
#15778 πŸ› Every hive-filed issue title starts with its [agent] tag same files src/docs/operator-reference.md
src/pkg/dashboard/static/index.html
#15748 πŸ› [reviewer] park PRs at 085 Needs decision when the fixer exhausted its attempts same files src/docs/hive-merge.md
src/pkg/stageengine/derive_pr_classify.go
#15731 πŸ“– docs: split the operator reference CONFLICT src/docs/operator-reference.md
#15757 ✨ Auto-merge hive-authored superseding PRs without operator decision same files src/docs/hive-merge.md
src/docs/operator-reference.md
#15774 ✨ dashboard: onboarding and GitHub App errors point to the Getting Started guide same files src/docs/operator-reference.md
src/pkg/dashboard/static/index.html

@hivecommons-hive

Copy link
Copy Markdown
Contributor

@clubanderson this PR is held at stage/071-needs-author and the hive will not merge it yet.

Failing checks:

  • build-and-test

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.

@hivecommons-hive

Copy link
Copy Markdown
Contributor

stage 080-awaiting-merge-admission β†’ 071-needs-author: required-check-failing:build-and-test

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The Go side reads correctly; the red build-and-test is the PR's own and is a two-line fix in the Node harness.

Why CI is red (Dashboard helper tests, 2 failures) β€” both in src/pkg/dashboard/stage_tracker_overlap_hint.test.js, which this PR does not touch

  1. not ok 76 … ReferenceError: STAGE_TRACKER_OVERLAP_CHIP_LEAD is not defined. The harness stitches named functions out of static/index.html plus a hand-maintained list of consts (stage_tracker_overlap_hint.test.js:21-25). stageTrackerOverlapBadgeText now references the new STAGE_TRACKER_OVERLAP_CHIP_LEAD (tracker-words-core.js:446, used at :462-463), but the const is not in that list. The Go-side harness got it β€” stage_tracker_merge_train_overlap_test.go:254 adds it via jsConstLine β€” the Node one did not. Add "const STAGE_TRACKER_OVERLAP_CHIP_LEAD = 'train Β· ';" to the src array.
  2. not ok 77 … expects 'overlaps #7 (a.go) β€” will queue behind it' at stage_tracker_overlap_hint.test.js:74; stageTrackerOverlapTip now emits '… β€” joins the merge train behind it when green' (tracker-words-core.js:473, mirroring Go's stageTrackerOverlapJoinsNote). Update the expectation.

Verified against the tree at ef944c9

  • groupMergeTrains (automerge_merge_train.go:311-316): readiness rank sits after Blocked and before mergeable_state, so a blocked head still never fronts, and a ready head now leads an unknown one, which leads an unready one. Matches the stated root cause.
  • noteMergeTrainOutcome (:927-943) now stores ready/unready verdicts, not just blocked/human. I checked every reader: mergeTrainHeadBlocked (:957-959) and mergeTrainHeadHumanMerge (:991-993) test v.blocked/v.humanMerge explicitly rather than mere presence, and the only other consumer (automerge_merge_train_duplicate.go:129) goes through mergeTrainHeadBlocked. No reader still treats "stored β‡’ blocked".
  • mergeTrainReadinessOf (:888-899): "" (merge attempted) / soaking / MergeQueueReason β†’ ready; CI pending / no-verdict / review-gate awaiting β†’ unready; everything else unknown, which deletes the mark exactly as before for handoffs. A parked merge-train:… reason therefore reads unknown and mergeTrainHeadReadiness (:968-986) also returns unknown for a parked stage record β€” the doc comment says so, and it is harmless (parked members are behind a ready front by construction).
  • stageengine.MergeQueueReason is a pure extraction of the existing ClassifyStage condition (derive_pr_classify.go:306-308, :500); automerge already imported stageengine, so no new cycle.
  • Post-pass stageTrackerOverlapJoinBehind (stage_tracker_merge_train_postpass.go:124-135) picks the lowest planner Position among riders and re-points below-queue hints at it; front == it.Number is guarded (overlap.go:72).
  • Odometer: stageTrackerMergingHoldMask does return held (tracker-merged.js:161), and _stageTrackerMergedHeld is folded into both stageTrackerMergedHoldback and stageTrackerMergedInFlight (:421-428, :590), so the count defers until the masked merge becomes a flight. I could not exercise the SPA; this is a read, not a run.

Once the two test lines are fixed this looks correct to me.

β€” hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Go side looks correct to me (I read automerge_merge_train.go, derive_pr_classify.go and the two dashboard post-pass files at e4572a7; I did not review the tracker-merged.js / tracker-words-core.js odometer change beyond its tests).

What I checked:

  • noteMergeTrainOutcome (src/pkg/github/automerge/automerge_merge_train.go:928–942) now also stores ready / unready verdicts, not just blocking/human-merge ones. Every reader of mergeTrainVerdicts was updated to test the specific field rather than presence: mergeTrainHeadBlocked :958 (v.blocked || v.humanMerge), mergeTrainHeadReadiness :969, mergeTrainHeadHumanMerge :992 (v.humanMerge). So a ready verdict can no longer be misread as "blocked".
  • Sort order in groupMergeTrains (:311–316) is Blocked β†’ readiness rank β†’ mergeable-state rank, which is the stated fix: a green 080 member fronts a CI/Review member of the same train.
  • stageengine.MergeQueueReason is a pure extraction of the existing predicate (derive_pr_classify.go:306–308, call site :500), and stageengine does not import automerge, so no cycle.
  • stage_tracker_merge_train_postpass.go:127–137 re-points below-queue hints at the lowest-Position rider via stageTrackerOverlapJoinBehind, which preserves trainID/position.

No findings.

β€” hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88

@github-actions github-actions Bot removed the conflicts-with-open-pr Open PR has a merge conflict with another open PR label Oct 30, 2026
@hivecommons-hive

Copy link
Copy Markdown
Contributor

@clubanderson this PR is held at stage/071-needs-author and the hive will not merge it yet.

Why:

  • the branch conflicts with the base and needs a rebase

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.

@hivecommons-hive

Copy link
Copy Markdown
Contributor

stage 080-awaiting-merge-admission β†’ 071-needs-author: conflicting

…y front

The lane's train planner ordered members by GitHub mergeable state, age
and number, never by hive's own readiness, so a PR still at 050
CI/Review could front a train and hold fully green 080 members behind
it (owner: "if 15471 is in ci/review, how can it be first in a train?").

- automerge: members carry a readiness tier (ready / unknown / unready)
  learned from the lane's last verdict or the stage store; the sort puts
  ready members first, then unknown, then unready, before the existing
  mergeable-state / age / number tiebreaks. Re-sorted every pass.
- dashboard: a below-queue member's overlap hint points at the riding
  (ready) front; the chip reads 'train Β· joins behind #N when green' in
  the member's real column, never a Merge-queue chip. An all-unready
  train says it is provisional.
- docs: hive-merge.md 'Merge train: ready PRs lead'; operator-reference.
- tests: ordering table cases, readiness memory, column placement, chip
  wording under node.

Signed-off-by: Andrew Anderson <andy@clubanderson.com>
Signed-off-by: Andrew Anderson <andy@clubanderson.com>
The merge-gate hold (#15245) masks a landed merge as still 'Merging' for
the banner's lifetime, and the bee only launches when the hold ends. The
Merged chip, though, held its number back only for merges with a glyph
pending or in flight β€” so the poll that brought the merge (and the
server's raised all_time) rolled the drum at once, thirty seconds before
the bee flew, and the landing found nothing left to roll.

Masked merges are now tracked (_stageTrackerMergedHeld) and treated as
flights to come: the holdback subtracts them from the shown count and
the drum (and day/week line) stays still while any is held. The number
rolls once, on the landing; successive merges each wait for their own
bee; the final displayed value equals the server's; a reload shows the
server's number immediately.

Node test runs the real hold functions, which the other celebration
tests stub off β€” the path was uncovered.

Fixes #15762

Signed-off-by: Andrew Anderson <andy@clubanderson.com>
Signed-off-by: Andrew Anderson <andy@clubanderson.com>
@hivecommons-hive
hivecommons-hive Bot force-pushed the fix/train-readiness-order-odometer branch from e4572a7 to 939172d Compare October 30, 2026 14:15
@kubestellar-prow kubestellar-prow Bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 30, 2026
@hivecommons-hive

Copy link
Copy Markdown
Contributor

hive/awaiting-ci: rebased onto v5 (e4572a7β†’939172d), conflicts in src/pkg/stageengine/derive_pr_classify.go resolved keeping both sides (v5's native merge-queue reason prefix folded into the new MergeQueueReason helper, so the train also counts natively-enqueued heads as ready); author commits and sign-offs preserved. CI pending β€” sweep will merge when green.


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

β€” hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88

@github-actions github-actions Bot added the conflicts-with-open-pr Open PR has a merge conflict with another open PR label Oct 30, 2026
@hivecommons-hive

Copy link
Copy Markdown
Contributor

@clubanderson this PR is back in your court (stage/071-needs-author). Its commits are signed off as the hive App rather than as you, so a squash merge would misattribute them and the sign-off attribution check stays red. No hive agent can rewrite a contributor's commits β€” the fix is yours:

  • 4 commits are signed off as the hive App instead of you, so a squash merge would misattribute them β€” set git config user.email to your own address, then run git rebase --exec 'git commit --amend --no-edit --reset-author -s' HEAD~4 && git push --force-with-lease

Once the new head lands, CI and the review swarm re-run automatically and the PR returns to the normal path.

@clubanderson
clubanderson merged commit db43b1a into v5 Oct 30, 2026
78 of 80 checks passed
@kubestellar-prow
kubestellar-prow Bot deleted the fix/train-readiness-order-odometer branch October 30, 2026 14:28
@github-actions

Copy link
Copy Markdown
Contributor

Thank you for your contribution! Your PR has been merged.

We'd love to hear how your experience was: share feedback

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Reviewed β€” no findings from this perspective.

β€” hive: agent=adjudicator-3 backend=copilot model=claude-fable-5.1 copilot=1.0.88

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

Labels

conflicts-with-open-pr Open PR has a merge conflict with another open PR dco-signoff: yes Indicates the PR's author has signed the DCO. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Merged odometer rolls before the bee lands on the chip merge train: a PR still in CI/Review can lead the train and block ready members

1 participant