Skip to content

🐛 fix: keep a covered issue at 040 while the hive still repairs its red PR - #16523

Merged
hivecommons-hive[bot] merged 2 commits into
v5from
fix/covered-issue-release-while-fixing
Nov 4, 2026
Merged

hivecommons-hive[bot] merged 2 commits into
v5from
fix/covered-issue-release-while-fixing

Conversation

@clubanderson

Copy link
Copy Markdown
Member

Fixes #16522

What the operator saw

hive#16475 (child of #16137) is covered by open PR #16492 (Closes #16475). The PR went red and the reviewer asked for changes, so it reads stage/070-fixing and the reaper re-dispatched a fix for it. Ten minutes after the red head stopped moving, the Fix #3 claim-release valve reported the PR red+stale and released the issue — stage/040-covered-by-pr → stage/010-actionable, an amber Actionable chevron with a stage ↓ pill — while the PR stayed open and the hive was still working on it.

Why

claimingPRRedStale keyed off Store.StaleRed alone. StaleRed is the re-engagement trigger (10 min): it says "stuck, nudge the fixer", not "give up". The re-engagement budget (MaxReEngagements × ReEngageCooldown) runs for ≥ 1 h, so for most of that hour the issue sat actionable under a live PR, and the kick offered it to the scanner — which the open-PR dispatch guard (#14812) then refused with has-open-pr. One piece of work, two owners.

Fix

  • escalation.Store.AbandonedRed(repo, n, head): stale and the fix loop is done with that head — escalated to a human, re-engagement budget spent, or red for ClaimReleaseAfter (= MaxReEngagements × ReEngageCooldown) with no owner ever reached.
  • claimingPRRedStale uses it. StaleRed is unchanged for the reaper and the merge watcher.
  • Comments on RedStaleFunc / claimingPRRedStale, contributor-relay.md, changelog fragment.

Tests

  • pkg/escalation/abandoned_red_test.go: stale-in-budget keeps the claim; escalated / budget spent / whole window releases; a moved head resets.
  • cmd/hive/escalation_gates_test.go: TestClaimingPRRedStale now pins that a stale red PR the reaper is still re-engaging keeps suppressing, and releases once escalated, budget-spent, or past the window.

go test ./pkg/escalation/ ./cmd/hive/ ./pkg/github/ ./pkg/dashboard/ ./pkg/stagelabels/ (targeted runs) green; go vet, gofmt clean on touched files.

…ed PR

The Fix #3 claim-release valve released an issue ten minutes after its
covering PR went red on an unchanged head, while the reaper was still
spending the re-engagement budget on that same head. The issue fell
040-covered-by-pr -> 010-actionable under a live PR staged 070-fixing
and the scanner kick offered work the open-PR dispatch guard then
refused.

escalation.Store.AbandonedRed is the valve predicate now: stale AND
(escalated | re-engagements >= MaxReEngagements | red for
ClaimReleaseAfter = MaxReEngagements x ReEngageCooldown). StaleRed is
unchanged for the reaper and merge watcher.

Fixes #16522

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 Nov 4, 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/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Nov 4, 2026
@github-actions

github-actions Bot commented Nov 4, 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.

No conflicting open PRs or same-file overlaps were found.

@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 pkg/escalation/escalation.go (StaleRed, reEngageEligibleLocked, EffectiveReEngageCooldown), cmd/hive/main_sweeps.go (ownerReEngageCooldown, claimingPRRedStale) and the new tests at head 7b5bcec. The direction is right — StaleRed is the nudge trigger, not a give-up signal, and swapping the valve onto escalated / budget-spent is exactly the fix #16522 asks for. One clause still releases under a live repair loop, though.

ClaimReleaseAfter fires inside the real re-engagement window — src/pkg/escalation/escalation.go:1006 / :1031 (medium)

ClaimReleaseAfter = MaxReEngagements × ReEngageCooldown = 6 × 10 min = 1 h. But the spacing the reaper actually enforces is not ReEngageCooldown: reEngageEligibleLocked (escalation.go:1117) gates on EffectiveReEngageCooldown(cooldown), and main_sweeps.go:403 passes ownerReEngageCooldown(cfg, fixer) — the owner's slowest configured cadence, capped at MaxReEngageCooldown = 1 h (escalation.go:88). For an owner on a 30–60 min cadence (the #9472 case this spacing was built for), six re-engagements span 3–6 h. The third clause in AbandonedRed:

return e.Escalated || e.ReEngagements >= MaxReEngagements || redFor >= ClaimReleaseAfter

therefore returns true at the 1 h mark with, say, ReEngagements == 1 and the reaper still scheduled to re-kick — the issue drops 040 → 010 while the PR reads 070-fixing, which is the two-owners state this PR exists to remove. Narrower than before (1 h instead of 10 min), but the same mechanism.

The doc comment on the clause says it covers the case where "no re-engagement was ever delivered (an owner the fix loop could not reach)", and the test unreachable owner releases after the whole window only exercises ReEngagements == 0. The code doesn't require that. Two ways to make the code match the comment:

  • gate it: (e.ReEngagements == 0 && redFor >= ClaimReleaseAfter) — unreachable owners (where resolveRedPRFixer returned "" and ReEngageEligible was never called, so LastReEngagedAt/ReEngagements stay zero) still release after 1 h; an owner mid-budget keeps the claim until MaxReEngagements or escalation; or
  • derive the window from the owner's effective cooldown (MaxReEngagements × EffectiveReEngageCooldown(ownerReEngageCooldown(cfg, fixer))) — more faithful, but it pulls the fixer resolution into the claim valve.

The first is a one-token change plus a test case (ReEngagements == 1, redFor == ClaimReleaseAfter + 1m → still covered). Also worth noting the ClaimReleaseAfter comment ("never offered … while the first is still inside the hive's own repair budget") overstates what a fixed 1 h guarantees given the 1 h cadence cap.

Everything else I checked holds: head-move reset (CurRedSHA != headSHA → false) matches StaleRed; the escalation.Disabled nil-func path is unchanged; RedStaleFunc/contributor-relay.md text tracks the new behaviour; changelog fragment name passes the guard. No security surface touched.

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

@hivecommons-hive

hivecommons-hive Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Hive status — updated in place; edits do not notify. Full history is in the Activity Monitor.

Review findings from reviewer (folded here because this head already carries its hive review):

Read claimingPRRedStale, the new Store.AbandonedRed, and the re-engagement path it is meant to defer to (reaper → ReEngageEligible(…, ownerReEngageCooldown(cfg, fixer))). The predicate change is correct in direction and a clear improvement over releasing at StaleRed (10 min). One arm does not do what the PR says it does.

Finding (medium) — the time arm releases while the reaper still has budget, for any owner whose cadence is slower than 10 min.

  • src/pkg/escalation/escalation.go:1008 — ClaimReleaseAfter = MaxReEngagements * ReEngageCooldown = 6 × 10 min = 60 min.
  • src/pkg/escalation/escalation.go:1031 — return e.Escalated || e.ReEngagements >= MaxReEngagements || redFor >= ClaimReleaseAfter. The third arm fires unconditionally at 60 min; nothing checks whether re-engagements were delivered.
  • But ReEngageCooldown is only a floor. src/cmd/hive/main_sweeps.go:403 passes ownerReEngageCooldown(cfg, fixer) (the owner's slowest configured cadence, main_sweeps.go:263-279), and EffectiveReEngageCooldown (escalation.go:1091-1099) widens the spacing up to MaxReEngageCooldown = 1 h. So the real re-engagement window is 6 × max(10m, ownerCadence) — anywhere from 1 h to 6 h.

Mechanism: owner on a 30-min cadence → re-engagements delivered at ~10, 40, 70, 100, 130, 160 min. At 60 min redFor >= ClaimReleaseAfter is true with only two kicks spent, AbandonedRed returns true, Fix #3 releases the issue to 010-actionable, and the reaper re-engages the same PR ten minutes later. That is the exact two-owner split this PR fixes, moved from minute 10 to minute 60. The PR body and the ClaimReleaseAfter doc comment (escalation.go:1001-1006) both scope this arm to "no owner ever reached / no re-engagement was ever delivered", but the code does not carry that condition.

Smallest fix that matches the stated intent: gate the time arm on the budget being untouched —

return e.Escalated || e.ReEngagements >= MaxReEngagements ||
    (e.ReEngagements == 0 && redFor >= ClaimReleaseAfter)

Then a reachable owner is only released via Escalated/budget-spent (whatever its cadence), and the unreachable-owner case keeps the 60-min bound as written. The existing "unreachable owner releases after the whole window" test (abandoned_red_test.go:68) still passes since that store has ReEngagements == 0; a sibling case with one RecordReEngagement and now += ClaimReleaseAfter + 1m would pin the gap. (Alternative: size the constant off MaxReEngageCooldown instead — 6 h — but that delays the genuinely-unreachable case for no gain.)

Everything else checked out: StaleRed is untouched so the reaper/merge-watcher trigger is unchanged; the CurRedSHA != headSHA guard means a pushed fix resets the verdict (escalation.go:1024, test at abandoned_red_test.go:80); RedStaleFunc stays a caller-supplied predicate so pkg/github keeps no escalation dependency; the contributor-relay.md and changelog edits describe the new rule accurately given the fix above. CI is green on everything reported so far; tide/coverage still pending at head 7b5bcec.

Evidence bundle `#165237b5bcec` sha256:2e244e08c2f823c6a7fc26c5c0c3e65e307ede16ead519403cc3f6c72784bc2d — download from the dashboard or `hivectl review evidence #16523`.

@hivecommons-hive
hivecommons-hive Bot merged commit 4a9bb62 into v5 Nov 4, 2026
79 of 80 checks passed
@kubestellar-prow
kubestellar-prow Bot deleted the fix/covered-issue-release-while-fixing branch November 4, 2026 03:06
@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 7b5bcec.

@github-actions

github-actions Bot commented Nov 4, 2026

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

dco-signoff: yes Indicates the PR's author has signed the DCO. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🐛 Red+stale claim release drops a covered issue to Actionable while the hive is still fixing its PR

1 participant