Skip to content

πŸ› tracker: show Merging in the merge gate for at least the toast lifetime before βœ“ - #15251

Merged
clubanderson merged 1 commit into
v5from
fix/merging-state-visible
Oct 29, 2026
Merged

clubanderson merged 1 commit into
v5from
fix/merging-state-visible

Conversation

@clubanderson

Copy link
Copy Markdown
Member

Fixes #15245

Root cause

Stage 100 (stagelabels.MergeQueue) was only derived after the fact from refusal reasons in pkg/stageengine/derive_pr_classify.go. A successful merge recorded nothing between the pre-merge stage and merged: the sweep evaluates and calls PullRequests.Merge inside one pass (executeMergeEffect), the dashboard's Approve & merge goes straight to MergePRVia, and within one 30 s tracker poll the PR simply vanished from items and appeared in recently_merged. There was no merging event or state; the SPA diffed polls to detect "merged" and replayed the row's last HTML (e.g. 060) during the celebration, so Merging never rendered β€” and nothing held transient gate states for a minimum time.

Fix

Backend β€” pkg/github/merge_attempts.go: a process-wide registry of merge attempts (Begin before the GitHub call, End with merged/refused after; finished attempts kept 10 min). Bracketed in MergePRVia (dashboard, relay, forge) and automerge.executeMergeEffect (all four automerge call sites), so every merge path is covered. The tracker (stage_tracker.go / stage_tracker_merge_gate.go) reads the registry on every build: an in-flight or just-landed attempt lights the PR at 100 Merging with merge_gate.merging_since + merge_path and a hive-actor caption; a refusal sets merge_gate.state: merge-failed with merge_failed/merge_failed_at and leaves the stage. server.go invalidates the tracker cache on every registry change so a poll cannot miss it.

SPA β€” stageTrackerNoteMerges keeps a hold per PR from the first moment it saw Merging (or from the poll that reported a surprise merge) and masks the merge as "still open" until STAGE_TRACKER_MERGING_HOLD_MS (= STAGE_TRACKER_MERGE_BANNER_MS, 30 s) has passed; renderStageTracker synthesises the held row at 100 Merging Β· merge landed from its last item. When the hold ends the merge is re-read as fresh β€” βœ“, banner, glyph flight, chip bump. merge-failed drops the hold at once and the pill reads Merge failed Β· . Existing ids/classes unchanged.

Tests

  • pkg/github/merge_attempts_test.go β€” lifecycle with a fake clock (in flight β†’ merged/refused, retention purge, onChange).
  • pkg/github/automerge/automerge_merge_attempt_test.go β€” executeMergeEffect registers the attempt before the call and the outcome after (merged / refused / not-applied).
  • pkg/dashboard/stage_tracker_merging_hold_test.go β€” Go payload overlay (100 Merging with merging_since, merge-failed keeps the stage) and a node run of the hold with an explicit clock: masked inside the window, fresh at its end, surprise merge held, satisfied hold not re-held, failure drops it; gate pill words for merging/held/failed.
  • Docs legend updated; changelog fragment changelog.d/fixed-merging-state-visible.md; check-api-reference-citations.sh --fix run for the server.go touch.

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

@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
#15104 πŸ› Activity Monitor: Rebase, then merge as maintainer; fixer owns parked conflicting PRs; dismiss self-inflicted changes_requested same files src/docs/api-reference.md
src/docs/dashboard-sections.md
src/pkg/dashboard/server.go
src/pkg/dashboard/stage_tracker.go
src/pkg/dashboard/stage_tracker_cues_test.go
src/pkg/dashboard/stage_tracker_merge_gate_test.go
src/pkg/dashboard/static/index.html
src/pkg/github/automerge/automerge_sweep.go
#15134 πŸ› Delegated decision on a capability gap: model the blocker, stop the un-park/re-park loop, name the missing App permission CONFLICT src/docs/api-reference.md
#15236 πŸ› Prefer covering PR progress in Activity Monitor messages same files src/pkg/dashboard/stage_tracker.go
#15253 πŸ› decision toast: issue decisions no longer read as 'approved for merge' 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
#15186 πŸ› Activity Monitor: one coherent post-decision state for Let hive decide rows; 060 reviewed in CI / Review same files src/docs/api-reference.md
src/docs/dashboard-sections.md
src/pkg/dashboard/stage_tracker.go
src/pkg/dashboard/stage_tracker_merge_gate.go
src/pkg/dashboard/stage_tracker_merge_gate_test.go
src/pkg/dashboard/static/index.html
#15122 πŸ› Write-back containment: per-kind gate for every unsolicited GitHub write, with backfill guard CONFLICT src/docs/api-reference.md
#15216 πŸ› Sentinel: a dashboard Approve releases the head for good; skip Prow-rejected /lgtm + /approve same files src/docs/dashboard-sections.md
#15226 ✨ feature: enqueue eligible PRs into GitHub native merge queues same files src/pkg/github/automerge/automerge_sweep.go
#15256 πŸ› clanker PRs with a human changes-requested review show Returned to contributor, not Sentinel alert same files src/docs/api-reference.md
src/docs/dashboard-sections.md
src/pkg/dashboard/stage_tracker.go
src/pkg/dashboard/static/index.html
src/pkg/github/automerge/automerge_sweep.go
#15270 πŸ› fix(kick-logs): archive kick log when the turn ends, not only at the next rotation point same files src/pkg/dashboard/static/index.html
#15267 πŸ› tracker: closed superseded PRs no longer render as rows same files src/pkg/dashboard/stage_tracker.go
src/pkg/dashboard/static/index.html
#15240 πŸ› Never adopt a person's PR: owner/human-authored PRs return to their author instead of the contributor-offline lane same files src/pkg/dashboard/server.go
src/pkg/dashboard/stage_tracker.go
src/pkg/dashboard/static/index.html

