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-offline-clanker-pr-in-progress.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Activity monitor: a contributor PR whose `stage/*` labels the write-back gate kept off GitHub (fork PR, no opt-in label) no longer reads as an unclassified "PR in progress Β· @x's clanker" when the stage engine holds it at `stage/085`: the stage record carries `labels_suppressed` and the tracker trusts it instead of treating the missing park label as a lifted park. An unclassified clanker PR now carries its author's `presence`; when the clanker is offline the chevron reads `PR in progress Β· @x's clanker Β· β–  offline 3h` and the caption names the next automatic step (a green PR is reviewed and merged without its author; hive adopts only once it is returned and nothing is pushed for `adoption.after_offline`). Human-authored PRs are unchanged and never adopted.
1 change: 1 addition & 0 deletions src/docs/dashboard-copy-inventory.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ The new hover, verbatim (title line omitted):
| `stageTrackerLeadActionHtml` (`tracker-actions.js`) | the row header's inline lead button (chip slot) | β€” (the lead sat in the β‹― menu only) | the menu entry's label (1–4), its hint as the hover | `TestStageTrackerLeadActionInline`, `TestStageTrackerMaintainerRowsHaveLeadAction` |
| Toasts (`STAGE_TRACKER_ACTING_CAPTIONS`, acted labels) | toast | 2–4 each | unchanged | β€” |
| `stageTrackerStripItems` holder token + `stageTrackerClaimantIconKind` (`tracker-row.js`) on the PR in progress chevron ([#15541](https://github.com/hivecommons/hive/issues/15541)) | lit chevron word, chevron hover | *PR in progress* (bare; the holder token only reached PRs from review on) | *PR in progress Β· scanner ⬑*, *PR in progress Β· @odttlnt's clanker πŸ€–*, *PR in progress Β· @clubanderson πŸ‘€* β€” the same token and hover line as *Claimed Β·*; the name ellipsizes before the one-line sub-row wraps; a detour word that already names them (*Returned to @bob's clanker*) does not repeat them | `TestStageTrackerClaimantChevronJS`, `TestStageTrackerPRClaimant`, `TestStageTrackerClaimantStage` |
| `stageTrackerHolderPresenceHtml` (`tracker-words.js`) after the holder token; `stageTrackerOfflineAuthorCaption` + `stageTrackerWaitingOn` at stage None (Go) | lit chevron holder suffix, chevron hover, row caption | *PR in progress Β· @odttlnt's clanker πŸ€–* (no live state; a fork PR the gate kept label-less read as unclassified even when the engine held it at 085) | *PR in progress Β· @odttlnt's clanker πŸ€– Β· β–  offline 3h* (muted; *Β· β—‹ not registered* for a login with no profile here; nothing when online); caption "@odttlnt's clanker is offline 3h; a green PR is reviewed and merged without its author β€” hive adopts it only once it is returned (red CI, conflicts or review asks) and nothing is pushed for 15m"; a suppressed-label 085 record keeps *Needs human decision* | `TestStageTrackerHolderPresenceJS`, `TestStageTrackerUnclassifiedClankerPROfflineCaption`, `TestStageTrackerSuppressedDecisionRecordKeepsStage` |
| `stageTrackerLinkedPRProgress` (Go) + `stageTrackerEventText` / `stageTrackerNestedOpenPRs` (`tracker-motion.js`, `tracker-row.js`) on an adoption pair ([#15495](https://github.com/hivecommons/hive/issues/15495)) | issue row caption, feed line, inline lead button | *fell back to Covered by pr β€” Covered by PR #15537 β€” Review swarm requested; … ; PR #15508 β€” Hive adopted this PR … β€” changes requested* (48) and a *Let hive decide β€” all 2 PRs* lead on a row with nothing to decide | *Covered by #15537 (adopted from @mendezr's #15508) β€” in CI / review* (11); the feed says *moved to* when an issue stops mirroring its PR; the pair counts as one open PR so no lead button | `TestStageTrackerLinkedPRProgressCollapsesAdoptionPair`, `TestStageTrackerAdoptionPairIsOneOpenPR`, `TestStageTrackerEventTextUnmirroredCoveredByPR` |
| `stageTrackerSelectionTriage` (`tracker-actions.js`) | selection bar lead button / bulk β‹― menu entry, summary toast | β€” (no bulk Accept triage; one row at a time) | *Accept triage (4 selected)* / *Accept triage (2 of 4)* with the hint *skips the 2 not waiting on triage*; one toast *Accepted 4 issues* | `TestStageTrackerBulkAcceptTriage` |
| Settings β†’ Features β†’ Auto-merge β†’ "Merge only on current base" help (`renderGovFeatures`, `config-features.js`) and the Repos-tab override row / repo-card `current-base` chip ([#15335](https://github.com/hivecommons/hive/issues/15335)) | settingHelpMark popover, checkbox label, chip hover | β€” (new) | 56 (help), 5 (row label), 1 (chip) | `TestCurrentBaseSettingsMarkupNodeGuard` |
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 @@ -987,6 +987,10 @@ Shape, not colour alone, carries the state; the indicator has its own `aria-labe

It refreshes with the tracker like every other pill.

**An offline clanker's PR that has not been returned.** A clanker-authored PR the engine has not classified yet (the chevron reads `PR in progress Β· @odttlnt's clanker`) carries the same `presence` for its author, with `next: wait` and no `adopt_at` β€” the adoption clock runs only at 072. When the clanker is offline (or not registered here) the chevron's holder gains a muted suffix with the state square: `PR in progress Β· @odttlnt's clanker Β· β–  offline 3h`, and the caption states the next automatic step: "@odttlnt's clanker is offline 3h; a green PR is reviewed and merged without its author β€” hive adopts it only once it is returned (red CI, conflicts or review asks) and nothing is pushed for 15m" (`governor.labels.stage.adoption.after_offline`). A green PR does not need its author online: review and merge admission run on the contributor lane regardless; adoption is the exit for a PR that is red, conflicting or asked to change while its clanker is away, never for a green one, and never for a human's PR.

A contributor PR whose `stage/*` labels the write-back gate kept off GitHub (no opt-in label, see [What hive writes to GitHub, and when](operator-reference.md#what-hive-writes-to-github-and-when)) is tracked from the engine's record alone: the record carries `labels_suppressed` and the tracker trusts its stage (085 reads *Needs human decision*, not *PR in progress*) even though the item's labels say nothing. Until this fix the tracker read the missing park label as a lifted park and dropped the record, so a dozen fork PRs parked at 085 for a human's decision sat under "PR in progress Β· @x's clanker" for hours while their clankers were offline.

#### Rework pickup on the waiting-on pill

**Rework pickup on the waiting-on pill.** The same 071 / 072 rows also carry `rework{state: requested|acknowledged|in_progress|pushed, actor, requested_at, since, evidence: queued|claim|activity|commit, mode, ahead, head}` β€” whether the person the row waits on has picked up the rework the hive (or a human reviewer) asked for ([hivecommons/hive#15280](https://github.com/hivecommons/hive/issues/15280): "waiting on @x" said who, never whether anything had happened since). It is derived from data the tracker already holds, no extra GitHub calls: `requested_at` is the first nudge the contributor engine recorded on the current head (`stage/072`) or, before any nudge, when the row entered the stage (`stage/071` after a human's changes-requested review); **pushed** when the PR's head is no longer the head the request named (`evidence: commit` β€” the stage engine routes the row back to `050` on its next sweep, the pill says `re-review pending` meanwhile); **in_progress** when the author's clanker relay β€” or, after a Reroute, the target's β€” has taken the `fix-pr` task from the contributor fix queue (`evidence: claim`, `mode` spawn/preempt/boundary, `since` the dispatch); **acknowledged** when the PR's `updated_at` moved after the request and after the hive's own nudge comment (`evidence: activity` β€” a reply, a review-thread answer, an edit; reactions do not bump it, so an πŸ‘€ alone is not seen); otherwise **requested**, with `evidence: queued` and `ahead` when the fix is enqueued on the clanker's hub queue but not yet dispatched. The pill appends the state after the login β€” `waiting on @x Β· no response`, `Β· queued`, `Β· acknowledged`, `Β· working`, `Β· re-review pending` β€” and its tooltip (and the row tooltip's `Rework:` line) says since when: "rework requested 1 hour ago (13:32 UTC) Β· no response from @x yet", "@x acknowledged Β· activity on the PR 20 min ago", "@x's clanker picked up the rework 5 min ago (spawn)", "@x pushed a new head 1 min ago Β· re-review pending". A state change at an unchanged stage writes the row's event line ("@x acknowledged the rework request", "@x's clanker picked up the rework", "@x pushed a new head β€” re-review pending"). The presence indicator stays; a nested per-PR row under an issue mirrors the field.
Expand Down
12 changes: 11 additions & 1 deletion src/pkg/dashboard/stage_tracker.go
Original file line number Diff line number Diff line change
Expand Up @@ -1963,11 +1963,18 @@ func (s *Server) stageDwellOverrides() map[string]time.Duration {
// 045/085 while its current labels carry no park signal at all β€” no stage
// label for the bay, no `needs-human`, no retired needs-decision spelling.
// The labels are the newer fact: the park lifted and the record is waiting
// on the engine's next reconcile.
// on the engine's next reconcile. Not so when the write-back gate kept the
// labels off the item (a contributor PR without the opt-in label): the
// labels never carried the park, the record is the only stage there is,
// and dropping it read the row as an unclassified "PR in progress" for
// hours while the engine held it at 085.
func stageTrackerStaleDecisionRecord(rec stagelabels.Record, labels []string) bool {
if rec.Stage != stagelabels.NeedsDecision && rec.Stage != stagelabels.IssueNeedsDecision {
return false
}
if rec.LabelsSuppressed {
return false
}
for _, l := range labels {
switch strings.ToLower(strings.TrimSpace(l)) {
case needsDecisionLabel, prNeedsDecisionLabel, "needs-decision", "needs-human", "needs-direction":
Expand Down Expand Up @@ -2310,6 +2317,9 @@ func (s *Server) buildStageTracker(status *StatusPayload, store *stagelabels.Sto
it.Caption = stageTrackerReturnedToHiveCaption(it.Caption, it.Author, requesters)
}
applyStageTrackerNew(&it, stageTrackerNewState(it, ok, issueFilter, status.Governor, now))
// After the New caption: an unclassified clanker PR whose clanker
// is offline says what that means for it.
it.Caption = stageTrackerOfflineAuthorCaption(it.Caption, it.Presence, it.Stage, adoptionClock, now)
it.SentinelAlert, it.SentinelFindings, it.SentinelReason = s.stageTrackerSentinel(evidenceVerifier, repoName, pr.Number, pr.HeadSHA, pr.Labels)
// The sentinel chip is a merge-gate pill too (the trusted-author
// notice and the real alert alike): sentinel_alert stays truthful
Expand Down
139 changes: 139 additions & 0 deletions src/pkg/dashboard/stage_tracker_offline_clanker_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
package dashboard

import (
"strings"
"testing"
"time"

"github.com/hivecommons/hive/pkg/config"
"github.com/hivecommons/hive/pkg/github"
"github.com/hivecommons/hive/pkg/github/automerge"
"github.com/hivecommons/hive/pkg/stagelabels"
)

// An offline clanker's PRs sat at "PR in progress Β· @odttlnt's clanker"
// for hours while the engine held them at 085: the write-back gate kept the
// stage label off the fork PR, and the tracker read the label-less item as
// a lifted park and dropped the record. The record now says the labels
// were suppressed and the row keeps its stage; an unclassified clanker PR
// carries its author's presence and a caption naming the next automatic
// step.

func offlineClankerFixture(t *testing.T, now time.Time, lastSeen time.Time) (*Server, *stagelabels.Store, *StatusPayload) {
t.Helper()
s := newTestServer()
store := stagelabels.NewStore("", func() time.Time { return now })
s.stageStore = store
s.presenceLookup = func(login string) (automerge.ContributorPresence, bool) {
if login != "odttlnt" {
return automerge.ContributorPresence{}, false
}
return automerge.ContributorPresence{Registered: true, Online: false, LastSeen: lastSeen}, true
}
s.deps = &Dependencies{Config: &config.Config{}}
status := minimalPayload()
status.HiveID = "hive"
status.Repos = []FrontendRepo{{
Name: "hive", Full: "hivecommons/hive",
OpenPrs: []any{
FrontendPR{PullRequest: github.PullRequest{Number: 15312, Title: "Decision asked", Author: "odttlnt", HeadSHA: "036b", Labels: []string{"dco-signoff: yes", "size/M", "author/clanker"}}},
FrontendPR{PullRequest: github.PullRequest{Number: 15343, Title: "Unclassified", Author: "odttlnt", HeadSHA: "d15e", Labels: []string{"dco-signoff: yes", "author/clanker"}}},
FrontendPR{PullRequest: github.PullRequest{Number: 15400, Title: "Human's PR", Author: "zoe", HeadSHA: "aaaa", Labels: []string{"author/human"}}},
},
}}
s.UpdateStatus(status)
return s, store, status
}

// A 085 record whose labels the gate suppressed is the row's stage.
func TestStageTrackerSuppressedDecisionRecordKeepsStage(t *testing.T) {
now := time.Date(2026, 10, 29, 20, 30, 0, 0, time.UTC)
s, store, status := offlineClankerFixture(t, now, now.Add(-3*time.Hour))
key := stagelabels.Key("hivecommons/hive", 15312)
store.Observe(key, stagelabels.NeedsDecision, "contributor-lane:decision-requested")
store.NoteLabelsSuppressed(key, true)
it := trackerItem(t, s.buildStageTracker(status, store, now), "pr", 15312)
if it.Stage != stagelabels.NeedsDecision.Number() || it.StageSince == nil {
t.Fatalf("suppressed 085 record: stage %d since %v caption %q, want 085 from the record", it.Stage, it.StageSince, it.Caption)
}
if it.Presence != nil {
t.Fatalf("a row waiting on a person's decision carries no author presence: %+v", it.Presence)
}
// The same record with the label write landed and then removed is a
// lifted park, as before.
store.NoteLabelsSuppressed(key, false)
if it := trackerItem(t, s.buildStageTracker(status, store, now), "pr", 15312); it.Stage == stagelabels.NeedsDecision.Number() {
t.Fatalf("label-less 085 record with labels not suppressed still parks the row: %+v", it)
}
}

// An unclassified clanker PR carries its author's presence and the
// caption says what the offline clanker means for it; a human's does not.
func TestStageTrackerUnclassifiedClankerPROfflineCaption(t *testing.T) {
now := time.Date(2026, 10, 29, 20, 30, 0, 0, time.UTC)
s, store, status := offlineClankerFixture(t, now, now.Add(-3*time.Hour))
on, off := true, false
s.deps.Config.Governor.Labels.Stage.Adoption.Enabled = &on
tr := s.buildStageTracker(status, store, now)
it := trackerItem(t, tr, "pr", 15343)
if it.Stage != 0 {
t.Fatalf("stage = %d, want unclassified", it.Stage)
}
p := it.Presence
if p == nil || p.Login != "odttlnt" || p.State != presenceStateOffline || p.Kind != presenceKindClanker || p.Next != presenceNextWait || p.AdoptAt != nil {
t.Fatalf("presence = %+v, want offline clanker, next wait, no adopt-at (the clock runs at 072 only)", p)
}
if p.LastSeen == nil || !p.LastSeen.Equal(now.Add(-3*time.Hour)) {
t.Fatalf("last_seen = %v", p.LastSeen)
}
for _, want := range []string{"waiting for the stage-label pass", "@odttlnt's clanker is offline 3h", "reviewed and merged without its author", "hive adopts it only once it is returned", "nothing is pushed for 15m"} {
if !strings.Contains(it.Caption, want) {
t.Errorf("caption lacks %q: %s", want, it.Caption)
}
}
if h := trackerItem(t, tr, "pr", 15400); h.Presence != nil || strings.Contains(h.Caption, "clanker") {
t.Fatalf("human's unclassified PR = presence %+v caption %q, want neither", h.Presence, h.Caption)
}
// Adoption off: no promise about adopting.
s.deps.Config.Governor.Labels.Stage.Adoption.Enabled = &off
if c := trackerItem(t, s.buildStageTracker(status, store, now), "pr", 15343).Caption; strings.Contains(c, "adopts") || !strings.Contains(c, "offline 3h") {
t.Fatalf("adoption off caption = %q", c)
}
}

// The chevron's holder gains the clanker's offline state and the title
// carries the next step (node, lifted from index.html).
func TestStageTrackerHolderPresenceJS(t *testing.T) {
html := indexHTML(t)
script := strings.Join([]string{
stageTrackerRowActionsPreamble(t, html),
stageTrackerPresenceJS(t, html),
jsFunc(t, html, "stageTrackerHolderPresenceHtml"),
`
const NOW = Date.parse('2026-10-30T00:30:00Z');
Date.now = () => NOW;
const iso = ms => new Date(ms).toISOString();
const HOUR = 3600000;
const claimant = { kind: 'clanker', login: 'odttlnt', source: 'author' };
const offline = { kind: 'pr', repo: 'hivecommons/hive', number: 15343, stage: 0, author: 'odttlnt', author_kind: 'clanker', claimant,
presence: { login: 'odttlnt', state: 'offline', kind: 'clanker', since: iso(NOW - 7 * HOUR), last_seen: iso(NOW - 3 * HOUR), next: 'wait' } };
const h = stageTrackerHolderPresenceHtml(offline, claimant, NOW);
assert.ok(/^<span class="ham-holder-presence ham-presence ham-presence-offline ham-presence-clanker" title="Waiting on @odttlnt&#39;s clanker \(offline 3h\) β€” hive is waiting for them" aria-label="[^"]*" data-ham-presence="offline"> Β· <i class="ham-presence-dot" aria-hidden="true"><\/i>offline 3h<\/span>$/.test(h), h);
// Online: nothing to flag. Another holder: not theirs. Human: no presence. Unregistered: said so.
assert.strictEqual(stageTrackerHolderPresenceHtml(Object.assign({}, offline, { presence: Object.assign({}, offline.presence, { state: 'online' }) }), claimant, NOW), '');
assert.strictEqual(stageTrackerHolderPresenceHtml(offline, { kind: 'clanker', login: 'karibhou' }, NOW), '');
assert.strictEqual(stageTrackerHolderPresenceHtml(offline, { kind: 'person', login: 'odttlnt' }, NOW), '');
assert.ok(stageTrackerHolderPresenceHtml(Object.assign({}, offline, { presence: Object.assign({}, offline.presence, { state: 'unknown' }) }), claimant, NOW).includes('>not registered</span>'));
assert.strictEqual(stageTrackerHolderPresenceHtml({ kind: 'pr', stage: 0 }, claimant, NOW), '');
`,
}, "\n")
runStageTrackerRowActionsScript(t, script)
for _, want := range []string{
"stageTrackerHolderPresenceHtml(item, claimant, nowMs)",
".ham-holder-presence {",
} {
if !strings.Contains(html, want) {
t.Errorf("index.html lacks %q", want)
}
}
}
Loading
Loading