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-reporter-trust-hold-hive-authored.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- The reporter-trust merge hold (#9665) no longer holds hive-authored PRs, judges only linked issues (closing-keyword and declared links; a link that resolves to a PR is skipped, hive self-reports count as trusted), and the stage-label pass releases a hive-set reporter-trust hold left on a hive-authored PR; the stage tracker pill now reads "Held by hive · reporter trust (issue #N by @X, contributor)" / "Held by @login" with a release/keep decision popover, and the needs-decision comment names who set the hold and why.
2 changes: 2 additions & 0 deletions src/docs/dashboard-sections.md
Original file line number Diff line number Diff line change
Expand Up @@ -708,6 +708,8 @@ Fed by `GET /api/stage-tracker`. Every issue and pull request follows the same p

**Needs-human decision popover.** Hovering — or, by keyboard, focusing — the *Needs human decision* chevron word on a row (an issue at 045, a PR at 085, an issue whose nested PR is parked there) or a lead *needs-human* / *triage needed* pill opens an in-app popover (no native tooltip on that element) that says, in this order: **what the row is waiting on** — the reviewer's own question when the hive has one (the text the hive's "Needs a decision" comment on the PR prints after *reviewer question:*, read from the same verdict record), else a plain-words sentence for the park reason, plus the blocker in plain words ("A reviewer requested changes on b0f5f80 — needs a new commit. Approving cannot override that."); **what you can do** — one button per applicable action, *Let hive decide* first, then Approve / Give direction / Close as superseded / Close as won't fix / Hold or Release hold (an issue at 015: Accept triage, Hold, Mark needs-human), each disabled with its reason when the row's state or your role rules it out; **who asked and when** ("Asked by a reviewer · 2 hours ago"); then the chevron's stage line. The buttons run the row context menu's code path, so the same result toast and in-flight chevron apply. The popover stays open while the pointer is over it or its trigger, pins on click or focus, and closes on Esc (focus returns to the trigger), click-away, scroll or resize. The text comes from the tracker payload's `decision_needed` (`question`, `asked_by`, `since`, `blocker`, `blocker_reason`, `options[] {action, label, enabled, reason_if_disabled}`), whose `action` ids are the context menu's own (`decide:delegate`, `decide:approve`, …).

