From ecd0a671cc7591bd10d031a6fd76bb21dd347568 Mon Sep 17 00:00:00 2001 From: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> Date: Wed, 28 Oct 2026 17:58:37 -0400 Subject: [PATCH 1/3] =?UTF-8?q?=F0=9F=90=9B=20fix:=20pause=20the=20074=20s?= =?UTF-8?q?tall=20clock=20while=20an=20adopted=20PR=20waits=20in=20the=20f?= =?UTF-8?q?ixer=20queue?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> Co-authored-by: Danathar <6772335+Danathar@users.noreply.github.com> Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> --- .../fixed-adoption-stall-fixer-queue.md | 1 + src/cmd/hive/merge_eligibility.go | 22 +++++++ src/docs/labels-and-control-signals.md | 2 +- .../automerge_adoption_escape_test.go | 47 ++++++++++++++ .../automerge/automerge_contributor_adopt.go | 15 ++++- src/pkg/scheduler/policy_overlays.go | 12 ++++ src/pkg/stagelabels/fixer_attempt_test.go | 31 +++++++++ src/pkg/stagelabels/store.go | 64 +++++++++++++++++++ 8 files changed, 192 insertions(+), 2 deletions(-) create mode 100644 changelog.d/fixed-adoption-stall-fixer-queue.md create mode 100644 src/pkg/stagelabels/fixer_attempt_test.go diff --git a/changelog.d/fixed-adoption-stall-fixer-queue.md b/changelog.d/fixed-adoption-stall-fixer-queue.md new file mode 100644 index 0000000000..bbcb57a39d --- /dev/null +++ b/changelog.d/fixed-adoption-stall-fixer-queue.md @@ -0,0 +1 @@ +An adopted PR waiting unattempted in the fixer queue no longer runs the stage/074 stall clock toward a needs-decision park; the wait is capped at four dwells and does not apply when the fixer is unavailable (#15036). diff --git a/src/cmd/hive/merge_eligibility.go b/src/cmd/hive/merge_eligibility.go index 07b832b1dc..e85e903cff 100644 --- a/src/cmd/hive/merge_eligibility.go +++ b/src/cmd/hive/merge_eligibility.go @@ -906,6 +906,26 @@ func routeConflictFixAgent(agent string, cfg *config.Config) (string, string) { return owner, "" } +// markAdoptedFixerQueued records that an adopted PR sits in the fixer queue +// so the 074 dwell can wait for a fixer that has not reached it +// (hivecommons/hive#15036). An unavailable fixer is not recorded: its rows +// must still escalate at the dwell. +func markAdoptedFixerQueued(repo string, number int, head, agent string, cfg *config.Config) { + if head == "" || !fixerAvailable(agent, cfg) { + return + } + stagelabels.Shared().MarkFixerQueued(stagelabels.Key(repo, number), head) +} + +func fixerAvailable(agent string, cfg *config.Config) bool { + if cfg == nil { + return true + } + base := cfg.BaseAgentName(agent) + ac, ok := cfg.Agents[base] + return ok && !ac.Paused && cfg.HasAnyCadence(base) && !allConfiguredCadencesPaused(cfg, base) +} + func allConfiguredCadencesPaused(cfg *config.Config, agent string) bool { if cfg == nil { return false @@ -1217,6 +1237,7 @@ func writeMergeEligible(actionable *github.ActionableResult, hold github.HoldRes row.ReroutedFrom = reroutedFrom row.DeferredIncident = pr.SharedCIIncident if adopted { + markAdoptedFixerQueued(fullRepo, pr.Number, pr.HeadSHA, agent, cfg) logger.Info("adopted PR routed to fixer", "repo", fullRepo, "number", pr.Number, "work", "rebase", "mergeable_state", pr.MergeableState, "fixer", agent, "sentinel_alert", row.SentinelAlert) } failing = append(failing, row) @@ -1234,6 +1255,7 @@ func writeMergeEligible(actionable *github.ActionableResult, hold github.HoldRes row.DeferredIncident = pr.SharedCIIncident row.DeferredExternal = pr.ExternalCIDeferred if adopted { + markAdoptedFixerQueued(fullRepo, pr.Number, pr.HeadSHA, agent, cfg) logger.Info("adopted PR routed to fixer", "repo", fullRepo, "number", pr.Number, "work", "fix-ci", "failing_checks", pr.FailingChecks, "fixer", agent, "sentinel_alert", row.SentinelAlert) } failing = append(failing, row) diff --git a/src/docs/labels-and-control-signals.md b/src/docs/labels-and-control-signals.md index 12527ec155..4d4e458297 100644 --- a/src/docs/labels-and-control-signals.md +++ b/src/docs/labels-and-control-signals.md @@ -226,7 +226,7 @@ referenced it) a lone `stage/050-review-pending` | `stage/070-fixing` | PR | hive-owned repair: App/taken-over PR red, changes requested (by the swarm, or by a trusted human's **changes requested** review / `/hive decision ` on the current head — reason `human-changes-requested`, which also kicks the author agent with the text verbatim, [#13041](https://github.com/hivecommons/hive/issues/13041)) or needs-rebase, **or** a non-App PR whose red head was caused by a hive-pushed commit that must be removed/re-homed; a hive agent is reworking it | 2h | | `stage/071-needs-author` | PR | human-authored PR (`author/human`): CI red / changes requested / conflicting; the hive posted its diagnosis, the author must act. No nudge, no adoption — the person pushes or comments | 24h | | `stage/072-returned-to-contributor` | PR | clanker PR (`author/clanker`, relay or external hive): CI red / changes requested / conflicting; the hive posted its diagnosis, the ball is in the contributor hive's court. (Briefly spelled `stage/072-needs-author` by [#12713](https://github.com/hivecommons/hive/pull/12713); the engine renames that label back in place) | 24h | -| `stage/074-adopted-by-hive` | PR | the author (a clanker) was unavailable — relay offline, never registered, or silent past the grace (see below); the hive took the PR over: in place on the PR's own branch when it may push there (the scanner's red-PR fix kick rebases and fixes it), otherwise via `hive/adopt-` and a superseding App PR that keeps the author's commits (the original closes automatically when the superseder merges). Adoption is an **ownership** state, not a CI state: the PR reads 074 for as long as the hive owns it — through its fixes going pending, green, reviewed or red again (074 outranks 050/060/070/071/072) — and leaves 074 only at the merge gate (080/085/090/100), when the adoption is released, or to 085 `adoption-stalled:` when the head sat unchanged past the dwell with CI idle and a real blocker the hive cannot push past — a red optional check alone never counts, and the escalation releases back to 074 as soon as the reason clears (an in-place adoption with a blocking review finding re-homes to `hive/adopt-` first instead; one with a squash-unsafe hive commit elects a merge commit on a `role/trusted` PR — `merge-method/merge` label, lane continues — and otherwise immediately re-homes to an App-authored superseder (`signoff-rehome`), preserving commits and sign-offs while changing squash attribution; loss of push access re-homes immediately, and idle rebase work re-homes after the dwell). For in-place adoption, a changed head must be linked to the App bot by GitHub commit metadata (the stage store only remembers heads that already passed that check); otherwise the hive treats it as a contributor push and hands the PR back (072 if red, else the normal path). Forgeable git author/committer names and emails never keep 074. A PR whose author holds **admin** or **maintain** on the repository is never adopted or re-homed (one cached permission read per repo and author per 10 minutes; a failed read is not cached and defers: no adoption, and an existing adoption is neither released nor re-homed until the read succeeds), and an adoption of such an author is released on the next pass, closing a still-open hive superseder with a note first. A fork PR is never superseded or re-homed into the base repository (that would run unreviewed fork code with the repository's trusted CI). So a fork PR is adopted only in place, when the hive can push to the fork's branch; one it cannot push to is not adopted at all. It stays at `072` with its author's nudge and queued `fix-pr` task, and parks at `085` as `adoption-stalled:fork-rehome-refused` only after the `072` dwell (24h) since the nudge on that head. An in-place fork adoption that can no longer be finished on the fork's branch parks there at once. | 3h | +| `stage/074-adopted-by-hive` | PR | the author (a clanker) was unavailable — relay offline, never registered, or silent past the grace (see below); the hive took the PR over: in place on the PR's own branch when it may push there (the scanner's red-PR fix kick rebases and fixes it), otherwise via `hive/adopt-` and a superseding App PR that keeps the author's commits (the original closes automatically when the superseder merges). Adoption is an **ownership** state, not a CI state: the PR reads 074 for as long as the hive owns it — through its fixes going pending, green, reviewed or red again (074 outranks 050/060/070/071/072) — and leaves 074 only at the merge gate (080/085/090/100), when the adoption is released, or to 085 `adoption-stalled:` when the head sat unchanged past the dwell with CI idle and a real blocker the hive cannot push past — a red optional check alone never counts, the dwell waits while the fixer queue lists the head and no fixer kick has carried it yet (capped at four dwells; not applied when the fixer is unavailable), and the escalation releases back to 074 as soon as the reason clears (an in-place adoption with a blocking review finding re-homes to `hive/adopt-` first instead; one with a squash-unsafe hive commit elects a merge commit on a `role/trusted` PR — `merge-method/merge` label, lane continues — and otherwise immediately re-homes to an App-authored superseder (`signoff-rehome`), preserving commits and sign-offs while changing squash attribution; loss of push access re-homes immediately, and idle rebase work re-homes after the dwell). For in-place adoption, a changed head must be linked to the App bot by GitHub commit metadata (the stage store only remembers heads that already passed that check); otherwise the hive treats it as a contributor push and hands the PR back (072 if red, else the normal path). Forgeable git author/committer names and emails never keep 074. A PR whose author holds **admin** or **maintain** on the repository is never adopted or re-homed (one cached permission read per repo and author per 10 minutes; a failed read is not cached and defers: no adoption, and an existing adoption is neither released nor re-homed until the read succeeds), and an adoption of such an author is released on the next pass, closing a still-open hive superseder with a note first. A fork PR is never superseded or re-homed into the base repository (that would run unreviewed fork code with the repository's trusted CI). So a fork PR is adopted only in place, when the hive can push to the fork's branch; one it cannot push to is not adopted at all. It stays at `072` with its author's nudge and queued `fix-pr` task, and parks at `085` as `adoption-stalled:fork-rehome-refused` only after the `072` dwell (24h) since the nudge on that head. An in-place fork adoption that can no longer be finished on the fork's branch parks there at once. | 3h | | `stage/080-awaiting-merge-admission` | PR | nothing left for the author: CI green (no red check on the head, required or not), verdict approve, no modifiers — and the automerge lane has not admitted it yet (prefilter not evaluated for this head, labels not synced, lane tripped). A stall here means a lane problem, so the hive also posts one `` comment with the lane's last skip reason | 30m | | `stage/085-needs-decision` | PR | **PR-only** since the owner decision of 2026-10-17 (issues park at `stage/045-needs-decision`; before that this stage carried both, [#12683](https://github.com/hivecommons/hive/issues/12683)). A person owes a **decision**, not a merge: a `requires_human` swarm verdict (reason `reviewer-verdict:requires_human`), `sentinel-alert`, `hold` / `do-not-merge*` / `needs-decision` modifier, no reviewer configured, GitHub workflow approval is required for a trusted same-repo bot/App/clanker PR (`workflow-approval-required:`); Hive has posted `/ok-to-test` and is waiting for the repo-local `hive-ok-to-test` workflow or a maintainer, or a human-only lane rule unrelated to trust (workflow-path edits, tests removed, human-merge path, reporter-trust hold), or an open issue the PR closes is held or parked (`linked-issue:hold:#N: