Skip to content
Closed
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-15071-activity-monitor.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- The Activity Monitor names server-derived stage actors, shows idle bot PRs as waiting or conflicting, draws shared covering PRs only once, and keeps the merged-today counter above the merge gate.
4 changes: 3 additions & 1 deletion src/docs/dashboard-sections.md
Original file line number Diff line number Diff line change
Expand Up @@ -702,7 +702,7 @@ Fed by `GET /api/stage-tracker`. Every issue and pull request follows the same p

**Confirmations and "Don't ask again".** Each confirm dialog a row action raises — Approve (including a sentinel-flagged head: *⚠ Sentinel flagged security-relevant changes at 40a959b …*), Let hive decide, Close as superseded / won't-fix, Mark needs-human and the rest — carries a **Don't ask again for this action** box. Ticking it and confirming stores `hive.tracker.confirm.<action>=skip` in this browser's `localStorage` (one key per action id, e.g. `hive.tracker.confirm.decide:delegate`); later clicks on that action run at once. Nothing the dialog would have said is lost: the result toast carries the same ⚠ sentinel line (it is per head, so skipping the confirm never skips the warning) and the one-line item summary. Actions that need your text (*Give direction…*, *Send back…*, the superseder picker) always ask. The ⚙ settings dialog's **Confirmations** section lists which actions are skipped and has one **Reset confirmations** button that turns them all back on.

**Merged today.** The toolbar's right end shows a small hex glyph with **Merged today: N** — pull requests the hive saw merge since your local midnight (seeded after a reload from the tracker payload's `merged_24h` list, the audit log's `pr_merged` entries over the last 24 hours, and grown live by the same merge detector that plays the zap); hovering lists the last five with their times. When a PR on the list merges its row does **not** simply vanish on the next refresh: it stays pinned for about 2.5 s, its ✓ cell glows amber, the event line reads *Hive: merged #14947 · by hive*, a flat brand-amber hex token lifts out of the ✓ cell and arcs (≈0.5 s) to the counter, which ticks up with a soft scale-pop — the merge zap, when sound is on, plays as the token lands — and then the row takes its normal exit. Several merges in one refresh stagger 200 ms apart with at most three tokens in flight (the rest tick the count without flying); a merged PR that is filtered out or on another page still counts. Under reduced motion nothing flies: the count ticks and the row glows. A PR drawn inline on its issue's row (the usual case — one covering PR, no sub-row) celebrates on that issue row: every row stamps the PR keys it draws (`data-ham-prs`) and the SPA remembers each PR's host row from the last payload, so the flight has somewhere to start from even when the merge also closes the issue. The ⚙ dialog's **Merges** section has **Celebrate merges** (default on, `hive.tracker.celebrate`); off, the row leaves as before and the zap plays at once. **Test celebration** beside it plays one flight from the first row of the list to the counter (pop and zap, the count unchanged) so the effect can be checked without waiting for a merge; under reduced motion it says so and only pops. The row effect is reusable in the SPA as `celebrateRow(rowEl, {kind: 'merged' | 'closed-by-merge'})`.
**Merged today.** Directly above the Merge gate / ✓ column header, right-aligned and independent of filter-bar wrapping, a small hex glyph appears with **Merged today: N** — pull requests the hive saw merge since your local midnight (seeded after a reload from the tracker payload's `merged_24h` list, the audit log's `pr_merged` entries over the last 24 hours, and grown live by the same merge detector that plays the zap); hovering lists the last five with their times. When a PR on the list merges its row does **not** simply vanish on the next refresh: it stays pinned for about 2.5 s, its ✓ cell glows amber, the event line reads *Hive: merged #14947 · by hive*, a flat brand-amber hex token lifts out of the ✓ cell and arcs (≈0.5 s) to the counter, which ticks up with a soft scale-pop — the merge zap, when sound is on, plays as the token lands — and then the row takes its normal exit. Several merges in one refresh stagger 200 ms apart with at most three tokens in flight (the rest tick the count without flying); a merged PR that is filtered out or on another page still counts. Under reduced motion nothing flies: the count ticks and the row glows. A PR drawn inline on its issue's row (the usual case — one covering PR, no sub-row) celebrates on that issue row: every row stamps the PR keys it draws (`data-ham-prs`) and the SPA remembers each PR's host row from the last payload, so the flight has somewhere to start from even when the merge also closes the issue. The ⚙ dialog's **Merges** section has **Celebrate merges** (default on, `hive.tracker.celebrate`); off, the row leaves as before and the zap plays at once. **Test celebration** beside it plays one flight from the first row of the list to the counter (pop and zap, the count unchanged) so the effect can be checked without waiting for a merge; under reduced motion it says so and only pops. The row effect is reusable in the SPA as `celebrateRow(rowEl, {kind: 'merged' | 'closed-by-merge'})`.

**Multi-select.** The checkbox in a row's left gutter selects the row — and the checkbox in a nested PR sub-row's gutter selects that PR on its own, so one or more PRs under an issue can be picked without the issue or each other; **Shift+click** selects the range from the last clicked row (sub-rows are in the range order right after their issue), **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), **Let hive decide (N selected)** (one click for the whole selection: one delegated-decision job per selected item, each nested PR sub-row by its own number, with one summary toast — "3 sent · 2 decided · 1 no-op", plus "· 1 failed" when any failed — and the per-action confirm / *Don't ask again* of *Let hive decide*), *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.

Expand Down Expand Up @@ -812,3 +812,5 @@ This section exists on the v6 line only. On v5 the same facts are in the Diagnos
**When it appears.** On v6 only, when the hive reports platform data.

**Settings that change it.** Your code hosting settings and optional service settings change it. The code hosting service is `project.forge`; a self-managed GitLab or a Gitea/Forgejo instance also shows its URL. See [Forges](integrations/forges.md).

The stage pill's actor comes from the server's `stage_actor` (`kind`, `login`, `since`, `why`): hive → ⬡, contributor clanker → robot, human → the same person glyph as Needs human decision, bot → robot. `none` has no actor icon and explains “no one is working on this right now — <why>” on hover. A bot PR in the fixing lane with no worker says **Conflicting · bot PR** (or **Waiting · bot PR**) with the bot author's icon, rather than claiming someone is fixing it. A current-round hive worker is explicit evidence of active work; a stage label alone is not. Each covering PR has one server-selected `drawn_under` issue (the lowest listed issue number); other linked issues point to that row instead of drawing its live strip again.
53 changes: 41 additions & 12 deletions src/pkg/dashboard/stage_tracker.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,20 @@ type StageTrackerHop struct {
Regressed bool `json:"regressed,omitempty"`
}

// StageTrackerActor names current work or the next responsible actor.
type StageTrackerActor struct {
Kind string `json:"kind"`
Login string `json:"login"`
Since *time.Time `json:"since"`
Why string `json:"why"`
}

// StageTrackerItem is one open issue or PR on the tracker.
type StageTrackerItem struct {
StageActor StageTrackerActor `json:"stage_actor"`
StageState string `json:"stage_state,omitempty"`
// DrawnUnder is the single issue row that draws this PR (0 = standalone).
DrawnUnder int `json:"drawn_under,omitempty"`
Superseded *github.ReviewQueueSuperseded `json:"superseded,omitempty"`
Repo string `json:"repo"`
Number int `json:"number"`
Expand All @@ -260,7 +272,7 @@ type StageTrackerItem struct {
// both empty for an actionable or held item.
Bucket string `json:"bucket,omitempty"`
BucketReason string `json:"bucket_reason,omitempty"`
// AuthorKind is human / clanker / hive ("" = unknown) and
// AuthorKind is human / clanker / hive / bot ("" = unknown) and
// AuthorKindSource says whether it came from an author/<kind> label
// ("label") or was inferred from the PR's hive markers ("inferred").
AuthorKind string `json:"author_kind,omitempty"`
Expand Down Expand Up @@ -458,16 +470,19 @@ type StageTrackerLinkedIssue struct {

// StageTrackerLinkedPR is one covering PR nested under an issue row.
type StageTrackerLinkedPR struct {
BaseRef string `json:"base_ref,omitempty"`
Number int `json:"number"`
Title string `json:"title,omitempty"`
URL string `json:"url,omitempty"`
Author string `json:"author,omitempty"`
AuthorKind string `json:"author_kind,omitempty"`
Stage int `json:"stage,omitempty"`
StageSince *time.Time `json:"stage_since,omitempty"`
Caption string `json:"caption,omitempty"`
Modifiers []string `json:"modifiers,omitempty"`
StageActor StageTrackerActor `json:"stage_actor"`
StageState string `json:"stage_state,omitempty"`
DrawnUnder int `json:"drawn_under,omitempty"`
BaseRef string `json:"base_ref,omitempty"`
Number int `json:"number"`
Title string `json:"title,omitempty"`
URL string `json:"url,omitempty"`
Author string `json:"author,omitempty"`
AuthorKind string `json:"author_kind,omitempty"`
Stage int `json:"stage,omitempty"`
StageSince *time.Time `json:"stage_since,omitempty"`
Caption string `json:"caption,omitempty"`
Modifiers []string `json:"modifiers,omitempty"`
// DeferredModifiers mirrors the nested PR's own row field: the
// merge-gate pills it is not yet drawing.
DeferredModifiers []string `json:"deferred_modifiers,omitempty"`
Expand Down Expand Up @@ -698,7 +713,7 @@ func stageTrackerAuthorKind(labels []string, author string, appAuthored, hiveAtt
}
}
if strings.HasSuffix(strings.ToLower(strings.TrimSpace(author)), botLoginSuffix) {
return "", ""
return "bot", authorKindSrcInfer
}
if strings.TrimSpace(author) == "" {
return "", ""
Expand Down Expand Up @@ -1777,6 +1792,9 @@ func (s *Server) buildStageTracker(status *StatusPayload, store *stagelabels.Sto
resp.OpenIssues, resp.OpenPRs = stageTrackerOpenCounts(resp.Items)
s.applyOperatorActions(resp.Items, now)
resp.NeedsHuman, resp.OnHold = stageTrackerHumanCounts(resp.Items)
for i := range resp.Items {
stageTrackerSetActor(&resp.Items[i], status.Agents)
}
stageTrackerResolveLinkedPRs(resp.Items)
sort.SliceStable(resp.Items, stageTrackerLess(resp.Items))
return resp
Expand Down Expand Up @@ -2500,6 +2518,7 @@ func stageTrackerResolveLinkedPRs(items []StageTrackerItem) {
if pr := prs[it.Repo+"#"+strconv.Itoa(lp.Number)]; pr != nil {
lp.Title, lp.Author, lp.AuthorKind, lp.Stage = pr.Title, pr.Author, pr.AuthorKind, pr.Stage
lp.StageSince, lp.Caption = pr.StageSince, pr.Caption
lp.StageActor, lp.StageState = pr.StageActor, pr.StageState
lp.SentinelAlert, lp.SentinelReason, lp.Head = pr.SentinelAlert, pr.SentinelReason, pr.Head
lp.Adoption = pr.Adoption
lp.HumanApprover, lp.ManualMerge = pr.HumanApprover, pr.ManualMerge
Expand Down Expand Up @@ -2541,9 +2560,19 @@ func stageTrackerResolveLinkedPRs(items []StageTrackerItem) {
}
for i := range items {
if items[i].Kind == "pr" {
items[i].DrawnUnder = items[i].NestedUnder
items[i].ClosedIssue = stageTrackerClosedIssueAnchor(items[i])
}
}
// Publish the final owner only after every issue has been considered.
for i := range items {
for j := range items[i].LinkedPRs {
lp := &items[i].LinkedPRs[j]
if pr := prs[items[i].Repo+"#"+strconv.Itoa(lp.Number)]; pr != nil {
lp.DrawnUnder = pr.DrawnUnder
}
}
}
}

// stageTrackerClosedIssueAnchor returns the closed issue a standalone PR
Expand Down
65 changes: 65 additions & 0 deletions src/pkg/dashboard/stage_tracker_actor.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
package dashboard

import (
"slices"
"strings"
"time"
)

// stageTrackerSetActor distinguishes a lane classification from live work.
// Human gates and author returns name the next responsible actor; execution
// stages name an agent only when its current round actually touches the item.
func stageTrackerSetActor(it *StageTrackerItem, agents []FrontendAgent) {
a := StageTrackerActor{Kind: "none", Why: "waiting for the next pipeline evaluation"}
switch it.Stage {
case 15, 17, 45, 85, 90:
a.Kind, a.Why = "human", "waiting for a human decision"
case 20:
if it.ClaimantKind != "" {
a.Kind, a.Why = it.ClaimantKind, "live claim holder"
}
case 30, 40, 70, 71, 72:
a.Login = it.Author
switch it.AuthorKind {
case "human", "clanker":
a.Kind, a.Why = it.AuthorKind, "waiting for the PR author"
case "bot":
a.Why = "bot PR; waiting for the bot's next run"
default:
a.Why = "no active agent is working on this PR"
}
}
a.Since = it.StageSince
// A live worker takes precedence over inferred responsibility, except at
// explicit human gates where a decision is still required.
if a.Kind != "human" {
for _, agent := range agents {
la := agent.LastAction
if agent.Busy != "working" || la == nil || !la.Current || la.Number != it.Number {
continue
}
repo := strings.ToLower(la.Repo)
target := strings.ToLower(it.Repo)
if repo == "" || (repo != target && !strings.HasSuffix(target, "/"+repo)) {
continue
}
a.Kind, a.Login, a.Why = "hive", agent.Name, "agent is working on this item in its current round"
if at, err := time.Parse(time.RFC3339, la.At); err == nil {
a.Since = &at
}
break
}
}
it.StageActor = a
if it.Stage == 70 && a.Kind == "none" {
it.StageState = "Waiting for fixes"
if it.AuthorKind == "bot" {
it.StageState = "Waiting · bot PR"
if strings.Contains(strings.ToLower(it.Reason), "conflict") || slices.Contains(it.Modifiers, "needs-rebase") {
it.StageState = "Conflicting · bot PR"
}
}
it.Caption = it.StageState + " — " + a.Why
it.Actor = ""
}
}
57 changes: 57 additions & 0 deletions src/pkg/dashboard/stage_tracker_actor_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
package dashboard

import (
"testing"
"time"
)

func TestStageTrackerActorEvidence(t *testing.T) {
for _, tc := range []struct {
name string
item StageTrackerItem
agents []FrontendAgent
kind, login, state string
}{
{name: "conflicting nightly bot", item: StageTrackerItem{Kind: "pr", Stage: 70, Author: "github-actions[bot]", AuthorKind: "bot", Modifiers: []string{"needs-rebase"}}, kind: "none", login: "github-actions[bot]", state: "Conflicting · bot PR"},
{name: "idle hive fixing classification", item: StageTrackerItem{Kind: "pr", Stage: 70, AuthorKind: "hive"}, kind: "none", state: "Waiting for fixes"},
{name: "human return", item: StageTrackerItem{Kind: "pr", Stage: 71, AuthorKind: "human", Author: "sam"}, kind: "human", login: "sam"},
{name: "contributor return", item: StageTrackerItem{Kind: "pr", Stage: 72, AuthorKind: "clanker", Author: "relay"}, kind: "clanker", login: "relay"},
{name: "decision gate", item: StageTrackerItem{Kind: "pr", Stage: 85}, kind: "human"},
{name: "unknown", item: StageTrackerItem{Kind: "pr", Stage: 30}, kind: "none"},
{name: "current worker", item: StageTrackerItem{Repo: "hivecommons/hive", Number: 14921, Kind: "pr", Stage: 70}, agents: []FrontendAgent{{Name: "fixer", Busy: "working", LastAction: &FrontendAgentLastAction{Repo: "hive", Number: 14921, Current: true, At: "2026-10-28T12:00:00Z"}}}, kind: "hive", login: "fixer"},
{name: "stale round", item: StageTrackerItem{Repo: "hivecommons/hive", Number: 14921, Kind: "pr", Stage: 70}, agents: []FrontendAgent{{Name: "fixer", Busy: "working", LastAction: &FrontendAgentLastAction{Repo: "hive", Number: 14921}}}, kind: "none", state: "Waiting for fixes"},
{name: "other repository", item: StageTrackerItem{Repo: "hivecommons/docs", Number: 14921, Kind: "pr", Stage: 70}, agents: []FrontendAgent{{Name: "fixer", Busy: "working", LastAction: &FrontendAgentLastAction{Repo: "hive", Number: 14921, Current: true}}}, kind: "none", state: "Waiting for fixes"},
} {
t.Run(tc.name, func(t *testing.T) {
stageTrackerSetActor(&tc.item, tc.agents)
a := tc.item.StageActor
if a.Kind != tc.kind || a.Login != tc.login || a.Why == "" || tc.item.StageState != tc.state {
t.Fatalf("actor=%+v state=%q", a, tc.item.StageState)
}
if tc.name == "current worker" && (a.Since == nil || !a.Since.Equal(time.Date(2026, 10, 28, 12, 0, 0, 0, time.UTC))) {
t.Fatalf("worker since=%v", a.Since)
}
})
}
}

func TestStageTrackerSharedPRDrawingOwner(t *testing.T) {
// #14921 closes #14906 (already closed), #14910 and #14911. Input
// order must not change its drawing owner, and other repos are isolated.
items := []StageTrackerItem{
{Repo: "hivecommons/hive", Number: 14911, Kind: "issue"},
{Repo: "hivecommons/hive", Number: 14921, Kind: "pr", Stage: 70, StageActor: StageTrackerActor{Kind: "hive", Login: "fixer"}, LinkedIssues: []StageTrackerLinkedIssue{{Number: 14906, State: "closed"}, {Number: 14910, State: "open"}, {Number: 14911, State: "open"}}},
{Repo: "hivecommons/hive", Number: 14910, Kind: "issue"},
{Repo: "hivecommons/docs", Number: 14921, Kind: "pr"},
}
stageTrackerResolveLinkedPRs(items)
if items[1].DrawnUnder != 14910 || items[3].DrawnUnder != 0 {
t.Fatalf("owners: %+v", items)
}
for _, i := range []int{0, 2} {
lp := items[i].LinkedPRs
if len(lp) != 1 || lp[0].DrawnUnder != 14910 || lp[0].StageActor.Login != "fixer" {
t.Fatalf("issue %d: %+v", items[i].Number, lp)
}
}
}
Loading
Loading