Skip to content

Commit e934b74

Browse files
author
Sean Roberts
committed
fix: only show active runs
1 parent 667e31c commit e934b74

1 file changed

Lines changed: 39 additions & 12 deletions

File tree

src/ui/LiveStatus.tsx

Lines changed: 39 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,25 @@ interface LiveStatusProps {
99
skippedCount?: number;
1010
}
1111

12+
/** A job is "active" when it's mid-flight — counts toward the live scenario list. */
13+
function isActive(job: JobState): boolean {
14+
if (job.inTeardown) return true;
15+
return job.status === "setup" || job.status === "running" || job.status === "teardown" || job.status === "scoring";
16+
}
17+
1218
export function LiveStatus({ jobs, skippedCount = 0 }: LiveStatusProps) {
1319
const done = jobs.filter((j) => j.status === "done").length;
1420
const failed = jobs.filter((j) => j.status === "failed").length;
21+
const pending = jobs.filter((j) => j.status === "pending").length;
1522
const scoring = jobs.filter((j) => j.status === "scoring").length;
1623
const tearingDown = jobs.filter((j) => j.inTeardown).length;
1724
const total = jobs.length;
1825

19-
const scenarios = groupByScenario(jobs);
20-
const scenarioCount = scenarios.length;
26+
const scenarioCount = new Set(jobs.map((j) => getBaseKey(j.scenarioKey))).size;
2127
const agentCount = new Set(jobs.map((j) => j.agentName)).size;
2228

29+
const activeScenarios = groupByScenario(jobs.filter(isActive));
30+
2331
const allFinished = done + failed === total && total > 0;
2432
const scoredJobs = jobs.filter((j) => j.axisScore !== undefined);
2533
const avgScore =
@@ -33,27 +41,46 @@ export function LiveStatus({ jobs, skippedCount = 0 }: LiveStatusProps) {
3341
{agentCount !== 1 ? "s" : ""}
3442
</Text>
3543
<Text>{"─".repeat(50)}</Text>
36-
{scenarios.map(({ scenarioKey, agents }) => (
37-
<ScenarioGroup key={scenarioKey} scenarioKey={scenarioKey} agents={agents} />
38-
))}
44+
{activeScenarios.length > 0 ? (
45+
activeScenarios.map(({ scenarioKey, agents }) => (
46+
<ScenarioGroup key={scenarioKey} scenarioKey={scenarioKey} agents={agents} />
47+
))
48+
) : allFinished ? null : (
49+
<>
50+
<Text dimColor>Waiting for scenarios to start…</Text>
51+
<Text> </Text>
52+
</>
53+
)}
3954
<Text>{"─".repeat(50)}</Text>
4055
{allFinished && avgScore !== null ? (
4156
<Text bold>Average AXIS Result: {avgScore} / 100</Text>
4257
) : (
43-
<Text>
44-
{done + failed}/{total} complete
45-
{scoring > 0 ? ` · scoring ${scoring} result${scoring !== 1 ? "s" : ""}…` : ""}
46-
{tearingDown > 0
47-
? ` · tearing down ${tearingDown} scenario${tearingDown !== 1 ? "s" : ""}…`
48-
: ""}
49-
</Text>
58+
<Text>{formatProgress({ done, failed, pending, total, scoring, tearingDown })}</Text>
5059
)}
5160
{skippedCount > 0 ? <Text dimColor>{skippedCount} marked to be skipped</Text> : null}
5261
<Text> </Text>
5362
</Box>
5463
);
5564
}
5665

66+
function formatProgress(counts: {
67+
done: number;
68+
failed: number;
69+
pending: number;
70+
total: number;
71+
scoring: number;
72+
tearingDown: number;
73+
}): string {
74+
const { done, failed, pending, total, scoring, tearingDown } = counts;
75+
const parts: string[] = [`${done + failed}/${total} complete`];
76+
if (done > 0) parts.push(`${done} passed`);
77+
if (failed > 0) parts.push(`${failed} failed`);
78+
if (pending > 0) parts.push(`${pending} pending`);
79+
if (scoring > 0) parts.push(`scoring ${scoring}…`);
80+
if (tearingDown > 0) parts.push(`tearing down ${tearingDown}…`);
81+
return parts.join(" · ");
82+
}
83+
5784
function ScenarioGroup({ scenarioKey, agents }: { scenarioKey: string; agents: JobState[] }) {
5885
return (
5986
<Box flexDirection="column">

0 commit comments

Comments
 (0)