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-review-chevron-amber.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Activity Monitor: the Review and CI chevrons wear the amber in-progress fill only while perspectives or checks are actually running; a finished verdict is done-style (approved, changes requested, or a muted "awaiting human decision"). Back in PR in progress with the hive on the repair, a human-decision verdict reads "changes requested" instead of "awaiting human decision" (#16531).
4 changes: 2 additions & 2 deletions src/pkg/dashboard/stage_tracker_activity.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const STAGE_TRACKER_NEEDS_DECISION = 85, STAGE_TRACKER_ISSUE_NEEDS_DECISION = 45
const STAGE_TRACKER_ISSUE_DECISION_COLUMN = 10, STAGE_TRACKER_TRIAGE_NEEDED = 15, STAGE_TRACKER_POSSIBLY_EXISTS = 17;
const STAGE_TRACKER_PRE_MERGE_SOAK = 95;
`;
const track = new Function('esc', 'stageTrackerIcon', fn(strip, 'stageTrackerTrackLead') + fn(strip, 'stageTrackerTrackWord') + fn(strip, 'stageTrackerActivityTrackHtml') + ';return stageTrackerActivityTrackHtml;')(esc, (n, cls) => `<svg class="${cls}" data-icon="${n}"></svg>`);
const track = new Function('esc', 'stageTrackerIcon', fn(strip, 'stageTrackerTrackLead') + fn(strip, 'stageTrackerHiveOwnsRepair') + fn(strip, 'stageTrackerTrackWord') + fn(strip, 'stageTrackerActivityTrackHtml') + ';return stageTrackerActivityTrackHtml;')(esc, (n, cls) => `<svg class="${cls}" data-icon="${n}"></svg>`);
const getAnchor = new Function(globals + anchor + ';return stageTrackerAnchor;')();
const header = new Function('esc', 'stageTrackerIcon', globals + fn(strip, 'stageTrackerHeaderHtml') + ';return stageTrackerHeaderHtml;')(esc, () => '');
const now = Date.parse('2026-11-02T21:00:00Z');
Expand Down Expand Up @@ -716,7 +716,7 @@ test('the backend detail sentence rides in the track tooltip, not on the chevron
});

test('#16484: count grammar — CI passed/total and Review done/total across every state', () => {
const word = new Function(fn(strip, 'stageTrackerTrackWord') + ';return stageTrackerTrackWord;')();
const word = new Function(fn(strip, 'stageTrackerHiveOwnsRepair') + fn(strip, 'stageTrackerTrackWord') + ';return stageTrackerTrackWord;')();
const ci = (state, extra = {}) => word({ head: 'h', ci_activity: { head: 'h', state, ...extra } }, 'ci', true);
assert.equal(ci('passing', { checks_passed: 14, checks_total: 14 }), 'CI 14/14 passed');
assert.equal(ci('failing', { checks_passed: 11, checks_total: 14, checks_failed: 1, checks_failing: ['lint'] }), 'CI 11/14 · 1 failing (lint)');
Expand Down
2 changes: 1 addition & 1 deletion src/pkg/dashboard/stage_tracker_build.go
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@ func (s *Server) buildStageTracker(status *StatusPayload, store *stagelabels.Sto
activityItem.CIActivity, activityItem.ReviewActivity = it.CIActivity, it.ReviewActivity
stageTrackerApplyCodeActivity(&activityItem, dispatchState, status, now)
stageTrackerApplyRemediation(&activityItem, dispatchState, status, stageTrackerFixerAgent(cfg), now)
it.CodeActivity, it.Remediation, it.DisplayColumn, it.Caption = activityItem.CodeActivity, activityItem.Remediation, activityItem.DisplayColumn, activityItem.Caption
it.CodeActivity, it.Remediation, it.ReviewActivity, it.DisplayColumn, it.Caption = activityItem.CodeActivity, activityItem.Remediation, activityItem.ReviewActivity, activityItem.DisplayColumn, activityItem.Caption
}
resp.NeedsHuman, resp.OnHold = stageTrackerHumanCounts(resp.Items)
resp.WaitingOnHuman = stageTrackerWaitingOnHuman(resp.Items)
Expand Down
36 changes: 36 additions & 0 deletions src/pkg/dashboard/stage_tracker_remediation.go
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ func stageTrackerApplyRemediation(it *StageTrackerItem, dispatch review.Dispatch
if it.Kind != "pr" || it.Head == "" || it.Superseded != nil || it.Stage == trackerNumberNeedsDecision || it.Stage >= trackerNumberAwaitingMerge {
return
}
stageTrackerAdoptHumanDecision(it)
redSince, redWord, red := stageTrackerRedSince(it)
if !red {
return
Expand All @@ -284,6 +285,10 @@ func stageTrackerApplyRemediation(it *StageTrackerItem, dispatch review.Dispatch
if out.State == "waiting_ci" && out.Source == "recorded-ci-retry" {
return
}
// 074: the hive adopted the repair; the stage word stands.
if out.State == "adopted" {
return
}
redAt := ""
if !redSince.IsZero() {
redAt = " at " + redSince.UTC().Format(time.RFC3339)
Expand Down Expand Up @@ -343,3 +348,34 @@ func stageTrackerApplyRemediation(it *StageTrackerItem, dispatch review.Dispatch
it.Caption = out.Caption
}
}

// stageTrackerAdoptHumanDecision: a review verdict that asked for a human
// decision stops reading "awaiting human decision" once the row is back in
// PR in progress with the hive on it — adopted (074) or in a fix stage —
// and nobody is actually parked on a person. The findings are then changes
// the hive is addressing; the decision question rides in the detail.
func stageTrackerAdoptHumanDecision(it *StageTrackerItem) {
a := it.ReviewActivity
if a == nil || a.State != "human_decision" || !strings.EqualFold(a.Head, it.Head) {
return
}
if it.NeedsHuman || it.OnHold || it.Hold != nil || it.Stage == trackerNumberNeedsDecision {
return
}
switch it.Stage {
case trackerNumberAdopted, trackerNumberFixing, trackerNumberNeedsAuthor, trackerNumberReturned:
default:
return
}
who := "the hive adopted the repair"
if it.Stage != trackerNumberAdopted {
who = "the row is under repair"
}
a.State, a.Caption, a.Active = "changes_requested", "Review findings · changes requested", false
a.Source += "+adopted-decision"
detail := "The review swarm asked for a human decision; " + who + ", so its findings are the changes to make."
if a.Blocker != "" {
detail += " Question: " + a.Blocker
}
a.Detail = strings.TrimSpace(detail + " " + a.Detail)
}
41 changes: 40 additions & 1 deletion src/pkg/dashboard/stage_tracker_remediation_chevron.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,15 @@ const STAGE_TRACKER_NEEDS_DECISION = 85, STAGE_TRACKER_ISSUE_NEEDS_DECISION = 45
const STAGE_TRACKER_ISSUE_DECISION_COLUMN = 10, STAGE_TRACKER_TRIAGE_NEEDED = 15, STAGE_TRACKER_POSSIBLY_EXISTS = 17;
const STAGE_TRACKER_PRE_MERGE_SOAK = 95;
`;
const track = new Function('esc', 'stageTrackerIcon', fn(strip, 'stageTrackerTrackLead') + fn(strip, 'stageTrackerTrackWord') + fn(strip, 'stageTrackerActivityTrackHtml') + ';return stageTrackerActivityTrackHtml;')(esc, (n, cls) => `<svg class="${cls}" data-icon="${n}"></svg>`);
const track = new Function('esc', 'stageTrackerIcon', fn(strip, 'stageTrackerTrackLead') + fn(strip, 'stageTrackerHiveOwnsRepair') + fn(strip, 'stageTrackerTrackWord') + fn(strip, 'stageTrackerActivityTrackHtml') + ';return stageTrackerActivityTrackHtml;')(esc, (n, cls) => `<svg class="${cls}" data-icon="${n}"></svg>`);
const getAnchor = new Function(globals + anchor + ';return stageTrackerAnchor;')();
const segments = new Function('stageTrackerAnchor', globals + `
const STAGE_TRACKER_ACTIVE_WORD = {70: 'Fixing'};
const STAGE_TRACKER_HUMAN_GATED = 85, STAGE_TRACKER_READY_FOR_HUMAN_MERGE = 90, STAGE_TRACKER_ADOPTED_BY_HIVE = 74;
function stageTrackerSentinelInLane() { return false; }
function stageTrackerUnauthorizedWord() { return ''; }
function stageTrackerManualMergeWord() { return 'Ready for human merge'; }
function stageTrackerAdoptedWord() { return 'Adopted by hive'; }
` + fn(rowSource, 'stageTrackerSegments') + ';return stageTrackerSegments;')(getAnchor);
const renderStrip = new Function('esc', 'stageTrackerSegments', 'stageTrackerActivityTrackHtml', globals + `
const STAGE_TRACKER_MOTION_STATIC = 'static', STAGE_TRACKER_MOTION_ACTIVE = 'active';
Expand Down Expand Up @@ -100,3 +101,41 @@ test('a red PR with a stale code head renders no remediation attributes', () =>
const html = renderStrip(item, stages, null, now, {});
assert.doesNotMatch(html, /data-remediation=/);
});

// hive#16509 row: back in PR in progress with the hive on it, a finished
// review is done-style — never the amber in-progress fill — and the word is
// the verdict, not "awaiting human decision".
test('adopted row: a complete review verdict is done-style, and a human-decision verdict reads as changes requested', () => {
const adopted = { head: 'abc1234def', state: 'adopted', caption: 'Adopted by hive · activity', source: 'adoption', observed_at: '2026-11-04T02:44:00Z' };
const decision = { head: 'abc1234def', state: 'human_decision', caption: 'Review findings · human decision', perspectives_done: 5, perspectives_total: 5, source: 'verified-review-bundle', observed_at: '2026-11-04T02:44:00Z', since: red };
const review = cells(redPR({ stage: 74, display_column: 30, code_activity: adopted, review_activity: decision }))[5];
assert.match(review, /class="ham-seg ham-activity-track done decided"/, 'done-style, muted: not the active fill');
assert.doesNotMatch(review, /ham-activity-track active|data-motion="active"/);
assert.match(review, /Review 5\/5 · changes requested</);
assert.doesNotMatch(review, /awaiting human/);

const parked = cells(redPR({ stage: 85, display_column: 85, needs_human: true, review_activity: decision }))[5];
assert.match(parked, /class="ham-seg ham-activity-track done decided"/, 'parked on a person is settled, still not amber');
assert.match(parked, /Review 5\/5 · awaiting human decision</, 'genuinely parked: the human word stands');

const changes = cells(redPR({ stage: 74, display_column: 30, code_activity: adopted, review_activity: { ...decision, state: 'changes_requested' } }))[5];
assert.match(changes, /class="ham-seg ham-activity-track failing"/);
assert.match(changes, /Review 5\/5 · changes requested</);
const approved = cells(redPR({ stage: 74, display_column: 30, code_activity: adopted, review_activity: { ...decision, state: 'approved' } }))[5];
assert.match(approved, /class="ham-seg ham-activity-track done"/);
assert.match(approved, /Review 5\/5 approved</);
const ci = cells(redPR({ stage: 74, display_column: 30, code_activity: adopted, review_activity: decision }))[4];
assert.match(ci, /class="ham-seg ham-activity-track done"/, '11/11 passed is done-style');
});

test('#16494 keeps: review perspectives still running stay amber beside running CI, with words', () => {
const item = redPR({ display_column: 50,
code_activity: { head: 'abc1234def', state: 'pushed', caption: 'New head pushed · CI and re-review', source: 'recorded-push', observed_at: '2026-11-04T02:44:00Z' },
ci_activity: { head: 'abc1234def', state: 'running', active: true, caption: 'CI 4/11 running', checks_passed: 4, checks_total: 11, source: 'checks', observed_at: '2026-11-04T02:44:00Z' },
review_activity: { head: 'abc1234def', state: 'reviewing', active: true, actor: 'reviewer-2', caption: 'Review 2/5 · reviewer-2 reviewing', perspectives_done: 2, perspectives_total: 5, source: 'dispatch', observed_at: '2026-11-04T02:44:00Z' } });
const c = cells(item);
assert.match(c[4], /ham-activity-track active ham-current/);
assert.match(c[4], /CI 4\/11/);
assert.match(c[5], /ham-activity-track active ham-current/);
assert.match(c[5], /Review 2\/5 · reviewer-2 reviewing</);
});
40 changes: 40 additions & 0 deletions src/pkg/dashboard/stage_tracker_remediation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,3 +223,43 @@ func TestStageTrackerRemediationJavaScript(t *testing.T) {
t.Fatalf("remediation chevron JavaScript: %v\n%s", err, output)
}
}

// hive#16509 shape: the review swarm asked for a human decision, then the
// hive adopted the PR (074). Back in PR in progress the review word is the
// verdict's substance — changes requested — not "awaiting human decision",
// and the track is no longer active.
func TestStageTrackerAdoptedRowRewordsHumanDecision(t *testing.T) {
for _, tc := range []struct {
name string
mutate func(*StageTrackerItem)
rewarded bool
}{
{"adopted 074", func(it *StageTrackerItem) { it.Stage = trackerNumberAdopted }, true},
{"fixing 070", func(it *StageTrackerItem) { it.Stage = trackerNumberFixing }, true},
{"adopted but needs human", func(it *StageTrackerItem) { it.Stage = trackerNumberAdopted; it.NeedsHuman = true }, false},
{"adopted but on hold", func(it *StageTrackerItem) { it.Stage = trackerNumberAdopted; it.OnHold = true }, false},
{"parked at 085", func(it *StageTrackerItem) { it.Stage = trackerNumberNeedsDecision }, false},
{"older head", func(it *StageTrackerItem) { it.Stage = trackerNumberAdopted; it.ReviewActivity.Head = "old" }, false},
} {
t.Run(tc.name, func(t *testing.T) {
it := &StageTrackerItem{Repo: "org/repo", Kind: "pr", Number: 9, Head: "abc1234def",
ReviewActivity: &StageTrackerActivity{Head: "abc1234def", State: "human_decision", Caption: "Review findings · human decision",
Blocker: "Should the API break?", Active: true, PerspectivesDone: 5, PerspectivesTotal: 5, Source: "verified-review-bundle"}}
tc.mutate(it)
stageTrackerAdoptHumanDecision(it)
a := it.ReviewActivity
if !tc.rewarded {
if a.State != "human_decision" || !a.Active {
t.Fatalf("human parking must keep the decision word: %+v", a)
}
return
}
if a.State != "changes_requested" || a.Caption != "Review findings · changes requested" || a.Active {
t.Fatalf("adopted row should carry the verdict as changes requested, inactive: %+v", a)
}
if !strings.Contains(a.Detail, "asked for a human decision") || !strings.Contains(a.Detail, "Should the API break?") || !strings.HasSuffix(a.Source, "+adopted-decision") {
t.Fatalf("the decision question and provenance ride in the detail/source: %q %q", a.Detail, a.Source)
}
})
}
}
2 changes: 2 additions & 0 deletions src/pkg/dashboard/stage_tracker_ui_prelude_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ func stageTrackerRowsPreludeJS(t *testing.T, html string) string {
jsFunc(t, html, "stageTrackerTrainIconHtml"),
jsFunc(t, html, "stageTrackerHoldLabels"),
jsFunc(t, html, "stageTrackerSoakLeft"),
jsFunc(t, html, "stageTrackerHiveOwnsRepair"),
jsFunc(t, html, "stageTrackerTrackWord"),
jsFunc(t, html, "stageTrackerActivityTrackHtml"),
jsFunc(t, html, "stageTrackerStripItems"),
jsFunc(t, html, "stageTrackerCurrentStageHtml"),
Expand Down
20 changes: 20 additions & 0 deletions src/pkg/dashboard/stage_tracker_ui_rows_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -670,6 +670,26 @@ assert.ok(/<a class="ham-pr-ref"[^>]*title="Standalone PR · Not yet admitted to
assert.ok(row.includes('aria-label="human · @cy"') && !row.includes('<title>'), 'author icon label is aria-only: ' + row);
// Since cells are untouched: plain text, no title.
assert.ok(/<span class="ham-since( ham-stalled)?">[^<]*<\/span>/.test(row) && !/ham-since[^>]*title=/.test(golden), 'since cells unchanged');
// hive#16509 row: adopted by hive with a finished review (5/5, human
// decision asked). The Review track is done-style and muted — never the amber
// in-progress fill — and reads the verdict, not "awaiting human decision";
// 11/11 passed CI is done-style too.
{
const seen = new Date(now - 60000).toISOString();
const adoptedRow = stageTrackerRowHtml({ repo: 'acme/console', number: 16509, kind: 'pr', stage: 74, display_column: 30, head: 'f269349', author: 'thatguywob', author_kind: 'human',
code_activity: { head: 'f269349', state: 'adopted', caption: 'Adopted by hive · activity', source: 'adoption', observed_at: seen },
ci_activity: { head: 'f269349', state: 'passing', caption: 'CI 11/11 passed', checks_passed: 11, checks_total: 11, source: 'checks', observed_at: seen },
review_activity: { head: 'f269349', state: 'human_decision', caption: 'Review findings · human decision', perspectives_done: 5, perspectives_total: 5, source: 'verified-review-bundle', observed_at: seen } }, stages, ctx);
const review = /<li class="ham-seg ham-activity-track ([^"]*)" data-track="review"[^>]*>[\s\S]*?<\/li>/.exec(adoptedRow);
assert.ok(review, 'review track present: ' + adoptedRow);
assert.strictEqual(review[1], 'done decided', 'a finished review back in PR in progress is settled, not amber: ' + review[0]);
assert.ok(review[0].includes('Review 5/5 · changes requested</span>') && !review[0].includes('awaiting human') && !review[0].includes('data-motion='), review[0]);
const ci = /<li class="ham-seg ham-activity-track ([^"]*)" data-track="ci"/.exec(adoptedRow);
assert.strictEqual(ci[1], 'done', '11/11 passed is done-style: ' + adoptedRow);
const parkedRow = stageTrackerRowHtml({ repo: 'acme/console', number: 16510, kind: 'pr', stage: 85, display_column: 85, head: 'f269349', needs_human: true, author: 'thatguywob', author_kind: 'human',
review_activity: { head: 'f269349', state: 'human_decision', caption: 'Review findings · human decision', perspectives_done: 5, perspectives_total: 5, source: 'verified-review-bundle', observed_at: seen } }, stages, ctx);
assert.ok(/<li class="ham-seg ham-activity-track done decided" data-track="review"[^>]*>[\s\S]*?Review 5\/5 · awaiting human decision<\/span>/.test(parkedRow), 'genuinely parked on a person keeps the human word, still not amber: ' + parkedRow);
}
// Merged: the lit cap is the only chevron with hover text.
row = stageTrackerRowHtml({ repo: 'acme/console', number: 106, kind: 'pr', stage: 110 }, stages, ctx);
assert.ok(/<li class="ham-seg active cap merged" title="Merged — [^"]*" aria-current="step">/.test(row) && titled(strip(row)).length === 1, row);
Expand Down
1 change: 1 addition & 0 deletions src/pkg/dashboard/static-src/css/tracker.css
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,7 @@
.ham-activity-track.ham-current { opacity: 1; box-shadow: none; }
.ham-seg.ham-activity-track.failing { background: var(--status-error); color: var(--surface-0); box-shadow: none; opacity: 1; }
.ham-seg.ham-activity-track.failing .ham-ico { stroke-width: 2; }
.ham-seg.ham-activity-track.done.decided { background: var(--surface-3); color: var(--muted); box-shadow: none; opacity: 1; animation: none; }
/* The count words stay on one line and ellipsize instead of wrapping. */
.ham-chevron-copy.ham-track-state .ham-ico { vertical-align: -2px; margin-right: 3px; }
.ham-seg.active[data-motion]::before { content: ''; position: absolute; inset: 0; opacity: 0; pointer-events: none; }
Expand Down
16 changes: 14 additions & 2 deletions src/pkg/dashboard/static-src/js/tracker-row-strip.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,23 @@
switch (state) {
case 'approved': return count + ' approved';
case 'changes_requested': return count + ' · changes requested';
case 'human_decision': return count + ' · awaiting human decision';
// The hive on the repair (adopted / remediating) is not a human
// decision: the findings are the changes requested.
case 'human_decision': return count + (stageTrackerHiveOwnsRepair(item) ? ' · changes requested' : ' · awaiting human decision');
case 'reviewing': case 'adjudicating': return count + ' · ' + (actor ? actor + ' reviewing' : 'reviewing');
case 'assigned': return count + ' · ' + (actor ? actor + ' queued' : 'queued');
case 'unassigned': return count + ' · swarm requested';
default: return count + ' · ' + (newHead ? 're-review pending (new head)' : total && done ? 'perspectives' : 'swarm requested');
}
}

function stageTrackerHiveOwnsRepair(item) {
if (!item || item.needs_human || item.on_hold || item.hold) return false;
const code = item.code_activity;
const hive = code && code.head === item.head && ['adopted', 'remediating', 'unassigned', 'fix_pushed', 'fixing'].includes(code.state);
return !!(hive || item.stage === 74 || item.adopted_by);
}

// Evidence is supplied independently by the backend. A native 050 label
// cannot say who reviews, whether checks run, or whether an author codes.
// The chevron wears its glyph plus the count words from
Expand Down Expand Up @@ -113,7 +122,10 @@
const text = typeof stageTrackerTrackWord === 'function' ? stageTrackerTrackWord(item, kind, current) : (matches ? a.caption || name + ' ' + state : '');
const finished = matches && (state === 'passing' || state === 'approved');
const finding = matches && (state === 'failing' || state === 'changes_requested');
const cls = finished ? 'done' : finding ? 'failing' : text ? 'active' : 'todo';
// A complete verdict parked on a person is settled, not in progress:
// done-style, muted, never the amber fill (hivecommons/hive#16509 row).
const settled = matches && state === 'human_decision' && (!known || !a.active);
const cls = finished ? 'done' : finding ? 'failing' : settled ? 'done decided' : text ? 'active' : 'todo';
const source = matches ? a.source || 'unavailable' : 'unavailable';
const freshness = !Number.isFinite(observed) ? 'observation time unknown' : (stale ? 'stale · ' : 'observed · ') + new Date(observed).toISOString();
const since = matches && a.since && Number.isFinite(Date.parse(a.since)) ? ' · since ' + new Date(a.since).toISOString() : '';
Expand Down
Loading
Loading