**Hold pill with provenance.** When the hive can say who set a row's `hold` label and why, the pill does not read a bare *hold*: it reads **Held by hive · reporter trust (issue #15017 by @Karibhou, contributor)** when the hive's own reporter-trust gate ([#9665](https://github.com/hivecommons/hive/issues/9665)) set it, **Held by hive** when the hive set it for another reason, or **Held by @login** when a person added the label; a hold the hive cannot attribute keeps the plain *hold* word. The hover text repeats the pill, says since when, and for a hive-set reporter-trust hold explains that the hive set it itself and that *Release hold* lifts it. That same pill opens the needs-human decision popover: its question reads *The hive held this PR itself for reporter trust (issue #N by @X, contributor). Release the hold, or keep it?*, **Release hold** leads the buttons (enabled), *Let hive decide* waits until the hold is released, and `blocker_reason` is `hold:hive`. A person's hold names them in the blocker instead (*On hold (set by @login) — the hive does nothing until the hold is released.*). The data rides the tracker payload as `hold {by, source, reason, since, issue, reporter, association, pill}` on the item and on each nested `linked_pr`; `by` is `hive` or the login of the person whose label event set it, `source` is `reporter-trust` or `label`. It comes from the stage-label pass, which reads the hive's `<!-- hive:reporter-trust-metadata -->` notice and the newest `hold` label event ([#15020](https://github.com/hivecommons/hive/pull/15020): a hive-authored PR sat 49 minutes as *hold +1 · Needs human decision* with no way to tell that the hive had held it two seconds after opening it). A hive-authored PR never keeps a hive-set reporter-trust hold: the same pass releases it, so the pill is normally seen only on contributor PRs.

**Cue tokens.** The three cues of the legend above (state pill, working spin, decision badge) share one `tracker-cues` CSS block on `.ham-row`: `--cue-state` (what the row waits on — the pill and this popover), `--cue-work` (the hive is working right now — the chevron spin), `--cue-decision` (what people and the hive decided — the ✓ badge). Nothing else blinks; motion stays in the 150–300 ms range.

### Let hive decide
Expand Down
4 changes: 2 additions & 2 deletions src/docs/labels-and-control-signals.md

Large diffs are not rendered by default.

38 changes: 38 additions & 0 deletions src/pkg/dashboard/stage_tracker.go
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,11 @@ type StageTrackerItem struct {
// OnHold is true when the item wears a hold pill: paused on purpose,
// waiting on nobody.
OnHold bool `json:"on_hold,omitempty"`
// Hold says who set the `hold` label and why, when the stage-label
// pass could read it (hivecommons/hive#15020): the pill then reads
// "Held by hive · reporter trust (issue #N by @X, contributor)" or
// "Held by @login" instead of a bare "hold".
Hold *StageTrackerHold `json:"hold,omitempty"`
// RegressedFrom / RegressedTo / RegressedAt / RegressedReason narrate
// the unresolved regression behind the `regressed` modifier: the
// high-water stage the item fell from, the stage that fall landed on
Expand Down Expand Up @@ -492,6 +497,37 @@ type StageTrackerLinkedPR struct {
// row fields so its sub-row wears the ✓ badge too.
LastOperatorAction *StageTrackerOperatorAction `json:"last_operator_action,omitempty"`
OperatorActionCount int `json:"operator_action_count,omitempty"`
// Hold mirrors the nested PR's own row field (hivecommons/hive#15020).
Hold *StageTrackerHold `json:"hold,omitempty"`
}

// StageTrackerHold is the row's hold provenance (stagelabels.HoldProvenance
// in payload shape). By is "hive" for the hive's own holds, else the login.
type StageTrackerHold struct {
By string `json:"by"`
Source string `json:"source,omitempty"`
Reason string `json:"reason,omitempty"`
Since *time.Time `json:"since,omitempty"`
Issue int `json:"issue,omitempty"`
Reporter string `json:"reporter,omitempty"`
Association string `json:"association,omitempty"`
// Pill is the ready-made pill text ("Held by hive · reporter trust
// (issue #15017 by @Karibhou, contributor)").
Pill string `json:"pill"`
}

// stageTrackerHoldFrom maps the store's provenance to the payload; nil when
// the record has none or the row no longer wears `hold`.
func stageTrackerHoldFrom(rec stagelabels.Record, hasRec bool, labels []string) *StageTrackerHold {
if !hasRec || rec.Hold == nil || strings.TrimSpace(rec.Hold.By) == "" || !slices.ContainsFunc(labels, func(l string) bool { return strings.EqualFold(strings.TrimSpace(l), modHold) }) {
return nil
}
h := &StageTrackerHold{By: rec.Hold.By, Source: rec.Hold.Source, Reason: rec.Hold.Reason, Issue: rec.Hold.Issue, Reporter: rec.Hold.Reporter, Association: strings.ToLower(rec.Hold.Association), Pill: rec.Hold.Pill()}
if !rec.Hold.Since.IsZero() {
t := rec.Hold.Since
h.Since = &t
}
return h
}

// Stage numbers the tracker lays out by. Pinned to stagelabels.Table in
Expand Down Expand Up @@ -1575,6 +1611,7 @@ func (s *Server) buildStageTracker(status *StatusPayload, store *stagelabels.Sto
it.AdoptedBy = rec.AdoptedBy
it.SoakRemainingSeconds = int64(stageTrackerSoakRemaining(rec, now) / time.Second)
}
it.Hold = stageTrackerHoldFrom(rec, hasRec, labels)
it.Stage = stage.Number()
it.StageSlug = stage.Slug()
it.StageLabel = stage.Label()
Expand Down Expand Up @@ -2507,6 +2544,7 @@ func stageTrackerResolveLinkedPRs(items []StageTrackerItem) {
lp.BaseRef = pr.BaseRef
lp.DecisionNeeded = pr.DecisionNeeded
lp.LastOperatorAction, lp.OperatorActionCount = pr.LastOperatorAction, pr.OperatorActionCount
lp.Hold = pr.Hold
if len(pr.Modifiers) > 0 {
lp.Modifiers = append([]string(nil), pr.Modifiers...)
}
Expand Down
63 changes: 55 additions & 8 deletions src/pkg/dashboard/stage_tracker_decision.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
package dashboard

import (
Expand Down Expand Up @@ -89,13 +89,14 @@
const (
decisionBlockerSentinel = "sentinel-alert"
decisionBlockerHold = "hold"
decisionBlockerHoldHive = "hold:hive"
)

const (
decisionWhyHeld = "On hold — release the hold first"
decisionWhyNoPermission = "Only a person with the permission can do this"
decisionWhyApproveNoGrant = "Approving does not grant the missing permission"
decisionHeldBlocker = "On hold — the hive does nothing until the hold is released."
decisionHeldBlockerPlain = "On hold — the hive does nothing until the hold is released."
)

// stageTrackerVerdictLookup returns a lookup over review-verdicts.json for
Expand Down Expand Up @@ -176,7 +177,7 @@
d.Question = who + " maintains this repository and " + gone + "; adopt the PR? The hive would take it over as it does any contributor's (the author's commits and sign-off are kept)."
d.Blocker = "maintainer_policy is ask: the hive never adopts a maintainer's PR on its own; a person decides."
if held {
d.Blocker += " " + decisionHeldBlocker
d.Blocker += " " + decisionHeldBlocker(it.Hold)
}
d.Options = []StageTrackerDecisionOption{
decisionOption(decisionActionAdopt, "Adopt (hive takes over)", !held, "Release the hold first"),
Expand Down Expand Up @@ -242,7 +243,7 @@
case stageengineprstage.ContributorLaneReasonNoReviewer:
return "no reviewer is configured for this repo"
case stageengineprstage.ContributorLaneReasonReporterTrustHold:
return "the author's trust level is not yet known"
return "the hive held it for the trust level of the linked issue's reporter"
case stageengineprstage.ContributorLaneReasonNoAppBotLogin, stageengineprstage.AutoMergeReasonNoAppBotLogin:
return "the hive's GitHub App login is not known"
case stageengineprstage.ContributorLaneReasonFilesEvidence:
Expand Down Expand Up @@ -274,6 +275,10 @@
d := &StageTrackerDecision{Since: it.StageSince, AskedBy: decisionAskedByLane, BlockerReason: base}
approveOK, approveWhy := true, ""
delegateOK, delegateWhy := !held, decisionWhyHeld
var selfHold *StageTrackerHold
if held && it.Hold != nil && strings.EqualFold(it.Hold.By, stagelabels.HoldByHive) && it.Hold.Source != "" && it.Hold.Source != stagelabels.HoldSourceLabel {
selfHold = it.Hold
}

sentinel := it.SentinelAlert || lower == "sentinel" || lower == stageengineprstage.ContributorLaneReasonSentinelBlocked
changes := decisionChangesRequested(base)
Expand All @@ -300,6 +305,17 @@
t := verdict.RecordedAt
d.Since = &t
}
case selfHold != nil:
// The hive held the PR itself (hivecommons/hive#15020): say so,
// name the gate and the issue, and offer release / keep.
d.AskedBy = decisionAskedByLane
d.Question = "The hive held this PR itself for " + decisionHoldReason(selfHold) + ". Release the hold (the lane then merges it on its next pass once the other gates are clear), or keep it?"
if selfHold.Since != nil {
t := *selfHold.Since
d.Since = &t
}
d.Blocker = "The hive set `hold` on its own: " + decisionHoldReason(selfHold) + ". It does nothing more until the hold is released."
d.BlockerReason = decisionBlockerHoldHive
case verdict != nil && decisionFirstNonEmpty(verdict.HumanSummaries) != "":
d.AskedBy = decisionAskedByReviewer
d.Question = "A reviewer handed this to a person: " + decisionFirstNonEmpty(verdict.HumanSummaries)
Expand Down Expand Up @@ -356,11 +372,11 @@
case reviewerDeferred:
d.Blocker = "The hive will not merge until a person decides."
}
if held {
if held && selfHold == nil {
if d.Blocker != "" {
d.Blocker += " "
}
d.Blocker += decisionHeldBlocker
d.Blocker += decisionHeldBlocker(it.Hold)
if d.BlockerReason == "" {
d.BlockerReason = decisionBlockerHold
}
Expand All @@ -374,15 +390,46 @@
decisionOption(decisionActionCloseWontfix, "Close as won't fix", true, ""),
decisionHoldOption(held),
}
if selfHold != nil {
// Release leads: it is the one action that answers the question.
d.Options = append([]StageTrackerDecisionOption{decisionHoldOption(true)}, d.Options[:len(d.Options)-1]...)
}
return d
}

// decisionHoldReason is the hold's plain-words reason for the popover.
func decisionHoldReason(h *StageTrackerHold) string {
if h != nil {
if reason := strings.TrimSpace(h.Reason); reason != "" {
return reason
}
}
return "its own gate"
}

// decisionHeldBlocker is the "On hold" blocker sentence, naming who set the
// hold when the row knows (hivecommons/hive#15020).
func decisionHeldBlocker(h *StageTrackerHold) string {
if h == nil || strings.TrimSpace(h.By) == "" {
return decisionHeldBlockerPlain
}
who := "@" + strings.TrimSpace(h.By)
if strings.EqualFold(h.By, stagelabels.HoldByHive) {
who = "the hive"
}
s := "On hold (set by " + who
if reason := strings.TrimSpace(h.Reason); reason != "" {
s += ": " + reason
}
return s + ") — the hive does nothing until the hold is released."
}

func decisionForIssue(it StageTrackerItem, held bool) *StageTrackerDecision {
d := &StageTrackerDecision{Since: it.StageSince, AskedBy: decisionAskedByHiveAgent, BlockerReason: strings.TrimSpace(it.Reason)}
d.Question = "The hive parked this issue for a person. Approve the direction, send it back with direction, or close it?"
d.Blocker = "No agent picks this up until a person answers. The hive's question is in its latest comment on the issue."
if held {
d.Blocker += " " + decisionHeldBlocker
d.Blocker += " " + decisionHeldBlocker(it.Hold)
if d.BlockerReason == "" {
d.BlockerReason = decisionBlockerHold
}
Expand All @@ -403,7 +450,7 @@
d.Question = "Should the hive work on this issue? Accept triage so an agent can take it, hold it, or mark it needs-human."
d.Blocker = "No agent picks up an issue until a maintainer accepts triage."
if held {
d.Blocker += " " + decisionHeldBlocker
d.Blocker += " " + decisionHeldBlocker(it.Hold)
}
d.Options = []StageTrackerDecisionOption{
decisionOption(decisionActionAcceptTriage, "Accept triage", true, ""),
Expand All @@ -424,7 +471,7 @@
d.Question = "This " + what + " is marked needs-human: automated fixes ran out, or a person flagged it. Review it on GitHub and remove the label when the hive may continue."
d.Blocker = "The hive does nothing with a needs-human item until a person removes the label."
if held {
d.Blocker += " " + decisionHeldBlocker
d.Blocker += " " + decisionHeldBlocker(it.Hold)
}
d.Options = []StageTrackerDecisionOption{decisionHoldOption(held)}
return d
Expand Down
Loading
Loading