Repository navigation
🐛 fix: keep a covered issue at 040 while the hive still repairs its red PR - #16523
Conversation
…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>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Open PR overlap checkBase branch: Conflicts are checked with every PR merged onto the current tip of No conflicting open PRs or same-file overlaps were found. |
There was a problem hiding this comment.
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 >= ClaimReleaseAftertherefore 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 (whereresolveRedPRFixerreturned "" andReEngageEligiblewas never called, soLastReEngagedAt/ReEngagementsstay zero) still release after 1 h; an owner mid-budget keeps the claim untilMaxReEngagementsor 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
|
Hive status — updated in place; edits do not notify. Full history is in the Activity Monitor. Review findings from Read Finding (medium) — the time arm releases while the reaper still has budget, for any owner whose cadence is slower than 10 min.
Mechanism: owner on a 30-min cadence → re-engagements delivered at ~10, 40, 70, 100, 130, 160 min. At 60 min 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 Everything else checked out: |
|
merged by Hive trusted-author auto-merge: author @clubanderson holds role owner and GitHub permission admin on repo; CI green at 7b5bcec. |
|
Thank you for your contribution! Your PR has been merged. We'd love to hear how your experience was: share feedback |
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 readsstage/070-fixingand 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 astage ↓pill — while the PR stayed open and the hive was still working on it.Why
claimingPRRedStalekeyed offStore.StaleRedalone. 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 withhas-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 forClaimReleaseAfter(=MaxReEngagements × ReEngageCooldown) with no owner ever reached.claimingPRRedStaleuses it.StaleRedis unchanged for the reaper and the merge watcher.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:TestClaimingPRRedStalenow 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,gofmtclean on touched files.