Skip to content

πŸ› fix: clear blocker ledger on ordinary issue closure - #15309

Merged
hivecommons-hive[bot] merged 1 commit into
hivecommons:v5from
thatguywob:fix/15155-clear-closed-blockers
Oct 29, 2026
Merged

hivecommons-hive[bot] merged 1 commit into
hivecommons:v5from
thatguywob:fix/15155-clear-closed-blockers

Conversation

@thatguywob

Copy link
Copy Markdown
Contributor

Closed issues retain their blocker ledger entries, inflating /api/status.capabilities.blocked_items. Clear the entries after a successful Hive issue close and whenever a configured repository's webhook reports a closed issue. Comments on closed issues skip blocker observation, and cleanup covers both configured short names and full repository names.

Regression coverage checks ordinary closes, comments on closed issues, unaffected open issues and PR comments, capability counts, and failed or confirmation-gated closes. Added a changelog fragment.

Validation: gofmt -l on all changed Go files returned no output; git diff --check passed. Go tests are deferred to CI as required by AGENTS.md.

Fixes #15155

Hive-Run: #15155
Hive-Plan: #15155
Hive-Spec: #15155#closed-issue-blocker-lifecycle

β€” hive: backend=codex


🐝 Hive Agent: contributor | SHA: cba03b08f

Clear blocker entries after successful issue closes and on closed issue webhook payloads. Ignore blocker reports embedded in comments on closed issues, and cover repository name aliases and failed or gated closes.

Hive-Run: hivecommons#15155
Hive-Plan: hivecommons#15155
Hive-Spec: hivecommons#15155#closed-issue-blocker-lifecycle
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 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/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Oct 29, 2026
@hivecommons-hive

Copy link
Copy Markdown
Contributor

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

@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
#15312 πŸ› fix: clear blocker ledger entry when an issue closes same files src/pkg/github/issue_blocker_test.go
src/pkg/github/webhook_cache.go

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

Read the diff against the tree at cba03b0; this looks correct to me.

  • src/pkg/github/webhook_cache.go:493-505: webhookItemHint is now computed before the issue branch, and Closed() (webhook_cache.go:90-92) checks state == "closed" case-insensitively, so issues/closed, a later issue_comment on a closed issue, and label events on closed issues all take the Clear path instead of Observe. The PR-comment exclusion is still enforced by webhookTouchedIssue (webhook_cache.go:624-632), so PR rows are untouched.
  • src/pkg/github/issue_close.go:132-138: cleared only on a successful Issues.Edit and only when !isPR, which matches how Ledger.Clear is documented (pkg/blocker/ledger.go:249: "forgets the item entirely (it closed…)").
  • The short-name/full-name double clear mirrors the mismatch that already exists between the webhook Observe(configured, …) and the sweep Observe(owner+"/"+repo, …) at task_list_sweep.go:663, so both keys are covered.

This closes exactly the gap #15155 describes (only item_blocker.go:384 and ClearKind previously cleared). The body's claims match the diff. Suggestion only, not a defect: the test matrix doesn't cover the hive's own closeIssue path clearing the ledger, though issue_close_test.go additions do assert it β€” fine.

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

@hivecommons-hive

Copy link
Copy Markdown
Contributor

stage 080-awaiting-merge-admission β†’ 050-review-pending: contributor-lane:no-verdict

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

Read the diff against the v5 tree plus the ledger and the other writers of the shared blocker ledger. Looks correct to me.

  • Ledger.Clear is documented for exactly this case β€” "forgets the item entirely (it closed, or a person resolved it)" (pkg/blocker/ledger.go:249) β€” so deleting the entry rather than just the blocker is the intended semantics, unlike ClearKind which keeps loop-guard history.
  • The only other writer, task_list_sweep.go:663, only observes issues from listOpenIssuesForTaskListSweep (State: "open", :290), so a cleared entry on a closed issue is not recreated by the next sweep tick; the webhook path now skips observation when res.Item.Closed() (webhook_cache.go:496), which covers the comment-after-close case.
  • Both key spellings are cleared (configured and owner/repo), matching how Observe is keyed at webhook_cache.go:512 vs task_list_sweep.go:663; splitRepo falls back to c.org for short names (client.go:1715), so the full-name key is always derivable.
  • Tests swap the shared ledger via swapSharedLedger so nothing touches /data/item-blockers.json. go build ./pkg/github/ passes at the PR head.

Residual, not a defect of this change: an issue closed while the webhook is down (or closed before this ships) keeps its entry until someone comments on it after closure or Hive closes it; no sweep reconciles the ledger against issue state. Worth a follow-up if blocked_items still reads high after this lands.

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

@hivecommons-hive
hivecommons-hive Bot merged commit 19b17ed into hivecommons:v5 Oct 29, 2026
68 of 71 checks passed
@hivecommons-hive

Copy link
Copy Markdown
Contributor
Evidence bundle `#15309cba03b0` sha256:d07eb950f19cfc9e3346dad79635ea0072e6c9072a7f36501528ee35c489b265 β€” download from the dashboard or `hivectl review evidence #15309`.

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Merged by hive contributor-lane auto-merge: CI green for β‰₯30m, reviewer verdict approve, @thatguywob was auto-promoted after 5 clean merged PRs in this hive's repositories.

hivecommons-hive Bot added a commit that referenced this pull request Oct 30, 2026
Base v5 already clears the blocker ledger row when a webhook payload
says the issue is closed (#15309, keyed on issue.state via
WebhookItemHint.Closed), so the action=="closed" block and
webhookIssueClosed added here were reachable only for payloads lacking
`state`, which real GitHub deliveries always carry. Remove them and the
changelog fragment (no behaviour change remains), and give the new test
realistic `state` fields so it guards the live issue_comment -> close
flow against the production code path.

Refs #15273

Hive-Fix-Attempt: 1/6
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
hivecommons-hive Bot added a commit that referenced this pull request Oct 30, 2026
…5646)

* πŸ› fix: clear blocker ledger entry when an issue closes

An `issues: closed` webhook left the issue's blocker ledger row in place,
so capabilities.blocked_items counted closed issues. Clear the row on
close, as the dashboard recheck and close-partial paths already do.

Hive-Run: #15273
Hive-Plan: review-backlog style finding, webhook_cache.go issue close
Hive-Spec: blocker-ledger#clear-on-close
Signed-off-by: SACHIN NAIK <sachin.naik@ibm.com>

* ♻️ refactor: drop redundant close-clear; keep realistic regression test

Base v5 already clears the blocker ledger row when a webhook payload
says the issue is closed (#15309, keyed on issue.state via
WebhookItemHint.Closed), so the action=="closed" block and
webhookIssueClosed added here were reachable only for payloads lacking
`state`, which real GitHub deliveries always carry. Remove them and the
changelog fragment (no behaviour change remains), and give the new test
realistic `state` fields so it guards the live issue_comment -> close
flow against the production code path.

Refs #15273

Hive-Fix-Attempt: 1/6
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>

* βœ… test: name comment-seeded blocker test for what it adds

TestWebhookIssueClosedClearsBlocker was a near-duplicate of the existing
table test TestWebhookClosedIssueClearsBlocker, differing only by word
order and re-asserting its labeled/PR-close cases. Rename it to
TestWebhookCommentSeededBlockerClearsOnClose and keep only the path the
table does not cover: ledger seeded via a live issue_comment delivery,
then cleared on issues:closed while a second item's count survives.

Refs #15273

Hive-Fix-Attempt: 2/6
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>

---------

Signed-off-by: SACHIN NAIK <sachin.naik@ibm.com>
Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
Co-authored-by: SACHIN NAIK <sachin.naik@ibm.com>
Co-authored-by: hivecommons-hive[bot] <280983584+hivecommons-hive[bot]@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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. role/trusted Author is trusted for unattended merge (trusted-author role or registry/claim tier in require_tiers) size/M Denotes a PR that changes 30-99 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.

Review backlog (intent-alignment): Blocker ledger not cleared on ordinary issue close; blocked_items over-counts

1 participant