Skip to content

🐛 fix(claims): record PR→issue claims from pull_request webhooks so claimed issues stop being offered - #14823

Merged
hivecommons-hive[bot] merged 1 commit into
v5from
fix/claim-link-webhook
Oct 28, 2026
Merged

hivecommons-hive[bot] merged 1 commit into
v5from
fix/claim-link-webhook

Conversation

@clubanderson

Copy link
Copy Markdown
Member

Fixes #14814

Root cause

Fix

  • pkg/github/webhook_pr_claims.go (new): PRClaimDelivery parsed from the webhook payload with the same claimsFromPR grammar (title/body keywords, branch name, references; hive vs external author); process-wide PRClaimsHook (pattern of SetIssueReopenedHook); ClaimLedger.ApplyPRDelivery — open → record (rank rules intact), edited to drop an issue / closed unmerged → release, merged → MergedPR claim anchored at merge; FirstObservedAt carried forward.
  • webhook_cache.go: fires the hook for opened/reopened/edited/synchronize/ready_for_review/converted_to_draft/closed, invalidates the Scanner dispatches issues that already have an open linked PR; duplicates escalate to owner instead of auto-resolving #14799 open-PR link cache for the repo, reports ClaimedIssues.
  • cmd/hive/webhook_pr_claims.go (new): governor hook — ApplyPRDelivery, Save(), then snapshotPatcher.suppressClaimed re-filters the cached actionable snapshot through FilterClaimedIssues so the hub's own agents stop seeing the issue too. Installed in applyWebhookItemsFunc.
  • issue_claim_gate.go: IssueDispatchBlockReason refuses an issue whose confirming GET says closed (issue closed) before the open-PR listing step — belt-and-braces for closed issues still in a cached snapshot.
  • api_github_webhook.go: response gains claimed_issues.
  • Closed-issue eviction on issues.closed already existed (evictClosedWebhookItem, ✨ feature: evaluate Microsoft NVX as a per-task sandbox runtime #14159); pinned by a test here.

Tests (no sleeps)

  • pkg/github: webhook pull_request with Fixes #7 / Refs #8 → hook fires with external closing + reference claims, response lists them, cache invalidated, no-op actions/unknown repo skipped, merged vs closed state; ApplyPRDelivery record/edit-release/close-release/merge; snapshot filter; IssueDispatchBlockReason → issue closed.
  • pkg/dashboard: end-to-end — signed webhook POST with Fixes #353 → real ledger via hook → selectTask withholds feat: copy existing agent when adding new agents #353, offers it again after the PR closes unmerged; issues closed delivery → row evicted → not offered.
  • cmd/hive: hook records, persists, filters snapshot, calls onPatch, nil-safe.

Docs

  • src/docs/operator-reference.md (Open-PR dispatch guard section): new "Webhook claim linking" bullet + closed-issue refusal.
  • changelog.d/fixed-14814-webhook-pr-claims.md.

The duplicate-PR claim ledger only learned which issues an open PR claims
from FetchClaimScan on the full reconcile pass; cached eval cycles skip
applyDuplicatePRGuard (SkipOptional) and the pull_request webhook patched
the PR row but never linked its Fixes #N. An owner PR opened between passes
left its issue offerable for up to an hour and the contribute lane handed it
to a contributor minutes later.

- parse claims from the pull_request payload (same claimsFromPR grammar) and
  apply them to the ledger via a process-wide PRClaimsHook: open → record,
  edited/closed-unmerged → release, merged → merged claim
- governor hook persists the ledger and re-filters the cached actionable
  snapshot through FilterClaimedIssues; open-PR link cache invalidated
- IssueDispatchBlockReason refuses a closed issue ("issue closed")
- webhook response lists claimed_issues; docs + changelog fragment

Fixes #14814

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 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 nicholasjackson 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/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Oct 28, 2026
@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.

@github-actions

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
#14758 🐛 fix(automerge): bind unmarked owner approvals to the head's observed push time same files src/docs/operator-reference.md

@hivecommons-hive hivecommons-hive Bot added author/human A person pushed this PR themselves 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 merged commit f7fbf9b into v5 Oct 28, 2026
80 of 84 checks passed
@kubestellar-prow
kubestellar-prow Bot deleted the fix/claim-link-webhook branch October 28, 2026 04:15
@hivecommons-hive

Copy link
Copy Markdown
Contributor
Evidence bundle `#148239e1e4c1` sha256:4c6a99b743543d750ecdf4fe4f31b67f82a941f670219eefc0f1b160e187fdc3 — download from the dashboard or `hivectl review evidence #14823`.

@hivecommons-hive

Copy link
Copy Markdown
Contributor

merged by Hive trusted-author auto-merge: author @clubanderson holds role owner and GitHub permission admin on repo; CI green at 9e1e4c1.

@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 dco All commits are DCO signed-off dco-signoff: yes Indicates the PR's author has signed the DCO. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.

Projects

None yet

1 participant