@hivecommons-hive

Copy link
Copy Markdown
Contributor

@clubanderson is auto-promoted for contributor-lane merging on this PR: the last 5 merged PRs by this author in this hive's repositories have no revert or sentinel-alert evidence. CI, reviewer verdict, diff fences, soak, holds and branch protection still apply.

@hivecommons-hive hivecommons-hive Bot added role/trusted Author is trusted for unattended merge (trusted-author role or registry/claim tier in require_tiers) stage/050-review-pending Review swarm requested; awaiting a verdict for the current head and removed stage/071-needs-author Human-authored PR: CI red, changes requested or conflicting; diagnosis posted, the author must act labels Oct 29, 2026

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

Correctness review (read at head e73be4c β€” the PR moved on from 396e188 while this was dispatched).

The hold logic itself checks out: traced stageTrackerMergingHoldNext/Mask/Release through stageTrackerNoteMerges (index.html:18979-19118) against stageTrackerCarryOpen/stageTrackerNewlyMerged (18966-18977); no second hold after expiry, re-read on release is fresh exactly once, and every merge path is bracketed (pullrequest.go:474-497, automerge_sweep.go:3066-3080, all three executeMergeEffect call sites). Two non-blocking notes:

  1. Merged chip bumps during the hold, not at its end (body: "When the hold ends the merge is re-read as fresh β€” βœ“, banner, glyph flight, chip bump"). While a PR is held, stageTrackerMergedSync still runs each poll with the merge already in d.merged.recent/all_time, and stageTrackerMergedHoldback(_stageTrackerMerged, _stageTrackerCelebratePending) (stageTrackerMergedCountDraw) only subtracts keys in _stageTrackerCelebratePending β€” the held merge isn't fresh yet, so it isn't pending, so the count rises up to 30 s before the row's βœ“/glyph flight. Pre-PR the holdback worked because fresh-detection and the server count rose in the same poll. Fix: treat live holds as holdback too:

       const holdback = Object.assign({}, _stageTrackerCelebratePending);
       for (const k of Object.keys(_stageTrackerMergingHold || {})) if (stageTrackerMergingHoldLive(_stageTrackerMergingHold[k], now)) holdback[k] = true;
       const txt = stageTrackerMergedText(_stageTrackerMerged, now, stageTrackerMergedHoldback(_stageTrackerMerged, holdback));
    

    (replacing the const txt = … line in stageTrackerMergedCountDraw). stageTrackerMergedHoldback already ignores keys not in server.recent, so an in-flight hold on a still-open PR costs nothing.

  2. Low: stageTrackerMergingHoldNext seeds since from server merging_since (index.html:19053) but tests liveness against browser Date.now(), so a browser clock ahead of the server shortens the β‰₯30 s dwell (behind lengthens it). The body says "from the first moment it saw Merging"; preferring the client first-sight time β€” (prev[key] && prev[key].since) || nowMs β€” matches that and removes the skew dependency. Same pattern as existing next_sweep_at countdowns, so advisory only.

Body nit: "all four automerge call sites" β€” there are three (automerge_sweep.go:1907, 2302, 2653).

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

@hivecommons-hive hivecommons-hive Bot added stage/071-needs-author Human-authored PR: CI red, changes requested or conflicting; diagnosis posted, the author must act 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

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

@github-actions github-actions Bot removed the conflicts-with-open-pr Open PR has a merge conflict with another open PR label Oct 29, 2026
…time before βœ“

Fixes #15245

Stage 100 was only derived after a refused merge; a successful merge
recorded nothing between the pre-merge stage and merged, so a PR went
from 060/090/095 to βœ“ within one 30 s poll and "Merging" never showed.

Backend: pkg/github/merge_attempts.go registers every merge attempt
(MergePRVia β€” dashboard/relay/forge; executeMergeEffect β€” all automerge
lanes) before the GitHub call and its outcome after; the tracker payload
lights the PR at 100 Merging with merge_gate.merging_since/merge_path
while the call is in flight or just landed, and merge-failed with the
reason when GitHub refused; the tracker cache invalidates on change.

SPA: holds Merging per PR for STAGE_TRACKER_MERGING_HOLD_MS (= the merge
banner's 30 s) before the row advances to βœ“; merge-failed drops the hold
at once with the reason.

Signed-off-by: Andrew Anderson <andy@clubanderson.com>
@clubanderson
clubanderson force-pushed the fix/merging-state-visible branch from e73be4c to 630991f Compare October 29, 2026 02:52
@github-actions github-actions Bot added the conflicts-with-open-pr Open PR has a merge conflict with another open PR label Oct 29, 2026
@hivecommons-hive hivecommons-hive Bot added stage/050-review-pending Review swarm requested; awaiting a verdict for the current head and removed stage/071-needs-author Human-authored PR: CI red, changes requested or conflicting; diagnosis posted, the author must act labels Oct 29, 2026
@clubanderson
clubanderson merged commit f961683 into v5 Oct 29, 2026
78 of 81 checks passed
@kubestellar-prow
kubestellar-prow Bot deleted the fix/merging-state-visible branch October 29, 2026 03:09
@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

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

Labels

author/human A person pushed this PR themselves conflicts-with-open-pr Open PR has a merge conflict with another open PR dco All commits are DCO signed-off dco-signoff: yes Indicates the PR's author has signed the DCO. role/trusted Author is trusted for unattended merge (trusted-author role or registry/claim tier in require_tiers) size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. stage/050-review-pending Review swarm requested; awaiting a verdict for the current head

Projects

None yet

Development

Successfully merging this pull request may close these issues.

πŸ› tracker: rows jump straight to βœ“ merged without ever showing Merging in the Merge gate

1 participant