Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/fixed-15692-never-adopt-countdown.md
Original file line number Diff line number Diff line change
@@ -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.
6 changes: 5 additions & 1 deletion src/docs/labels-and-control-signals.md
Original file line number Diff line number Diff line change
Expand Up @@ -1931,7 +1931,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
Expand Down
9 changes: 9 additions & 0 deletions src/pkg/dashboard/stage_tracker_adoption.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,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):
Expand Down
32 changes: 32 additions & 0 deletions src/pkg/dashboard/stage_tracker_adoption_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading