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/added-needs-human-decision-popover.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Activity Monitor: hovering or focusing the *Needs human decision* chevron word or a lead *needs-human* / *triage needed* pill opens an in-app popover that says what the row is waiting on (the reviewer's own question when the hive has one, else the park reason in plain words, plus the blocker — "A reviewer requested changes on b0f5f80 — needs a new commit. Approving cannot override that."), offers the applicable actions as buttons (*Let hive decide* first, then Approve / Give direction / Close as superseded / Close as won't fix / Hold or Release; disabled ones grey with their reason) down the row context menu's code path, and names who asked and when; `GET /api/stage-tracker` rows carry the new `decision_needed` (`question`, `asked_by`, `since`, `blocker`, `blocker_reason`, `options[]`). Requested by @clubanderson ([#14994](https://github.com/hivecommons/hive/issues/14994)).
2 changes: 1 addition & 1 deletion src/docs/api-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ always resolved server-side from the validated token.
| `GET` | `/api/budget-ignore` | Dashboard auth/session | Budget Ignore Get | `pkg/dashboard/api.go:171` |
| `POST` | `/api/budget-ignore` | Owner only | Budget Ignore Set | `pkg/dashboard/api.go:172` |
| `GET` | `/api/summaries` | Dashboard auth/session | Summaries | `pkg/dashboard/api.go:184` |
| `GET` | `/api/stage-tracker` | Dashboard auth/session | Stage Tracker: every open issue and pull request of the watched repos for the Hive activity monitor — actionable, held, claimed, in-progress, covered-by-PR, filtered (`needs-*`), draft and exempt-labelled items alike, each with `stage`, `stage_since`, `labels`, `created_at`, `author_kind`, `modifiers`, (PRs) `sentinel_alert` / `sentinel_findings` / `sentinel_reason` when the sentinel flagged the PR, and (issues) `linked_prs`; items with no stage yet report stage `0` "Open"; `needs_human_labels` is the "a person must act" label set behind the monitor's Needs human facet (the same list as `/api/status.labelPresets[needs-human]`); `recently_merged` lists the PRs (`repo`, `number`, `merged_at`) whose `pr_merged` audit entry is under 30 minutes old, so a client diffing two payloads can tell a merge from a close. Served from a server-side cache rebuilt at most every `dashboard.stage_tracker.cache_ttl_s` (default `governor.eval_interval_s`) from the spoke's existing snapshot — a request never calls GitHub. Carries `generated_at`, `source` (`cache` or `fresh`), `cache_ttl_s`, an `ETag` and `Cache-Control: private, max-age=<remaining>`; `If-None-Match` yields 304. Each hit is recorded under REST caller `dashboard:stage-tracker` so `/api/gh-rate-limits` shows it charged nothing. | `pkg/dashboard/api.go:185` |
| `GET` | `/api/stage-tracker` | Dashboard auth/session | Stage Tracker: every open issue and pull request of the watched repos for the Hive activity monitor — actionable, held, claimed, in-progress, covered-by-PR, filtered (`needs-*`), draft and exempt-labelled items alike, each with `stage`, `stage_since`, `labels`, `created_at`, `author_kind`, `modifiers`, (PRs) `sentinel_alert` / `sentinel_findings` / `sentinel_reason` when the sentinel flagged the PR, `decision_needed` on a row parked on a person (085 / 045 / 015, the needs-human pill; mirrored onto the issue's `linked_prs[]` entry): `{question, asked_by, since, blocker, blocker_reason, options: [{action, label, enabled, reason_if_disabled}]}` — the reviewer's own decision question when the verdict record has one, the blocker in plain words, and the applicable actions under the row context menu's action ids (`decide:delegate` first), and (issues) `linked_prs`; items with no stage yet report stage `0` "Open"; `needs_human_labels` is the "a person must act" label set behind the monitor's Needs human facet (the same list as `/api/status.labelPresets[needs-human]`); `recently_merged` lists the PRs (`repo`, `number`, `merged_at`) whose `pr_merged` audit entry is under 30 minutes old, so a client diffing two payloads can tell a merge from a close. Served from a server-side cache rebuilt at most every `dashboard.stage_tracker.cache_ttl_s` (default `governor.eval_interval_s`) from the spoke's existing snapshot — a request never calls GitHub. Carries `generated_at`, `source` (`cache` or `fresh`), `cache_ttl_s`, an `ETag` and `Cache-Control: private, max-age=<remaining>`; `If-None-Match` yields 304. Each hit is recorded under REST caller `dashboard:stage-tracker` so `/api/gh-rate-limits` shows it charged nothing. | `pkg/dashboard/api.go:185` |
| `POST` | `/api/prs/{owner}/{repo}/{number}/queue-automerge` | Merger/owner role | Queue PRAuto Merge | `pkg/dashboard/api.go:186` |
| `GET` | `/api/inference/models/{backend}` | Dashboard auth/session | Inference Models | `pkg/dashboard/api.go:356` |
| `GET` | `/api/hive-id` | Dashboard auth/session | Hive IDGet | `pkg/dashboard/api.go:418` |
Expand Down
4 changes: 4 additions & 0 deletions src/docs/dashboard-sections.md
Original file line number Diff line number Diff line change
Expand Up @@ -687,6 +687,10 @@ Fed by `GET /api/stage-tracker`. Every issue and pull request follows the same p

**Multi-select.** The checkbox in a row's left gutter selects the row; **Shift+click** selects the range from the last clicked row, **Cmd/Ctrl+click** toggles, **Cmd/Ctrl+Shift+click** adds a range to what is selected; with a row focused, **Space** toggles it (Shift+Space extends). Cmd/Ctrl- or Shift-clicking the row itself, away from its links, selects it too. A selection bar appears above the list with the count, **Clear**, and the same actions for the whole selection — *Decide…* (opens the group as a menu, *Let hive decide* first — each selected row gets its own delegated-decision job, see below), *Hold*, *Release hold*, *Re-evaluate now*, *Mark needs-human…*, *Copy links* — each enabled only when it is valid for every selected row and otherwise greyed with the first reason ("Not applicable to acme/console#12", "Sign in with write access…"). Right-clicking a selected row acts on the whole selection. Bulk actions run one request per row, in list order, under a progress toast ("Hold 2/5 — acme/console#12…"); the result toast lists each failure by row and the successes stand, after which the list and the status snapshot refresh (a hive-wide rescan is sent once per batch). Selection is keyed on the row's item (repository, kind, number), not its node, so the live re-render keeps it; a row that leaves the list — merged, closed, filtered or paged out — leaves the selection.

**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`, …).

**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

**What it is.** *Let hive decide* is the first entry under *Decide…* on a row parked at *Needs human decision* (an issue at 045, a PR at 085, or an issue whose nested PR is parked there), and under *Decide…* in the selection bar for a bulk run. It asks the hive to make the decision itself, as the owner's delegate, under the owner's standing operating rules — and to record it exactly as a human decision is recorded: a `/hive decision <text>` comment on the item (plus the queue approval on a PR head when the decision is to release the PR), the parking labels lifted, `triage/accepted` added where it applies, and the stage engine's un-park logged with the requesting operator named. The item leaves 085/045 and proceeds without the owner. The action is audited as `repo_item_decision_delegated` (or `repo_item_decision_delegated_failed`) and the **Decisions log** shows those rows with a *delegated* badge so delegated and human decisions can be told apart and counted.
Expand Down
26 changes: 26 additions & 0 deletions src/pkg/dashboard/stage_tracker.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
package dashboard

import (
Expand All @@ -19,6 +19,7 @@
"github.com/hivecommons/hive/pkg/dashboard/collect"
"github.com/hivecommons/hive/pkg/dashboard/webstatic"
"github.com/hivecommons/hive/pkg/github"
"github.com/hivecommons/hive/pkg/review"
"github.com/hivecommons/hive/pkg/stageengine"
stageengineprstage "github.com/hivecommons/hive/pkg/stageengine/prstage"
"github.com/hivecommons/hive/pkg/stagelabels"
Expand Down Expand Up @@ -330,6 +331,12 @@
// (hivecommons/hive#14589).
UnauthorizedStep string `json:"unauthorized_step,omitempty"`
Unauthorized string `json:"unauthorized,omitempty"`
// DecisionNeeded is set on a row parked on a person (085 / 045 / 015,
// the needs-human or needs-decision pill): what the person must
// decide, who asked, the plain-words blocker and the actions that
// advance it, under the row context menu's action ids. See
// stage_tracker_decision.go.
DecisionNeeded *StageTrackerDecision `json:"decision_needed,omitempty"`
// StaleLabels are control labels the row still wears that its stage
// has outrun, so they are not read as modifiers: `needs-triage` on an
// issue at 020 or later (015 is not a gate; the reconciler removes the
Expand Down Expand Up @@ -432,6 +439,9 @@
HumanMergeReason string `json:"human_merge_reason,omitempty"`
HumanMergeReasonText string `json:"human_merge_reason_text,omitempty"`
Head string `json:"head,omitempty"`
// DecisionNeeded mirrors the nested PR's own row field so the issue's
// sub-row can open the same "Needs human" popover.
DecisionNeeded *StageTrackerDecision `json:"decision_needed,omitempty"`
}

// Stage numbers the tracker lays out by. Pinned to stagelabels.Table in
Expand Down Expand Up @@ -1458,6 +1468,15 @@
if verifierErr == nil {
evidenceVerifier = &verifier
}
// The reviewer's decision question for a parked PR comes from the
// local verdict artifact; a missing or unreadable artifact just means
// the popover falls back to the reason-derived question.
var verdictArtifact *review.Artifact
if art, err := review.LoadArtifact(""); err == nil {
verdictArtifact = &art
}
verdictFor := stageTrackerVerdictLookup(verdictArtifact)
sentinelLabel := s.sentinelLabel()
lookup := func(repo string, number int) (stagelabels.Record, bool) {
if store == nil {
return stagelabels.Record{}, false
Expand Down Expand Up @@ -1604,6 +1623,7 @@
it.LinkedPRs = append(it.LinkedPRs, StageTrackerLinkedPR{Number: lp.Number, URL: lp.URL})
}
}
it.DecisionNeeded = stageTrackerDecisionNeeded(it, nil, sentinelLabel)
add(it)
}
addPR := func(repoName string, pr github.PullRequest, verdict *github.MergeVerdict, bucket, bucketReason string) {
Expand Down Expand Up @@ -1654,6 +1674,11 @@
}
it.Actor = "maintainer"
}
var agg *review.Aggregate
if a, ok := verdictFor(repoName, pr.Number, pr.HeadSHA); ok {
agg = &a
}
it.DecisionNeeded = stageTrackerDecisionNeeded(it, agg, sentinelLabel)
add(it)
}
for _, repo := range status.Repos {
Expand Down Expand Up @@ -2352,6 +2377,7 @@
lp.HumanApprover, lp.ManualMerge = pr.HumanApprover, pr.ManualMerge
lp.HumanMergeReason, lp.HumanMergeReasonText = pr.HumanMergeReason, pr.HumanMergeReasonText
lp.BaseRef = pr.BaseRef
lp.DecisionNeeded = pr.DecisionNeeded
if len(pr.Modifiers) > 0 {
lp.Modifiers = append([]string(nil), pr.Modifiers...)
}
Expand Down
Loading
Loading