Skip to content

🐛 [reviewer] park PRs at 085 Needs decision when the fixer exhausted its attempts - #15748

Merged
clubanderson merged 25 commits into
v5from
fix/fixer-exhausted-stage
Oct 30, 2026
Merged

clubanderson merged 25 commits into
v5from
fix/fixer-exhausted-stage

Conversation

@clubanderson

Copy link
Copy Markdown
Member

Closes #15744

Hive's #15308 sat 13h at stage/070-fixing showing "Fixing · @hivecommons-hive[bot]" while the fix dispatcher logged review fix dispatch excluded … reason=fix-attempts-exhausted attempts=6 every cycle, automerge skipped it (human-changes-requested), it was CONFLICTING, and stage/stalled was removed with decision-answered.

Changes

  • review: FixDispatchStatusFor reads dispatch state for a (repo, pr, head): active fix job vs. excluded (attempts exhausted / no enabled fixer / not hive-authored).
  • stageengine + automerge: fixer-exhausted hive PR at 070 → 085-needs-decision with reason fixer-exhausted:N; FixerExhaustedRoute posts one decision comment per head (re-author / hand to a person / close as not planned) through the existing write-back gate. A stale decision-answered no longer clears the 085 park while the fixer is excluded and the head is unchanged.
  • dashboard: 085 caption 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 says Fixing paused — <why>; no fix job is dispatched with stage actor nobody instead of Fixing · @bot.
  • cmd/hive: review fix dispatch excluded WARN once per (pr, head, reason); debug thereafter.
  • Docs (review-swarm.md, hive-merge.md) and changelog.d entry.

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.

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>
@kubestellar-prow kubestellar-prow Bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Oct 30, 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 clubanderson 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 30, 2026
@github-actions

github-actions Bot commented Oct 30, 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.

PR Title Relation Files
#15887 🐛 Show current preparation backlog without fabricating a ready train same files src/cmd/hive/main.go
src/pkg/dashboard/stage_tracker_build.go
#15819 🌱 refactor: split src/pkg/github/automerge/automerge_sweep.go into 4 files same files src/pkg/github/automerge/automerge_sweep.go
#15886 🐛 Bound review-slot handoff for active base preparation heads same files src/cmd/hive/main_sweeps.go
src/docs/hive-merge.md
#15885 ✨ Add integration-aware orchestration above preparation and native queues same files src/cmd/hive/main.go
src/cmd/hive/main_sweeps.go
src/pkg/github/automerge/automerge_sweep.go
#15876 🐛 Fold hive PR notes into one edited status comment and stop no-findings review spam same files src/cmd/hive/main_sweeps.go
src/pkg/github/automerge/automerge_stage_labels.go
#15865 ✨ feature: carry abandoned counts through the hub leaderboard same files src/cmd/hive/main.go

@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.

Reviewed — no findings from this perspective.

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

@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.

Reviewed — no findings from this perspective.

— hive: agent=adjudicator-3 backend=copilot model=claude-fable-5.1 copilot=1.0.88

@hivecommons-hive

Copy link
Copy Markdown
Contributor

stage 080-awaiting-merge-admission → 050-review-pending: check-pending

@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.

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

@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.

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

@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.

Reviewed — no findings from this perspective.

— hive: agent=adjudicator-3 backend=copilot model=claude-fable-5.1 copilot=1.0.88

@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.

Reviewed — no findings from this perspective.

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

@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.

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

@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.

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

@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.

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:65 stageTrackerFixerExhaustedSummary — HumanSummaries → DecisionQuestion → Findings[].Title → Reasons
  • src/pkg/dashboard/stage_tracker_decision_pr.go:247 decisionFixerExhaustedFinding — HumanSummaries → DecisionQuestion → caption dash-clause
  • src/pkg/github/automerge/automerge_stage_human.go:739 fixerExhaustedSummary — 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

@hivecommons-hive

Copy link
Copy Markdown
Contributor

stage 080-awaiting-merge-admission → 050-review-pending: required-check-pending:build-and-test

@github-actions github-actions Bot removed the conflicts-with-open-pr Open PR has a merge conflict with another open PR label Oct 30, 2026
@hivecommons-hive

Copy link
Copy Markdown
Contributor

stage 080-awaiting-merge-admission → 050-review-pending: required-check-pending:Sign-off survives the squash

@github-actions github-actions Bot removed the conflicts-with-open-pr Open PR has a merge conflict with another open PR label Oct 30, 2026
@hivecommons-hive

Copy link
Copy Markdown
Contributor

stage 080-awaiting-merge-admission → 050-review-pending: required-check-pending:build-and-test

@hivecommons-hive

Copy link
Copy Markdown
Contributor

stage 080-awaiting-merge-admission → 050-review-pending: required-check-pending:build-and-test

@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.

Reviewed — no findings from this perspective.

— hive: agent=adjudicator-5 backend=copilot model=claude-fable-5.1 copilot=1.0.88

@hivecommons-hive

Copy link
Copy Markdown
Contributor

stage 080-awaiting-merge-admission → 050-review-pending: required-check-pending:build-and-test

@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.

Reviewed — no findings from this perspective.

— hive: agent=adjudicator-4 backend=copilot model=claude-fable-5.1 copilot=1.0.88

@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.

Reviewed — no findings from this perspective.

— hive: agent=adjudicator-3 backend=copilot model=claude-fable-5.1 copilot=1.0.88

@github-actions github-actions Bot added the conflicts-with-open-pr Open PR has a merge conflict with another open PR label Oct 30, 2026
@hivecommons-hive

Copy link
Copy Markdown
Contributor

@clubanderson this PR is held at stage/071-needs-author and the hive will not merge it yet.

Failing checks:

  • coverage

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.

@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.

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-226 makes decide:re-author the lead option with consequence "opens a fresh PR … closes this one as superseded"; stagelabels/human.go FixerExhaustedRoute tells the maintainer the same, or to add adoption/supersede.
  • decide:re-author is handled at api_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 applies adoption/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>
@kubestellar-prow kubestellar-prow Bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 30, 2026
Signed-off-by: Andrew Anderson <andy@clubanderson.com>

# Conflicts:
#	src/pkg/dashboard/stage_tracker_decision_pr.go
@kubestellar-prow kubestellar-prow Bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 30, 2026
@clubanderson
clubanderson merged commit 94e0d49 into v5 Oct 30, 2026
76 of 77 checks passed
@kubestellar-prow
kubestellar-prow Bot deleted the fix/fixer-exhausted-stage branch October 30, 2026 21:31
@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

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

Development

Successfully merging this pull request may close these issues.

🐛 [reviewer] PR stays at 070 Fixing for hours after the fixer exhausted its attempts

1 participant