Skip to content

πŸ› fix(automerge): time-box adopted-PR rebase attempts and re-home when exhausted - #16028

Merged
hivecommons-hive[bot] merged 2 commits into
v5from
scanner/fix-16023
Oct 31, 2026
Merged

hivecommons-hive[bot] merged 2 commits into
v5from
scanner/fix-16023

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Closes #16023

Why

An adopted conflicting PR could sit on Rebasing Β· attempt 1/2 forever when the fallback fixer was busy:

  • The rebase loop guard (rebasemerge.Attempts) only advanced when it saw a new dirty head. If the fixer never pushed, the episode never left attempt 1, so Exhausted() never fired and nothing escalated.
  • writeMergeEligible re-listed and re-logged "PR routed to fixer for rebase" every sweep, with no record that the attempt had already been dispatched or how long it had waited, so the stall looked like progress.
  • The in-place adoption's only way out to a hive-owned superseding PR (rebase-rehome) waited for the 074 dwell (3h) via adoptionStale, so a conflict the fixer never picked up stalled silently for hours.

Approach

  • Each fixer-owned rebase attempt (adopted, trusted-author, operator-requested) is now dispatched once. The dispatch time starts that attempt's deadline. Later sweeps keep the row in ci-failing.json so the kick overlay still sees it, but they don't re-route it or log it again.
  • An attempt that sees no push within 15m counts as failed, and the next attempt is dispatched with a single INFO line saying who it waited for and for how long. Past the cap the episode is exhausted, the same as two dirty pushes.
  • When an in-place adoption's episode is exhausted, it re-homes to a superseding PR (rebase-rehome) on that sweep instead of waiting out the 3h dwell.
  • The row shows the stall: "Rebasing Β· attempt 1/2 Β· waiting for scanner 12m".

The deadline is a new, additive key governor.labels.stage.adoption.rebase_attempt_timeout (default 15m, matching the other adoption waits). No existing key, id or public name changes. Episodes already on disk load unchanged: the new fields are optional and start empty. Hive-authored PRs routed to their own lane are not time-boxed, so their behaviour does not change.

Out of scope, per the issue: routing attempt 2 to a different fixer than attempt 1 (the alternate fixer is still hard-coded) and an in-process git rebase.

β€” hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88 requested_by=@clubanderson

…n exhausted

Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
Co-authored-by: clubanderson <407614+clubanderson@users.noreply.github.com>
@kubestellar-prow kubestellar-prow Bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Oct 31, 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 hanthor 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 Oct 31, 2026
@hivecommons-hive

hivecommons-hive Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor Author

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

hive/awaiting-ci: CI pending β€” sweep will merge when green.


🐝 Hive Agent: scanner | Instance: hosted-available-oke-11-placeholder-r05x | SHA: unknown

β€” hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88

Evidence bundle `#160281a69ac2` sha256:62757360ead1dfb96f9d32c7d289950fa2b86af96349b269655b526356cf2cb4 β€” download from the dashboard or `hivectl review evidence #16028`.

@github-actions

github-actions Bot commented Oct 31, 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
#16024 ✨ feature(spoke): publish bounded activity digest from heartbeat same files src/pkg/config/config.go
src/pkg/config/testdata/agent_runtime_golden.json
src/pkg/dashboard/stage_tracker_build.go
#16027 πŸ› fix: keep the preparation train connector continuous between adjacent members same files src/pkg/dashboard/static/index.html
#15890 πŸ› dashboard: point operator-reference help marks at the section sub-pages same files src/pkg/dashboard/static-src/js/config-governor.js
src/pkg/dashboard/static/index.html
#16020 ✨ feature: add opt-in Matrix Rain and Cascade display same files src/pkg/dashboard/static/index.html

@hivecommons-hive hivecommons-hive Bot added author/hive This repository's own hive (the App or one of its agent lanes) authored this PR dco All commits are DCO signed-off role/trusted Author is trusted for unattended merge (trusted-author role or registry/claim tier in require_tiers) stage/050-review-pending Review swarm requested; awaiting a verdict for the current head labels Oct 31, 2026
The new governor.labels.stage.adoption.rebase_attempt_timeout key made
TestAgentRuntimeConfigGolden report the field as unexpected; pin its
empty default in the golden JSON.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
@hivecommons-hive hivecommons-hive Bot added stage/070-fixing Hive-authored PR: CI red, changes requested or needs rebase; a hive agent is fixing it and removed stage/050-review-pending Review swarm requested; awaiting a verdict for the current head labels Oct 31, 2026
@hivecommons-hive hivecommons-hive Bot added stage/050-review-pending Review swarm requested; awaiting a verdict for the current head and removed stage/070-fixing Hive-authored PR: CI red, changes requested or needs rebase; a hive agent is fixing it labels Oct 31, 2026

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Read the diff against the tree at 1a69ac2; this looks correct to me.

What I verified:

  • src/pkg/rebasemerge/attempts.go β€” Count() = len(Heads)+Stalled and Exhausted() derive from it, so a timed-out attempt is indistinguishable from a dirty push for the cap. Dispatch returns first=false while DispatchedAttempt == Count(), and both Expire (via Stalled++) and Observe (new head) advance Count(), which re-arms Dispatched() for the next attempt β€” so each attempt is routed/logged exactly once, and Expire is a no-op on an attempt that was never dispatched or already pushed.
  • src/cmd/hive/merge_eligibility.go:1258-1265 β€” prev is captured before Expire, so timedOut.Waiting(rebaseNow) reports the stalled attempt's wait, not the new one's.
  • src/cmd/hive/main.go:2222 builds automerge.RebaseEpisode.Exhausted from a.Exhausted(), so the new inPlaceRebaseExhausted in automerge_contributor_adopt.go:1158 sees timed-out attempts too; inPlaceRehomeReason still requires needs-rebase/conflict reason and the same guards (AdoptedInPlace, head match, no DCO-red, not blocked) before rebaseExhausted short-circuits adoptionStale.
  • TestWriteMergeEligible_AdoptedRebaseAttemptTimesOutWithoutPush walks dispatch β†’ in-window re-sweep (no re-route) β†’ timeout β†’ attempt 2 β†’ exhausted, and fails on the base code (where Count() never moves without a push).

One consequence worth being aware of, not a defect: a fixer that pushes a still-dirty head after its 15m deadline lands at Heads=2, Stalled=1 β†’ exhausted immediately, so a slow-but-working fixer gets one shot, not two. That matches the issue's "timeout = failed attempt" framing and the default is tunable via rebase_attempt_timeout.

β€” hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88

@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

author/hive This repository's own hive (the App or one of its agent lanes) authored this PR copilot dco All commits are DCO signed-off dco-signoff: yes Indicates the PR's author has signed the DCO. role/trusted Author is trusted for unattended merge (trusted-author role or registry/claim tier in require_tiers) size/L Denotes a PR that changes 100-499 lines, ignoring generated files. stage/050-review-pending Review swarm requested; awaiting a verdict for the current head

Projects

None yet

Development

Successfully merging this pull request may close these issues.

πŸ› Adopted conflicting PR sits on Rebasing attempt 1/2 indefinitely while the fixer is busy

0 participants