Repository navigation
🐛 [reviewer] park PRs at 085 Needs decision when the fixer exhausted its attempts - #15748
Conversation
When the review fix dispatcher refuses a hive-authored PR with fix-attempts-exhausted, the stage engine now moves it from stage/070-fixing to stage/085-needs-decision (reason fixer-exhausted:N) with a 'fixer gave up after N attempts — <finding>' caption, a once-per-head decision comment (re-author / hand to a person / close as not planned) behind the write-back gate, and Re-author as the tracker's lead action. A 070 row no longer reads 'Fixing · @bot' while no fix job is dispatched; it says why the fixer is paused. A stale answered decision no longer clears stage/stalled or pulls the PR back to 070 while the fixer is excluded and the head is unchanged. The 'review fix dispatch excluded' WARN logs once per (pr, head, reason) instead of every cycle. Closes #15744 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
|
|
stage 080-awaiting-merge-admission → 050-review-pending: check-pending |
There was a problem hiding this comment.
Reviewed (correctness) — one low-severity edge, non-blocking.
Gate-refused 085 entry comment is never retried when the lane reason is decision-answered (src/pkg/github/automerge/automerge_stage_labels.go:918-922 vs :1117-1129). postHumanEntry leaves the record unmarked on a write-back refusal so "the next pass asks again" (automerge_stage_human.go:649-653). But on the next pass PreserveStageOnStaleDecisionAnswer (line 920) already turns the verdict into NeedsDecision/fixer-exhausted:N, so the exhausted branch at line 1117 (verdict.Stage == fixingStage(obs)) no longer fires, obs.Route stays nil, and the decision comment is never posted. This is exactly the #15308 shape (decision-answered + exhausted fixer); the window is only a repo whose write-back mode later changes, so low. Suggested fix — also build the route when the preserved reason is a fixer-exhausted park:
if !verdict.Terminal && fixerKnown && fixer.Exhausted() && (verdict.Stage == fixingStage(obs) || (verdict.Stage == stagelabels.NeedsDecision && stagelabels.IsFixerExhausted(obs.Reason))) {
(where IsFixerExhausted is _, ok := ParseFixerExhausted(r)), and set pass.FixerExhausted in that case too so the stage-engine facts match the inline verdict on every pass, not just the first.
Verified: go build ./... at 7f1189f passes; FixDispatchStatusFor attempt semantics match dispatchFix (pkg/review/dispatch.go:1574-1586, per-PR max across heads); auditWithheldReviewFixes is called once per cycle with the single cross-repo plan (cmd/hive/main_eval_cycle.go:954) so retain is safe. Go tests could not be run here; CI Go jobs were still pending when reviewed.
— hive: agent=adjudicator backend=copilot model=claude-fable-5.1 copilot=1.0.88
There was a problem hiding this comment.
Reviewed (correctness) — head 2e768b7. Traced FixDispatchStatusFor against dispatchFix (pkg/review/dispatch.go:1565-1598): the attempts/Human/Withheld derivation agrees with the dispatcher, the 085 override sits in the same slot as the rebase-failed-twice one in both ApplyStageLabels (automerge_stage_labels.go:1117-1129) and passDecision (stageengine/derive_pr.go:300-304), and postHumanEntry dedupes on EntryCause(route.Reasons) which embeds the short head, so one comment per head holds. No blocker.
Low — stageTrackerFirstLine can split a UTF-8 rune (src/pkg/dashboard/stage_tracker_fixer.go:96-98). The cap slices bytes (s[:stageTrackerFixerExhaustedSummaryMax-1]); a reviewer summary with a multi-byte char at the boundary (em dashes and curly quotes are common in these findings) yields invalid UTF-8 in the 085 caption / decision question JSON.
if r := []rune(s); len(r) > stageTrackerFixerExhaustedSummaryMax {
s = strings.TrimSpace(string(r[:stageTrackerFixerExhaustedSummaryMax-1])) + "…"
}
Advisory (no change requested): the entry comment's "Hand it to a person — reply /hive decision …" (stagelabels/human.go:675) cannot move the row. StageReasonDecisionAnswered routes to 070, and the same pass re-parks it at 085 via the exhausted override (automerge_stage_labels.go:1117) — by design per #15744 item 3 — with the identical cause, so no new comment and the tracker keeps asking the same question until the head moves. Worth a line in the comment or docs so a maintainer isn't surprised.
— hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88
There was a problem hiding this comment.
Reviewed (correctness) — head 45148a1. No blocking findings; one low advisory.
Verified: review.FixDispatchStatusFor (src/pkg/review/fix_dispatch_status.go:42-98) counts attempts the same way dispatchFix does (per-PR max over Fixes+FixAttempts vs escalation.MaxReEngagements, src/pkg/review/dispatch.go:1575-1586), so the stage park and the dispatcher's exclusion agree. The automerge branch (automerge_stage_labels.go:1116-1129) lives in the !verdict.Terminal else-block, matching the unconditional stageengine branch (derive_pr.go:300-304). item.HiveAuthored = fixerExhausted (automerge_stage_human.go:673) does not regress the human-merge-required path — writebackItemForObservation never set it (automerge_writeback.go:38). A human /hive decision on an exhausted head also routes through dispatchFix (dispatch.go:695-706), so it re-parks at 085 rather than bypassing the cap — consistent with the route text.
Low (in-scope): src/pkg/dashboard/stage_tracker_build.go:402-404 — the 085 fixer gave up after N attempts caption overwrites the Superseded by #N — decide caption set at :381-384 without checking it.Superseded == nil (the review-wait clause at :397 does). After the lead action Re-author opens a replacement, the original row stops saying it was superseded.
if n, ok := stageTrackerFixerExhaustedAttempts(it.Reason); ok && it.Stage == trackerNumberNeedsDecision && it.Superseded == nil {
— hive: agent=adjudicator backend=copilot model=claude-fable-5.1 copilot=1.0.88
There was a problem hiding this comment.
Reviewed (docs-currency, at head 336e089 — the PR moved past the dispatched 45148a1) — one small doc/behavior mismatch.
src/docs/review-swarm.md:557 lists budget as a dispatcher exclusion that produces the Fixing paused — <why> caption. No such exclusion exists: review.FixDispatchStatusFor (src/pkg/review/fix_dispatch_status.go:41-93) only yields fix-attempts-exhausted, no-enabled-fixer, or not-hive-authored, and the FixDispatchExcluded* constants in src/pkg/review/dispatch.go:600-609 have no budget reason; FixDispatchExclusionText (fix_dispatch_status.go:97-112) has no phrase for one either. An operator reading the doc would expect a budget-paused caption the tracker cannot produce.
- A `070-fixing` row never claims `Fixing · @bot` when no fix job is dispatched or running. If the dispatcher excludes the head (attempts exhausted or no enabled fixer), the caption reads `Fixing paused — <why>; no fix job is dispatched` (plus `conflicting with the base branch` when the PR is dirty) and the stage actor is *nobody*.
Everything else in review-swarm.md, hive-merge.md:715-719 and the changelog fragment matches the code: fixer-exhausted:<N> (stagelabels/human.go FixerExhaustedReason), caption/lead action/submenu (dashboard/stage_tracker_fixer.go:51-57, stage_tracker_decision_pr.go decisionLeadWithReauthor), once-per-head comment via the write-back gate (automerge_stage_human.go), stale decision-answered preservation (stageengine/derive_pr_classify.go:575-586), and WARN-once-then-debug (cmd/hive/main_sweeps.go:2741-2751, warn_once_pr.go:22-33).
— hive: agent=adjudicator-3 backend=copilot model=claude-fable-5.1 copilot=1.0.88
There was a problem hiding this comment.
Style review (read at head 336e0895, the current head; 45148a1b was superseded by a v5 merge).
Low (in-scope, non-blocking): the "reviewer's last finding, first line" logic is implemented three times with three different precedence orders.
src/pkg/dashboard/stage_tracker_fixer.go:65stageTrackerFixerExhaustedSummary— HumanSummaries → DecisionQuestion → Findings[].Title → Reasonssrc/pkg/dashboard/stage_tracker_decision_pr.go:247decisionFixerExhaustedFinding— HumanSummaries → DecisionQuestion → caption dash-clausesrc/pkg/github/automerge/automerge_stage_human.go:739fixerExhaustedSummary— HumanSummaries → DecisionQuestion → DecisionDirective → lane reason
plus two private first-line helpers (stageTrackerFirstLine at stage_tracker_fixer.go:90, firstLine at automerge_stage_human.go:758) and a one-line pass-through stageTrackerFixerExhaustedAttempts (stage_tracker_fixer.go:103) while decision_pr.go:43 calls stagelabels.ParseFixerExhausted directly. The automerge copy is justified by its different input type (ContributorLaneVerdict), but the two dashboard copies take the same *review.Aggregate, and decisionForPR runs after buildStageTracker has already written that summary into it.Caption (stage_tracker_build.go:407), so the second derivation only re-does the first two steps before falling back to the caption anyway. Collapsing it keeps the popover question and the row caption guaranteed to quote the same finding when the precedence order is next tweaked:
func decisionFixerExhaustedFinding(it StageTrackerItem, verdict *review.Aggregate) string {
if s := stageTrackerFixerExhaustedSummary(verdict); s != "" {
return s
}
if _, after, ok := strings.Cut(it.Caption, " — "); ok {
return strings.TrimSpace(after)
}
return ""
}
and drop stageTrackerFixerExhaustedAttempts in favour of stagelabels.ParseFixerExhausted at stage_tracker_build.go:407, matching decision_pr.go:43.
Everything else in the contract (#15744 items 1–4) is implemented as described and follows the package idioms (prWarnOnce, preserveNormalizedFixingStage-style guards, write-back gate reuse, stagelabels.Route for the comment).
— hive: agent=adjudicator-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88
|
stage 080-awaiting-merge-admission → 050-review-pending: required-check-pending:build-and-test |
|
stage 080-awaiting-merge-admission → 050-review-pending: required-check-pending:Sign-off survives the squash |
|
stage 080-awaiting-merge-admission → 050-review-pending: required-check-pending:build-and-test |
|
stage 080-awaiting-merge-admission → 050-review-pending: required-check-pending:build-and-test |
|
stage 080-awaiting-merge-admission → 050-review-pending: required-check-pending:build-and-test |
|
@clubanderson this PR is held at Failing checks:
Next: the hive does not push to your branch. Push a new head (or reply here); CI and the review swarm re-run automatically and the PR returns to the normal path. |
There was a problem hiding this comment.
Intent alignment (read at head 1ee0b0f, against #15744)
Items 2–4 of #15744 land as described (stage_tracker_fixer.go:24-48, derive_pr_classify.go:613-624, main_sweeps.go:2833-2846). Item 1 does not fully: the lead Re-author action is wired to a path that refuses hive-authored PRs — the only class this feature targets.
1. "Re-author from scratch" is a dead end on the hive's own PR (in-scope, high)
stage_tracker_decision_pr.go:224-226makesdecide:re-authorthe lead option with consequence "opens a fresh PR … closes this one as superseded";stagelabels/human.goFixerExhaustedRoutetells the maintainer the same, or to addadoption/supersede.decide:re-authoris handled atapi_repo_item_decision.go:491-519: it posts the DCO re-home note (:682, "its head cannot merge as-is (commits without a Signed-off-by)") and appliesadoption/supersede.- The adoption sweep then hits
automerge_contributor_adopt.go:615-626: on the self lane,normalizeBotLogin(obs.Author) == normalizeBotLogin(c.transport.AppBotLogin())→refuseSelfAuthoredSupersede, which posts "Not superseding: this PR is the hive's own … there is no contributor branch to re-home" (:774-776) and clears the label.
So for #15308 the maintainer clicks Re-author, gets a misleading DCO-flavoured note, then a refusal note, and the PR stays at 085. Nothing "re-authors from scratch". Neither new test exercises the action end to end (stage_tracker_fixer_test.go:65-95 only checks option ordering).
Suggested fix — let a fixer-exhausted park through the supersede path so a fresh hive PR really is opened (the new PR number resets the fixer's attempt count), and give it its own note:
--- a/src/pkg/github/automerge/automerge_contributor_adopt.go
+++ b/src/pkg/github/automerge/automerge_contributor_adopt.go
@@ func (c *Engine) adoptContributorPR(
if !requested && !forced {
return 0, nil
}
- if normalizeBotLogin(obs.Author) == normalizeBotLogin(c.transport.AppBotLogin()) {
+ _, fixerExhausted := stagelabels.ParseFixerExhausted(rec.Reason)
+ if normalizeBotLogin(obs.Author) == normalizeBotLogin(c.transport.AppBotLogin()) && !fixerExhausted {
+ // A fixer-exhausted park (hivecommons/hive#15744) is the one
+ // case where the hive re-homes its own PR: Re-author promised
+ // a fresh PR from the current base.
return c.refuseSelfAuthoredSupersede(ctx, store, key, obs, rec, now)
}and in api_repo_item_decision.go:505-507 pick a fixer-exhausted-specific note instead of renderRepoItemDecisionReauthorComment (its text is about unsigned commits). Alternatively, if a true from-scratch re-author (new kick for the linked issue, not a re-home of the failing commits) is what's wanted, the option should dispatch that and the consequence/comment text should stop promising supersession until it does.
Add a test in automerge_fixer_exhausted_test.go that applies adoption/supersede on the parked PR and asserts a superseding PR is opened (no AdoptionSelfRefusedMarker comment).
— hive: agent=adjudicator backend=copilot model=claude-fable-5.1 copilot=1.0.88
…omment Signed-off-by: Andrew Anderson <andy@clubanderson.com>
Signed-off-by: Andrew Anderson <andy@clubanderson.com> # Conflicts: # src/pkg/dashboard/stage_tracker_decision_pr.go
|
Thank you for your contribution! Your PR has been merged. We'd love to hear how your experience was: share feedback |
Closes #15744
Hive's #15308 sat 13h at
stage/070-fixingshowing "Fixing · @hivecommons-hive[bot]" while the fix dispatcher loggedreview fix dispatch excluded … reason=fix-attempts-exhausted attempts=6every cycle, automerge skipped it (human-changes-requested), it was CONFLICTING, andstage/stalledwas removed withdecision-answered.Changes
FixDispatchStatusForreads dispatch state for a (repo, pr, head): active fix job vs. excluded (attempts exhausted / no enabled fixer / not hive-authored).085-needs-decisionwith reasonfixer-exhausted:N;FixerExhaustedRouteposts one decision comment per head (re-author / hand to a person / close as not planned) through the existing write-back gate. A staledecision-answeredno longer clears the 085 park while the fixer is excluded and the head is unchanged.fixer gave up after N attempts — <reviewer finding>; lead action Re-author (decide:re-author), "Close as not planned" in the Decide… submenu. A 070 row with no dispatched/active fix job saysFixing paused — <why>; no fix job is dispatchedwith stage actor nobody instead ofFixing · @bot.review fix dispatch excludedWARN once per (pr, head, reason); debug thereafter.review-swarm.md,hive-merge.md) andchangelog.dentry.Tests
review, stageengine, stagelabels, automerge, dashboard, cmd/hive packages pass; new tests cover exhausted → 085 with caption + single comment, excluded caption, once-per-head WARN. No
time.Sleep.