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/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/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..3fdfacf454 100644 --- a/src/pkg/dashboard/stage_tracker_adoption.go +++ b/src/pkg/dashboard/stage_tracker_adoption.go @@ -216,13 +216,26 @@ func stageTrackerAdoptionText(author string, a StageTrackerAdoption, now time.Ti case a.BlockedBy != "": text += " — not adopted: " + a.BlockedBy 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. 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