Skip to content

🐛 activity monitor: 'merging now' lingers, silent merges, closed rows vanish - #15817

Merged
clubanderson merged 3 commits into
v5from
fix/merging-now-celebration
Oct 30, 2026
Merged

clubanderson merged 3 commits into
v5from
fix/merging-now-celebration

Conversation

@clubanderson

Copy link
Copy Markdown
Member

Closes #15808

What the user saw (hive's own spoke, roll 11 = v5 db43b1a)

Why

  1. "merging now" for minutes. The chevron's "merging now" is merge_gate.sweep_running && OnPR, and SweepState.OnPR was true for every PR for the whole floor pass (all lanes + ApplyStageLabels, serially, 1–2 min). Not the merge call (state=merging from 🐛 tracker: rows jump straight to ✓ merged without ever showing Merging in the Merge gate #15245, which is seconds). The row then only cleared on the webhook eviction / next enumerate.
  2. No celebration (🐛 activity monitor: a row that needs a person says so once #15805 vs 🐛 fix: hive validate surfaces launch_cmd degradations instead of reporting config OK #15791). The lanes are symmetric server-side (both write the merge attempt + ledger). The difference was timing: the merge-attempt hook only invalidated the tracker cache; the webhook closed eviction then dropped the row before any payload showed it merged, and the SPA needs an open→merged transition (or recently_merged) to call it fresh. 🐛 fix: hive validate surfaces launch_cmd degradations instead of reporting config OK #15791 happened to get a merged payload before eviction.
  3. 🌱 refactor: split src/pkg/review/prompts.go into 4 files #15707 toast without bee. stageTrackerCelebrateMerges only flew the glyph when the PR's row was in the DOM; otherwise it went straight to stageTrackerCelebrateTick — toast yes, no flight, odometer rolled instantly/unnoticed.
  4. 🐛 stage tracker: 'Let hive decide' shows it is working and answers faster #15793. Closed-unmerged PRs just drop out of items; nothing told the SPA why.

Fix

Server

  • SweepClock.evaluating/evaluated: OnPR is true only for the PR a lane is deciding on right now (sweeping_since added to merge_gate).
  • Merge-attempt hook → noteMergeAttempt: patches the cached snapshot (closed/merged/MergedByHive), records the ledger entry and nudges SSE so the row reaches ✓ within one SPA poll.
  • recently_closed (closed twin of recently_merged) fed from every closed-unmerged snapshot reaching applyWebhookItemSnapshots; merged_hold_ms in the payload.
  • Knob dashboard.stage_tracker.merged_hold_s (default 8, min 3), documented in webhooks.md / operator-reference.md.

SPA

  • One celebration pipeline per PR: toast + bee + odometer-after-landing (🐛 merge train: ready PRs lead; odometer rolls only after the bee lands #15763 kept). A merge whose row is not in the DOM flies the bee from the toast's ✓ (else panel foot / viewport) — celebrateDetached, stageTrackerFlyGlyph. Idempotent per PR key.
  • Removal reconcile: removed + merged fact → celebration; removed + recently_closed → neutral info toast #15793 closed · superseded by #15783 (reason from last known caption), no bee / count.
  • Merge-gate hold is now a bridge until the merged fact, not a fixed 30 s mask; the celebration launches as soon as merged_at is known. merging · waiting for GitHub… once a merge call / sweep has been on the PR > 60 s.

Tests

  • Go: TestSweepClockNarrowed, TestNoteMergeAttempt*, TestStageTrackerRecentlyClosed, TestStageTrackerMergedHoldKnob.
  • node: TestStageTrackerRemovedRowReconcileNode (removed+merged → one celebration; removed+closed → info toast), TestStageTrackerDetachedCelebrationNode (row not in DOM → toast + bee + odometer, once), rewritten TestStageTrackerMergingHold, TestStageTrackerOdometerWaitsForMergingHoldNode (8 s knob).

Train UX gaps (left-train chip, stale "behind #N (2nd of 3)" captions) follow in a second PR.

@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 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 the size/XXL Denotes a PR that changes 1000+ 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
#15757 ✨ Auto-merge hive-authored superseding PRs without operator decision same files src/docs/operator-reference.md
src/pkg/config/config.go
src/pkg/github/automerge/automerge_sweep.go
#15853 ✨ Complete native GitHub queue CI and policy integration same files src/pkg/dashboard/static/index.html
#15748 🐛 [reviewer] park PRs at 085 Needs decision when the fixer exhausted its attempts same files src/pkg/dashboard/stage_tracker_build.go
src/pkg/github/automerge/automerge_sweep.go
#15804 ✨ Show the upgrade animation for every roll (announce + SIGTERM fallback) CONFLICT src/docs/api-reference/auth.md
src/docs/api-reference/dashboard-misc.md
src/docs/api-reference/health-status-events.md
src/docs/api-reference/snapshots-and-style.md
#15831 🐛 Merge train seats only PRs green and reviewed on their current head; regressed members are ejected CONFLICT src/pkg/github/automerge/automerge_contributor_lane.go
src/pkg/github/automerge/automerge_sweep.go
src/pkg/github/automerge/sweep_clock.go
#15819 🌱 refactor: split src/pkg/github/automerge/automerge_sweep.go into 4 files same files src/pkg/github/automerge/automerge_sweep.go
#15787 🐛 Run the reconcile pass when wakes outpace the eval interval; age unblocked rows from the lift same files src/pkg/dashboard/stage_tracker_build.go
#15774 ✨ dashboard: onboarding and GitHub App errors point to the Getting Started guide CONFLICT src/docs/api-reference/auth.md
src/docs/api-reference/dashboard-misc.md
src/docs/api-reference/health-status-events.md
src/docs/api-reference/snapshots-and-style.md
#15830 ✨ dashboard: pop out the Hive activity monitor into its own window and a full-screen toggle same files src/pkg/dashboard/static/index.html
#15731 📖 docs: split the operator reference CONFLICT src/docs/operator-reference.md
#15834 ✨ stage tracker: PR sub-row names the other issues it also closes same files src/pkg/dashboard/stage_tracker.go
src/pkg/dashboard/static/index.html
#15849 ✨ Show online ClankeR IDs on the Contributors count pill same files src/pkg/dashboard/static/index.html

@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 held at stage/071-needs-author and the hive will not merge it yet.

Failing checks:

  • relative links and anchors resolve

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

Another agent tried to open a PR from scanner/fix-15808, but this PR already closes #15808. No second PR was opened; please continue here, or rebase the new work onto this branch.

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

  • coverage

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:coverage

@hivecommons-hive

Copy link
Copy Markdown
Contributor

stage 080-awaiting-merge-admission → 050-review-pending: required-check-pending:Sign-off survives the squash

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

…anish

- sweep clock marks only the PR under evaluation, so merge_gate.sweep_running
  no longer reads as 'merging now' on every soaked row for a whole floor pass
- a merge call returning patches the cached snapshot (closed/merged/MergedByHive)
  and nudges the SPA, so the row reaches ✓ within one poll
- every hive-performed merge celebrates exactly once from one pipeline (toast,
  bee, odometer after landing); a row not in the DOM flies its bee from the
  toast's ✓ (#15707); removal reconciled by recently_merged / recently_closed
- closed-not-merged rows show a neutral '#N closed · <reason>' toast
- merge-gate hold is a bridge, not a delay: dashboard.stage_tracker.merged_hold_s
  (default 8, min 3); 'merging · waiting for GitHub…' past 60s

Closes #15808

Signed-off-by: Andrew Anderson <andy@clubanderson.com>
Signed-off-by: Andrew Anderson <andy@clubanderson.com>
Signed-off-by: Andrew Anderson <andy@clubanderson.com>
@clubanderson
clubanderson force-pushed the fix/merging-now-celebration branch from e51f3d4 to 54111b6 Compare October 30, 2026 17:43
@hivecommons-hive

Copy link
Copy Markdown
Contributor

stage 080-awaiting-merge-admission → 050-review-pending: required-check-pending:Sign-off survives the squash

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

Style / conventions review (head 54111b6) — no blockers; three advisory notes.

  1. Docs describe the string this PR removed. The held row now reads waiting for GitHub (static-src/js/tracker-words-gate.js:228) and its caption Merging — waiting for GitHub to confirm; ✓ follows (static-src/js/tracker-merged.js:183), but the knob's three new descriptions still call it "Merging · merge landed": src/pkg/config/config.go:4978, src/docs/webhooks.md:125, src/docs/operator-reference.md:2021. An operator grepping the UI text for the knob will not find it.

        merged_hold_s: 8               # ceiling on the "Merging · waiting for GitHub" bridge; celebration fires on the merged fact (min 3)
    

    (same substitution in config.go:4978 and webhooks.md:125.)

  2. Contract wording. #15808's stated fix is: "The SPA says 'Soaked · checking now' for a pass on a soaked row and keeps 'merging now' for a live merge call." The soaked branch still says merging now while sweep_running (tracker-words-gate.js:396), even though the pass may just be evaluating and refusing. The repo's idiom for sweep_running elsewhere is "checking now" (tracker-queue.js:33, tracker-words-gate.js:208). If keeping "merging now" here is deliberate, a one-line note in the PR body would settle it; otherwise:

            return { word: 'Mergeable', detail: prefix ? 'soaked — checking now' : 'checking now', tip: soaked + "Mergeable — hive's pass is on it now.", cue: 'running' };
    
  3. _stageTrackerPRLast only shrinks on closes. tracker-merged.js:63 copies every poll's PR items into it, and :71 deletes only the closed keys; merged keys stay for the tab's lifetime. It is only read for the closed toast's reason (:70), so the fresh merges can be dropped too:

          fresh.forEach(k => { _stageTrackerZapped[k] = true; delete _stageTrackerPRLast[k]; });
    

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

Correctness review (head 54111b6)

1. sweeping_since is the pass start, not when the lane reached this PR → "merging · waiting for GitHub…" fires on rows no merge call touched.
stage_tracker_merge_gate.go:170-173 sets mg.SweepingSince = sweep.StartedAt (set once per pass in sweep_clock.go begin). The SPA then reads nowMs - sweepingSince > 60000 as "waiting for GitHub" (tracker-words-gate.js stageTrackerSoakWords, the new STAGE_TRACKER_MERGING_SLOW_MS branch). A floor pass on this spoke runs 1–2 min (per #15808), so any soaked PR the trusted/contributor lane starts evaluating after the first minute reads "waiting for GitHub…" instantly — the spinner-without-reason #15808 asks to remove is replaced by a wrong reason. Record the per-PR mark time in evaluating and serve that:

--- a/src/pkg/github/automerge/sweep_clock.go
+++ b/src/pkg/github/automerge/sweep_clock.go
@@ type SweepState struct {
 	EvalRepo   string
 	EvalNumber int
+	EvalSince  time.Time
 	Narrowed   bool
@@ func (c *SweepClock) evaluating(repo string, n int) {
-	c.st.EvalRepo, c.st.EvalNumber, c.st.Narrowed = repo, n, true
+	c.st.EvalRepo, c.st.EvalNumber, c.st.EvalSince, c.st.Narrowed = repo, n, time.Now(), true
@@ func (c *SweepClock) evaluated() {
-	c.st.EvalRepo, c.st.EvalNumber = "", 0
+	c.st.EvalRepo, c.st.EvalNumber, c.st.EvalSince = "", 0, time.Time{}
--- a/src/pkg/dashboard/stage_tracker_merge_gate.go
+++ b/src/pkg/dashboard/stage_tracker_merge_gate.go
@@ 	if sweep.OnPR(repo, number) {
 		mg.SweepRunning = true
-		if !sweep.StartedAt.IsZero() {
-			t := sweep.StartedAt
+		since := sweep.StartedAt
+		if sweep.Narrowed && !sweep.EvalSince.IsZero() {
+			since = sweep.EvalSince
+		}
+		if !since.IsZero() {
+			t := since
 			mg.SweepingSince = &t
 		}

(evaluating could take now from c.now() at the call sites instead of time.Now() to stay testable.)

2. recently_closed records merged PRs on issue_comment/issues deliveries → false "#N closed" toast and the celebration is lost for good.
noteClosedSnapshots (stage_tracker_recently_closed.go:36) treats State=="closed" && !Merged as closed-unmerged. But evictClosedWebhookItem (webhook_tracker_refresh.go:336) builds that snapshot with Merged: h.Merged, and for issues/issue_comment hints webhookItemHint never sets Merged (webhook_cache.go:630-634; Issue.PullRequest is a json.RawMessage, merged_at is not parsed). So a comment delivered on a merged PR before its merged fact is in the payload (human/admin merges where a bot comment outruns or replaces the pull_request closed delivery) lands the PR in recently_closed. On the SPA, stageTrackerNewlyClosed only skips it if rawState[key] === true in that same poll (tracker-merged.js:70); otherwise it toasts "closed", sets _stageTrackerClosedNoted[k] and delete next[k] (tracker-merged.js:72). When the merged fact arrives next poll, stageTrackerNewlyMerged needs prev[k] === false (tracker-merged.js:47) — the key is gone, so no toast/bee/odometer, and the user was told the PR was closed. The server entry also persists 30 min (stageTrackerMergedWindow) and is never retracted when the merge is later recorded. Minimal fix: read merged_at from the embedded issue.pull_request:

--- a/src/pkg/github/webhook_cache.go
+++ b/src/pkg/github/webhook_cache.go
@@ func webhookItemHint(event string, p webhookEventPayload) *WebhookItemHint {
 		h := &WebhookItemHint{Number: p.Issue.Number, IsPR: p.Issue.PullRequest != nil, State: p.Issue.State}
+		if p.Issue.PullRequest != nil {
+			var pr struct{ MergedAt *time.Time `json:"merged_at"` }
+			if json.Unmarshal(*p.Issue.PullRequest, &pr) == nil && pr.MergedAt != nil && !pr.MergedAt.IsZero() {
+				h.Merged = true
+			}
+		}

and, defensively, keep the key comparable on the SPA so a later merged fact still celebrates: in stageTrackerNoteMerges replace delete next[k] with next[k] = false (carry-open already tolerates a few lifetime keys, per the stageTrackerCarryOpen comment).

Advisory (low): SweepState.OnPR still returns true for every PR from begin until the first evaluating (sweep_clock.go OnPR: Narrowed false → Targets == nil → true; pinned by the last assertion of TestSweepClockNarrowed). On a floor pass that is the whole repo-enumeration phase of the self-authored lane (and the whole lane when it has no candidates), so soaked rows still read "Mergeable · merging now" for that stretch. Setting Narrowed = true in begin when targets == nil would close it; if the current shape is intended, say so in the test.

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

@hivecommons-hive

Copy link
Copy Markdown
Contributor

stage 080-awaiting-merge-admission: no activity for 30m0s: merge-train:queued-behind#15748:6/10:0/0:main.go,main_sweeps.go,auth.md,dashboard-misc.md,+29

@clubanderson
clubanderson merged commit 7ae94d0 into v5 Oct 30, 2026
78 of 79 checks passed
@kubestellar-prow
kubestellar-prow Bot deleted the fix/merging-now-celebration branch October 30, 2026 19:01
@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

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/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🐛 activity monitor: "Mergeable · merging now" lingers for minutes and hive-performed merges can vanish without a celebration

1 participant