From f72561ef88efb7c7303344b85cf9bdfd175566c4 Mon Sep 17 00:00:00 2001 From: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> Date: Wed, 28 Oct 2026 13:12:34 -0400 Subject: [PATCH 1/2] =?UTF-8?q?=F0=9F=90=9B=20fix(stage):=20no-linked-issu?= =?UTF-8?q?e=20PRs=20do=20not=20wait=20on=20the=20hive=20past=20dwell?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A contributor PR skipped with contributor-lane:no-linked-issue at 050 never gets a reviewer verdict, yet the verdict-less review-pending rule marked it waiting on the hive, so the dwell warning blamed the reviewer lane and re-fired whenever the activity digest changed. It is waiting on the contributor or a maintainer. Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> --- changelog.d/fixed-15009-stage-dwell-warning.md | 1 + src/pkg/github/automerge/automerge_stage_labels.go | 7 +++++-- .../automerge/automerge_stage_sharedci_test.go | 13 +++++++++++++ 3 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 changelog.d/fixed-15009-stage-dwell-warning.md diff --git a/changelog.d/fixed-15009-stage-dwell-warning.md b/changelog.d/fixed-15009-stage-dwell-warning.md new file mode 100644 index 0000000000..c4904b1b94 --- /dev/null +++ b/changelog.d/fixed-15009-stage-dwell-warning.md @@ -0,0 +1 @@ +- A contributor PR with no linked issue no longer logs the "waits on the hive past the stage dwell — reviewer lane needs attention" warning; it is waiting on a person, not the reviewer lane (#15009) diff --git a/src/pkg/github/automerge/automerge_stage_labels.go b/src/pkg/github/automerge/automerge_stage_labels.go index 27f1c93c6d..7bfb095760 100644 --- a/src/pkg/github/automerge/automerge_stage_labels.go +++ b/src/pkg/github/automerge/automerge_stage_labels.go @@ -591,9 +591,12 @@ func stageActivity(obs stageObservation, stage stagelabels.Stage) stagelabels.Ac sort.Strings(labels) a.Digest = verdict + "|ci:" + ci.String() + "|" + strings.Join(labels, ",") // Checks still running, or a review-pending head with no reviewer - // verdict yet, is waiting on the hive, not on a person. + // verdict yet, is waiting on the hive, not on a person. A contributor PR + // the lane skipped for want of a linked issue gets no verdict until the + // contributor or a maintainer acts, so it never waits on the hive. a.WaitingOnHive = ci == ciReasonPending || stageReasonWaitsOnHive(obs.Reason) || - (stage == stagelabels.ReviewPending && !(obs.Detail.VerdictKnown && obs.Detail.Verdict.Verdict != "")) + (stage == stagelabels.ReviewPending && obs.Reason != prstage.ContributorLaneReasonNoLinkedIssue && + !(obs.Detail.VerdictKnown && obs.Detail.Verdict.Verdict != "")) return a } diff --git a/src/pkg/github/automerge/automerge_stage_sharedci_test.go b/src/pkg/github/automerge/automerge_stage_sharedci_test.go index 2371613f87..afb589ee0f 100644 --- a/src/pkg/github/automerge/automerge_stage_sharedci_test.go +++ b/src/pkg/github/automerge/automerge_stage_sharedci_test.go @@ -7,6 +7,7 @@ import ( "time" gh "github.com/google/go-github/v72/github" + "github.com/hivecommons/hive/pkg/stageengine/prstage" "github.com/hivecommons/hive/pkg/stagelabels" ) @@ -56,6 +57,18 @@ func TestStageActivitySharedCIAndBudgetWaitOnHive(t *testing.T) { } } +// A contributor PR skipped for no-linked-issue is waiting on a person, so +// the stage-dwell "waits on the hive" warning must not fire for it. +func TestStageActivityNoLinkedIssueDoesNotWaitOnHive(t *testing.T) { + obs := stageObservation{HeadSHA: "sha", Reason: prstage.ContributorLaneReasonNoLinkedIssue} + if a := stageActivity(obs, stagelabels.ReviewPending); a.WaitingOnHive { + t.Fatal("no-linked-issue waits on the hive") + } + if a := stageActivity(stageObservation{HeadSHA: "sha"}, stagelabels.ReviewPending); !a.WaitingOnHive { + t.Fatal("verdict-less review-pending head no longer waits on the hive") + } +} + // A base-red clanker PR stays at 050 across repeated sweeps — no 072, no // nudge comment or relay interrupt, no stall — and is handed back to its // author with a nudge only once the incident closes and the head is still From c5939b62ab14849e0e8766ba462e3f75156de393 Mon Sep 17 00:00:00 2001 From: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> Date: Wed, 28 Oct 2026 19:14:39 -0400 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=90=9B=20fix(stage):=20keep=20running?= =?UTF-8?q?=20checks=20waiting=20on=20the=20hive=20for=20no-linked-issue?= =?UTF-8?q?=20heads?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The no-linked-issue admission reason is decided before CI is read, so once the missing-verdict exclusion applies, a 050 head whose checks are still running had no WaitingOnHive signal left and could read as stalled after the dwell. ApplyStageLabels now honours the human route's check digest for a review-pending head; the unit test uses the package alias and an ApplyStageLabels-level test covers the pending and settled paths. Hive-Fix-Attempt: 1/6 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> --- .../automerge/automerge_stage_human_test.go | 39 +++++++++++++++++++ .../automerge/automerge_stage_labels.go | 16 ++++++-- .../automerge_stage_sharedci_test.go | 3 +- 3 files changed, 53 insertions(+), 5 deletions(-) diff --git a/src/pkg/github/automerge/automerge_stage_human_test.go b/src/pkg/github/automerge/automerge_stage_human_test.go index 46a0da32ab..b2d16d05e3 100644 --- a/src/pkg/github/automerge/automerge_stage_human_test.go +++ b/src/pkg/github/automerge/automerge_stage_human_test.go @@ -542,3 +542,42 @@ func TestDecisionEntryRepostsWhenCauseChanges(t *testing.T) { t.Fatalf("cause list grew: %+v", rec) } } + +// TestHumanHandoffNoLinkedIssuePendingChecksWaitOnHive: a contributor PR +// admission skipped for no-linked-issue carries no CI state in its reason, +// so the human route's check digest decides whether the 050 head waits on +// the hive (hivecommons/hive#15009): running checks do, a settled head with +// no verdict does not. +func TestHumanHandoffNoLinkedIssuePendingChecksWaitOnHive(t *testing.T) { + api, closeAPI := seededStageAPI(t) + defer closeAPI() + clock := &contributorLaneClock{at: time.Date(2026, 10, 28, 12, 0, 0, 0, time.UTC)} + verdict := &ContributorLaneVerdict{Configured: true} + e, store := humanStageEngine(t, api.url, clock, verdict, 0) + e.checkSummary = func(context.Context, string, string, string) (hgithub.CommitChecksSummary, error) { + return hgithub.CommitChecksSummary{Total: 3, Green: 1, Pending: 2, DCO: 1}, nil + } + sweep := func() { + t.Helper() + pr := stagePR(11, "role/contributor", "author/human") + pr.Head.SHA = ptrString("sha11") + e.recordStage(stageLaneContributor, "acme/widget", "acme", "widget", pr, contributorLaneReasonNoLinkedIssue, false, nil) + e.noteStageRole("acme", "widget", 11, stagelabels.RoleContributor) + if _, err := e.ApplyStageLabels(context.Background()); err != nil { + t.Fatal(err) + } + } + sweep() + rec, _ := store.Get(stageKey("acme", "widget", 11)) + if rec.Stage != stagelabels.ReviewPending || !rec.WaitingOnHive { + t.Fatalf("pending checks: stage=%v waiting_on_hive=%v", rec.Stage, rec.WaitingOnHive) + } + + e.checkSummary = greenChecks + clock.at = clock.at.Add(humanChecksTTL) + sweep() + rec, _ = store.Get(stageKey("acme", "widget", 11)) + if rec.Stage != stagelabels.ReviewPending || rec.WaitingOnHive { + t.Fatalf("checks settled, no verdict: stage=%v waiting_on_hive=%v", rec.Stage, rec.WaitingOnHive) + } +} diff --git a/src/pkg/github/automerge/automerge_stage_labels.go b/src/pkg/github/automerge/automerge_stage_labels.go index 7bfb095760..43beb9032b 100644 --- a/src/pkg/github/automerge/automerge_stage_labels.go +++ b/src/pkg/github/automerge/automerge_stage_labels.go @@ -593,9 +593,11 @@ func stageActivity(obs stageObservation, stage stagelabels.Stage) stagelabels.Ac // Checks still running, or a review-pending head with no reviewer // verdict yet, is waiting on the hive, not on a person. A contributor PR // the lane skipped for want of a linked issue gets no verdict until the - // contributor or a maintainer acts, so it never waits on the hive. + // contributor or a maintainer acts, so the missing verdict alone does + // not make it wait on the hive (ApplyStageLabels still honours the + // head's running checks from the human route's digest). a.WaitingOnHive = ci == ciReasonPending || stageReasonWaitsOnHive(obs.Reason) || - (stage == stagelabels.ReviewPending && obs.Reason != prstage.ContributorLaneReasonNoLinkedIssue && + (stage == stagelabels.ReviewPending && obs.Reason != contributorLaneReasonNoLinkedIssue && !(obs.Detail.VerdictKnown && obs.Detail.Verdict.Verdict != "")) return a } @@ -953,7 +955,15 @@ func (c *Engine) ApplyStageLabels(ctx context.Context) (StageLabelResult, error) if verdict.Stage != stagelabels.ReturnedToContributor && verdict.Stage != stagelabels.NeedsAuthor { c.resolveNudge(ctx, prevRec, hadPrev, obs) } - store.NoteActivity(key, stageActivity(obs, verdict.Stage)) + act := stageActivity(obs, verdict.Stage) + if !act.WaitingOnHive && verdict.Stage == stagelabels.ReviewPending && pass.Route != nil && pass.Route.Checks.Known && pass.Route.Checks.Pending > 0 { + // An admission reason decided before CI was read (no + // linked issue) says nothing about the checks; the human + // route's digest of the head does, and running checks + // wait on the hive. + act.WaitingOnHive = true + } + store.NoteActivity(key, act) rec, _ := store.Get(key) want = stagelabels.Desired{ Stage: verdict.Stage, diff --git a/src/pkg/github/automerge/automerge_stage_sharedci_test.go b/src/pkg/github/automerge/automerge_stage_sharedci_test.go index afb589ee0f..a7fb688d37 100644 --- a/src/pkg/github/automerge/automerge_stage_sharedci_test.go +++ b/src/pkg/github/automerge/automerge_stage_sharedci_test.go @@ -7,7 +7,6 @@ import ( "time" gh "github.com/google/go-github/v72/github" - "github.com/hivecommons/hive/pkg/stageengine/prstage" "github.com/hivecommons/hive/pkg/stagelabels" ) @@ -60,7 +59,7 @@ func TestStageActivitySharedCIAndBudgetWaitOnHive(t *testing.T) { // A contributor PR skipped for no-linked-issue is waiting on a person, so // the stage-dwell "waits on the hive" warning must not fire for it. func TestStageActivityNoLinkedIssueDoesNotWaitOnHive(t *testing.T) { - obs := stageObservation{HeadSHA: "sha", Reason: prstage.ContributorLaneReasonNoLinkedIssue} + obs := stageObservation{HeadSHA: "sha", Reason: contributorLaneReasonNoLinkedIssue} if a := stageActivity(obs, stagelabels.ReviewPending); a.WaitingOnHive { t.Fatal("no-linked-issue waits on the hive") }