Skip to content

πŸ› tracker: merge-train header counts its rows; human-merge PRs ride no train - #15553

Merged
clubanderson merged 1 commit into
v5from
fix/train-header-count
Oct 29, 2026
Merged

clubanderson merged 1 commit into
v5from
fix/train-header-count

Conversation

@clubanderson

Copy link
Copy Markdown
Member

Fixes #15552

The Activity Monitor's train header read merge train Β· 3 PRs Β· 1st: #15425 over one row. Train v5#15425 = #15425, #15529, #15530; the last two were drawn as sub-rows of their issues #15493 / #15523, which the header grouping could not see, and #15425 β€” waiting for a maintainer (untrusted author) β€” fronted the train anyway.

SPA (tracker-words.js)

  • stageTrackerRowTrain(item): an issue row rides the merge train of its open linked PR, so key / contiguity / rail / merge order treat it as a member and the train renders all its members together regardless of issue grouping.
  • stageTrackerTrainRows counts the run it heads; stageTrackerTrainHeaderText(mt, shown) says 3 PRs only when three rows are there, otherwise 1 of 3 PRs here Β· 1st: #15425 Β· not in this view: #15529, #15530. No member on the page, no header.
  • Payload gains merge_train.members (whole roster in merge order) so the hidden ones can be named.

Planner (automerge_merge_train.go)

  • One predicate, mergeTrainHumanMergeReason, built on prstage.HumanMergeReason: any lane verdict that maps to a human-merge code other than the catch-all policy (untrusted author, contributor-lane:no-linked-issue, the title/label human-merge rule, human-merge path, review-refused merge, …) makes the PR no train member at all, not just a non-front.
  • Verdicts are keyed per lane (noteMergeTrainOutcome(lane, …)), so the trusted lane's untrusted-author-role for a PR the contributor lane admits never evicts it from the contributor lane's train.

Tests: TestMergeTrainHumanMergeNeverMember (planner excludes / re-admits, per-lane isolation), node harness: header count == rendered rows, issue rows in the run, hidden members named, no header for an empty run; payload test covers members.

Docs: dashboard-sections.md merge-train section (header counting, who rides). Changelog fragment included.

…o train

The Activity Monitor's train header read 'merge train Β· 3 PRs Β· 1st: #15425'
over one row: #15529 and #15530 were drawn as sub-rows of their linked
issues (nested_under), which the header grouping did not see. An issue row
now rides its open PR's train (key, contiguity, rail, merge order), the
header counts the rows drawn under it and names members the view hides,
and the payload carries merge_train.members.

#15425 fronted that train although it waits for a maintainer (untrusted
author): the lane's admission verdicts were not blocking for the planner.
A head whose last lane verdict maps to a human_merge_reason other than the
catch-all policy is now no train member at all; verdicts are keyed per lane
so another lane's opinion never evicts a member.

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 kellyaa 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/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Oct 29, 2026
@github-actions

github-actions Bot commented Oct 29, 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
#15554 ✨ tracker: PR in progress names who is working it, like Claimed same files src/docs/dashboard-sections.md
src/pkg/dashboard/static/index.html
#15550 πŸ› Activity monitor: an adoption pair never asks a human to pick a PR same files src/pkg/dashboard/static/index.html
#15530 πŸ› fix(dashboard): issue-row linked PR passes null when the lineage chip is empty same files src/pkg/dashboard/static/index.html
#15529 πŸ› fix(dashboard): omit empty lineage separator same files src/pkg/dashboard/static/index.html
#15547 πŸ› fix(dashboard): stalled merge-queue chevrons read their words (ochre on amber was invisible) same files src/docs/dashboard-sections.md
src/pkg/dashboard/stage_tracker_merge_train_test.go
src/pkg/dashboard/static-src/js/tracker-words.js
src/pkg/dashboard/static/index.html
#15556 ✨ dashboard: toast countdown progress bar same files src/docs/dashboard-sections.md
src/pkg/dashboard/static/index.html
#15526 🌱 dashboard: split stage_tracker.go into 4 files same files src/docs/dashboard-sections.md
#15308 ✨ feature: enqueue eligible PRs into GitHub native merge queues same files src/pkg/github/automerge/automerge_contributor_lane.go
src/pkg/github/automerge/automerge_sweep.go

@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.

One verified defect in the planner predicate; the SPA/payload side reads correctly to me.

mergeTrainHumanMergeReason (new, src/pkg/github/automerge/automerge_merge_train.go) treats every prstage.HumanMergeReason code except policy as "no train member at all". But HumanMergeReason is not a 090-only mapping β€” one of its cases catches a transient review-pending state:

  • src/pkg/stageengine/prstage/reasons.go:147 β€” strings.HasPrefix(base, AutoMergeReasonReviewGatePrefix) β†’ HumanMergeReasonBranchProtection. That prefix is "review-gate:" (reasons.go:35).
  • src/pkg/stageengine/derive_pr_classify.go:529-530 β€” review-gate:awaiting-review-approval and review-gate:no-review-bundle are classified 060 review-pending, not 090; the comment there says exactly why ("the OWNERS PRs of 2026-10-20 sat unlabelled through the whole review wait").
  • src/pkg/github/automerge/automerge_sweep.go:1980-1981 β€” trySweepSelfAuthoredPR returns that review-gate:<outcome> string as the sweep skip reason, and automerge_sweep.go:1226 (this diff) hands it to noteMergeTrainOutcome(stageLaneSelf, …); same path for the trusted lane at :2388 β†’ :1400.

Mechanism: a self/trusted PR that is simply waiting for the review swarm gets humanMerge: true recorded for its head; on the next planMergeTrains pass it hits the new mergeTrainHeadHumanMerge branch and is skipped as "human-merge". When the verdict lands and the sweep returns a different reason, the entry is deleted and the PR re-enters. Consequence: while awaiting review the PR (a) imposes no ordering on overlapping PRs behind it β€” the thing the train exists for β€” and (b) drops out of Members/Ahead, so the header this PR fixes flips from 3 PRs to 2 PRs Β· not in this view: … and back as the swarm catches up. Pre-change, mergeTrainBlockingReason("review-gate:…") was false and the PR stayed a member. Severity: medium.

The new table in TestMergeTrainHumanMergeNeverMember does not include a review-gate: reason, so it passes. Adding prstage.AutoMergeReasonReviewGatePrefix + prstage.ReviewGateOutcomeAwaiting: false would fail on this head.

Suggested fix: allow-list the codes that actually mean a person must merge (workflow-files, tests-removed, manual-merge-policy, breaking-change, auto-merge-off, untrusted-author, unauthorized, reviewer-deferred, and branch-protection only when the base reason is merge-refused-review) instead of "anything but policy" β€” or special-case the review-gate: prefix before calling HumanMergeReason.

Verified OK: the lane strings now in the key match on both sides (planMergeTrains is called with stageLaneSelf / stageLaneTrusted / stageLaneContributor at automerge_sweep.go:1107, :1335, automerge_contributor_lane.go:433, and each sweep notes with the same constant), so per-lane isolation works as the body describes. Members is populated once per train and copied per item, consistent with Ahead.

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

@clubanderson
clubanderson merged commit 287b8dc into v5 Oct 29, 2026
81 of 84 checks passed
@kubestellar-prow
kubestellar-prow Bot deleted the fix/train-header-count branch October 29, 2026 23:16
@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.

Planner side read against v5; one thing worth a look before this lands, the rest looks correct to me. I did not read the SPA (tracker-words.js) changes in depth.

Check: review-gate:awaiting / review-gate:no-bundle now drop a PR from the train entirely. mergeTrainHumanMergeReason (automerge_merge_train.go:840-843) treats every prstage.HumanMergeReason code except policy as "a person merges this". But HumanMergeReason (src/pkg/stageengine/prstage/reasons.go:151) maps every review-gate:* reason to HumanMergeReasonBranchProtection, and an enforcing gate returns review-gate:<outcome> for any non-approved outcome (automerge_review_gate.go:267,284) β€” including awaiting and no-bundle, which just mean the swarm has not reported on this head yet. So under an enforcing review gate, every freshly pushed self/trusted PR is skipped as human-merge at automerge_merge_train.go:389-392 until its review arrives, and the PRs behind it merge first. That may be what you want (nobody waits on a head that is not moving), but it is the same class as the "soaking, CI pending" verdicts the body and the mergeTrainHumanMergeReason doc comment say stay members, and it is not a case where a human is going to merge β€” the hive resolves it itself a few sweeps later. If the intent is to keep those as (non-front) members, the predicate needs to exclude awaiting/no-bundle outcomes rather than the whole branch-protection code; if the intent is to drop them, the doc comment and dashboard-sections.md "Who rides" paragraph should say so. requires-human and changes-requested:* outcomes correctly fall on the human side.

What I verified as correct:

  • Per-lane keying: noteMergeTrainOutcome callers now pass stageLaneSelf (automerge_sweep.go:1229), stageLaneTrusted (automerge_sweep.go:1403) and stageLaneContributor (automerge_contributor_lane.go), and planMergeTrains/planDuplicateHolds/mergeTrainHeadBlocked all read with the lane they plan for, so the trusted lane's untrusted-author-role on a PR the contributor lane admits no longer touches the contributor lane's train β€” the mechanism the body describes.
  • mergeTrainVerdictFor still requires v.sha == sha, so a new head starts clean, and a non-blocking, non-human verdict still deletes the entry (automerge_merge_train.go:861-864), preserving the old clear-on-success behaviour.
  • Blocked members (red check / terminal hold / permanent refusal) keep their old "member but never fronts" semantics; only the human-merge set is new.

β€” hive: agent=reviewer 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

dco-signoff: yes Indicates the PR's author has signed the DCO. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Activity Monitor: merge-train header says 3 PRs over one row; untrusted-author PR fronts the train

1 participant