Skip to content

The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.

Sidebar Models: exact models over the last 7 days, collapsing like every section (#2288)

0xken15ce826650cd03
diff --git a/backend/src/superTabs/commands.ts b/backend/src/superTabs/commands.ts
index e394861a8..1d3eb5474 100644
--- a/backend/src/superTabs/commands.ts
+++ b/backend/src/superTabs/commands.ts
@@ -25,7 +25,7 @@ import { credentialResult, redactCredentials, type CredentialKind } from './cred
import { dirtyGroups, reportGroups, summarize } from './projectUpdates.js'
import { workspaceCan, type WorkspaceRole } from './workspaces.js'
import { fixedOriginal, LEDGER_WEEKS, PULL_REQUEST_URL, recordAsked, recordFix, recordDecision, recordMerged, recordPost, recordProposal, recordReview, recordRun, recordStatus,
- recordVerdict } from './leaderboard/record.js'
+ recordReportedModel, recordVerdict } from './leaderboard/record.js'
import { WEEK_MS } from './leaderboard/week.js'
import { react, reactionSchema, type ReactionTarget } from './reactions.js'
import { shipNotice, shippedAt } from './ship.js'
@@ -1724,6 +1724,7 @@ export function applyCommand(original: SuperTabState, actor: Actor, input: Comma
if (Object.entries(command.configuration).some(([key, value]) => target.configuration[key as keyof typeof target.configuration] !== value)) {
target.configuration = command.configuration
target.configurationVersion = operationId
+ recordReportedModel(state, target)
}
break
}
diff --git a/backend/src/superTabs/leaderboard/contract.ts b/backend/src/superTabs/leaderboard/contract.ts
index a428619fa..ba0df0491 100644
--- a/backend/src/superTabs/leaderboard/contract.ts
+++ b/backend/src/superTabs/leaderboard/contract.ts
@@ -79,6 +79,18 @@ export interface ModelScore {
reviews: number
}
+/** A model's tasks over the 7 days up to the read, whichever week the board shows: the sidebar's Models (Dee, 2026-10-30: "this
+ * week is very confusing"). One row per engine and model as its agents reported it, every effort as one; `model` null for
+ * attempts whose agent had reported none. */
+export interface RecentModel {
+ engine: string
+ model: string | null
+ /** Attempts at requests, never reviews, started in the 7 days. */
+ attempts: number
+ /** Those with a first review on record, and how many passed it. */
+ firstReview: { reviewed: number; passed: number }
+}
+
export interface Leaderboard {
projectId: string
week: number
@@ -94,4 +106,6 @@ export interface Leaderboard {
agents: AgentScore[]
/** Every model that worked this week, most points first. Absent from a backend before it. */
byModel: ModelScore[]
+ /** The models of the 7 days up to now, most attempts first. Absent from a backend before it. */
+ recentModels: RecentModel[]
}
diff --git a/backend/src/superTabs/leaderboard/record.test.ts b/backend/src/superTabs/leaderboard/record.test.ts
index 50e70f30a..c4705fd5a 100644
--- a/backend/src/superTabs/leaderboard/record.test.ts
+++ b/backend/src/superTabs/leaderboard/record.test.ts
@@ -622,6 +622,65 @@ describe('the model behind each assignment, and its first review (roadmap, Dec:
}
})
+ it('names the model an agent reports after its task began, when it had reported none: never "Codex" alone (Dee, 2026-10-30)', () => {
+ const f = fixture()
+ const id = f.create(owner, { checks: independent }), done = f.create(owner, { checks: independent })
+ const worker = f.add('codex-worker', id), earlier = f.add('codex-earlier', done)
+ for (const agentId of [worker, earlier]) f.state.agents.find(a => a.id === agentId)!.configuration = { ...config, engine: 'codex', model: null }
+ const { assignmentId } = f.assign(id, worker)
+ const finished = f.assign(done, earlier)
+ f.passChecks(done, finished.assignmentId)
+ f.status(done, finished.assignmentId, earlier, 'done', 'Shipped')
+ const report = (agentId: string, model: string) => {
+ const agent = f.state.agents.find(a => a.id === agentId)!
+ f.run({ type: 'agent.configuration', previousVersion: agent.configurationVersion!, configuration: { ...agent.configuration, model } }, f.asAgent(agentId))
+ }
+ report(worker, 'gpt-6.1-sol')
+ report(earlier, 'gpt-6.1-sol')
+ expect(f.group(id).ledger!.runs).toEqual([{ assignmentId, engine: 'codex', model: 'gpt-6.1-sol', effort: 'high', at: 1_000 }])
+ // A finished task's attempt is history: what its agent reports afterwards is another task's.
+ expect(f.group(done).ledger!.runs![0]!.model).toBeNull()
+ // A model on record is never rewritten by a later report.
+ report(worker, 'gpt-6.1-luna')
+ expect(f.group(id).ledger!.runs![0]!.model).toBe('gpt-6.1-sol')
+ })
+
+ /** [count] Codex workers on their own groups, launched on Codex's own model, which they have not reported yet. */
+ const codexTasks = (f: ReturnType<typeof fixture>, count: number) => Array.from({ length: count }, (_, i) => {
+ const id = f.create(owner, { checks: independent }), worker = f.add(`codex-${i}`, id)
+ f.state.agents.find(a => a.id === worker)!.configuration = { ...config, engine: 'codex', model: null }
+ return { id, ...f.assign(id, worker) }
+ })
+ const reportModel = (f: ReturnType<typeof fixture>, agentId: string, configuration: Partial<AgentConfiguration>) => {
+ const agent = f.state.agents.find(a => a.id === agentId)!
+ f.run({ type: 'agent.configuration', previousVersion: agent.configurationVersion!, configuration: { ...agent.configuration, ...configuration } },
+ f.asAgent(agentId))
+ }
+
+ it('names the reported model on the attempt a request shipped on, when its merge was recorded while it still ran', () => {
+ const f = fixture()
+ const [task] = codexTasks(f, 1)
+ f.run({ type: 'conversation.merged', conversationId: task!.id, pullRequestUrl: 'https://github.com/o/r/pull/7' })
+ expect(f.group(task!.id).ledger!.shippedBy).toMatchObject({ assignmentId: task!.assignmentId, model: null })
+ reportModel(f, task!.worker, { model: 'gpt-6.1-sol' })
+ expect(f.group(task!.id).ledger!.shippedBy).toMatchObject({ assignmentId: task!.assignmentId, engine: 'codex', model: 'gpt-6.1-sol' })
+ })
+
+ it('names no model on a grid attempt, another engine\'s attempt, or another agent\'s task', () => {
+ const f = fixture()
+ const [grid, other, mine] = codexTasks(f, 3)
+ const run = (id: string) => f.group(id).ledger!.runs![0]!
+ run(grid!.id).grid = true
+ reportModel(f, grid!.worker, { model: 'gpt-6.1-sol' })
+ // A report from another engine is not what the attempt ran on.
+ reportModel(f, other!.worker, { engine: 'claude', model: 'opus' })
+ reportModel(f, mine!.worker, { model: 'gpt-6.1-sol' })
+ expect(run(grid!.id).model).toBeNull()
+ expect(run(other!.id).model).toBeNull()
+ expect(run(mine!.id).model).toBe('gpt-6.1-sol')
+ expect([run(grid!.id), run(other!.id)].map(r => r.engine)).toEqual(['codex', 'codex'])
+ })
+
it('names the grid model from the start of an agent from before agents kept it, while that start is loaded', () => {
const f = fixture()
const id = f.create(owner, { checks: independent })
diff --git a/backend/src/superTabs/leaderboard/record.ts b/backend/src/superTabs/leaderboard/record.ts
index 8d7c1b3a2..c65372236 100644
--- a/backend/src/superTabs/leaderboard/record.ts
+++ b/backend/src/superTabs/leaderboard/record.ts
@@ -2,7 +2,7 @@
* What the leaderboard counts, recorded as it happens on the group it happened in (docs/swarms.md, Leaderboard): when a
* request was asked and first shipped, which item waits on a person, and who answered it. Only facts and times, never text.
*/
-import { isLeads, type Actor, type Agent, type AgentConfiguration, type Assignment, type Author, type Check, type Conversation, type SuperTabState, type WorkStatus } from '../model.js'
+import { activeWork, isLeads, type Actor, type Agent, type AgentConfiguration, type Assignment, type Author, type Check, type Conversation, type SuperTabState, type WorkStatus } from '../model.js'
import { groupProject, ledProject } from '../projects.js'
import { WEEK_MS, weekStart } from './week.js'
import { agentTarget } from '../rules.js'
@@ -241,6 +241,22 @@ export function recordRun(state: SuperTabState, group: Conversation, assignment:
ledger.runs = [...ledger.runs ?? [], run].slice(-MAX_RUNS)
}
+/** An agent started on its engine's own model reports which one only once it runs (Codex): its open task's attempt, recorded
+ * with none, takes the model it reports, so the board names it and step-ups rate it by it rather than by the engine alone
+ * (Dee, 2026-10-30). A model on record is never rewritten, and a finished task's attempt is history. */
+export function recordReportedModel(state: SuperTabState, worker: Agent): void {
+ const model = worker.configuration.model
+ if (!model || worker.gridModel) return
+ for (const group of state.conversations) {
+ const assignment = group.assignment
+ if (!assignment || assignment.agentId !== worker.id || !activeWork(group)) continue
+ // The attempt, and the copy of it kept when its merge was recorded while it still ran.
+ for (const on of [group.ledger?.runs?.find(r => r.assignmentId === assignment.id), group.ledger?.shippedBy]) {
+ if (on?.assignmentId === assignment.id && on.model === null && !on.grid && on.engine === worker.configuration.engine) on.model = model
+ }
+ }
+}
+
/** When a request's first attempt was assigned: kept since that was recorded. A request recorded before has its first
* attempt in [runs] while fewer than MAX_RUNS are kept; once that many are, the first may have rolled off, so it takes
* the time the request was asked (full review of #2097). Undefined for a request never assigned. */
diff --git a/backend/src/superTabs/leaderboard/stats.test.ts b/backend/src/superTabs/leaderboard/stats.test.ts
index 087bda338..e6e87ad56 100644
--- a/backend/src/superTabs/leaderboard/stats.test.ts
+++ b/backend/src/superTabs/leaderboard/stats.test.ts
@@ -466,3 +466,40 @@ describe('Agents: the permanent agents, the PM and Buddies, by name like people
expect(of(view, 'river')).toMatchObject({ points: 0, shipped: 0, rank: 2 })
})
})
+
+describe('Models, last 7 days: each model\'s tasks over a rolling week, for the sidebar (Dee, 2026-10-30)', () => {
+ const run = (assignmentId: string, at: number, engine: string, model: string | null, extra: Partial<Run> = {}): Run =>
+ ({ assignmentId, engine, model, effort: 'high', at, ...extra })
+ const work = (runs: Run[], extra: Partial<Conversation> = {}) => group({ status: 'working', ledger: { runs }, ...extra })
+
+ it('counts the attempts of the 7 days up to now, across the Monday, never older ones', () => {
+ // Now is Thursday noon: last Friday counts, last Thursday morning does not.
+ const view = board(swarm(), [work([run('a1', NOW - 6 * DAY_MS, 'claude', 'opus'), run('a2', NOW - 7 * DAY_MS - HOUR, 'claude', 'opus'),
+ run('a3', WEEK + HOUR, 'claude', 'opus', { firstReview: true }), run('a4', WEEK + 2 * HOUR, 'codex', 'gpt-6.1-sol', { firstReview: false })])])
+ expect(view.recentModels).toEqual([
+ { engine: 'claude', model: 'opus', attempts: 2, firstReview: { reviewed: 1, passed: 1 } },
+ { engine: 'codex', model: 'gpt-6.1-sol', attempts: 1, firstReview: { reviewed: 1, passed: 0 } },
+ ])
+ })
+
+ it('is the 7 days up to now whichever week the board shows', () => {
+ const view = board(swarm(), [work([run('a1', NOW - DAY_MS, 'claude', 'opus'), run('a2', LAST + HOUR, 'claude', 'sonnet')])], LAST)
+ expect(view.recentModels.map(m => [m.model, m.attempts])).toEqual([['opus', 1]])
+ })
+
+ it('sums one model\'s efforts as one, keeps an attempt with no reported model apart, and counts no review group', () => {
+ const view = board(swarm(), [
+ work([run('a1', WEEK, 'claude', 'opus'), run('a2', WEEK + HOUR, 'claude', 'opus', { effort: 'xhigh' }), run('a3', WEEK + 2 * HOUR, 'codex', null)]),
+ work([run('b1', WEEK + HOUR, 'codex', 'gpt-6.1-sol')], { reviewOf: 'g0' }),
+ ])
+ expect(view.recentModels.map(m => [m.engine, m.model, m.attempts])).toEqual([['claude', 'opus', 2], ['codex', null, 1]])
+ })
+
+ it('never counts a private conversation\'s or another project\'s attempts', () => {
+ const view = board(swarm(), [
+ work([run('a1', WEEK, 'claude', 'opus')], { audience: { people: [{ id: 'dee', generation: 'g' }] } }),
+ work([run('b1', WEEK, 'claude', 'opus')], { projectId: 'other' }),
+ ])
+ expect(view.recentModels).toEqual([])
+ })
+})
diff --git a/backend/src/superTabs/leaderboard/stats.ts b/backend/src/superTabs/leaderboard/stats.ts
index 54adebb4f..be1b058b4 100644
--- a/backend/src/superTabs/leaderboard/stats.ts
+++ b/backend/src/superTabs/leaderboard/stats.ts
@@ -10,7 +10,7 @@ import { isBuddy } from '../buddies.js'
import { agentProjectId, canReadProject, projectOf } from '../projects.js'
import { firstAssignedAt, waitedOn, waitsNow, type RanOn, type Unblock } from './record.js'
import { DAY_MS, WEEK_MS } from './week.js'
-import type { AgentScore, Leaderboard, Medal, ModelScore, ModelShare, PersonDetails, PersonScore, WeekGoal } from './contract.js'
+import type { AgentScore, Leaderboard, Medal, ModelScore, ModelShare, PersonDetails, PersonScore, RecentModel, WeekGoal } from './contract.js'
export const SHIPPED_POINTS = 3
/** A reviewer model's point for each review verdict it gave (Lead, 2026-10-29). */
@@ -100,9 +100,28 @@ export function leaderboard({ state, groups, machines: visibleMachines, projectI
models: { thisWeek: modelShare(requests, week), lastWeek: modelShare(requests, week - WEEK_MS) },
agents: agentScores(state, projectId, shippedRequests.filter(g => inWeek(g.ledger!.shippedAt!))),
byModel: modelScores(requests, shippedRequests.filter(g => inWeek(g.ledger!.shippedAt!)), inWeek),
+ recentModels: recentModels(requests, now),
}
}
+/** Each model's attempts at requests in the 7 days up to [now], every effort as one, most attempts first. The groups the board
+ * already holds cover them: dormant ones of the last LEDGER_WEEKS are read with it (read/service.ts). */
+function recentModels(requests: Conversation[], now: number): RecentModel[] {
+ const rows = new Map<string, RecentModel>()
+ for (const run of requests.flatMap(g => g.ledger?.runs ?? [])) {
+ if (run.at < now - WEEK_MS || run.at > now) continue
+ const key = JSON.stringify([run.engine, run.model])
+ let row = rows.get(key)
+ if (!row) rows.set(key, row = { engine: run.engine, model: run.model, attempts: 0, firstReview: { reviewed: 0, passed: 0 } })
+ row.attempts++
+ if (run.firstReview === undefined) continue
+ row.firstReview.reviewed++
+ if (run.firstReview) row.firstReview.passed++
+ }
+ return [...rows.values()].sort((a, b) => b.attempts - a.attempts || a.engine.localeCompare(b.engine)
+ || (a.model ?? '').localeCompare(b.model ?? ''))
+}
+
/** The project's PM and Buddies with the requests each shipped this week: a PM by the groups it led when they shipped, a
* Buddy by the groups opened from its proposals. One credited this week stays listed after it was removed or replaced,
* as "Former PM" or "Former Buddy" once the Swarm no longer has it (full review of #2097). Builders and Reviewers are
diff --git a/desktop/lib/super_tabs/controller.dart b/desktop/lib/super_tabs/controller.dart
index d18e7bc45..f78adfc27 100644
--- a/desktop/lib/super_tabs/controller.dart
+++ b/desktop/lib/super_tabs/controller.dart
@@ -177,6 +177,8 @@ class SuperTabController extends ChangeNotifier {
devicesSelected = initial['devicesSelected'] == true;
projectsGroupOpen = initial['projectsGroupOpen'] as bool? ?? true;
machinesGroupOpen = initial['machinesGroupOpen'] as bool? ?? true;
+ buddiesGroupOpen = initial['buddiesGroupOpen'] as bool? ?? true;
+ modelsGroupOpen = initial['modelsGroupOpen'] as bool? ?? true;
offlineMachinesOpen = initial['offlineMachinesOpen'] as bool? ?? false;
selectedId = initial['selectedId'] as String? ?? 'lead';
final drafts = initial['drafts'];
@@ -736,6 +738,10 @@ class SuperTabController extends ChangeNotifier {
bool devicesSelected = false;
bool projectsGroupOpen = true, machinesGroupOpen = true;
+ /// The sidebar's Buddies and Models, collapsed and remembered like Projects
+ /// and Machines (Dee, 2026-10-30: every section the same).
+ bool buddiesGroupOpen = true, modelsGroupOpen = true;
+
bool isMachineExpanded(String id) => expandedMachines.contains(id);
void toggleMachineExpanded(String id) {
@@ -812,6 +818,18 @@ class SuperTabController extends ChangeNotifier {
_changed();
}
+ void toggleBuddiesGroup() {
+ buddiesGroupOpen = !buddiesGroupOpen;
+ _saveSoon();
+ _changed();
+ }
+
+ void toggleModelsGroup() {
+ modelsGroupOpen = !modelsGroupOpen;
+ _saveSoon();
+ _changed();
+ }
+
void toggleOfflineMachines() {
offlineMachinesOpen = !offlineMachinesOpen;
_saveSoon();
@@ -1851,6 +1869,8 @@ class SuperTabController extends ChangeNotifier {
'devicesSelected': devicesSelected,
'projectsGroupOpen': projectsGroupOpen,
'machinesGroupOpen': machinesGroupOpen,
+ 'buddiesGroupOpen': buddiesGroupOpen,
+ 'modelsGroupOpen': modelsGroupOpen,
'offlineMachinesOpen': offlineMachinesOpen,
'drafts': Map<String, String>.of(_drafts),
'terminals': Map<String, String>.of(_terminals),
diff --git a/desktop/lib/super_tabs/leaderboard/model.dart b/desktop/lib/super_tabs/leaderboard/model.dart
index 84211e84a..7878bde5c 100644
--- a/desktop/lib/super_tabs/leaderboard/model.dart
+++ b/desktop/lib/super_tabs/leaderboard/model.dart
@@ -23,7 +23,12 @@ class SuperTabLeaderboard {
agents = _list(json['agents']).map(SuperTabAgentScore.fromJson).toList(),
byModel = _list(json['byModel'])
.map(SuperTabModelScore.fromJson)
- .toList();
+ .toList(),
+ recentModels = json['recentModels'] is List
+ ? _list(json['recentModels'])
+ .map(SuperTabModelScore.fromJson)
+ .toList()
+ : null;
final String projectId;
@@ -41,6 +46,11 @@ class SuperTabLeaderboard {
/// Every model that worked the week, most points first; empty from a
/// server before them.
final List<SuperTabModelScore> byModel;
+
+ /// Each model's tasks of the 7 days up to the read, whichever [week] this
+ /// is: engine, model, tasks and first reviews, no effort or points. Null
+ /// from a server before it.
+ final List<SuperTabModelScore>? recentModels;
}
/// A permanent agent, the PM or a Buddy, scored by name like a person
diff --git a/desktop/lib/super_tabs/leaderboard/models_section.dart b/desktop/lib/super_tabs/leaderboard/models_section.dart
index 9ea40c930..b4004ac63 100644
--- a/desktop/lib/super_tabs/leaderboard/models_section.dart
+++ b/desktop/lib/super_tabs/leaderboard/models_section.dart
@@ -15,12 +15,9 @@ import 'reader.dart';
const _gap = DesktopChrome.controlGap;
const _rowHeight = 36.0;
-/// How many models the sidebar lists until its heading shows them all.
-const leaderboardModelsShown = 3;
-
/// A model as the sidebar's Models lists it: every engine and effort it ran
-/// at as one, its share of the week's tasks, and how many of its tasks
-/// reviewers approved on first review.
+/// at as one, its share of the tasks, and how many of its tasks reviewers
+/// approved on first review.
class LeaderboardModelShare {
const LeaderboardModelShare({
required this.name,
@@ -32,47 +29,39 @@ class LeaderboardModelShare {
required this.passed,
});
- /// "Opus 5.5", "GPT-6.1 Sol"; the engine's name when it reported no model.
+ /// "Opus 5.5", "GPT-6.1 Sol"; "Codex, model not reported" when the agent
+ /// reported none.
final String name;
- /// The engine that ran most of its tasks: its icon leads the row. Null for
- /// [LeaderboardModelShare.other], which no one engine ran.
- final String? engine;
+ /// The engine that ran most of its tasks: its icon leads the row.
+ final String engine;
/// Its tasks, of the [total] every model ran.
final int attempts, total;
- /// Its share of [total], rounded so the week's rows add up to 100.
+ /// Its share of [total], rounded so the rows add up to 100.
final int percent;
final int reviewed, passed;
- /// The models behind the heading as one row, so the rows shown add up to
- /// 100 too: its percent is the sum of theirs, never a rounding of its own.
- factory LeaderboardModelShare.other(List<LeaderboardModelShare> rest) =>
- LeaderboardModelShare(
- name: 'Other',
- engine: null,
- attempts: rest.fold(0, (sum, share) => sum + share.attempts),
- total: rest.first.total,
- percent: rest.fold(0, (sum, share) => sum + share.percent),
- reviewed: rest.fold(0, (sum, share) => sum + share.reviewed),
- passed: rest.fold(0, (sum, share) => sum + share.passed),
- );
+ /// The share as the row says it: under 1% says so, never 0% (it ran
+ /// tasks) nor the 1% rounding gave some of several alike to reach 100.
+ String get percentLabel => attempts * 100 < total ? '<1%' : '$percent%';
}
-/// The week's models that ran tasks, the largest share first, then by name.
-/// Shares round by largest remainder: the floors, then one more point each
-/// to the largest remainders until they add up to 100.
+/// The models that ran tasks in the last 7 days, or the board's week from a
+/// server before those, the largest share first, then by name. Shares round
+/// by largest remainder: the floors, then one more point each to the largest
+/// remainders until they add up to 100.
List<LeaderboardModelShare> leaderboardModelShares(SuperTabLeaderboard board) {
final merged =
<
String,
({Map<String, int> engines, int attempts, int reviewed, int passed})
>{};
- for (final score in board.byModel) {
+ for (final score in board.recentModels ?? board.byModel) {
final name = switch (score.model) {
final String model => modelDisplayName(model),
- null => engineIdentity(score.engine).label,
+ null => '${engineIdentity(score.engine).label}, model not reported',
};
// One row per model, whichever engine ran it at whichever effort:
// rows are keyed by name.
@@ -124,72 +113,60 @@ List<LeaderboardModelShare> leaderboardModelShares(SuperTabLeaderboard board) {
];
}
-/// The left sidebar's Models, after Machines (Dee, 2026-10-29): each model's
-/// share of the tasks of the week the right pane shows, behind its engine's
-/// icon, the counts and its first-review pass rate in words on hover and to a
-/// screen reader. Behind the first [leaderboardModelsShown] the rest are one
-/// Other row, so the rows shown add up to 100%; the heading names them all.
-/// Nothing shows without a board of [projectId], or when no model ran a task
-/// that week.
-class LeaderboardModelsSection extends StatefulWidget {
+/// The left sidebar's Models, after Machines (Dee, 2026-10-29 and 10-30):
+/// every model by its exact name with its share of the agents' tasks of the
+/// last 7 days, largest first, behind its engine's icon; the counts and its
+/// first-review pass rate in words on hover and to a screen reader. Its
+/// chevron collapses it like every other section. A server before the last
+/// 7 days gives the board's week instead, under the same heading. Nothing
+/// shows without a board of [projectId], or when no model ran a task.
+class LeaderboardModelsSection extends StatelessWidget {
const LeaderboardModelsSection({
super.key,
required this.board,
required this.projectId,
+ required this.collapsed,
+ required this.onToggleCollapsed,
this.now = DateTime.now,
});
final SuperTabLeaderboardReader board;
/// The open project; a board of any other shows nothing.
final String? projectId;
+ final bool collapsed;
+ final VoidCallback onToggleCollapsed;
final DateTime Function() now;
- @override
- State<LeaderboardModelsSection> createState() =>
- _LeaderboardModelsSectionState();
-}
-
-class _LeaderboardModelsSectionState extends State<LeaderboardModelsSection> {
- var _all = false;
-
@override
Widget build(BuildContext context) => ListenableBuilder(
- listenable: widget.board,
+ listenable: board,
builder: (context, _) {
- final board = widget.board.board;
- if (board == null || board.projectId != widget.projectId) {
+ final read = board.board;
+ if (read == null || read.projectId != projectId) {
return const SizedBox.shrink();
}
- final shares = leaderboardModelShares(board);
+ final shares = leaderboardModelShares(read);
if (shares.isEmpty) return const SizedBox.shrink();
- final more = shares.length > leaderboardModelsShown;
- final week = weekName(widget.board.week, leaderboardWeekOf(widget.now()));
+ final span = read.recentModels != null
+ ? 'in the last 7 days'
+ : weekName(board.week, leaderboardWeekOf(now()));
final style = leaderboardPointsStyle();
final column = _width(context, '100%', style);
return Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
SuperTabSectionHeading(
- 'Models · $week',
+ 'Models',
key: const ValueKey('super-models-heading'),
endInset: 0,
- startInset: SuperTabSectionHeading.indentFor(0),
- collapsed: more ? !_all : null,
- onToggleCollapsed: more ? () => setState(() => _all = !_all) : null,
+ collapsed: collapsed,
+ onToggleCollapsed: onToggleCollapsed,
+ titleTooltip: read.recentModels != null
+ ? 'Share of agent work, last 7 days'
+ : 'Share of agent work, $span',
),
- for (final share
- in _all ? shares : shares.take(leaderboardModelsShown))
- _row(share, week, style, column),
- if (more && !_all)
- _row(
- LeaderboardModelShare.other(
- shares.sublist(leaderboardModelsShown),
- ),
- week,
- style,
- column,
- key: const ValueKey('super-models-other'),
- ),
+ if (!collapsed)
+ for (final share in shares) _row(share, span, style, column),
],
);
},
@@ -197,18 +174,17 @@ class _LeaderboardModelsSectionState extends State<LeaderboardModelsSection> {
Widget _row(
LeaderboardModelShare share,
- String week,
+ String span,
TextStyle style,
- double column, {
- Key? key,
- }) {
+ double column,
+ ) {
final reviews = share.reviewed == 0
? 'no first review yet'
: '${(share.passed * 100 / share.reviewed).round()}% passed first review';
final words =
- '${share.name}: ${share.attempts} of ${share.total} tasks $week · $reviews';
+ '${share.name}: ${share.attempts} of ${share.total} tasks $span · $reviews';
return Tooltip(
- key: key ?? ValueKey('super-model-${share.name}'),
+ key: ValueKey('super-model-${share.name}'),
message: words,
excludeFromSemantics: true,
child: Semantics(
@@ -232,15 +208,12 @@ class _LeaderboardModelsSectionState extends State<LeaderboardModelsSection> {
children: [
SizedBox(
width: SuperTabSectionHeading.actionWidth,
- // Other has no engine: its icon column stays empty.
- child: share.engine == null
- ? null
- : Center(
- child: EngineMark(
- engine: share.engine,
- size: AppIcons.inlineSize,
- ),
- ),
+ child: Center(
+ child: EngineMark(
+ engine: share.engine,
+ size: AppIcons.inlineSize,
+ ),
+ ),
),
Expanded(
child: Text(
@@ -256,7 +229,7 @@ class _LeaderboardModelsSectionState extends State<LeaderboardModelsSection> {
SizedBox(
width: column,
child: Text(
- '${share.percent}%',
+ share.percentLabel,
maxLines: 1,
textAlign: TextAlign.right,
style: style,
diff --git a/desktop/lib/super_tabs/project_sidebar.dart b/desktop/lib/super_tabs/project_sidebar.dart
index 4d50a579a..2dcac7fd4 100644
--- a/desktop/lib/super_tabs/project_sidebar.dart
+++ b/desktop/lib/super_tabs/project_sidebar.dart
@@ -877,9 +877,10 @@ class ProjectSidebar extends StatelessWidget {
: null,
addTooltip: 'Add a Buddy',
endInset: 0,
- startInset: SuperTabSectionHeading.indentFor(0),
+ collapsed: !controller.buddiesGroupOpen,
+ onToggleCollapsed: controller.toggleBuddiesGroup,
),
- ..._buddies(projects, reading),
+ if (controller.buddiesGroupOpen) ..._buddies(projects, reading),
const SizedBox(height: 16),
],
// Machine online/offline, unread marks and theme changes do not touch
@@ -913,6 +914,8 @@ class ProjectSidebar extends StatelessWidget {
LeaderboardModelsSection(
board: board,
projectId: snapshot?.projectFor(controller.selectedId)?.id,
+ collapsed: !controller.modelsGroupOpen,
+ onToggleCollapsed: controller.toggleModelsGroup,
now: now,
),
],
diff --git a/desktop/lib/super_tabs/section_heading.dart b/desktop/lib/super_tabs/section_heading.dart
index 658adb56a..e97a173e9 100644
--- a/desktop/lib/super_tabs/section_heading.dart
+++ b/desktop/lib/super_tabs/section_heading.dart
@@ -18,6 +18,7 @@ class SuperTabSectionHeading extends StatelessWidget {
this.startInset,
this.collapsed,
this.onToggleCollapsed,
+ this.titleTooltip,
});
final String title;
@@ -48,6 +49,12 @@ class SuperTabSectionHeading extends StatelessWidget {
/// trailing chevron form one button on the left of the heading.
final VoidCallback? onToggleCollapsed;
+ /// What hovering a collapsible heading's title says: what the section
+ /// shows, when its title alone does not. The chevron still says Collapse or
+ /// Expand, and a screen reader hears this as the button's hint, never its
+ /// name.
+ final String? titleTooltip;
+
/// The chevron and every action are a fixed 32 px square; the gap
/// before the actions is 4 px; the title always keeps at least this
/// much room, even when the trailing pill is at its widest.
@@ -120,6 +127,7 @@ class SuperTabSectionHeading extends StatelessWidget {
child: Semantics(
button: true,
expanded: collapsed != true,
+ hint: titleTooltip,
child: Tooltip(
message:
'${collapsed == true ? 'Expand' : 'Collapse'} $title',
@@ -135,7 +143,15 @@ class SuperTabSectionHeading extends StatelessWidget {
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
- Flexible(child: titleLabel),
+ Flexible(
+ child: titleTooltip == null
+ ? titleLabel
+ : Tooltip(
+ message: titleTooltip,
+ excludeFromSemantics: true,
+ child: titleLabel,
+ ),
+ ),
const SizedBox(width: _trailingGap),
Icon(
collapsed == true
diff --git a/desktop/test/super_tab_leaderboard_shots_test.dart b/desktop/test/super_tab_leaderboard_shots_test.dart
index 817f5e025..7a988debf 100644
--- a/desktop/test/super_tab_leaderboard_shots_test.dart
+++ b/desktop/test/super_tab_leaderboard_shots_test.dart
@@ -98,4 +98,51 @@ void main() {
await tester.pumpWidget(const SizedBox());
}
}, skip: shots == null);
+
+ testWidgets('sidebar Models screenshots, expanded and collapsed', (
+ tester,
+ ) async {
+ for (final (brightness, name) in [
+ (Brightness.light, 'light'),
+ (Brightness.dark, 'dark'),
+ ]) {
+ await showHumans(
+ tester,
+ brightness,
+ swarm: modelsSwarm,
+ size: const Size(1300, 1000),
+ );
+ await tester.runAsync(
+ () => precacheImage(
+ const AssetImage('assets/engine-icons/codex.png'),
+ tester.element(find.byKey(const ValueKey('super-models-heading'))),
+ ),
+ );
+ await tester.pumpAndSettle();
+ await captureWindow(tester, shots, 'sidebar-models-$name');
+ // The heading's hover line.
+ final mouse = await tester.createGesture(kind: PointerDeviceKind.mouse);
+ await mouse.addPointer(location: Offset.zero);
+ await mouse.moveTo(
+ tester.getCenter(
+ find.descendant(
+ of: find.byKey(const ValueKey('super-models-heading')),
+ matching: find.text('Models'),
+ ),
+ ),
+ );
+ await tester.pumpAndSettle(const Duration(seconds: 2));
+ await captureWindow(tester, shots, 'sidebar-models-hover-$name');
+ await mouse.removePointer();
+ await tester.tap(
+ find.descendant(
+ of: find.byKey(const ValueKey('super-models-heading')),
+ matching: find.text('Models'),
+ ),
+ );
+ await tester.pumpAndSettle();
+ await captureWindow(tester, shots, 'sidebar-models-collapsed-$name');
+ await tester.pumpWidget(const SizedBox());
+ }
+ }, skip: shots == null);
}
diff --git a/desktop/test/super_tab_members_list_test.dart b/desktop/test/super_tab_members_list_test.dart
index 48614e354..cf1013b2f 100644
--- a/desktop/test/super_tab_members_list_test.dart
+++ b/desktop/test/super_tab_members_list_test.dart
@@ -131,7 +131,9 @@ void main() {
find.descendant(
of: find.byKey(const ValueKey('super-person-peer')),
// The row names the person by username (dee) or, before usernames, by email prefix (Dee).
- matching: find.textContaining(RegExp('dee', caseSensitive: false)),
+ matching: find.textContaining(
+ RegExp('dee', caseSensitive: false),
+ ),
),
)
.dx,
@@ -198,7 +200,8 @@ void main() {
final server = modelsSwarm(membersSwarm());
server.leaderboard!
..remove('agents')
- ..remove('byModel');
+ ..remove('byModel')
+ ..remove('recentModels');
final controller = await show(tester, server);
expect(
find.byKey(const ValueKey('leaderboard-points-peer')),
@@ -244,7 +247,7 @@ void main() {
);
await tester.pumpAndSettle();
expect(tester.takeException(), isNull);
- for (final number in ['21', '44%']) {
+ for (final number in ['21', '84%']) {
expect(find.text(number), findsOneWidget, reason: number);
final paragraph = tester.renderObject<RenderParagraph>(find.text(number));
expect(paragraph.didExceedMaxLines, isFalse, reason: number);
diff --git a/desktop/test/super_tab_sidebar_models_test.dart b/desktop/test/super_tab_sidebar_models_test.dart
index 53b65434d..d59ee45d7 100644
--- a/desktop/test/super_tab_sidebar_models_test.dart
+++ b/desktop/test/super_tab_sidebar_models_test.dart
@@ -1,3 +1,4 @@
+import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:harness/shared/theme/app_theme.dart' as grid;
@@ -8,20 +9,25 @@ import 'package:harness/widgets/engine_identity.dart';
import 'support/humans_fixture.dart';
import 'support/super_tab_fixture.dart';
-/// Models in the left sidebar, after Machines (Dee, 2026-10-29): each model's
-/// share of the tasks of the week the right pane shows, rounded so the rows
-/// add up to 100%, behind its engine's icon; the counts and its first-review
-/// pass rate in words on hover and for a screen reader.
+/// Models in the left sidebar, after Machines (Dee, 2026-10-29 and 10-30):
+/// every model by its exact name with its share of the agents' tasks of the
+/// last 7 days, largest first, rounded so the rows add up to 100%, behind its
+/// engine's icon. Its chevron collapses it like every other section; the
+/// counts and first-review pass rate are in words on hover and for a screen
+/// reader.
void main() {
Future<SuperTabController> show(
WidgetTester tester,
- ConversationServer server,
- ) async {
+ ConversationServer server, {
+ Map<String, dynamic>? initial,
+ }) async {
await tester.binding.setSurfaceSize(const Size(1300, 1400));
addTearDown(() => tester.binding.setSurfaceSize(null));
final controller = server.controller(
account: 'peer',
- initial: {'tabId': 'tab', 'accountId': 'peer', 'selectedId': 'lead'},
+ initial:
+ initial ??
+ {'tabId': 'tab', 'accountId': 'peer', 'selectedId': 'lead'},
);
await controller.refresh();
await tester.pumpWidget(
@@ -51,55 +57,123 @@ void main() {
final heading = find.byKey(const ValueKey('super-models-heading'));
final headingText = find.descendant(
of: heading,
- matching: find.text('Models · this week'),
+ matching: find.text('Models'),
);
Finder row(String name) => find.byKey(ValueKey('super-model-$name'));
+ final rows = find.byWidgetPredicate(
+ (w) =>
+ w.key is ValueKey<String> &&
+ (w.key! as ValueKey<String>).value.startsWith('super-model-'),
+ );
Finder inRow(String name, Finder finder) =>
find.descendant(of: row(name), matching: finder);
Finder mark(String name, String engine) => inRow(
name,
find.byWidgetPredicate((w) => w is EngineMark && w.engine == engine),
);
+ List<String> names(WidgetTester tester) {
+ final found = rows.evaluate().toList()
+ ..sort(
+ (a, b) => tester
+ .getTopLeft(find.byWidget(a.widget))
+ .dy
+ .compareTo(tester.getTopLeft(find.byWidget(b.widget)).dy),
+ );
+ return [
+ for (final element in found)
+ (element.widget.key! as ValueKey<String>).value.substring(
+ 'super-model-'.length,
+ ),
+ ];
+ }
testWidgets(
- 'lists the top three by share of the week\'s tasks after Machines',
+ 'is headed Models, says on hover it is the last 7 days, and lists every model largest first after Machines',
(tester) async {
final controller = await show(tester, modelsSwarm());
expect(headingText, findsOneWidget);
+ expect(find.textContaining('this week'), findsNothing);
+ // The chevron says what it does, as every section's does; the title
+ // says what the shares are.
+ expect(find.byTooltip('Collapse Models'), findsOneWidget);
+ expect(
+ find.byTooltip('Share of agent work, last 7 days'),
+ findsOneWidget,
+ );
expect(
tester.getTopLeft(heading).dy,
greaterThan(tester.getTopLeft(find.text('Machines')).dy),
);
- // 32 tasks: 14, 9, 6 and 3 of them, 43.75, 28.1, 18.75 and 9.4%.
- expect(inRow('Opus 5.5', find.text('44%')), findsOneWidget);
- expect(inRow('GPT-6.1 Sol', find.text('28%')), findsOneWidget);
- expect(inRow('Sonnet 5.5', find.text('19%')), findsOneWidget);
- // Fourth, so not shown until asked for; no task of its own, never.
- expect(row('Haiku 5.5'), findsNothing);
- expect(row('GPT-6.1 Luna'), findsNothing);
- final top = tester.getTopLeft(row('Opus 5.5')).dy;
- final second = tester.getTopLeft(row('GPT-6.1 Sol')).dy;
- expect(top, lessThan(second));
- expect(second, lessThan(tester.getTopLeft(row('Sonnet 5.5')).dy));
- // No effort split, no rank, no other number.
- expect(find.textContaining('Opus 5.5 ·'), findsNothing);
+ // The approved mockup: 100 tasks, no Other row, nothing left out.
+ expect(names(tester), [
+ 'Opus 5.5',
+ 'Sonnet 5.5',
+ 'Codex, model not reported',
+ 'GPT-6.1 Sol',
+ ]);
+ expect(find.text('Other'), findsNothing);
+ expect(inRow('Opus 5.5', find.text('84%')), findsOneWidget);
+ expect(inRow('Sonnet 5.5', find.text('11%')), findsOneWidget);
+ expect(
+ inRow('Codex, model not reported', find.text('3%')),
+ findsOneWidget,
+ );
+ expect(inRow('GPT-6.1 Sol', find.text('2%')), findsOneWidget);
// The percentages line up at their trailing edge.
expect(
- tester.getTopRight(find.text('44%')).dx,
- tester.getTopRight(find.text('19%')).dx,
+ tester.getTopRight(find.text('84%')).dx,
+ tester.getTopRight(find.text('2%')).dx,
);
await close(tester, controller);
},
);
+ testWidgets(
+ 'says the last 7 days over the title and Collapse over the chevron, and a screen reader hears the action',
+ (tester) async {
+ final semantics = tester.ensureSemantics();
+ final controller = await show(tester, modelsSwarm());
+ const explained = 'Share of agent work, last 7 days';
+ final mouse = await tester.createGesture(kind: PointerDeviceKind.mouse);
+ await mouse.addPointer(location: Offset.zero);
+ addTearDown(mouse.removePointer);
+ await mouse.moveTo(tester.getCenter(headingText));
+ await tester.pumpAndSettle(const Duration(seconds: 2));
+ expect(find.text(explained), findsOneWidget);
+ expect(find.text('Collapse Models'), findsNothing);
+ await mouse.moveTo(Offset.zero);
+ await tester.pumpAndSettle(const Duration(seconds: 2));
+ await mouse.moveTo(
+ tester.getCenter(
+ find.descendant(of: heading, matching: find.byType(Icon)).first,
+ ),
+ );
+ await tester.pumpAndSettle(const Duration(seconds: 2));
+ expect(find.text('Collapse Models'), findsOneWidget);
+ expect(find.text(explained), findsNothing);
+ // The button is named by its title and its action, as Projects' is;
+ // the explanation is a hint, never its name.
+ final node = tester.getSemantics(headingText);
+ expect(node.label, 'Models');
+ expect(node.tooltip, 'Collapse Models');
+ expect(node.hint, explained);
+ expect(
+ find.bySemanticsLabel(RegExp('Share of agent work')),
+ findsNothing,
+ );
+ semantics.dispose();
+ await close(tester, controller);
+ },
+ );
+
testWidgets('puts its engine\'s icon before each model\'s name', (
tester,
) async {
final controller = await show(tester, modelsSwarm());
for (final (name, engine) in [
('Opus 5.5', 'claude'),
+ ('Codex, model not reported', 'codex'),
('GPT-6.1 Sol', 'codex'),
- ('Sonnet 5.5', 'claude'),
]) {
expect(mark(name, engine), findsOneWidget, reason: name);
expect(
@@ -117,17 +191,17 @@ void main() {
});
testWidgets(
- 'says the tasks and first-review pass rate on hover and to a screen reader',
+ 'says the last 7 days\' tasks and first-review pass rate on hover and to a screen reader',
(tester) async {
final semantics = tester.ensureSemantics();
final controller = await show(tester, modelsSwarm());
const opus =
- 'Opus 5.5: 14 of 32 tasks this week · 92% passed first review';
+ 'Opus 5.5: 84 of 100 tasks in the last 7 days · 92% passed first review';
expect(find.byTooltip(opus), findsOneWidget);
expect(find.bySemanticsLabel(opus), findsOneWidget);
expect(
find.byTooltip(
- 'GPT-6.1 Sol: 9 of 32 tasks this week · 75% passed first review',
+ 'Codex, model not reported: 3 of 100 tasks in the last 7 days · no first review yet',
),
findsOneWidget,
);
@@ -136,162 +210,106 @@ void main() {
},
);
- testWidgets('shows the whole list from its heading, and back', (
- tester,
- ) async {
- final controller = await show(tester, modelsSwarm());
- await tester.tap(headingText);
- await tester.pumpAndSettle();
- expect(inRow('Haiku 5.5', find.text('9%')), findsOneWidget);
- expect(mark('Haiku 5.5', 'claude'), findsOneWidget);
- // Not reviewed yet: says so rather than a pass rate.
- expect(
- find.byTooltip(
- 'Haiku 5.5: 3 of 32 tasks this week · no first review yet',
- ),
- findsOneWidget,
- );
- expect(row('GPT-6.1 Luna'), findsNothing);
- await tester.tap(headingText);
- await tester.pumpAndSettle();
- expect(row('Haiku 5.5'), findsNothing);
- await close(tester, controller);
- });
-
testWidgets(
- 'adds the models behind the heading as one Other row, so the shown rows add up to 100%',
+ 'collapses fully from its chevron and expands again, remembered after a restart',
(tester) async {
- final semantics = tester.ensureSemantics();
- final controller = await show(tester, modelsSwarm());
- final other = find.byKey(const ValueKey('super-models-other'));
- expect(other, findsOneWidget);
- // Haiku's 3 of 32 tasks, 9%: 44 + 28 + 19 + 9 = 100.
- expect(
- find.descendant(of: other, matching: find.text('Other')),
- findsOneWidget,
- );
- expect(
- find.descendant(of: other, matching: find.text('9%')),
- findsOneWidget,
- );
- final shown = [
- for (final name in ['Opus 5.5', 'GPT-6.1 Sol', 'Sonnet 5.5'])
- inRow(name, find.textContaining('%')),
- find.descendant(of: other, matching: find.textContaining('%')),
- ];
- expect(
- shown
- .map(
- (f) =>
- int.parse(tester.widget<Text>(f).data!.replaceAll('%', '')),
- )
- .fold<int>(0, (sum, percent) => sum + percent),
- 100,
- );
- const words = 'Other: 3 of 32 tasks this week · no first review yet';
- expect(find.byTooltip(words), findsOneWidget);
- expect(find.bySemanticsLabel(words), findsOneWidget);
- // The whole list names them instead.
+ final server = modelsSwarm();
+ final controller = await show(tester, server);
+ expect(controller.modelsGroupOpen, isTrue);
await tester.tap(headingText);
await tester.pumpAndSettle();
- expect(other, findsNothing);
- expect(inRow('Haiku 5.5', find.text('9%')), findsOneWidget);
- semantics.dispose();
+ // Collapsed: the heading stays, nothing below it.
+ expect(headingText, findsOneWidget);
+ expect(rows, findsNothing);
+ expect(find.text('84%'), findsNothing);
+ await controller.flush();
+ expect(server.saved!['modelsGroupOpen'], isFalse);
await close(tester, controller);
+
+ final reopened = await show(tester, server, initial: server.saved);
+ expect(reopened.modelsGroupOpen, isFalse);
+ expect(headingText, findsOneWidget);
+ expect(rows, findsNothing);
+ await tester.tap(headingText);
+ await tester.pumpAndSettle();
+ expect(names(tester), hasLength(4));
+ expect(inRow('Opus 5.5', find.text('84%')), findsOneWidget);
+ await close(tester, reopened);
},
);
- testWidgets('has no Other row when every model is shown', (tester) async {
- final server = modelsSwarm();
- server.leaderboard!['byModel'] = [
- modelScore('claude', 'claude-opus-5-5', 'high', attempts: 3),
- modelScore('codex', 'gpt-6.1-sol', null, attempts: 1),
- ];
- final controller = await show(tester, server);
- expect(find.byKey(const ValueKey('super-models-other')), findsNothing);
- expect(inRow('Opus 5.5', find.text('75%')), findsOneWidget);
- expect(inRow('GPT-6.1 Sol', find.text('25%')), findsOneWidget);
- await close(tester, controller);
- });
-
testWidgets('rounds the shares so all rows add up to 100%', (tester) async {
final server = modelsSwarm();
// A third each: plain rounding says 33% three times, 99%.
- server.leaderboard!['byModel'] = [
- modelScore('claude', 'claude-opus-5-5', 'high', attempts: 1),
- modelScore('codex', 'gpt-6.1-sol', null, attempts: 1),
- modelScore('claude', 'claude-sonnet-5-5', 'high', attempts: 1),
+ server.leaderboard!['recentModels'] = [
+ recentModel('claude', 'claude-opus-5-5', attempts: 1),
+ recentModel('codex', 'gpt-6.1-sol', attempts: 1),
+ recentModel('claude', 'claude-sonnet-5-5', attempts: 1),
];
final controller = await show(tester, server);
// Of three alike, by name.
+ expect(names(tester), ['GPT-6.1 Sol', 'Opus 5.5', 'Sonnet 5.5']);
expect(inRow('GPT-6.1 Sol', find.text('34%')), findsOneWidget);
expect(inRow('Opus 5.5', find.text('33%')), findsOneWidget);
expect(inRow('Sonnet 5.5', find.text('33%')), findsOneWidget);
- expect(
- tester.getTopLeft(row('GPT-6.1 Sol')).dy,
- lessThan(tester.getTopLeft(row('Opus 5.5')).dy),
- );
await close(tester, controller);
});
- testWidgets('follows the week the right pane shows', (tester) async {
+ testWidgets('says under 1% for a model with a few tasks, never 0%', (
+ tester,
+ ) async {
final server = modelsSwarm();
+ // 2 of 500 tasks: 0.4%.
+ server.leaderboard!['recentModels'] = [
+ recentModel('claude', 'claude-opus-5-5', attempts: 498),
+ recentModel('codex', 'gpt-6.1-sol', attempts: 2),
+ ];
final controller = await show(tester, server);
- server.leaderboard!['byModel'] = [
- modelScore(
- 'claude',
- 'claude-sonnet-5-5',
- 'high',
- attempts: 4,
- reviewed: 4,
- passed: 4,
- ),
+ expect(inRow('Opus 5.5', find.text('100%')), findsOneWidget);
+ expect(inRow('GPT-6.1 Sol', find.text('<1%')), findsOneWidget);
+ expect(find.text('0%'), findsNothing);
+ await close(tester, controller);
+ });
+
+ testWidgets('says the same for models with as many tasks', (tester) async {
+ final server = modelsSwarm();
+ // 163, 1, 1 and 1 of 166: largest remainders give two of the three 1s a
+ // point to reach 100; under 1% each, they all read alike.
+ server.leaderboard!['recentModels'] = [
+ recentModel('claude', 'claude-opus-5-5', attempts: 163),
+ recentModel('claude', 'claude-sonnet-5-5', attempts: 1),
+ recentModel('codex', 'gpt-6.1-sol', attempts: 1),
+ recentModel('codex', 'gpt-6.1-luna', attempts: 1),
];
- await tester.tap(find.byKey(const ValueKey('leaderboard-week')));
- await tester.pumpAndSettle();
- await tester.tap(find.text('Last week').last);
- await tester.pumpAndSettle();
- expect(server.leaderboardReads.last, contains('&week='));
- expect(
- find.descendant(of: heading, matching: find.text('Models · last week')),
- findsOneWidget,
- );
- expect(row('Opus 5.5'), findsNothing);
- expect(inRow('Sonnet 5.5', find.text('100%')), findsOneWidget);
- expect(
- find.byTooltip(
- 'Sonnet 5.5: 4 of 4 tasks last week · 100% passed first review',
- ),
- findsOneWidget,
- );
+ final controller = await show(tester, server);
+ expect(inRow('Opus 5.5', find.text('98%')), findsOneWidget);
+ for (final name in ['Sonnet 5.5', 'GPT-6.1 Sol', 'GPT-6.1 Luna']) {
+ expect(inRow(name, find.text('<1%')), findsOneWidget, reason: name);
+ }
await close(tester, controller);
});
testWidgets(
- 'lists a model run through two engines once, behind the engine that ran most of it',
+ 'lists one model under one name, however its engine or provider spelled it',
(tester) async {
// Review of e4b70e9: one grid model through Claude Code and Codex drew
// two rows with one key ("Duplicate keys found").
final server = modelsSwarm();
- server.leaderboard!['byModel'] = [
- modelScore(
- 'claude',
- 'qwen3',
- 'high',
- attempts: 3,
- reviewed: 4,
- passed: 3,
- ),
- modelScore('codex', 'qwen3', null, attempts: 5, reviewed: 4, passed: 4),
+ server.leaderboard!['recentModels'] = [
+ recentModel('claude', 'qwen3', attempts: 3, reviewed: 4, passed: 3),
+ recentModel('codex', 'qwen3', attempts: 5, reviewed: 4, passed: 4),
+ recentModel('claude', 'claude-opus-5-5', attempts: 1),
+ recentModel('claude', 'Claude-Opus-5.5', attempts: 1),
];
final controller = await show(tester, server);
expect(tester.takeException(), isNull);
- expect(row('qwen3'), findsOneWidget);
- expect(inRow('qwen3', find.text('100%')), findsOneWidget);
+ expect(names(tester), ['qwen3', 'Opus 5.5']);
+ expect(inRow('qwen3', find.text('80%')), findsOneWidget);
+ expect(inRow('Opus 5.5', find.text('20%')), findsOneWidget);
expect(mark('qwen3', 'codex'), findsOneWidget);
expect(
find.byTooltip(
- 'qwen3: 8 of 8 tasks this week · 88% passed first review',
+ 'qwen3: 8 of 10 tasks in the last 7 days · 88% passed first review',
),
findsOneWidget,
);
@@ -299,13 +317,55 @@ void main() {
},
);
- testWidgets('hides Models when no model ran a task this week', (
+ testWidgets('keeps the last 7 days whichever week the right pane shows', (
tester,
) async {
final server = modelsSwarm();
- server.leaderboard!['byModel'] = [
- modelScore('codex', 'gpt-6.1-luna', null, attempts: 0, reviews: 3),
- ];
+ final controller = await show(tester, server);
+ await tester.tap(find.byKey(const ValueKey('leaderboard-week')));
+ await tester.pumpAndSettle();
+ await tester.tap(find.text('Last week').last);
+ await tester.pumpAndSettle();
+ expect(server.leaderboardReads.last, contains('&week='));
+ expect(headingText, findsOneWidget);
+ expect(find.textContaining('last week'), findsNothing);
+ expect(inRow('Opus 5.5', find.text('84%')), findsOneWidget);
+ await close(tester, controller);
+ });
+
+ testWidgets(
+ 'shows the week\'s models from a server before the last 7 days, still headed Models',
+ (tester) async {
+ final server = modelsSwarm();
+ server.leaderboard!.remove('recentModels');
+ final controller = await show(tester, server);
+ expect(headingText, findsOneWidget);
+ expect(find.byTooltip('Share of agent work, this week'), findsOneWidget);
+ // 32 tasks: Opus at two efforts as one, 14; then 9, 6 and 3; Luna ran
+ // none of its own.
+ expect(names(tester), [
+ 'Opus 5.5',
+ 'GPT-6.1 Sol',
+ 'Sonnet 5.5',
+ 'Haiku 5.5',
+ ]);
+ expect(inRow('Opus 5.5', find.text('44%')), findsOneWidget);
+ expect(inRow('Haiku 5.5', find.text('9%')), findsOneWidget);
+ expect(
+ find.byTooltip(
+ 'Opus 5.5: 14 of 32 tasks this week · 92% passed first review',
+ ),
+ findsOneWidget,
+ );
+ await close(tester, controller);
+ },
+ );
+
+ testWidgets('hides Models when no model ran a task in the last 7 days', (
+ tester,
+ ) async {
+ final server = modelsSwarm();
+ server.leaderboard!['recentModels'] = <Object>[];
final controller = await show(tester, server);
expect(heading, findsNothing);
await close(tester, controller);
@@ -314,6 +374,7 @@ void main() {
testWidgets('hides Models from a server before task counts', (tester) async {
// Its rows carry first reviews but no tasks: no share to show.
final server = modelsSwarm();
+ server.leaderboard!.remove('recentModels');
server.leaderboard!['byModel'] = [
modelScore(
'claude',
@@ -329,6 +390,21 @@ void main() {
await close(tester, controller);
});
+ testWidgets(
+ 'shows Models once a failed first read recovers, without a stuck row',
+ (tester) async {
+ final server = modelsSwarm()..failLeaderboardReads = 1;
+ final controller = await show(tester, server);
+ expect(heading, findsNothing);
+ expect(find.textContaining('Loading'), findsNothing);
+ await controller.refresh();
+ await tester.pump(const Duration(minutes: 5));
+ await tester.pumpAndSettle();
+ expect(inRow('Opus 5.5', find.text('84%')), findsOneWidget);
+ await close(tester, controller);
+ },
+ );
+
testWidgets('clears Models once the reader loses the project', (
tester,
) async {
@@ -339,7 +415,7 @@ void main() {
await controller.refresh();
await tester.pumpAndSettle();
expect(heading, findsNothing);
- expect(find.text('44%'), findsNothing);
+ expect(find.text('84%'), findsNothing);
await close(tester, controller);
});
diff --git a/desktop/test/super_tab_sidebar_sections_test.dart b/desktop/test/super_tab_sidebar_sections_test.dart
new file mode 100644
index 000000000..e1e65150e
--- /dev/null
+++ b/desktop/test/super_tab_sidebar_sections_test.dart
@@ -0,0 +1,149 @@
+import 'package:flutter/material.dart';
+import 'package:flutter_test/flutter_test.dart';
+import 'package:harness/shared/theme/app_theme.dart' as grid;
+import 'package:harness/super_tabs/project_sidebar.dart';
+import 'package:harness/super_tabs/section_heading.dart';
+import 'package:harness/super_tabs/view.dart';
+
+import 'support/humans_fixture.dart';
+
+/// Every section of the left sidebar collapses the same way (Dee, 2026-10-30:
+/// "needs to fully collapse/uncollapse (like machines and projects!!!)"): its
+/// heading's chevron hides everything below it down to the next heading, and
+/// shows it all again. Walks whatever headings the sidebar has, so a section
+/// added later without a chevron fails here.
+void main() {
+ testWidgets(
+ 'every sidebar heading collapses all of its rows and expands them again',
+ (tester) async {
+ await tester.binding.setSurfaceSize(const Size(1300, 1600));
+ addTearDown(() => tester.binding.setSurfaceSize(null));
+ final server = modelsSwarm();
+ final controller = server.controller(
+ account: 'peer',
+ initial: {'tabId': 'tab', 'accountId': 'peer', 'selectedId': 'lead'},
+ );
+ await controller.refresh();
+ await tester.pumpWidget(
+ MaterialApp(
+ theme: grid.buildAppTheme(brightness: Brightness.light),
+ home: Scaffold(
+ body: SuperTabView(
+ controller: controller,
+ onInvite: () {},
+ onAddAgent: (_) {},
+ onOpenTerminal: (_) {},
+ machineName: (_) => 'Mac Studio',
+ ),
+ ),
+ ),
+ );
+ await tester.pumpAndSettle();
+
+ final sidebar = find.byType(ProjectSidebar);
+ final headings = find.descendant(
+ of: sidebar,
+ matching: find.byType(SuperTabSectionHeading),
+ );
+
+ /// The headings top to bottom, with where each one's section ends.
+ List<({String title, double top, double bottom})> sections() {
+ final found = [
+ for (final element in headings.evaluate())
+ (
+ title: (element.widget as SuperTabSectionHeading).title,
+ top: tester.getTopLeft(find.byWidget(element.widget)).dy,
+ bottom: tester.getBottomLeft(find.byWidget(element.widget)).dy,
+ ),
+ ]..sort((a, b) => a.top.compareTo(b.top));
+ return found;
+ }
+
+ /// Every text drawn between [title]'s heading and the next one.
+ List<String> body(String title) {
+ final all = sections();
+ final i = all.indexWhere((s) => s.title == title);
+ final end = i + 1 < all.length
+ ? all[i + 1].top
+ : tester.getBottomLeft(sidebar).dy;
+ return [
+ for (final element
+ in find
+ .descendant(of: sidebar, matching: find.byType(RichText))
+ .evaluate())
+ if (tester.getTopLeft(find.byWidget(element.widget)).dy case final y
+ when y >= all[i].bottom && y < end)
+ (element.widget as RichText).text.toPlainText(),
+ ];
+ }
+
+ final titles = [for (final s in sections()) s.title];
+ // Not a vacuous walk: the sections people asked about are all here.
+ expect(
+ titles,
+ containsAllInOrder(['Projects', 'Buddies', 'Machines', 'Models']),
+ );
+ for (final title in titles) {
+ final heading = find.descendant(
+ of: sidebar,
+ matching: find.byWidgetPredicate(
+ (w) => w is SuperTabSectionHeading && w.title == title,
+ ),
+ );
+ expect(
+ tester.widget<SuperTabSectionHeading>(heading).onToggleCollapsed,
+ isNotNull,
+ reason: '$title chevron',
+ );
+ // Every chevron says what it does, alike.
+ expect(
+ find.descendant(
+ of: heading,
+ matching: find.byTooltip('Collapse $title'),
+ ),
+ findsOneWidget,
+ reason: '$title says Collapse',
+ );
+ final shown = body(title);
+ expect(shown, isNotEmpty, reason: '$title has rows');
+ final label = find.descendant(of: heading, matching: find.text(title));
+ await tester.tap(label);
+ await tester.pumpAndSettle();
+ expect(body(title), isEmpty, reason: '$title collapsed');
+ expect(
+ find.descendant(
+ of: heading,
+ matching: find.byTooltip('Expand $title'),
+ ),
+ findsOneWidget,
+ reason: '$title says Expand',
+ );
+ await tester.tap(label);
+ await tester.pumpAndSettle();
+ expect(body(title), shown, reason: '$title expanded');
+ }
+
+ await tester.pumpWidget(const SizedBox());
+ await controller.flush();
+ controller.dispose();
+ },
+ );
+
+ testWidgets('remembers a collapsed Buddies after a restart', (tester) async {
+ final server = modelsSwarm();
+ final controller = server.controller(
+ account: 'peer',
+ initial: {'tabId': 'tab', 'accountId': 'peer', 'selectedId': 'lead'},
+ );
+ await controller.refresh();
+ controller.toggleBuddiesGroup();
+ await controller.flush();
+ controller.dispose();
+ expect(server.saved!['buddiesGroupOpen'], isFalse);
+ final reopened = server.controller(account: 'peer', initial: server.saved);
+ await reopened.refresh();
+ expect(reopened.buddiesGroupOpen, isFalse);
+ await reopened.flush();
+ reopened.dispose();
+ });
+}
diff --git a/desktop/test/support/humans_fixture.dart b/desktop/test/support/humans_fixture.dart
index fa3fa9d22..9c36991c7 100644
--- a/desktop/test/support/humans_fixture.dart
+++ b/desktop/test/support/humans_fixture.dart
@@ -253,5 +253,42 @@ ConversationServer modelsSwarm([ConversationServer? base]) {
// Only reviewed others' work: no task of its own.
modelScore('codex', 'gpt-6.1-luna', null, attempts: 0, reviews: 5),
];
+ server.leaderboard!['recentModels'] = recentModels();
return server;
}
+
+/// One model's last 7 days on the board, as the sidebar's Models reads them:
+/// its tasks and first reviews, every effort as one.
+Map<String, dynamic> recentModel(
+ String engine,
+ String? model, {
+ required int attempts,
+ int reviewed = 0,
+ int passed = 0,
+}) => {
+ 'engine': engine,
+ 'model': model,
+ 'attempts': attempts,
+ 'firstReview': {'reviewed': reviewed, 'passed': passed},
+};
+
+/// The last 7 days of [modelsSwarm] (the approved mockup, 10-30): 100 tasks,
+/// 84 on Opus, 11 on Sonnet, 3 on Codex with no model reported, 2 on Sol.
+List<Map<String, dynamic>> recentModels() => [
+ recentModel(
+ 'claude',
+ 'claude-opus-5-5',
+ attempts: 84,
+ reviewed: 50,
+ passed: 46,
+ ),
+ recentModel(
+ 'claude',
+ 'claude-sonnet-5-5',
+ attempts: 11,
+ reviewed: 4,
+ passed: 3,
+ ),
+ recentModel('codex', null, attempts: 3),
+ recentModel('codex', 'gpt-6.1-sol', attempts: 2, reviewed: 2, passed: 2),
+];
diff --git a/desktop/test/support/super_tab_fixture.dart b/desktop/test/support/super_tab_fixture.dart
index 9a84e3f0b..13523eb1b 100644
--- a/desktop/test/support/super_tab_fixture.dart
+++ b/desktop/test/support/super_tab_fixture.dart
@@ -465,6 +465,10 @@ class ConversationServer {
/// The leaderboard read's answer; reads of it are listed in [leaderboardReads].
Map<String, dynamic>? leaderboard;
final leaderboardReads = <String>[];
+
+ /// How many leaderboard reads fail as a server that is down does, before
+ /// they answer again.
+ var failLeaderboardReads = 0;
// The reader's tags, newest last, answered by GET .../mentions?state=.
final mentions = <Map<String, dynamic>>[];
// Decisions asked of the reader, newest last, answered by GET .../decisions?state=.
@@ -1238,6 +1242,10 @@ class ConversationServer {
}
if (uri.pathSegments.last == 'leaderboard') {
leaderboardReads.add(path);
+ if (failLeaderboardReads > 0) {
+ failLeaderboardReads--;
+ throw const SuperTabFailure('OFFLINE', 'No connection.', statusCode: 503);
+ }
final board = leaderboard;
if (board == null) {
throw const SuperTabFailure('NOT_FOUND', 'Not found.', statusCode: 404);