Skip to content

Claim release regresses covered issues to stage/010 (bucket=claimed_by_pr); close-on-merge and stage store never heal between reconcile passes #14970

Closed

Description

@clubanderson

Summary

Issues an open PR already covers (stage-tracker bucket=claimed_by_pr) regress to stage/010-actionable (actor=scanner) the moment their live issue claim is released, and stay there for hours. Follow-up to #14942 / #14943, which fixed the webhook fact emission: the class is wider — the claim-release path itself re-derives the wrong stage, and nothing between reconcile passes heals it.

Evidence (hive's own hosted spoke, 2026-10-28, /api/stage-tracker + pod logs)

9 issues at 010 with bucket=claimed_by_pr: #14910, #14911, #14929, #14934, #14935, #14938, #14940, #14944, #14646 (covering PRs #14921 / #14931 / #14941 / #14945 / #14947 / #14951 / #14955). Four carry both stage/010-actionable and stage/040-covered-by-pr, five only 010.

Observed sequence for #14935 (store history + logs, local time):

  • 09:37:35 → 020 claimed (live issue claim) — contribute-ws task claim mirrored
  • external PR 🐛 fix(automerge): route contributor merges through the serialized lane #14941 opened → suppressing issue: open external PR covers it → webhook PR claims applied to claim ledger … recorded=…
  • [claims] contributor claim released with lease … reason "lease revoked" → ClaimReleased fact
  • 09:42:37 → 010 actionable (from 20) — not 040

#14646: same pattern (020 ↔ 010 flaps), covering PR #14920 (external, trusted author) merged 12:54Z; the issue never closed. The close-on-merge ledger sweep last ran 12:41Z; every eval cycle since planned from the cached snapshot (eval cycle planning from cached snapshot, snapshot_age up to 1h44m) and cached cycles skip the optional sweeps — "issue stage labels applied" last logged 12:40Z.

Root cause

  1. enrichCoveringPR (pkg/github/stage_facts_sink.go) upgrades an out-of-cycle Claimed/ClaimReleased/InProgress fact to 040 only when the store already remembers a 040 record with CoveringPR. For an issue that was at 020 when its PR's webhook landed, the ledger knows the cover but the store does not, so the ClaimReleased fact re-derives 010 and the store/labels regress. derive_issue.go maps claimed_by_pr→040 correctly — the bucket just never reaches it.
  2. Close-on-merge only runs from the reconcile pass's sweep (runCloseOnMergeSweep, gated !SkipOptional), so a PR that merges right after a pass waits for the next one — hours under webhook cadence.
  3. There is no reconciliation between the claim ledger and the stage store; a record written wrong stays wrong until the next full sweep.

Fix (PR to follow)

  • enrichCoveringPR falls back to the duplicate-PR claim ledger (Client.SetPRClaimLookup) for claims FilterClaimedIssues would suppress (IssueClaim.CoversOpenIssue: open, hive-closing or external), keeping the fresh-read liveness check; wired with the same red+stale valve as the guard.
  • A MERGED pull_request delivery runs the close-on-merge ledger sweep for that PR immediately (CloseOnMergeOptions.OnlyPRRepo/OnlyPRNumber).
  • Client.BackfillCoveredByLedger: every eval cycle (cached included) moves store records below 040 under an open ledger claim to 040 (one PR read per mismatch, no-op when consistent), so the 9 heal on the next roll.

Activity

  1. added
    help wantedDenotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.
    on Oct 28, 2026
  2. github-actions commented on Oct 28, 2026

    @github-actions
    Contributor

    @clubanderson this issue was closed by @hivecommons-hive[bot] as completed.

    If this was closed by a merged PR, the fix only takes effect once it ships in a tagged release and your deployment updates to it — check your running version against the fix before concluding the fix failed.

    If you are still seeing the problem, comment /reopen and it will be reopened for you — you do not need write access. Please add what you are still observing (running version, logs, steps) so it is not closed the same way again.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedDenotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions