Skip to content
Merged
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-rework-push-response.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- The activity monitor no longer tells an author who just force-pushed that they have given "no response" ([#16021](https://github.com/hivecommons/hive/issues/16021)): a human PR whose new head was red again re-entered 071 within one sweep, which restarted the waiting-on-push state and re-nudged for the new head, so the rework chip read `requested Β· no response` and the row kept "Needs @author". The stage record now remembers the original ask and the head pushed after it (`rework_asked_at`, `rework_pushed_head`, `rework_pushed_at`) across that re-ask, the chip reads `pushed Β· re-review pending` dated from the push with `requested_at` on the original ask (a review verdict on the pushed head is a fresh ask), and a row whose `push` field says pushed drops the "Needs @author" decision and the needs-human count until CI / the re-review settle.
10 changes: 9 additions & 1 deletion src/docs/operator-reference/sweeps-and-operations.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,15 @@ returns to the column's own word β€” stage only, the πŸ‘€ clears because the
ball is back with the hive β€” and the gray pill names the push: `@user
pushed abc1234 Β· 2m` (links to the commit), `adopted from @x's #N Β· pushed
2m ago` on an adopted row, `pushed abc1234 Β· 2m` on a plain CI / Review
row; the hive line reads `push seen 2m ago β†’ CI/re-review queued`. When the
row; the hive line reads `push seen 2m ago β†’ CI/re-review queued`. A pushed
human-authored 071 / 072 row asks nothing of a person until the hive has
looked at the new head: no "Needs @author" decision, not counted as needs-
human (hivecommons/hive#16021). When the new head is red again and the
sweep returns it to 071 within one pass, the record keeps the original ask
and the push that answered it (`rework_asked_at`, `rework_pushed_head`,
`rework_pushed_at`), so the chip reads `Β· re-review pending` dated from the
push rather than `Β· no response` for a fresh ask on the very head the
author just pushed; a review verdict on that head is a fresh ask. When the
PR allows maintainer edits (`adoption.in_place`, default on) the hive adopts
it in place: `stage/074-adopted-by-hive`, the PR's own branch filed in
`ci-failing.json` as the hive's (`adopted: true`) for the scanner's red-PR
Expand Down
4 changes: 3 additions & 1 deletion src/pkg/dashboard/stage_tracker_build.go
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,9 @@ func stageTrackerNeedsHuman(it StageTrackerItem) bool {
if slices.Contains(stageTrackerNeedsHumanStages, it.Stage) {
return true
}
return slices.Contains(stageTrackerNeedsHumanAuthorStages, it.Stage) && it.AuthorKind == authorKindHuman
// The author pushed and the hive has not evaluated the new head yet:
// the ball is with the hive, not a person (hivecommons/hive#16021).
return slices.Contains(stageTrackerNeedsHumanAuthorStages, it.Stage) && it.AuthorKind == authorKindHuman && !stageTrackerPushPending(it)
}

// stageTrackerOnHold mirrors the dashboard's stageTrackerItemOnHold: the
Expand Down
6 changes: 6 additions & 0 deletions src/pkg/dashboard/stage_tracker_decision.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,12 @@ func stageTrackerDecisionNeededWith(it StageTrackerItem, verdict *review.Aggrega
// person's to end (Adopt now / Reroute) β€” hivecommons/hive#15038.
return decisionForWaitingOnContributor(it, held, now)
case it.Kind == "pr" && it.AuthorKind == authorKindHuman && slices.Contains(stageTrackerNeedsHumanAuthorStages, it.Stage):
if stageTrackerPushPending(it) {
// The author pushed and CI / the re-review for the new head
// still run: nothing to decide until the hive has looked
// (hivecommons/hive#16021).
return nil
}
return decisionForWaitingOnAuthor(it, held)
case stageTrackerNeedsHuman(it) || (held && stageTrackerNeedsHuman(stageTrackerWithoutHold(it))):
// Flagged for a person by a stage/kind pairing none of the cases
Expand Down
20 changes: 20 additions & 0 deletions src/pkg/dashboard/stage_tracker_decision_redundant_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,23 @@ func TestDecisionForWaitingOnAuthorNeverLeadsWithClose(t *testing.T) {
t.Fatalf("closes in the menu = %d, want 2: %+v", closes, d.Options)
}
}

// hivecommons/hive#16021: once the author pushed and the new head's CI /
// re-review are still running, the row asks nothing of a person β€” the
// "waits on @author to push" question would ask for what already happened.
func TestDecisionNeededDropsWaitingOnAuthorAfterPush(t *testing.T) {
now := time.Date(2026, 10, 31, 11, 5, 0, 0, time.UTC)
it := StageTrackerItem{Repo: "hivecommons/hive", Number: 15849, Kind: "pr", Stage: 71, Author: "clubanderson", AuthorKind: authorKindHuman, Reason: "required-check-failing:build-and-test"}
if d := stageTrackerDecisionNeededAt(it, nil, "", now); d == nil || !strings.Contains(d.Question, "waits on @clubanderson to push") {
t.Fatalf("waiting row must ask: %+v", d)
}
it.Push = &StageTrackerPush{State: pushStatePushed, Login: "clubanderson", Sha: "0ff4ed17e"}
if d := stageTrackerDecisionNeededAt(it, nil, "", now); d != nil {
t.Fatalf("pushed row must ask nothing: %+v", d)
}
// Held rows still derive from the underlying state: nothing either.
it.Modifiers = []string{modHold}
if d := stageTrackerDecisionNeededAt(it, nil, "", now); d != nil {
t.Fatalf("held pushed row must ask nothing: %+v", d)
}
}
8 changes: 6 additions & 2 deletions src/pkg/dashboard/stage_tracker_needs_human_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ func TestStageTrackerNeedsHuman(t *testing.T) {
{"071 human author", StageTrackerItem{Stage: 71, AuthorKind: authorKindHuman}, true, false},
{"071 clanker author", StageTrackerItem{Stage: 71, AuthorKind: "clanker"}, false, false},
{"072 human author", StageTrackerItem{Stage: 72, AuthorKind: authorKindHuman}, true, false},
// hivecommons/hive#16021: the author pushed; CI / the re-review for
// the new head are the hive's to run.
{"071 human author who pushed", StageTrackerItem{Stage: 71, AuthorKind: authorKindHuman, Push: &StageTrackerPush{State: pushStatePushed}}, false, false},
{"071 human author still waited on", StageTrackerItem{Stage: 71, AuthorKind: authorKindHuman, Push: &StageTrackerPush{State: pushStateWaiting}}, true, false},
{"needs-human pill", StageTrackerItem{Stage: 20, Modifiers: []string{modNeedsHuman}}, true, false},
{"needs-decision pill", StageTrackerItem{Stage: 50, Modifiers: []string{modNeedsDecision}}, true, false},
{"unauthorized pill", StageTrackerItem{Stage: 50, Modifiers: []string{modUnauthorized}}, true, false},
Expand All @@ -46,8 +50,8 @@ func TestStageTrackerNeedsHuman(t *testing.T) {
items = append(items, c.it)
}
nh, oh := stageTrackerHumanCounts(items)
if nh != 9 || oh != 2 {
t.Fatalf("counts = (%d, %d), want (9, 2)", nh, oh)
if nh != 10 || oh != 2 {
t.Fatalf("counts = (%d, %d), want (10, 2)", nh, oh)
}
for i, c := range cases {
if items[i].NeedsHuman != c.needsHuman || items[i].OnHold != c.hold {
Expand Down
7 changes: 7 additions & 0 deletions src/pkg/dashboard/stage_tracker_push.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,3 +177,10 @@ func (s *Server) stageTrackerWaitingPushStale() time.Duration {
func stageTrackerPushOnHead(it StageTrackerItem, rec stagelabels.Record) bool {
return it.Head == "" || strings.EqualFold(it.Head, rec.LastPushSha) || strings.EqualFold(it.Head, rec.ActivityHead)
}

// stageTrackerPushPending reports whether the row's `push` field says a
// head landed that CI / the re-review have not settled: the ball is with
// the hive, so the row asks nothing of a person (hivecommons/hive#16021).
func stageTrackerPushPending(it StageTrackerItem) bool {
return it.Push != nil && it.Push.State == pushStatePushed
}
53 changes: 50 additions & 3 deletions src/pkg/dashboard/stage_tracker_rework.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,13 @@ func stageTrackerReworkFor(it StageTrackerItem, login string, stage stagelabels.
if requested.IsZero() {
requested = rec.EnteredAt
}
// A re-ask on the head the author pushed restarts the nudge clock and
// the stage entry; the ask the operator cares about is the original
// one (hivecommons/hive#16021).
pushedHead, pushedAt, pushed := stageTrackerReworkPushed(it, rec)
if pushed && !rec.ReworkAskedAt.IsZero() && rec.ReworkAskedAt.Before(requested) {
requested = rec.ReworkAskedAt
}
if requested.IsZero() {
return nil
}
Expand All @@ -125,9 +132,16 @@ func stageTrackerReworkFor(it StageTrackerItem, login string, stage stagelabels.
}
// Pushed: the head the request named is gone. The stage engine routes
// the row back to 050 on its next sweep; until then the row says so.
if rec.NudgeHead != "" && it.Head != "" && it.Head != rec.NudgeHead {
out.State, out.Evidence, out.Head = reworkStatePushed, reworkEvidenceCommit, it.Head
if it.UpdatedAt != nil && it.UpdatedAt.After(requested) {
// Or the engine already did, found the pushed head red again and asked
// once more for it: the author answered the ask all the same.
if pushed {
out.State, out.Evidence, out.Head = reworkStatePushed, reworkEvidenceCommit, pushedHead
if !pushedAt.IsZero() {
if pushedAt.After(now) {
pushedAt = now
}
out.Since = &pushedAt
} else if it.UpdatedAt != nil && it.UpdatedAt.After(requested) {
u := *it.UpdatedAt
out.Since = &u
}
Expand Down Expand Up @@ -183,3 +197,36 @@ func stageTrackerReworkFor(it StageTrackerItem, login string, stage stagelabels.
}
return out
}

// stageTrackerReworkPushed reports the author's head pushed after the ask,
// and when it landed when the record knows: the row's head is no longer
// the one the nudge named (the sweep has not re-staged the row yet; the
// push instant is the booked one when the webhook saw it), or the record
// remembers the push across the re-ask on that head
// (hivecommons/hive#16021) β€” unless the re-ask is a review verdict on it,
// which means the re-review the push queued has happened and the new ask
// stands on its own.
func stageTrackerReworkPushed(it StageTrackerItem, rec stagelabels.Record) (head string, at time.Time, ok bool) {
if rec.NudgeHead != "" && it.Head != "" && it.Head != rec.NudgeHead {
if strings.EqualFold(rec.LastPushSha, it.Head) {
at = rec.LastPushAt
}
return it.Head, at, true
}
head, at, ok = rec.ReworkPushed()
if !ok || (it.Head != "" && !strings.EqualFold(it.Head, head)) {
return "", time.Time{}, false
}
if stageTrackerReworkAnswered(rec.Reason) {
return "", time.Time{}, false
}
return head, at, true
}

// stageTrackerReworkAnswered reports whether the standing ask's reason is
// a review verdict β€” a reviewer or the swarm looked at the pushed head and
// asked for more β€” rather than a gate the hive reads off the head (CI,
// conflict, sign-off).
func stageTrackerReworkAnswered(reason string) bool {
return stageTrackerPushNext(stagelabels.NeedsAuthor, reason) == pushNextReReview
}
20 changes: 20 additions & 0 deletions src/pkg/dashboard/stage_tracker_rework_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,26 @@ func TestStageTrackerReworkFor(t *testing.T) {
state: "requested", actor: "zoe", since: requested, reqAtFrom: requested},
{name: "new head pushed", it: pr("bbb", tp(-3*time.Minute)), login: "zoe", stage: stagelabels.ReturnedToContributor, rec: nudged, hasRec: true, fixWork: inflight,
state: "pushed", evidence: "commit", actor: "zoe", since: now.Add(-3 * time.Minute), head: "bbb", reqAtFrom: requested},
// hivecommons/hive#16021: the author force-pushed (rebased commits
// keep their old dates; the list payload's updated_at predates the
// ask), the sweep re-entered 071 for the new red head and re-nudged
// for it. The record remembers the push: pushed, dated from the
// push, requested_at from the original ask.
{name: "re-asked on the pushed head still reads pushed", it: pr("bbb", tp(-2*time.Hour)), login: "zoe", stage: stagelabels.NeedsAuthor,
rec: stagelabels.Record{Stage: stagelabels.NeedsAuthor, Reason: "optional-check-failing:server-tests", EnteredAt: now.Add(-10 * time.Minute), NudgeHead: "bbb", FirstNudgeAt: now.Add(-10 * time.Minute), LastNudgeAt: now.Add(-10 * time.Minute), NudgeCount: 1,
ReworkAskedAt: requested, ReworkPushedHead: "bbb", ReworkPushedAt: now.Add(-12 * time.Minute)}, hasRec: true, fixWork: none,
state: "pushed", evidence: "commit", actor: "zoe", since: now.Add(-12 * time.Minute), head: "bbb", reqAtFrom: requested},
{name: "review verdict on the pushed head is a fresh ask", it: pr("bbb", nil), login: "zoe", stage: stagelabels.NeedsAuthor,
rec: stagelabels.Record{Stage: stagelabels.NeedsAuthor, Reason: stagelabels.LaneReasonChangesRequested, EnteredAt: now.Add(-10 * time.Minute), NudgeHead: "bbb", FirstNudgeAt: now.Add(-10 * time.Minute), LastNudgeAt: now.Add(-10 * time.Minute), NudgeCount: 1,
ReworkAskedAt: requested, ReworkPushedHead: "bbb", ReworkPushedAt: now.Add(-12 * time.Minute)}, hasRec: true, fixWork: none,
state: "requested", actor: "zoe", since: now.Add(-10 * time.Minute), reqAtFrom: now.Add(-10 * time.Minute)},
{name: "remembered push on another head does not vouch for this one", it: pr("ccc", nil), login: "zoe", stage: stagelabels.NeedsAuthor,
rec: stagelabels.Record{Stage: stagelabels.NeedsAuthor, Reason: "conflicting", EnteredAt: now.Add(-10 * time.Minute), NudgeHead: "ccc", FirstNudgeAt: now.Add(-10 * time.Minute), LastNudgeAt: now.Add(-10 * time.Minute), NudgeCount: 1,
ReworkAskedAt: requested, ReworkPushedHead: "bbb", ReworkPushedAt: now.Add(-12 * time.Minute)}, hasRec: true, fixWork: none,
state: "requested", actor: "zoe", since: now.Add(-10 * time.Minute), reqAtFrom: now.Add(-10 * time.Minute)},
{name: "webhook-booked push dates the pushed state", it: pr("bbb", tp(-2*time.Hour)), login: "zoe", stage: stagelabels.ReturnedToContributor,
rec: stagelabels.Record{Stage: stagelabels.ReturnedToContributor, EnteredAt: requested.Add(-time.Minute), NudgeHead: "aaa", FirstNudgeAt: requested, LastNudgeAt: requested, NudgeCount: 1, LastPushSha: "bbb", LastPushAt: now.Add(-4 * time.Minute)}, hasRec: true, fixWork: none,
state: "pushed", evidence: "commit", actor: "zoe", since: now.Add(-4 * time.Minute), head: "bbb", reqAtFrom: requested},
}
for _, tc := range cases {
t.Run(tc.name, func(t *testing.T) {
Expand Down
71 changes: 71 additions & 0 deletions src/pkg/stagelabels/push_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,74 @@ func TestStoreNotePushEnumerateFallback(t *testing.T) {
t.Fatalf("waiting clock must survive a reload: %+v ok=%v", rec, ok)
}
}

// TestStoreReworkPushSurvivesReAsk (hivecommons/hive#16021): the author
// answers a 071 ask with a new head; the sweep re-stages the PR to 050 and,
// the head red again, back to 071 within one pass, re-nudging for it. That
// re-entry restarts the waiting-on-push state and the nudge clock, but the
// record keeps the original ask and the push that answered it.
func TestStoreReworkPushSurvivesReAsk(t *testing.T) {
now := time.Date(2026, 10, 30, 22, 48, 0, 0, time.UTC)
s := NewStore(filepath.Join(t.TempDir(), "stage.json"), func() time.Time { return now })
key := Key("hivecommons/hive", 15849)
asked := now
s.Observe(key, NeedsAuthor, "required-check-failing:build-and-test")
s.NoteActivity(key, Activity{Head: "3746f58", Comments: -1, Reviews: -1})
s.MarkNudged(key, "3746f58", 1, false, now)
rec, _ := s.Get(key)
if !rec.ReworkAskedAt.Equal(asked) || rec.ReworkPushedHead != "" {
t.Fatalf("071 entry must open the ask and nothing else: %+v", rec)
}
// The webhook sees the force-push (rebased commits keep their old
// dates; only the delivery instant counts).
pushAt := now.Add(12 * time.Hour)
now = pushAt.Add(time.Minute)
if !s.NotePush(key, "0ff4ed1", pushAt) {
t.Fatal("new head is a push")
}
// Sweep A: CI pending on the new head β†’ 050, waiting on the hive.
now = now.Add(time.Minute)
s.Observe(key, ReviewPending, "required-check-pending:sign-off")
s.NoteActivity(key, Activity{Head: "0ff4ed1", Comments: -1, Reviews: -1, WaitingOnHive: true})
// Sweep B, seconds later: an optional check failed fast β†’ 071 again,
// nudged for the new head.
now = now.Add(12 * time.Second)
s.Observe(key, NeedsAuthor, "optional-check-failing:server-tests")
s.MarkNudged(key, "0ff4ed1", 1, false, now)
s.NoteActivity(key, Activity{Head: "0ff4ed1", Comments: -1, Reviews: -1})
rec, _ = s.Get(key)
if rec.LastPushSha != "" || !rec.WaitingPushSince.Equal(now) || rec.NudgeHead != "0ff4ed1" || !rec.FirstNudgeAt.Equal(now) {
t.Fatalf("re-entry must restart the push wait and the nudge clock as before: %+v", rec)
}
head, at, ok := rec.ReworkPushed()
if !ok || head != "0ff4ed1" || !at.Equal(pushAt) || !rec.ReworkAskedAt.Equal(asked) {
t.Fatalf("the push that answered the ask must survive the re-ask: %+v", rec)
}
// A second push the webhook missed, seen by the enumerate while the
// row still sits at 071, replaces it.
now = now.Add(time.Hour)
s.NoteActivity(key, Activity{Head: "0157cc9", Comments: -1, Reviews: -1})
rec, _ = s.Get(key)
if head, at, _ = rec.ReworkPushed(); head != "0157cc9" || !at.Equal(now) {
t.Fatalf("enumerate head change must book the newer push: %+v", rec)
}
// The hive evaluates it, finds it green and waits on nobody: the
// exchange is over, the next 071 is a fresh ask.
now = now.Add(time.Minute)
s.Observe(key, ReviewPending, "review-gate:awaiting-review-approval")
s.NoteActivity(key, Activity{Head: "0157cc9", Comments: -1, Reviews: -1})
rec, _ = s.Get(key)
if _, _, ok := rec.ReworkPushed(); ok || !rec.ReworkAskedAt.IsZero() {
t.Fatalf("settled head must close the ask: %+v", rec)
}
now = now.Add(time.Hour)
s.Observe(key, NeedsAuthor, LaneReasonChangesRequested)
if rec, _ := s.Get(key); !rec.ReworkAskedAt.Equal(now) || rec.ReworkPushedHead != "" {
t.Fatalf("a later 071 is a new ask: %+v", rec)
}
// Leaving the CI / Review column forgets it all.
s.Observe(key, AwaitingMergeAdmission, "green")
if rec, _ := s.Get(key); !rec.ReworkAskedAt.IsZero() || rec.ReworkPushedHead != "" {
t.Fatalf("leaving the column must clear the ask: %+v", rec)
}
}
Loading
Loading