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-rereview-outdated-change-request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- A pull request whose only standing change request is on an older commit the author has already pushed past now waits on the reviewer, not the author. The contributor and trusted-author lanes used to treat any standing `CHANGES_REQUESTED` review as the author's turn, whatever commit it was on. So a clanker PR whose author had pushed the fix sat at `stage/072-returned-to-contributor`, its author was nudged, and once the adoption grace ran out the Activity monitor asked "@author has been offline … take the PR over now?" On projectbluefin/chairlift#799 that lasted about 2h 45m after the author had pushed and commented. The lanes now return `re-review-requested:<reviewer>` and the PR routes to `stage/085-needs-decision`, where the 085 note and the monitor name the reviewer, the commit their review was on and the author's push since, and ask for a re-review or a dismissal. The author gets no nudge and no adoption clock runs. A request on the current head, one carried to it by a merge of the base, red CI or a swarm `changes_requested` on the new head is still the author's, as before. The hive never dismisses the review itself.
1 change: 1 addition & 0 deletions src/docs/labels-and-control-signals/stage-labels.md
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,7 @@ used to admit the PR:
| a posted reviewer decision question (`decision_requested`) on a conflicting / not-mergeable / changes-requested head | `085-needs-decision`, reason `contributor-lane:decision-requested` — no fixer is kicked for such a head, and a conflict is moot if the answer is to close it ([#14607](https://github.com/hivecommons/hive/issues/14607)) |
| a trusted maintainer answered that question on the same head — `/hive decision <instruction>` or a CHANGES_REQUESTED review (recorded in `review-human-change-requests.json`, head-scoped) | `070-fixing`, reason `contributor-lane:decision-answered`: the answer is folded into the reviewer verdict for that head on every tick and after a restart, so the stage never re-derives 085 from the stale `requires_human` verdict. A bare `/hive decision approve` instead answers that `requires_human` question; it does not remove a `hold` label or provide the broad GitHub-review override for `changes_requested`/`reject`. A new head draws a new verdict with no answer and asks again ([#14679](https://github.com/hivecommons/hive/issues/14679)) |
| CI red (`check-failing:*`, `required-check-failing:*`, `status-*`), `conflicting`, `not-mergeable`, `changes-requested`, verdict changes_requested/reject, `needs-rebase` present, `closing-contradiction:#N` (the PR body closes #N and also says #N stays open or is partial — a `Refs #N` line saying partial, remaining, deferred, follow-up or not (yet) addressed, or "#N stays open"; every lane refuses it right after its label checks, before admission, CI or soak, and a body edit releases it, [#15025](https://github.com/hivecommons/hive/issues/15025)), `closing-keyword-targets-pr:#N` (a closing keyword in the PR body, or in a commit message on a merge-ready head, names open pull request #N, which GitHub would close on merge; a closed pull request is left alone, since closing it again is a no-op; read with the linked-issue gate, [#15025](https://github.com/hivecommons/hive/issues/15025)). Neither applies to a PR whose base is not the repository's default branch (a forward-merge, say): GitHub acts on closing keywords only there, so such a PR closes nothing | `070-fixing` (self-authored lane or `author/hive`) / `071-needs-author` (`author/human`) / `072-returned-to-contributor` (`author/clanker`) — see [Stage 07x by author kind](#stage-07x-by-author-kind). A head whose App-linked commits carry a `Signed-off-by` the squash would misattribute to the PR author (`hive-signoff-attribution`) follows the same split: the branch owner is the only one who can rewrite them. |
| `re-review-requested:<login>[,<login>…]`: a change request is standing on the PR (that login's latest Approve / Request changes / Dismiss review is Request changes), and every one standing is on an older commit with content pushed since — not on the head, and not carried to it by a merge of the base (the walk an approval uses, `automerge_review_head_binding.go`). GitHub keeps such a review blocking until its reviewer re-reviews or it is dismissed, so the PR waits on the reviewer, not on the author who pushed the fix. A request on the head (or one with no commit) is still `contributor-lane:changes-requested` / `changes-requested` above. Both the contributor lane and the trusted-author lane return it | human hand-off, **decision** cause → routed by the head's evidence like the lane rules below: red CI, a swarm `changes_requested` or a conflict on the new head is still the author's (070 / 071 / 072), a head with no verdict yet is `050`, otherwise `085-needs-decision`. Never 071 / 072 for the old review, so the author is not nudged, no adoption clock runs, and the Activity monitor asks the reviewer ("@reviewer requested changes on an older commit; @author pushed `<sha>` since. Re-review it, or dismiss the review?", wait kind `re-review-requested`, who the reviewer) instead of calling the author offline. The 085 note names each review, its commit and a compare link to the push since. The hive never dismisses the review itself (projectbluefin/chairlift#799) |
| `contributor-lane:soaking(...)` — and no red check on the head | `095-pre-merge-soak` |
| `head-changed-since-eval`, `merge-failed`, `merge-queue-required` (the base branch's ruleset only accepts merges through GitHub's merge queue and the transport is a static token that cannot enqueue, so the direct REST merge is refused; with App auth on a repo opted in through `auto_merge.native_merge_queue` these bases are enqueued instead, see [native-merge-queue.md](../native-merge-queue.md); logged as a skip rather than a merge error, [#14018](https://github.com/hivecommons/hive/issues/14018); the self-authored sweep then skips the direct merge on that base for 30 minutes and logs the skip once per PR head, [#14068](https://github.com/hivecommons/hive/issues/14068); the trusted-author, queued and contributor-lane sweeps skip it the same way, sharing one memory of such bases; while a base is remembered the dashboard shows its otherwise-green PRs as a person's to merge, not Merge-eligible; with `auto_merge.require_current_base` on, a head behind such a base is not updated for 24 hours after the last refusal and holds here instead, so the base moving does not reset its review), `required-checks-expected`, `behind`, `updated-branch`, `behind-update-budget-exhausted` (a behind self-authored PR the sweep did not update only because this tick's branch-update budget was spent; retried next tick, waits on the hive, [#12607](https://github.com/hivecommons/hive/issues/12607)), `release-hold*`, `native-merge-queued: queued (position N, STATE)` (the PR was enqueued into GitHub's native merge queue) and the failures `native-merge-queue-read`, `native-merge-queue-enqueue`, `native-merge-queue-method` — and no red check on the head | `100-merge-queue` |
| CI red (required or optional check) while the PR is deferred to an open `[shared-ci]` incident (`<!-- hive-shared-ci-<n> -->`, the governor's `deferred_incident`) for the same head | `050-review-pending` / `060-reviewed`, reason `shared-ci-incident:<n>`: the base or a shared check is what is red, so the PR is never sent to 070/071/072, never nudged and never stalled. A 072 nudge already posted for the head (the nudge goes out on entering 072, and the incident marker can land minutes later) is edited in place to say it was withdrawn, and the head's nudge count is reset. Once the incident closes the PR stays deferred until the shared-CI rerun sweep has re-run its failed jobs (at most 30 minutes); a head still red after that is handed back as usual, with a fresh nudge. Conflicts and requested changes stay author-facing ([#12606](https://github.com/hivecommons/hive/issues/12606)) |
Expand Down
3 changes: 3 additions & 0 deletions src/pkg/dashboard/stage_tracker_caption.go
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,9 @@ func humanizeStageReason(reason string) string {
if r == "" {
return ""
}
if reviewers, ok := stageengineprstage.ParseReReviewRequested(r); ok {
return "waiting on " + decisionReReviewNames(reviewers) + " to re-review: the change request is on an older commit"
}
if rest, ok := strings.CutPrefix(r, "ci-reporting-stalled:"); ok {
return "CI reporting stalled — " + rest
}
Expand Down
42 changes: 42 additions & 0 deletions src/pkg/dashboard/stage_tracker_decision_pr.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ func decisionForPR(it StageTrackerItem, verdict *review.Aggregate, sentinelLabel
// branch that bot regenerates, so the fix lands on the base branch.
botAuthorFinding := lower == stagelabels.LaneReasonBotAuthorFinding
hiveSupersederStop := stagelabels.HiveSupersederHardStopReason(base)
// Every standing change request is on an older commit the author has
// pushed past: the reviewer re-reviews, not the author
// (projectbluefin/chairlift#799).
reReviewers, reReview := stageengineprstage.ParseReReviewRequested(base)

// WHAT it is waiting on: the question, most specific source first. A
// reviewer's own question is quoted verbatim — it is the text the
Expand Down Expand Up @@ -138,6 +142,9 @@ func decisionForPR(it StageTrackerItem, verdict *review.Aggregate, sentinelLabel
d.Question = "The hive took this PR over but could not move it (" + decisionPlainReason(adoptionLane) + "). Give direction, or close it?"
case forkGuarded:
d.Question = "CI will not run for this fork PR (" + strings.ReplaceAll(forkGuard, ",", ", ") + "). A maintainer must push the branch to this repo — or close it?"
case reReview:
d.AskedBy = decisionAskedByReviewer
d.Question = decisionReReviewQuestion(reReviewers, it.Author, sha)
case changes:
d.AskedBy = decisionAskedByReviewer
d.Question = "A reviewer requested changes" + at + ". Give direction for a new commit, or close it?"
Expand All @@ -158,6 +165,9 @@ func decisionForPR(it StageTrackerItem, verdict *review.Aggregate, sentinelLabel
switch {
case it.UnauthorizedStep != "":
// set above
case reReview:
d.Blocker = "GitHub keeps " + decisionReReviewNames(reReviewers) + "'s change request blocking until it is re-reviewed or dismissed. The author has nothing left to push for it."
approveOK, approveWhy = false, "Approving here does not clear "+decisionReReviewNames(reReviewers)+"'s change request on GitHub; they re-review, or a maintainer dismisses the review."
case changes:
d.Blocker = "A reviewer requested changes" + at + " — needs a new commit. Approving cannot override that."
approveOK, approveWhy = false, d.Blocker
Expand Down Expand Up @@ -236,6 +246,38 @@ func decisionForPR(it StageTrackerItem, verdict *review.Aggregate, sentinelLabel
return d
}

// decisionReReviewQuestion is the question for a re-review-requested PR:
// it names the reviewers, the author and the head they pushed, and never
// calls the author offline (projectbluefin/chairlift#799).
func decisionReReviewQuestion(reviewers []string, author, sha string) string {
who := "the author"
if a := strings.TrimSpace(author); a != "" {
who = "@" + a
}
pushed := " pushed new commits"
if sha != "" {
pushed = " pushed `" + sha + "`"
}
return decisionReReviewNames(reviewers) + " requested changes on an older commit; " + who + pushed + " since. Re-review it, or dismiss the review?"
}

// decisionReReviewNames renders the reviewers as "@a", "@a and @b".
func decisionReReviewNames(reviewers []string) string {
var names []string
for _, r := range reviewers {
if r = strings.TrimSpace(r); r != "" {
names = append(names, "@"+r)
}
}
switch len(names) {
case 0:
return "the reviewer"
case 1:
return names[0]
}
return strings.Join(names[:len(names)-1], ", ") + " and " + names[len(names)-1]
}

// decisionApproveSignOffConsequence is the inline Approve pill's hover on
// a sign-off ask.
const decisionApproveSignOffConsequence = "Posts /lgtm + /approve as you; the merge queue takes it from there. Nothing merges here."
Expand Down
68 changes: 68 additions & 0 deletions src/pkg/dashboard/stage_tracker_rereview_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
package dashboard

import (
"strings"
"testing"
"time"

"github.com/hivecommons/hive/pkg/stageengine/prstage"
"github.com/hivecommons/hive/pkg/stagelabels"
)

// projectbluefin/chairlift#799: @Danathar's change request was on an older
// commit and @castrojo had pushed the fix. The row asked "@castrojo has been
// offline … take the PR over now?". A re-review-requested 085 names the
// reviewer and the author's push, waits on the reviewer, and never offers
// the takeover or calls the author offline, even with the adoption grace
// run out on the row.
func TestReReviewRequestedRowWaitsOnTheReviewer(t *testing.T) {
reason := prstage.ReReviewRequestedReason([]string{"Danathar"})
it := StageTrackerItem{
Repo: "projectbluefin/chairlift", Number: 799, Kind: "pr", Stage: stagelabels.NeedsDecision.Number(),
Head: "948192f343abcdef", Author: "castrojo", Reason: reason,
Adoption: &StageTrackerAdoption{Author: "castrojo", Due: true},
Takeover: &StageTrackerTakeover{GraceElapsed: true},
}
d := stageTrackerDecisionNeededAt(it, nil, "", time.Date(2026, 11, 17, 16, 11, 0, 0, time.UTC))
if d == nil {
t.Fatal("no decision for a re-review-requested row")
}
want := "@Danathar requested changes on an older commit; @castrojo pushed `" + shortHead(it.Head) + "` since. Re-review it, or dismiss the review?"
if d.Question != want {
t.Fatalf("question = %q\nwant %q", d.Question, want)
}
if strings.Contains(d.Question+d.Blocker, "offline") {
t.Fatalf("decision calls the author offline: %+v", d)
}
for _, o := range d.Options {
if o.Action == decisionActionApprove && o.Enabled {
t.Fatalf("approve option = %+v, want disabled: it does not clear the change request", o)
}
if o.Action == decisionActionAdopt {
t.Fatalf("decision offers adoption: %+v", o)
}
}
if kind, who := stageTrackerWaitKind(it); kind != waitKindReReview || who != "Danathar" {
t.Fatalf("wait kind/who = %s/%s, want %s/Danathar", kind, who, waitKindReReview)
}
if got := humanizeStageReason(reason); got != "waiting on @Danathar to re-review: the change request is on an older commit" {
t.Fatalf("caption clause = %q", got)
}
// Any other 085 keeps the operator's decision wait.
it.Reason = prstage.ContributorLaneReasonReporterTrustHold
if kind, who := stageTrackerWaitKind(it); kind != waitKindNeedsDecision || who != waitWhoOperator {
t.Fatalf("other 085 wait kind/who = %s/%s", kind, who)
}
}

func TestDecisionReReviewNames(t *testing.T) {
for in, want := range map[string]string{"": "the reviewer", "a": "@a", "a,b": "@a and @b", "a,b,c": "@a, @b and @c"} {
var reviewers []string
if in != "" {
reviewers = strings.Split(in, ",")
}
if got := decisionReReviewNames(reviewers); got != want {
t.Errorf("%q: got %q, want %q", in, got, want)
}
}
}
22 changes: 20 additions & 2 deletions src/pkg/dashboard/stage_tracker_waiting.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"sort"
"time"

stageengineprstage "github.com/hivecommons/hive/pkg/stageengine/prstage"
"github.com/hivecommons/hive/pkg/stagelabels"
)

Expand Down Expand Up @@ -34,6 +35,10 @@ const (
// waitKindOther: any other stage only a person can advance (015
// triage-needed).
waitKindOther = "other-human-wait"
// waitKindReReview: 085 because every change request standing on the
// PR is on an older commit the author pushed past; Who is the first
// reviewer, who re-reviews (or a maintainer dismisses the review).
waitKindReReview = "re-review-requested"
)

// waitWhoOperator is the Who value for a wait that falls to the signed-in
Expand All @@ -60,8 +65,9 @@ type StageTrackerWaitingItem struct {
// recorded, else when the item entered its stage.
Since *time.Time `json:"since,omitempty"`
// Who is the login the wait is attributed to: "operator" for the
// signed-in operator / maintainers, else the contributor whose
// offline grace ran out (the operator is their fallback).
// signed-in operator / maintainers, the reviewer a re-review waits on,
// else the contributor whose offline grace ran out (the operator is
// their fallback).
Who string `json:"who"`
}

Expand All @@ -85,6 +91,8 @@ func stageTrackerWaitKind(it StageTrackerItem) (kind, who string) {
return "", ""
}
switch {
case it.Kind == "pr" && it.Stage == stagelabels.NeedsDecision.Number() && stageTrackerReReviewer(it) != "":
return waitKindReReview, stageTrackerReReviewer(it)
case it.Stage == stagelabels.NeedsDecision.Number(), it.Stage == stagelabels.IssueNeedsDecision.Number(), slices.Contains(it.Modifiers, modNeedsDecision):
return waitKindNeedsDecision, waitWhoOperator
case it.Stage == stagelabels.ReadyForHumanMerge.Number():
Expand All @@ -109,6 +117,16 @@ func stageTrackerWaitKind(it StageTrackerItem) (kind, who string) {
return "", ""
}

// stageTrackerReReviewer is the first reviewer a re-review-requested row
// waits on, "" for any other row.
func stageTrackerReReviewer(it StageTrackerItem) string {
base, _ := stagelabels.HumanApprovedReason(it.Reason)
if reviewers, ok := stageengineprstage.ParseReReviewRequested(base); ok && len(reviewers) > 0 {
return reviewers[0]
}
return ""
}

// stageTrackerWaitStandingMeta reports whether it is a standing meta
// issue: a bot Dependency Dashboard or the Hive Advisory Report, which the
// enumeration files under the dependency_dashboard / hive_advisory buckets
Expand Down
4 changes: 3 additions & 1 deletion src/pkg/dashboard/static-src/js/tracker-waiting.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
The stage tracker payload carries waiting_on_human (stage_tracker_waiting.go):
every open item parked on the signed-in operator / maintainers, with a
kind (needs-decision, ready-for-human-merge, approve-needed,
returned-to-contributor-offline, other-human-wait) and who the wait
returned-to-contributor-offline, re-review-requested,
other-human-wait) and who the wait
is attributed to. Three surfaces read it so a human wait is never
silent (hivecommons/hive#15638): a second, attention-coloured badge on
the "Hive activity monitor" sidebar item, a "Waiting on you · N" pill
Expand All @@ -19,6 +20,7 @@
'ready-for-human-merge': 'ready for you to merge',
'approve-needed': 'needs your approval',
'returned-to-contributor-offline': 'contributor offline — adopt or reroute',
're-review-requested': 'waiting on a re-review',
'other-human-wait': 'needs a person',
};
var _stageTrackerWaitingPrevCount = null;
Expand Down
4 changes: 3 additions & 1 deletion src/pkg/dashboard/static/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -30734,7 +30734,8 @@ <h2 class="config-title" id="activity-monitor-labels-title">All labels</h2>
The stage tracker payload carries waiting_on_human (stage_tracker_waiting.go):
every open item parked on the signed-in operator / maintainers, with a
kind (needs-decision, ready-for-human-merge, approve-needed,
returned-to-contributor-offline, other-human-wait) and who the wait
returned-to-contributor-offline, re-review-requested,
other-human-wait) and who the wait
is attributed to. Three surfaces read it so a human wait is never
silent (hivecommons/hive#15638): a second, attention-coloured badge on
the "Hive activity monitor" sidebar item, a "Waiting on you · N" pill
Expand All @@ -30751,6 +30752,7 @@ <h2 class="config-title" id="activity-monitor-labels-title">All labels</h2>
'ready-for-human-merge': 'ready for you to merge',
'approve-needed': 'needs your approval',
'returned-to-contributor-offline': 'contributor offline — adopt or reroute',
're-review-requested': 'waiting on a re-review',
'other-human-wait': 'needs a person',
};
var _stageTrackerWaitingPrevCount = null;
Expand Down
Loading
Loading