diff --git a/changelog.d/fixed-ci-activity-unknown-caption.md b/changelog.d/fixed-ci-activity-unknown-caption.md
new file mode 100644
index 0000000000..056a4e8cfa
--- /dev/null
+++ b/changelog.d/fixed-ci-activity-unknown-caption.md
@@ -0,0 +1 @@
+- Activity Monitor stage tracker: a PR head whose checks are still reporting now reads `CI running · 4 checks pending` (chevron `CI 7/11 · 4 running`, or the last one or two unfinished names) instead of `CI activity unknown · last observed missing` / `CI unknown · no check results observed` / `no verdict yet`; a required check with no run while others still execute is one sentence in the tooltip rather than the "missing" verdict; the "no check results observed" wording is reserved for a head with zero check runs; and the chevron tooltip states each fact once (count word, detail sentence, head, source, observation time) instead of repeating the unreported check four times (#16630). Check names embedded in captions and chevron text are wrapped in single quotes.
diff --git a/src/pkg/dashboard/stage_tracker_activity.go b/src/pkg/dashboard/stage_tracker_activity.go
index 0302221485..dcefe29406 100644
--- a/src/pkg/dashboard/stage_tracker_activity.go
+++ b/src/pkg/dashboard/stage_tracker_activity.go
@@ -39,6 +39,10 @@ type StageTrackerActivity struct {
ChecksTotal int `json:"checks_total,omitempty"`
ChecksFailed int `json:"checks_failed,omitempty"`
ChecksFailing []string `json:"checks_failing,omitempty"`
+ // ChecksPending names the counted checks with no final result yet
+ // (running, queued, or not reported), so the chevron can name the last
+ // one or two the head waits on (hivecommons/hive#16630).
+ ChecksPending []string `json:"checks_pending,omitempty"`
// Perspective counts on the current head for the Review track: Total is
// the swarm's expected set for this PR (configured perspectives plus any
// extra one dispatched or reported for the head), Done the ones with a
@@ -81,7 +85,7 @@ func stageTrackerCIActivity(pr github.PullRequest, now time.Time) *StageTrackerA
}
if !a.RequiredKnown || a.RequiredSource == "" || len(a.RequiredChecks) == 0 || len(a.Required) == 0 {
stageTrackerCountHeadChecks(out, a)
- stageTrackerHeadChecksMotion(out, a)
+ out.Active = out.State == "running"
return out
}
type requiredObservation struct {
@@ -117,7 +121,7 @@ func stageTrackerCIActivity(pr github.PullRequest, now time.Time) *StageTrackerA
}
if !found {
stageTrackerCountHeadChecks(out, a)
- stageTrackerHeadChecksMotion(out, a)
+ out.Active = out.State == "running"
return out
}
}
@@ -191,7 +195,10 @@ func stageTrackerCIActivity(pr github.PullRequest, now time.Time) *StageTrackerA
// red, unreported or ambiguous its neighbours are — a ring that is not
// yet full is a running ring, so the chevron stays active with its
// count (hivecommons/hive#16631). The red names ride in ChecksFailing.
+ // Runs held behind the approve-workflows gate keep the waiting state,
+ // since only a person's click moves them (hivecommons/hive#16599).
switch {
+ case out.State == "missing" && a.WorkflowApproval != nil && a.WorkflowApproval.Pending > 0:
case running:
out.State, out.Blocker = "running", ""
case queued && out.State != "queued":
@@ -205,6 +212,7 @@ func stageTrackerCIActivity(pr github.PullRequest, now time.Time) *StageTrackerA
}
total := len(a.Required)
out.ChecksTotal = total
+ var unreported []string
for _, name := range a.Required {
switch perName[name] {
case "passing":
@@ -212,9 +220,26 @@ func stageTrackerCIActivity(pr github.PullRequest, now time.Time) *StageTrackerA
case "failing":
out.ChecksFailed++
out.ChecksFailing = append(out.ChecksFailing, name)
- }
- }
- check := fmt.Sprintf("%q", out.Blocker)
+ case "missing":
+ unreported = append(unreported, name)
+ out.ChecksPending = append(out.ChecksPending, name)
+ case "skipped":
+ default:
+ out.ChecksPending = append(out.ChecksPending, name)
+ }
+ }
+ // A required check that has not reported while others on the same
+ // head still run or queue is not "missing": the head is mid-pipeline
+ // and its workflow is usually just later in the fan-out. The state is
+ // the motion; the unreported name rides in Detail (hivecommons/hive#16630).
+ // Runs held behind the approve-workflows gate keep the waiting state,
+ // since only a person's click moves them.
+ if out.State == "running" || out.State == "queued" {
+ if since := stageTrackerLatestCheckTime(a); since != nil {
+ out.Since = since
+ }
+ }
+ check := stageTrackerCheckName(out.Blocker)
switch out.State {
case "passing":
out.Caption = "CI green · all " + plural(total, "required check") + " passed"
@@ -223,13 +248,22 @@ func stageTrackerCIActivity(pr github.PullRequest, now time.Time) *StageTrackerA
out.Caption = "CI failing · " + check + " red"
out.Detail = "Required check " + check + " finished without success (failed, timed out, was cancelled, or needs action) on the PR's current commit. A fix or a re-run has to turn it green before CI can pass."
case "running":
- out.Caption = fmt.Sprintf("CI running · %d/%d checks done", done, total)
+ out.Caption = "CI running · " + stageTrackerPendingChecksWord(out.ChecksPending)
out.Detail = fmt.Sprintf("%d of the %s have a final result; the rest are still executing or waiting for a runner on the PR's current commit.", done, plural(total, "required check"))
+ if len(unreported) > 0 {
+ out.Detail += " " + stageTrackerUnreportedChecksSentence(unreported)
+ }
if out.ChecksFailed > 0 {
out.Caption += fmt.Sprintf(" · %d failing", out.ChecksFailed)
out.Detail += fmt.Sprintf(" %s already red: %s.", plural(out.ChecksFailed, "required check"), strings.Join(out.ChecksFailing, ", "))
}
case "queued":
+ if len(unreported) > 0 {
+ out.Blocker = ""
+ out.Caption = "CI queued · " + stageTrackerPendingChecksWord(out.ChecksPending)
+ out.Detail = fmt.Sprintf("%d of the %s have a final result; the rest are waiting for a runner on the PR's current commit. %s", done, plural(total, "required check"), stageTrackerUnreportedChecksSentence(unreported))
+ break
+ }
out.Caption = "CI queued · " + check + " waiting for a runner"
out.Detail = "Required check " + check + " has been requested for the PR's current commit but has not started executing yet."
case "missing":
@@ -288,7 +322,10 @@ func pluralVerb(n int, one, many string) string {
// stageTrackerCountHeadChecks fills the check counts from every check run
// observed on the head when the required set is not known: one entry per
// check name, red if any run of that name is red, green only if its latest
-// run succeeded.
+// run succeeded. The state follows the count (hivecommons/hive#16630): red
+// when any name is red, running while names still lack a final result,
+// and unknown — "no check results observed" — only when the head has no
+// check run at all.
func stageTrackerCountHeadChecks(out *StageTrackerActivity, a *github.PRCIActivity) {
type tally struct {
passing, failing bool
@@ -327,39 +364,87 @@ func stageTrackerCountHeadChecks(out *StageTrackerActivity, a *github.PRCIActivi
out.ChecksFailing = append(out.ChecksFailing, name)
case t.passing:
out.ChecksPassed++
+ default:
+ out.ChecksPending = append(out.ChecksPending, name)
}
}
+ if out.ChecksTotal == 0 {
+ return
+ }
+ out.Since = stageTrackerLatestCheckTime(a)
+ observed := plural(out.ChecksTotal, "check") + " observed on the head"
+ unknownSet := "hive has not seen which checks branch protection requires"
+ switch {
+ case len(out.ChecksPending) > 0:
+ // Motion leads: a ring that is not full is running, however red
+ // its neighbours (hivecommons/hive#16631); the red names ride in
+ // ChecksFailing and the caption.
+ out.State = "running"
+ out.Caption = "CI running · " + stageTrackerPendingChecksWord(out.ChecksPending)
+ out.Detail = fmt.Sprintf("%d of the %s have a final result; the rest are still executing or waiting for a runner on the PR's current commit. %s, so every check on the head counts.", out.ChecksPassed+out.ChecksFailed, observed, unknownSet)
+ if out.ChecksFailed > 0 {
+ out.Caption += fmt.Sprintf(" · %d failing", out.ChecksFailed)
+ out.Detail += fmt.Sprintf(" %s already red: %s.", plural(out.ChecksFailed, "check"), strings.Join(out.ChecksFailing, ", "))
+ }
+ case out.ChecksFailed > 0:
+ // Fail closed to unknown, never to a verdict, without the required
+ // set — but the caption carries the red name.
+ out.Blocker = out.ChecksFailing[0]
+ out.Caption = "CI unknown · " + stageTrackerCheckName(out.ChecksFailing[0]) + " red · required set unknown"
+ out.Detail = fmt.Sprintf("%s of the %s finished without success on the PR's current commit, but %s, so it cannot tell whether the red check gates the merge.", plural(out.ChecksFailed, "check"), observed, unknownSet)
+ default:
+ out.Caption = fmt.Sprintf("CI unknown · all %s passed · required set unknown", observed)
+ out.Detail = fmt.Sprintf("Every check run observed on the PR's current commit succeeded, but %s, so it cannot call CI green.", unknownSet)
+ }
}
-// stageTrackerHeadChecksMotion turns the required-set-unknown count into a
-// running track while any check run on the head is still executing or
-// queued: the ring is not full, so the chevron must be active with its
-// count rather than a silent part-green glyph (hivecommons/hive#16631).
-func stageTrackerHeadChecksMotion(out *StageTrackerActivity, a *github.PRCIActivity) {
- moving := 0
+// stageTrackerLatestCheckTime is the newest timestamp of any check run or
+// commit status on the activity's head: the last moment CI was seen moving.
+func stageTrackerLatestCheckTime(a *github.PRCIActivity) *time.Time {
+ var latest *time.Time
for _, check := range a.Checks {
if check.Head != "" && !strings.EqualFold(check.Head, a.Head) {
continue
}
- switch check.State {
- case "in_progress", "queued", "waiting", "pending", "requested":
- moving++
+ if check.Since != nil && (latest == nil || check.Since.After(*latest)) {
+ latest = check.Since
}
}
- if moving == 0 {
- return
- }
- done := out.ChecksTotal - moving
- if done < 0 {
- done = 0
- }
- out.State, out.Blocker = "running", ""
- out.Caption = fmt.Sprintf("CI running · %d/%d checks done", done, out.ChecksTotal)
- out.Detail = fmt.Sprintf("%d of the %s observed on the PR's current commit have a final result; the rest are still executing or waiting for a runner. Which of them branch protection requires is not yet known.", done, plural(out.ChecksTotal, "check"))
- if out.ChecksFailed > 0 {
- out.Caption += fmt.Sprintf(" · %d failing", out.ChecksFailed)
+ return latest
+}
+
+// stageTrackerCheckName is a CI job / check name as it reads inside
+// caption, detail and chevron text: wrapped in single quotes, so a name
+// stands apart from the words around it ('test' not reported).
+func stageTrackerCheckName(name string) string {
+ return "'" + name + "'"
+}
+
+// stageTrackerPendingChecksNamed is the most pending check names the
+// caption spells out; beyond it the count speaks.
+const stageTrackerPendingChecksNamed = 2
+
+// stageTrackerPendingChecksWord: `'test' pending`, `'lint', 'test' pending`,
+// or "54 checks pending".
+func stageTrackerPendingChecksWord(pending []string) string {
+ if n := len(pending); n > 0 && n <= stageTrackerPendingChecksNamed {
+ quoted := make([]string, 0, n)
+ for _, name := range pending {
+ quoted = append(quoted, stageTrackerCheckName(name))
+ }
+ return strings.Join(quoted, ", ") + " pending"
}
- out.Active = true
+ return plural(len(pending), "check") + " pending"
+}
+
+// stageTrackerUnreportedChecksSentence names the required checks with no
+// run on the head, once, for the Detail of a running or queued head.
+func stageTrackerUnreportedChecksSentence(names []string) string {
+ quoted := make([]string, 0, len(names))
+ for _, name := range names {
+ quoted = append(quoted, stageTrackerCheckName(name))
+ }
+ return fmt.Sprintf("Required %s %s %s not reported for this head yet.", pluralVerb(len(names), "check", "checks"), strings.Join(quoted, ", "), pluralVerb(len(names), "has", "have"))
}
// stageTrackerExpectedPerspectives is the swarm's perspective set for this
diff --git a/src/pkg/dashboard/stage_tracker_activity.test.js b/src/pkg/dashboard/stage_tracker_activity.test.js
index 12b2c673c8..3aa547d240 100644
--- a/src/pkg/dashboard/stage_tracker_activity.test.js
+++ b/src/pkg/dashboard/stage_tracker_activity.test.js
@@ -27,7 +27,7 @@ function constLine(source, name) {
assert.ok(match, name);
return match[0];
}
-const trackConsts = ['STAGE_TRACKER_WORKFLOW_APPROVAL_BLOCKER', 'STAGE_TRACKER_WORKFLOW_APPROVAL_TIP', 'STAGE_TRACKER_RING_SEGMENT_GAP_MAX', 'STAGE_TRACKER_RING_RADIUS', 'STAGE_TRACKER_RING_GAP_DEG'].map(name => constLine(strip, name)).join('\n');
+const trackConsts = ['STAGE_TRACKER_WORKFLOW_APPROVAL_BLOCKER', 'STAGE_TRACKER_PENDING_CHECKS_NAMED', 'STAGE_TRACKER_WORKFLOW_APPROVAL_TIP', 'STAGE_TRACKER_RING_SEGMENT_GAP_MAX', 'STAGE_TRACKER_RING_RADIUS', 'STAGE_TRACKER_RING_GAP_DEG'].map(name => constLine(strip, name)).join('\n');
const trackFns = ['stageTrackerHiveOwesReReview', 'stageTrackerTrackLead', 'stageTrackerWaitingOnPerson', 'stageTrackerTrackRunning', 'stageTrackerWorkflowApprovalPending', 'stageTrackerRingSvg', 'stageTrackerStalledTrack', 'stageTrackerQueueAheadWord', 'stageTrackerStageTrack', 'stageTrackerHiveOwnsRepair', 'stageTrackerTrackWord', 'stageTrackerAgoWord', 'stageTrackerActivityTrackHtml'].map(name => fn(strip, name)).join('\n');
const track = new Function('esc', 'stageTrackerIcon', trackConsts + '\n' + trackFns + ';return stageTrackerActivityTrackHtml;')(esc, (n, cls) => ``);
const getAnchor = new Function(globals + anchor + ';return stageTrackerAnchor;')();
@@ -458,7 +458,7 @@ test('browser probes require a dedicated preview and cannot count offscreen head
});
test('Hotshot #344 shape: queued CI and approved review retain current phase without pretending work runs', () => {
- const item = livePR({ stage: 60, ci_activity: activity('queued', 'CI queued · "build" waiting for a runner'), review_activity: activity('approved', 'Review approved') });
+ const item = livePR({ stage: 60, ci_activity: activity('queued', "CI queued · 'build' waiting for a runner"), review_activity: activity('approved', 'Review approved') });
const before = JSON.stringify(item);
const cells = physicalTracks(item);
assert.match(cells.ci, /ham-activity-track active ham-current/, 'queued CI is in progress: the full active fill, no pulse');
@@ -501,7 +501,7 @@ test('Hive #16268 shape: held native Fixing waits for a fixer in the CI/Review p
const item = livePR({
stage: 70, modifiers: ['hold'], hold: { by: 'hanthor', reason: 'Maintainer hold' }, display_column: 50,
code_activity: { head: 'head', state: 'waiting_fixer', caption: 'Waiting for fixer · no code work observed', source: 'native-fix-request' },
- ci_activity: activity('missing', 'CI waiting · required check "test" hasn\'t reported for this head yet'),
+ ci_activity: activity('missing', "CI waiting · required check 'test' hasn't reported for this head yet"),
review_activity: activity('approved', 'Review approved'),
});
const cells = physicalTracks(item);
@@ -526,7 +526,7 @@ test('current phase, running activity, failure and successful completion are ind
['failing', 'CI failing · "build" red', false, 'failing'],
['running', 'CI running · 1/2 checks done', true, 'active'],
['passing', 'CI green · all 2 required checks passed', false, 'done'],
- ['skipped', 'CI skipped · check "build" skipped', false, 'todo'],
+ ['skipped', "CI skipped · check 'build' skipped", false, 'todo'],
]) {
const cells = physicalTracks(livePR({ ci_activity: activity(state, caption, running) }));
assert.ok(cells.ci.includes('ham-activity-track ' + cls + ' ham-current'), state + ' → ' + cls + ': ' + cells.ci);
@@ -759,30 +759,66 @@ test('linked movement uses current-head repair evidence while native sort stays
});
test('the backend detail sentence rides in the track tooltip, not on the chevron', () => {
- const detail = 'Branch protection requires a check named "test", but no check run or commit status with that name exists for the PR\'s current commit.';
- const item = livePR({ ci_activity: { ...activity('missing', 'CI waiting · required check "test" hasn\'t reported for this head yet'), detail } });
+ const detail = "Branch protection requires a check named 'test', but no check run or commit status with that name exists for the PR's current commit.";
+ const item = livePR({ ci_activity: { ...activity('missing', "CI waiting · required check 'test' hasn't reported for this head yet"), detail } });
const html = track(item, 'ci', { state: 'active' }, false, now);
const panel = html.match(/aria-describedby="[^"]+">([^]*?)[^]*hasn't reported for this head yet · Branch protection requires a check named "test"/);
- assert.match(html, /title="[^"]*Branch protection requires a check named "test", but no check run/);
+ assert.match(html, /role="tooltip">Current pipeline phase · CI: CI \?\/\? · no checks reported yet · Branch protection requires a check named 'test'/);
+ assert.match(html, /title="[^"]*Branch protection requires a check named 'test', but no check run/);
+ // The detail sentence is the caption spelled out: the caption does not
+ // repeat beside it, and the blocker is not a third mention (#16630).
+ assert.doesNotMatch(html, /hasn't reported for this head yet/);
+ assert.equal((html.match(/role="tooltip">([^<]*?) · head /)[1].match(/test/g) || []).length, 1, 'the unreported check is named once in the tooltip');
+});
+
+test('#16630: a head with checks still reporting is running, never "activity unknown", and the tooltip states each fact once', () => {
+ const stale = now + 10 * 60 * 1000;
+ const detail = '7 of the 11 required checks have a final result; the rest are still executing on the PR\'s current commit. Required check \'test\' has not reported for this head yet.';
+ const item = livePR({ ci_activity: { ...activity('running', 'CI running · 4 checks pending', true), detail, checks_passed: 7, checks_total: 11, checks_pending: ['a', 'b', 'c', 'test'] } });
+ const html = track(item, 'ci', { state: 'active' }, false, stale);
+ const tip = html.match(/role="tooltip">([^<]*)/)[1];
+ assert.equal(tip, 'Current pipeline phase · CI: CI 7/11 · 4 running · ' + esc(detail) + ' · head head · observed-test-source · stale · 2026-11-02T21:00:00.000Z (10m ago) · since 2026-11-02T20:59:00.000Z · hive is waiting on CI');
+ assert.doesNotMatch(html, /activity unknown|last observed running|no verdict yet|no check results observed/);
+ assert.match(html, /ham-activity-track active ham-current/, 'a stale poll of a counted running head keeps the lit fill');
+ assert.doesNotMatch(html, /data-motion/, 'but does not pulse');
+ // Row B: the required set unknown, 12/66 reported — the unfinished count, not "no verdict yet".
+ const rowB = livePR({ ci_activity: { ...activity('running', 'CI running · 54 checks pending', true), detail: '12 of the 66 checks observed on the head have a final result; the rest are still executing.', checks_passed: 12, checks_total: 66 } });
+ const b = track(rowB, 'ci', { state: 'active' }, false, now);
+ assert.match(b, /ham-chevron-copy ham-track-state">