From 6d8085d12bdfd070304328f3ffe04a4363a3660a Mon Sep 17 00:00:00 2001 From: onkar717 Date: Fri, 30 Oct 2026 14:43:42 +0530 Subject: [PATCH 1/2] =?UTF-8?q?=F0=9F=90=9B=20fix:=20never-policy=20072=20?= =?UTF-8?q?row=20stops=20promising=20adoption=20it=20can't=20back?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The engine only reads a contributor's repository permission once adoption is due (adoptContributorPR gates maintainerHoldsAdoption behind the due check), so a stage/072 row under maintainer_policy: never had no AdoptionBlocked record before that moment and nothing to tell it apart, in the dashboard's own data, from a row the hive will truly auto-adopt. The tracker read "hive adopts it in Nm" right up to the due moment for a maintainer's own PR, then flipped to "not adopted: maintainer_policy is never". stageTrackerAdoptionText now names the exception for the never policy's auto-adopt countdown instead of promising an outcome it cannot back for every author: "… unless the author maintains this repository". Hive-Run: hivecommons/hive#15692 Hive-Plan: review-backlog-correctness Hive-Spec: issue-15692#stage_tracker_adoption_never_policy_text Signed-off-by: onkar717 --- .../fixed-15692-never-adopt-countdown.md | 1 + .../stage-labels.md | 6 +++- src/pkg/dashboard/stage_tracker_adoption.go | 9 ++++++ .../dashboard/stage_tracker_adoption_test.go | 32 +++++++++++++++++++ 4 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 changelog.d/fixed-15692-never-adopt-countdown.md diff --git a/changelog.d/fixed-15692-never-adopt-countdown.md b/changelog.d/fixed-15692-never-adopt-countdown.md new file mode 100644 index 0000000000..98887b43f0 --- /dev/null +++ b/changelog.d/fixed-15692-never-adopt-countdown.md @@ -0,0 +1 @@ +- A stage/072 row under `maintainer_policy: never` no longer claims `hive adopts it in Nm` right up to the due moment for a maintainer's own PR, only to flip to `not adopted: maintainer_policy is never`: the engine does not read the author's repository permission until adoption is due, so the tracker names the exception (`unless the author maintains this repository`) instead of promising an outcome it cannot back for every author. diff --git a/src/docs/labels-and-control-signals/stage-labels.md b/src/docs/labels-and-control-signals/stage-labels.md index 3dfe08df09..84077b88ee 100644 --- a/src/docs/labels-and-control-signals/stage-labels.md +++ b/src/docs/labels-and-control-signals/stage-labels.md @@ -923,7 +923,11 @@ When a contributor-agent PR goes red the hive does not just relabel it (a human- tracker's 072 pill reads `… — hive adopts it in 3m unless a new head lands` while the clock runs and `… — hive adopts it on the next sweep` once it has. **Adopt now** stays as the override for a clock that has - not run out yet. + not run out yet. Under `maintainer_policy: never` the engine has not + read the author's repository permission yet at this point — it only + does so once due — so the pill cannot promise that outcome for every + author; it names the exception instead: `… unless the author maintains + this repository` (hivecommons/hive#15692). A PR carrying `hold`, `do-not-merge` or `do-not-merge/hold` is never adopted (a human parked it; one log line, the stage stays 072). A PR whose diff trips the contributor lane's diff fences — it touches diff --git a/src/pkg/dashboard/stage_tracker_adoption.go b/src/pkg/dashboard/stage_tracker_adoption.go index 17f2136dfd..e776278633 100644 --- a/src/pkg/dashboard/stage_tracker_adoption.go +++ b/src/pkg/dashboard/stage_tracker_adoption.go @@ -215,6 +215,15 @@ func stageTrackerAdoptionText(author string, a StageTrackerAdoption, now time.Ti text += " — not adopted: a maintainer approved this head; the hive merges it as-is" case a.BlockedBy != "": text += " — not adopted: " + a.BlockedBy + case a.Policy == config.AdoptionMaintainerPolicyNever && a.AutoDue: + // The engine has not read the author's repository permission yet + // (it only does so once due): under never, a maintainer's head + // never reaches this moment at all, so the row cannot promise + // adoption the way the non-never case below does + // (hivecommons/hive#15692). + text += " — hive adopts it on the next sweep unless the author maintains this repository" + case a.Policy == config.AdoptionMaintainerPolicyNever && a.AutoAdoptAt != nil && a.AutoAdoptAt.After(now): + text += " — hive adopts it in " + stageTrackerShortDuration(max(a.AutoAdoptAt.Sub(now), time.Minute)) + " unless a new head lands or the author maintains this repository" case a.AutoDue: text += " — hive adopts it on the next sweep" case a.AutoAdoptAt != nil && a.AutoAdoptAt.After(now): diff --git a/src/pkg/dashboard/stage_tracker_adoption_test.go b/src/pkg/dashboard/stage_tracker_adoption_test.go index 071036df24..9a66a19cb3 100644 --- a/src/pkg/dashboard/stage_tracker_adoption_test.go +++ b/src/pkg/dashboard/stage_tracker_adoption_test.go @@ -110,6 +110,38 @@ func TestStageTrackerAdoptionNeverSaysSo(t *testing.T) { } } +// hivecommons/hive#15692: the engine only reads the author's repository +// permission once adoption is due (automerge_contributor_adopt.go), so a +// never-policy row that has not reached that moment yet has no +// AdoptionBlocked record — nothing distinguishes it, in the dashboard's +// own data, from a row the hive will truly auto-adopt. Before this fix the +// row read "hive adopts it in Nm" right up to the due moment, then flipped +// to "not adopted: maintainer_policy is never" for a maintainer's PR. The +// row now names the exception instead of promising an outcome it cannot +// back for every author. +func TestStageTrackerAdoptionNeverHedgesBeforeDue(t *testing.T) { + now := time.Date(2026, 10, 28, 16, 0, 0, 0, time.UTC) + s, store, status := adoptionFixture(t, now, config.AdoptionMaintainerPolicyNever, offlinePresence(now.Add(-3*time.Hour))) + a := trackerItem(t, s.buildStageTracker(status, store, now), "pr", 14524).Adoption + if a == nil || a.Due || a.BlockedBy != "" || a.Action != "" || a.Policy != "never" || !a.AutoDue { + t.Fatalf("adoption = %+v", a) + } + if a.Text != "waiting on @hanthor (offline 3h, 2 nudges) — hive adopts it on the next sweep unless the author maintains this repository" { + t.Fatalf("text = %q", a.Text) + } + // Nudged 13 minutes ago, offline: the pending countdown carries the + // same hedge. + store2 := stagelabels.NewStore("", func() time.Time { return now }) + key := stagelabels.Key("hivecommons/hive", 14524) + store2.Observe(key, stagelabels.ReturnedToContributor, "conflicting") + store2.MarkNudged(key, "feed", 1, false, now.Add(-13*time.Minute)) + s.stageStore = store2 + s.presenceLookup = offlinePresence(now.Add(-13 * time.Minute)) + if a = trackerItem(t, s.buildStageTracker(status, store2, now), "pr", 14524).Adoption; a == nil || a.AutoDue || a.AutoAdoptAt == nil || !a.AutoAdoptAt.Equal(now.Add(2*time.Minute)) || a.Text != "waiting on @hanthor (offline 13m, 1 nudge) — hive adopts it in 2m unless a new head lands or the author maintains this repository" { + t.Fatalf("pending text = %+v", a) + } +} + // adopt (default): nothing is held, so the row reports the wait, the // nudges, the presence and — since the engine's own predicate // (automerge.AutoAdoption) is what the row reads — that the hive adopts From 83630b6b780e08ad0c7aa4d1f3686d6cc5a8284d Mon Sep 17 00:00:00 2001 From: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> Date: Fri, 30 Oct 2026 08:18:05 -0400 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=90=9B=20fix:=20fold=20never-policy?= =?UTF-8?q?=20hedge=20into=20one=20countdown=20source;=20document=20pill?= =?UTF-8?q?=20wordings?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Review follow-up for hivecommons/hive#15738. - stageTrackerAdoptionText: the two never-only cases repeated the AutoDue / AutoAdoptAt branches verbatim save for a trailing clause. stageTrackerAdoptionNeverHedge now computes that clause once and the two existing branches append it, so the countdown text has a single source of truth. Rendered strings are unchanged. - docs/dashboard-sections/activity-monitor.md: the 072 pill vocabulary now lists the two pre-due never wordings (… unless a new head lands or the author maintains this repository / … on the next sweep unless the author maintains this repository), matching the code. - Rebased onto v5: the hedge paragraph moved with the split page to docs/labels-and-control-signals/stage-labels.md (#15712). Hive-Fix-Attempt: 1/6 Hive-Run: hivecommons/hive#15692 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> --- .../dashboard-sections/activity-monitor.md | 2 +- src/pkg/dashboard/stage_tracker_adoption.go | 26 +++++++++++-------- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/src/docs/dashboard-sections/activity-monitor.md b/src/docs/dashboard-sections/activity-monitor.md index d9d331e2ea..c82943212d 100644 --- a/src/docs/dashboard-sections/activity-monitor.md +++ b/src/docs/dashboard-sections/activity-monitor.md @@ -244,7 +244,7 @@ A return placed by hand counts too: when a trusted maintainer swaps `stage/085` #### Adoption pill (072) -A nudged `author/clanker` pull request at `stage/072-returned-to-contributor` carries `adoption{author, due, blocked_by, since, nudges, author_online, author_registered, author_last_seen, author_maintainer, policy, action, text}` — the nudge count and first-nudge time from the stage record, the author's live hub presence (the same lookup the contributor-offline adoption itself consults), and, when the adoption engine judged adoption due and held it, why (`blocked_by: author-is-maintainer`). The row's caption and an amber pill say it in plain words instead of a bare "Returned to contributor": `waiting on @hanthor (maintainer, offline 26h) — adopt?` under `governor.labels.stage.adoption.maintainer_policy: ask`, `waiting on @zoe (offline 40m, 2 nudges)` while the default `adopt` policy's clock runs, `… — not adopted: maintainer_policy is never` under `never` ([hivecommons/hive#14524](https://github.com/hivecommons/hive/pull/14524): the PR sat 26h at 072 with its author's hive gone and nothing on screen saying why). +A nudged `author/clanker` pull request at `stage/072-returned-to-contributor` carries `adoption{author, due, blocked_by, since, nudges, author_online, author_registered, author_last_seen, author_maintainer, policy, action, text}` — the nudge count and first-nudge time from the stage record, the author's live hub presence (the same lookup the contributor-offline adoption itself consults), and, when the adoption engine judged adoption due and held it, why (`blocked_by: author-is-maintainer`). The row's caption and an amber pill say it in plain words instead of a bare "Returned to contributor": `waiting on @hanthor (maintainer, offline 26h) — adopt?` under `governor.labels.stage.adoption.maintainer_policy: ask`, `waiting on @zoe (offline 40m, 2 nudges)` while the default `adopt` policy's clock runs, `… — not adopted: maintainer_policy is never` under `never` once due — before that, `never`'s countdown hedges with `… — hive adopts it in 3m unless a new head lands or the author maintains this repository` / `… — hive adopts it on the next sweep unless the author maintains this repository`, because the engine only reads the author's permission at the due moment (hivecommons/hive#15692) ([hivecommons/hive#14524](https://github.com/hivecommons/hive/pull/14524): the PR sat 26h at 072 with its author's hive gone and nothing on screen saying why). When `action` is `decide:adopt` the row also carries `decision_needed` (question "@hanthor maintains this repository and has been offline for 26h; adopt the PR?", `blocker_reason: adoption:author-is-maintainer`, options Adopt then Hold/Release), so the lit 072 chevron and the `adopt?` pill open the Needs-human popover, and the row menu and the selection bar offer **Adopt (hive takes over)** — same action-id vocabulary as the other `decide:*` entries — which, after an in-app confirm, POSTs `{"decision":"adopt"}` to the item's decision endpoint: the hive posts an attributed note, sets `adoption/supersede` (the owner-delegate's request label) and the next sweep adopts the head on the existing adopt/supersede path; the toast reads `adoption-queued`. diff --git a/src/pkg/dashboard/stage_tracker_adoption.go b/src/pkg/dashboard/stage_tracker_adoption.go index e776278633..3fdfacf454 100644 --- a/src/pkg/dashboard/stage_tracker_adoption.go +++ b/src/pkg/dashboard/stage_tracker_adoption.go @@ -215,23 +215,27 @@ func stageTrackerAdoptionText(author string, a StageTrackerAdoption, now time.Ti text += " — not adopted: a maintainer approved this head; the hive merges it as-is" case a.BlockedBy != "": text += " — not adopted: " + a.BlockedBy - case a.Policy == config.AdoptionMaintainerPolicyNever && a.AutoDue: - // The engine has not read the author's repository permission yet - // (it only does so once due): under never, a maintainer's head - // never reaches this moment at all, so the row cannot promise - // adoption the way the non-never case below does - // (hivecommons/hive#15692). - text += " — hive adopts it on the next sweep unless the author maintains this repository" - case a.Policy == config.AdoptionMaintainerPolicyNever && a.AutoAdoptAt != nil && a.AutoAdoptAt.After(now): - text += " — hive adopts it in " + stageTrackerShortDuration(max(a.AutoAdoptAt.Sub(now), time.Minute)) + " unless a new head lands or the author maintains this repository" case a.AutoDue: - text += " — hive adopts it on the next sweep" + text += " — hive adopts it on the next sweep" + stageTrackerAdoptionNeverHedge(a, " unless") case a.AutoAdoptAt != nil && a.AutoAdoptAt.After(now): - text += " — hive adopts it in " + stageTrackerShortDuration(max(a.AutoAdoptAt.Sub(now), time.Minute)) + " unless a new head lands" + text += " — hive adopts it in " + stageTrackerShortDuration(max(a.AutoAdoptAt.Sub(now), time.Minute)) + " unless a new head lands" + stageTrackerAdoptionNeverHedge(a, " or") } return text } +// stageTrackerAdoptionNeverHedge qualifies the auto-adopt countdown under +// maintainer_policy: never. The engine has not read the author's repository +// permission yet (it only does so once due), so a maintainer's head never +// reaches the promised moment at all and the row cannot promise adoption for +// every author the way it does under adopt (hivecommons/hive#15692). lead is +// the conjunction that joins the clause to the text before it. +func stageTrackerAdoptionNeverHedge(a StageTrackerAdoption, lead string) string { + if a.Policy != config.AdoptionMaintainerPolicyNever { + return "" + } + return lead + " the author maintains this repository" +} + // stageTrackerAdoptionOfflineFor renders " 26h" for the time the author's // hive has been gone: since its last heartbeat when one is known and later // than the first nudge, else since the first nudge.