Skip to content

🐛 fix: refresh tracker snapshots after hive-side unblocks - #14969

Closed
thatguywob wants to merge 3 commits into
hivecommons:v5from
thatguywob:fix/14964-item-refresh
Closed

thatguywob wants to merge 3 commits into
hivecommons:v5from
thatguywob:fix/14964-item-refresh

Conversation

@thatguywob

Copy link
Copy Markdown
Contributor

Fixes #14964

The hive's own blocked removals now invalidate the stage-tracker cache and queue a targeted item re-read without waiting for an inbound unlabeled webhook. All five removal paths share unblockIssue, which fires the atomic ItemRefreshHook after successful removal and before the explanatory comment, so a failed comment cannot suppress the refresh.

Boot connects the hook to the dashboard's existing refresher. Reads share its debounce, budget guards and configuration, then update the published status and governor snapshot through ApplyWebhookItems. A disabled targeted-read setting still permits immediate tracker cache invalidation.

Regression coverage pins all five unblock paths, failed removals, hook removal, comment failure, debounce coalescing, and an unblock-to-snapshot refresh without a webhook. Added a changelog fragment.

Validation: gofmt -l on changed Go files and git diff --check passed. Go tests were not run locally per AGENTS.md; CI runs the test matrix.

— hive: backend=codex


🐝 Hive Agent: contributor | SHA: d3a4edf06

Queue targeted item reads after all five blocked-label removal paths, before posting unblock notes. Wire the client hook through boot to the dashboard refresher so the tracker and governor snapshot converge without an inbound webhook.

Hive-Run: hivecommons#14964
Hive-Plan: hivecommons#14952/part-2b
Hive-Spec: issue-14964#item-refresh-hook
Signed-off-by: thatguywob <thatguywob@users.noreply.github.com>
@kubestellar-prow kubestellar-prow Bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Oct 28, 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/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Oct 28, 2026
@hivecommons-hive hivecommons-hive Bot added author/clanker A contributor's own hive authored this PR under their login dco All commits are DCO signed-off 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 labels Oct 28, 2026
@hivecommons-hive hivecommons-hive Bot added stage/072-returned-to-contributor Contributor PR: CI red, changes requested or conflicting; diagnosis posted, author must act and removed stage/050-review-pending Review swarm requested; awaiting a verdict for the current head labels Oct 28, 2026
@hivecommons-hive

Copy link
Copy Markdown
Contributor

@thatguywob this PR is back in your court (stage/072-returned-to-contributor). The hive will not merge it until the head changes.

Failing checks:

  • test (dashboard shuffle 3/3)

Reply here or push a new head to this branch (same sign-off); CI and the review swarm re-run automatically and the PR returns to the normal path.

Queued in your relay fix queue (1 waiting): fixes are handed out before new work as soon as you have capacity.

Signed-off-by: thatguywob <thatguywob@users.noreply.github.com>
@github-actions

github-actions Bot commented Oct 28, 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
#14971 🐛 fix: claim release re-derives covered-by-pr from the claim ledger; close-on-merge on the webhook; ledger backfill same files src/cmd/hive/github_client_config.go
src/pkg/github/client.go
#14965 🐛 fix(dashboard): name the blocking PR on tracker rows and keep webhook unblocks from being overwritten same files src/pkg/github/client.go

@kubestellar-prow kubestellar-prow Bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 28, 2026
Signed-off-by: thatguywob <thatguywob@users.noreply.github.com>
@kubestellar-prow kubestellar-prow Bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 28, 2026
@hivecommons-hive

Copy link
Copy Markdown
Contributor

@thatguywob this PR is back in your court (stage/072-returned-to-contributor). The hive will not merge it until the head changes.

Review asks:

  • the branch conflicts with the base and needs a rebase

Reply here or push a new head to this branch (same sign-off); CI and the review swarm re-run automatically and the PR returns to the normal path.

Queued in your relay fix queue (0 waiting): fixes are handed out before new work as soon as you have capacity.

@hivecommons-hive hivecommons-hive Bot added stage/050-review-pending Review swarm requested; awaiting a verdict for the current head and removed stage/072-returned-to-contributor Contributor PR: CI red, changes requested or conflicting; diagnosis posted, author must act labels Oct 28, 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.

Decision needed: @clubanderson should decide whether #14969 should land as a second, client-scoped refresh hook when #14957 (a748632, this PR's own merge base) already wires the process-wide hook that delivers #14964's prescription, or whether #14969 should be closed and #14964 closed as fixed by #14957.

Conclusion: the behaviour this PR adds is already on v5 at this PR's merge base, so the code is not wrong, but merging it adds a parallel path and makes the existing wiring dead. A maintainer should decide whether that is wanted.

What I verified in the tree (merge base a748632, #14957):

  • src/cmd/hive/main.go:3697 — github.SetItemRefreshHook(b.dashSrv.RefreshSelfEditedItem) is already installed at boot, with the comment "The hive's own unblock (blocked sweep, review-backlog block lift) re-reads the issue … (#14952)".
  • src/pkg/github/item_refresh_hook.go:50 (at a748632) — unblockIssue already calls notifyItemRefresh(repo, number, false) after a successful RemoveLabel, so all five blocked-removal sites that share unblockIssue already fire the hook.
  • src/pkg/dashboard/webhook_tracker_refresh.go:275-284 — RefreshSelfEditedItem already does invalidateStageTrackerForWebhook() + trackerRefresher().enqueue(...) gated by webhookTrackerRefreshEnabled(). The new RefreshHiveItem (src/pkg/dashboard/hive_item_refresh.go:9-18) is the same body with strings.TrimSpace, a different tag string (hive-write:item-refresh vs self:edit — nothing consumes either, I grepped pkg/ and cmd/), and without the s.deps.GHClient == nil guard, which is harmless because the refresher's fetch at webhook_tracker_refresh.go:218-220 returns ErrNoGitHubClient itself.

Effect of merging as-is: unblockIssue (item_refresh_hook.go:65-69 in this PR) prefers the client hook when set, and applyGitHubClientDashboardHooks always sets it when a dashboard exists, so the SetItemRefreshHook call at main.go:3697 becomes dead code without being removed. Two mechanisms, one of them unreachable, for one event.

On the PR body: it says "Boot connects the hook to the dashboard's existing refresher" — accurate, but boot already did that at main.go:3697 before this branch was cut. Issue #14964 was written as "part 2b" of #14952 before #14957 merged the hook; it reads as already satisfied by #14957.

If the client-scoped hook is wanted anyway (e.g. for multi-client isolation), the one change I'd ask for is to delete the now-dead main.go:3697 line in the same PR so there is a single path. If not, I'd recommend closing this in favour of what #14957 already shipped. I have not closed or changed anything.

— hive: agent=reviewer 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.

Decision needed: @clubanderson should decide whether #14969 should land as a second, client-scoped ItemRefreshHook path on top of #14957 (which already fixes #14964 at this PR's base), or be closed as superseded.

Conclusion: the behaviour this PR describes already exists on v5 at this PR's own base commit, landed by #14957 six minutes after this PR opened. What is left in the diff is a parallel re-implementation that shadows the merged one, not a fix. I'd route this to a maintainer rather than nit it.

What is already on the base (a748632, read from the tree, not the diff):

  • src/pkg/github/item_refresh_hook.go:36-50 — process-wide ItemRefreshHook; unblockIssue fires notifyItemRefresh after RemoveLabel(..., BlockedLabel).
  • All 5 hive-side unblock sites already route through unblockIssue (issue_blocked.go:465,506,562,632, review_backlog_blocks.go:84).
  • src/cmd/hive/main.go:3697 — github.SetItemRefreshHook(b.dashSrv.RefreshSelfEditedItem).
  • src/pkg/dashboard/webhook_tracker_refresh.go:275-284 — RefreshSelfEditedItem invalidates the tracker cache and enqueues the targeted read with delivery id self:edit.

That is exactly the mechanism #14964 asks for ("add a github.ItemRefreshHook fired by every hive-side blocked removal … invalidates the stage-tracker cache and queues the same targeted re-read"), and #14957's body documents it as shipped.

What this PR adds on top:

  1. (*Client).SetItemRefreshHook (per-client, takes precedence over the global hook — item_refresh_hook.go:65-69 in this branch).
  2. dashboard.RefreshHiveItem (hive_item_refresh.go:9-18), a near-copy of RefreshSelfEditedItem.
  3. github_client_config.go:333 installs (2) via (1).

In production both registrations run, the client hook wins, so #14957's RefreshSelfEditedItem becomes dead code while still being wired at main.go:3697. Two mechanisms, one event, and the one that actually runs is the undocumented one.

Small concrete differences, in case the per-client hook is wanted anyway:

  • RefreshHiveItem drops the s.deps == nil || s.deps.GHClient == nil guard that RefreshSelfEditedItem:280 has. Not a crash — the refresher's fetch at webhook_tracker_refresh.go:218-220 returns ErrNoGitHubClient — but it arms a debounce timer for a read that cannot happen. (low)
  • The delivery id changes from self:edit (webhook_tracker_refresh.go:265, cited in #14957's body) to hive-write:item-refresh, reusing the prefix hive_write_evict.go:12 reserves for closed-item evictions. Anyone grepping patches by prefix will now see reads under the eviction tag. (low)
  • changelog.d/fixed-14964-unblock-item-refresh.md describes the behaviour #14957's fixed-14952-tracker-blocked-on-pill.md already announces. (info)

Body vs diff: the body says "Boot connects the hook to the dashboard's existing refresher" — true, but boot already did that at main.go:3697; the PR body does not mention #14957 or that this is a second connection.

I have not closed or changed anything.

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

@hivecommons-hive hivecommons-hive Bot added stage/085-needs-decision A human decision is owed: sentinel alert, hold/needs-decision label, human-only rule or parked issue and removed stage/050-review-pending Review swarm requested; awaiting a verdict for the current head labels Oct 28, 2026
@hivecommons-hive

Copy link
Copy Markdown
Contributor

Needs a decision, not a merge:

Head: verdict requires_human @c7030bf, 55/55 checks green, DCO yes, soak 0s of 30m0s.

How to release it:

  • After reading the verdict, a trusted merger can submit a GitHub Approve review for the current head and the lane clears the hold on its next pass; /hive approve replies on a PR are acknowledged but not consumed. An ordinary contributor cannot release their own PR.

Clear the cause and the hive re-evaluates on its next pass; the stage moves to stage/090-ready-for-human-merge, stage/095-pre-merge-soak or the merge queue on its own. Approval does not bypass CI, hold labels or other merge gates.

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Closed as superseded by #14957 by @clubanderson from the Hive dashboard.

@hivecommons-hive hivecommons-hive Bot added the hive/superseded Closed by Hive: a different merged PR already landed this change label Oct 28, 2026
@hivecommons-hive hivecommons-hive Bot closed this Oct 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author/clanker A contributor's own hive authored this PR under their login dco All commits are DCO signed-off dco-signoff: yes Indicates the PR's author has signed the DCO. hive/superseded Closed by Hive: a different merged PR already landed this change role/trusted Author is trusted for unattended merge (trusted-author role or registry/claim tier in require_tiers) size/L Denotes a PR that changes 100-499 lines, ignoring generated files. stage/085-needs-decision A human decision is owed: sentinel alert, hold/needs-decision label, human-only rule or parked issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[scanner] Fire a targeted re-read when the hive itself removes blocked (ItemRefreshHook)

1 participant