From 5594ae76dadc38e2ba7db45ef468e8c87e56056d Mon Sep 17 00:00:00 2001 From: Danathar <6772335+Danathar@users.noreply.github.com> Date: Tue, 17 Nov 2026 14:15:14 -0500 Subject: [PATCH 1/2] =?UTF-8?q?=F0=9F=90=9B=20delegate:=20an=20offline=20a?= =?UTF-8?q?uthor's=20PR=20is=20not=20"picked=20up"=20by=20someone=20else's?= =?UTF-8?q?=20activity?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit "Let hive decide" returned projectbluefin/bluefin-bling#128 to an author whose clanker had been offline for a day (rule return-to-contributor, "the author's clanker has picked the rework up"). delegatedReworkPickedUp counted the tracker's "acknowledged" rework state, which only says the PR's updated_at moved after the request: a maintainer's review on 11-11 moved it. The direction timed out after 30 minutes, and because stageTrackerWaitKind skips every row with a decision record, the PR never reached Waiting on you; it sat five days until closed by hand. - delegatedReworkPickedUp counts only in_progress (the author's relay holds the fix task) and pushed (a new head). An offline author now falls through to the adoption rung. - stageTrackerWaitKind skips a decided row only while its effect has not timed out; a timed-out decision is a person's wait again by the row's real stage. Signed-off-by: Danathar <6772335+Danathar@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01BQYnPGFJx81c8JXR3o1sg1 --- .../fixed-delegate-offline-author-return.md | 1 + src/pkg/dashboard/delegated_ladder.go | 14 +++-- .../dashboard/delegated_rework_pickup_test.go | 53 +++++++++++++++++++ .../dashboard/stage_tracker_decided_test.go | 5 ++ src/pkg/dashboard/stage_tracker_waiting.go | 8 ++- .../dashboard/stage_tracker_waiting_test.go | 8 ++- src/pkg/delegatedecision/policy.go | 6 +-- 7 files changed, 83 insertions(+), 12 deletions(-) create mode 100644 changelog.d/fixed-delegate-offline-author-return.md create mode 100644 src/pkg/dashboard/delegated_rework_pickup_test.go diff --git a/changelog.d/fixed-delegate-offline-author-return.md b/changelog.d/fixed-delegate-offline-author-return.md new file mode 100644 index 0000000000..4c66c6560e --- /dev/null +++ b/changelog.d/fixed-delegate-offline-author-return.md @@ -0,0 +1 @@ +- "Let hive decide" no longer sends a PR back to an author whose clanker is offline just because someone else touched the PR. The rework-pickup signal it reads counted any change to the PR's `updated_at` as the author having "picked the rework up": a maintainer's review, a comment or a label all count. On projectbluefin/bluefin-bling#128 a maintainer's review made the hive return the PR to an author who had been offline for a day, and nothing followed for five days. Only a fix task the author's relay has taken, or a new head, counts now. An offline author falls through to the next rung, which adopts the PR. Separately, a hive decision whose effect timed out ("no effect after 30m") now shows in **Waiting on you** by the PR's real stage. Nothing re-runs such a decision, and until now the row dropped out of that list for good. diff --git a/src/pkg/dashboard/delegated_ladder.go b/src/pkg/dashboard/delegated_ladder.go index 758afc15ba..d5648739b6 100644 --- a/src/pkg/dashboard/delegated_ladder.go +++ b/src/pkg/dashboard/delegated_ladder.go @@ -64,10 +64,14 @@ func (s *Server) delegatedAuthorTooling(labels []string, owner bool) delegatedec } // delegatedReworkPickedUp reads the rework-pickup signal of -// hivecommons/hive#15280 for the PR's author: their relay holds or queued -// the fix task, someone acted on the PR since the request, or a new head -// is up. It rests on the stage record and the hub's fix queue; no GitHub -// call. "requested" (nobody has acted) is not a pickup. +// hivecommons/hive#15280 for the PR's author: their relay holds the fix +// task, or a new head is up. It rests on the stage record and the hub's fix +// queue; no GitHub call. "requested" (nobody has acted) is not a pickup, +// and neither is "acknowledged": that state only says the PR's updated_at +// moved after the request, which anyone's review, comment or label moves. +// Read as the author's pickup, a maintainer's review on a PR whose author +// had been offline for a day sent it back to that author, and nothing +// followed for five days (projectbluefin/bluefin-bling#128). func (s *Server) delegatedReworkPickedUp(repoFull string, pr *gh.PullRequest, author string, now time.Time) bool { rec, ok := s.stageStoreOrShared().Get(stagelabels.Key(repoFull, pr.GetNumber())) if !ok { @@ -83,7 +87,7 @@ func (s *Server) delegatedReworkPickedUp(repoFull string, pr *gh.PullRequest, au return false } switch rw.State { - case reworkStateAcknowledged, reworkStateInProgress, reworkStatePushed: + case reworkStateInProgress, reworkStatePushed: return true } return false diff --git a/src/pkg/dashboard/delegated_rework_pickup_test.go b/src/pkg/dashboard/delegated_rework_pickup_test.go new file mode 100644 index 0000000000..d79f23b933 --- /dev/null +++ b/src/pkg/dashboard/delegated_rework_pickup_test.go @@ -0,0 +1,53 @@ +package dashboard + +import ( + "testing" + "time" + + gh "github.com/google/go-github/v72/github" + + "github.com/hivecommons/hive/pkg/stagelabels" +) + +// projectbluefin/bluefin-bling#128: the PR sat at 085 from 11-08, a +// maintainer reviewed it on 11-11, and "Let hive decide" on 11-12 read the +// review's updated_at bump as the author's clanker picking the rework up. +// The author had been offline for a day; the PR went back to them and +// nothing followed. Only a fix task the author's relay holds, or a new head, +// is a pickup. +func TestDelegatedReworkPickedUpIgnoresAnyonesActivity(t *testing.T) { + entered := time.Date(2026, 11, 8, 20, 44, 0, 0, time.UTC) + reviewed := time.Date(2026, 11, 11, 15, 3, 21, 0, time.UTC) + decided := time.Date(2026, 11, 12, 19, 16, 34, 0, time.UTC) + const repo, author = "projectbluefin/bluefin-bling", "mendezr" + store := stagelabels.NewStore("", func() time.Time { return entered }) + store.ObserveHead(stagelabels.Key(repo, 128), "bbd5a8d", stagelabels.NeedsDecision, "adoption-stalled:hive-signoff-attribution") + rec, _ := store.Get(stagelabels.Key(repo, 128)) + pr := &gh.PullRequest{Number: gh.Ptr(128), Head: &gh.PullRequestBranch{SHA: gh.Ptr("bbd5a8d")}, UpdatedAt: &gh.Timestamp{Time: reviewed}} + + // The tracker does read the bump as "acknowledged"… + it := StageTrackerItem{Repo: repo, Kind: "pr", Number: 128, Head: "bbd5a8d", UpdatedAt: &reviewed} + if rw := stageTrackerReworkFor(it, author, stagelabels.ReturnedToContributor, rec, true, nil, decided); rw == nil || rw.State != reworkStateAcknowledged { + t.Fatalf("rework = %+v, want the activity-only acknowledged state this test is about", rw) + } + // …but the delegate does not take it for the author's pickup. + s := &Server{stageStore: store} + if s.delegatedReworkPickedUp(repo, pr, author, decided) { + t.Fatal("a maintainer's review read as the offline author picking the rework up") + } + + // The author's relay holding the fix task is a pickup. + s.fixWorkLookup = func(login, r string, number int) (StageTrackerFixWork, bool) { + return StageTrackerFixWork{InFlight: true, DispatchedAt: decided.Add(-time.Hour)}, login == author && r == repo && number == 128 + } + if !s.delegatedReworkPickedUp(repo, pr, author, decided) { + t.Fatal("an in-flight fix task held by the author's relay is not a pickup") + } + // A task only queued on the hub, never taken, is not. + s.fixWorkLookup = func(string, string, int) (StageTrackerFixWork, bool) { + return StageTrackerFixWork{Queued: true, QueuedAt: decided.Add(-time.Hour)}, true + } + if s.delegatedReworkPickedUp(repo, pr, author, decided) { + t.Fatal("a queued, untaken fix task read as a pickup") + } +} diff --git a/src/pkg/dashboard/stage_tracker_decided_test.go b/src/pkg/dashboard/stage_tracker_decided_test.go index 3c295d2cb0..b70da8b933 100644 --- a/src/pkg/dashboard/stage_tracker_decided_test.go +++ b/src/pkg/dashboard/stage_tracker_decided_test.go @@ -133,6 +133,11 @@ func TestStageTrackerDecidedProjection(t *testing.T) { if !strings.Contains(pr.Decided.Title, "not in effect after 30m") { t.Fatalf("title %q", pr.Decided.Title) } + // Nothing re-runs a timed-out decision: the row is a person's wait + // again, by its real stage. + if kind, who := stageTrackerWaitKind(pr); kind != waitKindReadyForHumanMerge || who != waitWhoOperator { + t.Fatalf("timed-out wait kind/who = %s/%s, want %s/%s", kind, who, waitKindReadyForHumanMerge, waitWhoOperator) + } }) t.Run("approve reads approving; other verdicts never do", func(t *testing.T) { diff --git a/src/pkg/dashboard/stage_tracker_waiting.go b/src/pkg/dashboard/stage_tracker_waiting.go index e5c956874b..82b07380f6 100644 --- a/src/pkg/dashboard/stage_tracker_waiting.go +++ b/src/pkg/dashboard/stage_tracker_waiting.go @@ -75,9 +75,13 @@ var stageTrackerReturnedStages = []int{stagelabels.NeedsAuthor.Number(), stagela // standing meta issues and already-decided rows never count: hold is the // operator's own choice, an advisory asks for nothing, a bot Dependency // Dashboard is a control panel whatever labels it wears, and a decided -// row is the hive's to act on next. +// row is the hive's to act on next. A decision whose effect timed out is +// no longer the hive's: nothing re-runs it, so the row waits on a person +// again by its real stage (projectbluefin/bluefin-bling#128 sat five days +// as "no effect after 30m" and never reached Waiting on you). func stageTrackerWaitKind(it StageTrackerItem) (kind, who string) { - if stageTrackerOnHold(it) || it.Advisory != nil || it.Decided != nil || stageTrackerWaitStandingMeta(it) { + decided := it.Decided != nil && it.Decided.Effect != decidedEffectTimedOut + if stageTrackerOnHold(it) || it.Advisory != nil || decided || stageTrackerWaitStandingMeta(it) { return "", "" } switch { diff --git a/src/pkg/dashboard/stage_tracker_waiting_test.go b/src/pkg/dashboard/stage_tracker_waiting_test.go index f07e0bbab7..ce8f5fd659 100644 --- a/src/pkg/dashboard/stage_tracker_waiting_test.go +++ b/src/pkg/dashboard/stage_tracker_waiting_test.go @@ -34,17 +34,21 @@ func TestStageTrackerWaitingOnHuman_KindsAndAttribution(t *testing.T) { {Repo: "o/r", Number: 60, Kind: "pr", Stage: stagelabels.NeedsDecision.Number(), Modifiers: []string{modHold}}, {Repo: "o/r", Number: 61, Kind: "pr", Stage: stagelabels.NeedsDecision.Number(), Advisory: &StageTrackerAdvisory{}}, {Repo: "o/r", Number: 62, Kind: "pr", Stage: stagelabels.NeedsDecision.Number(), Decided: &StageTrackerDecided{}}, + // …unless the decision timed out: nothing re-runs it, so the row + // waits on a person by its real stage (projectbluefin/bluefin-bling#128). + {Repo: "o/r", Number: 64, Kind: "pr", Stage: stagelabels.NeedsDecision.Number(), Decided: &StageTrackerDecided{Effect: decidedEffectTimedOut}}, // a nested PR is counted once, under its issue. {Repo: "o/r", Number: 63, Kind: "pr", Stage: stagelabels.NeedsDecision.Number(), NestedUnder: 20}, // an ordinary in-flight PR waits on nobody. {Repo: "o/r", Number: 70, Kind: "pr", Stage: 60}, } got := stageTrackerWaitingOnHuman(items) - if got.Count != 6 || len(got.Items) != 6 { - t.Fatalf("count = %d (%d items), want 6: %+v", got.Count, len(got.Items), got.Items) + if got.Count != 7 || len(got.Items) != 7 { + t.Fatalf("count = %d (%d items), want 7: %+v", got.Count, len(got.Items), got.Items) } want := map[int][2]string{ 15312: {waitKindNeedsDecision, waitWhoOperator}, + 64: {waitKindNeedsDecision, waitWhoOperator}, 20: {waitKindNeedsDecision, waitWhoOperator}, 15433: {waitKindReadyForHumanMerge, waitWhoOperator}, 30: {waitKindApproveNeeded, waitWhoOperator}, diff --git a/src/pkg/delegatedecision/policy.go b/src/pkg/delegatedecision/policy.go index 262816eba6..3ea66d576c 100644 --- a/src/pkg/delegatedecision/policy.go +++ b/src/pkg/delegatedecision/policy.go @@ -302,9 +302,9 @@ type Input struct { // AuthorTooling: what the author drives (hive / clanker / person); // picks the words a decision uses for them (AuthorWord). AuthorTooling AuthorTooling - // ReworkPickedUp: the author's relay has acknowledged, claimed or - // pushed the requested rework (hivecommons/hive#15280's signal), so - // they are responsive even without recent activity. + // ReworkPickedUp: the author's relay has claimed or pushed the + // requested rework (hivecommons/hive#15280's signal), so they are + // responsive even without recent activity. ReworkPickedUp bool // RepoPaused: the repo is under an operator pause; a decision that // would write (close) is recommend-only instead. From 2c880a9f4595c4d12e3c094f0e555fd4178e95d6 Mon Sep 17 00:00:00 2001 From: Danathar <6772335+Danathar@users.noreply.github.com> Date: Tue, 17 Nov 2026 20:36:57 +0000 Subject: [PATCH 2/2] ci: re-run checks after mutation job checkout stall MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Mutation (advisory) job on 291d6d1 was cancelled at its 20-minute timeout while actions/checkout's `git fetch` hung; no code ran. No source change — this empty commit gives the PR a fresh head for CI. Co-Authored-By: Claude Opus 5.5 Signed-off-by: Danathar <6772335+Danathar@users.noreply.github.com>