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.

Models list: every attempt names the model it ran on, Codex included (#2348)

0xken152a57d2c267ae
diff --git a/backend/integration/superTabAttemptModels.test.ts b/backend/integration/superTabAttemptModels.test.ts
new file mode 100644
index 000000000..6849bc33a
--- /dev/null
+++ b/backend/integration/superTabAttemptModels.test.ts
@@ -0,0 +1,95 @@
+import { randomUUID } from 'node:crypto'
+import { execFile } from 'node:child_process'
+import { promisify } from 'node:util'
+import { join } from 'node:path'
+import { tmpdir } from 'node:os'
+import { afterAll, beforeAll, describe, expect, it } from 'vitest'
+import { MongoMemoryReplSet } from 'mongodb-memory-server-core'
+import { PrismaClient } from '@prisma/client'
+import type { AuthUser } from '../src/lib/ssoAuth.js'
+import { SuperTabStore } from '../src/superTabs/store.js'
+import type { Command } from '../src/superTabs/commands.js'
+import type { AgentConfiguration } from '../src/superTabs/model.js'
+import { SwarmReads } from '../src/superTabs/read/service.js'
+import { poolRows } from './hostRows.test-support.js'
+
+// Scholes, 2026-10-30: the sidebar's Models listed "Codex, model not reported". End to end through the store and the
+// leaderboard read the sidebar shows: a Codex agent its host starts on Codex's own model, work assigned to it, and the row it
+// counts under. A fresh loopback replica set, created here.
+let replica: MongoMemoryReplSet
+let db: PrismaClient
+const owner: AuthUser = { sub: '310000000000000000000001', email: '[email protected]', autonomousEnv: 'prod', role: 'user' }
+const lead = { engine: 'claude', model: 'opus', effort: 'high', contextWindow: 200000, engineVersion: 'fixture' }
+/** What a Codex agent at its own default joins with: no model yet. */
+const joined: AgentConfiguration = { engine: 'codex', model: null, effort: null, contextWindow: null, engineVersion: '0.165.0' }
+const reading: AgentConfiguration = { ...joined, model: 'gpt-6.1-sol', effort: 'auto' }
+
+beforeAll(async () => {
+ replica = await MongoMemoryReplSet.create({ binary: { version: '7.0.24', downloadDir: join(tmpdir(), 'harness-super-tab-mongodb-binaries') },
+ replSet: { count: 1, ip: '127.0.0.1', storageEngine: 'wiredTiger' } })
+ const uri = replica.getUri(`swarm_attempt_models_test_${randomUUID().replaceAll('-', '_')}`)
+ await promisify(execFile)(join(process.cwd(), 'node_modules/.bin/prisma'), ['db', 'push', '--skip-generate'], {
+ env: { ...process.env, DATABASE_URL: uri }, timeout: 60000,
+ })
+ db = new PrismaClient({ datasources: { db: { url: uri } } })
+ await db.user.create({ data: { id: owner.sub, externalId: `fixture-${owner.sub}`, email: owner.email, autonomousEnv: 'prod' } })
+ await db.machine.create({ data: { machineId: 'owner-mac', userId: owner.sub, apiKey: 'fixture-owner-mac', managerId: 'fixture', autonomousEnv: 'prod', authMode: 'remote' } })
+})
+afterAll(async () => {
+ await db?.$disconnect()
+ await replica?.stop()
+})
+
+/** A Swarm whose owner's Mac runs Codex agents for it, each started by that Mac's host. */
+async function swarm() {
+ const store = new SuperTabStore(db)
+ const reads = new SwarmReads(store)
+ const tab = (await store.create(owner, randomUUID(), 'Models', 'public')).id
+ const execute = (command: Command, asAgentId?: string, hostMachineId?: string) =>
+ store.execute(owner, tab, { operationId: randomUUID(), command }, asAgentId, hostMachineId)
+ await execute({ type: 'agent.add', conversationId: 'lead', machineId: 'owner-mac', harnessId: randomUUID(), name: 'PM', configuration: lead, lead: true })
+ await execute({ type: 'machine.contribute', machineId: 'owner-mac', name: 'Owner Mac', cwd: '/swarm', scope: 'swarm', engines: ['claude', 'codex'], maxAgents: 4 })
+ const generation = (await poolRows(store, owner, 'owner-mac')).find(p => p.tabId === tab)!.machine.generation
+ await store.observeMachine(owner, tab, 'owner-mac', { generation, resources: { cpuPercent: 10, memoryTotalBytes: 64e9, memoryUsedBytes: 4e9,
+ diskFreeBytes: 120e9, diskTotalBytes: 500e9, projectDiskFreeBytes: 120e9, deviceType: 'Desktop', chip: 'Fixture', os: 'macOS', gpuPercent: null },
+ quotas: [], tools: { git: true }, runningHarnessIds: [], stoppedHarnessIds: [] })
+ /** A task with a Codex agent on its own model started for it by the host, which settles it with [settled] or nothing. */
+ const task = async (title: string, settled?: AgentConfiguration) => {
+ const group = String((await execute({ type: 'conversation.create', title, brief: 'Build it.', checks: [{ description: 'Tests pass.', independent: false }] }))
+ .result.conversationId)
+ const request = { conversationId: group, machineId: 'owner-mac', engine: 'codex', name: 'Builder', cwd: '/swarm/lead', worktree: false,
+ requirements: { memoryBytes: 1e9, diskBytes: 1e9, maxCpuPercent: 90, tools: ['git'], devices: [], quotaRequired: false } }
+ const startId = String((await execute({ type: 'agent.start', request })).result.startId)
+ const host = (command: Command) => execute(command, undefined, 'owner-mac')
+ await host({ type: 'agent.startDispatch', startId })
+ const agentId = String((await host({ type: 'agent.started', startId, harnessId: randomUUID(), configuration: joined })).result.agentId)
+ await host({ type: 'agent.startSettled', startId, warning: null, ...(settled ? { configuration: settled } : {}) })
+ const assignmentId = String((await execute({ type: 'work.assign', conversationId: group, agentId })).result.assignmentId)
+ return { group, agentId, assignmentId }
+ }
+ const models = async () => (await reads.leaderboard(owner, tab, 'lead')).recentModels.map(m => [m.engine, m.model, m.attempts])
+ return { store, tab, execute, task, models }
+}
+
+describe('the model each attempt ran on, as the sidebar\'s Models reads it', () => {
+ it('names a Codex agent\'s model from its start\'s settle, before its first report', async () => {
+ const f = await swarm()
+ await f.task('Settled with its model', reading)
+ expect(await f.models()).toEqual([['codex', 'gpt-6.1-sol', 1]])
+ })
+
+ it('names it once the agent first reports it, though its work ended before, and keeps it through a later report', async () => {
+ const f = await swarm()
+ const { group, agentId, assignmentId } = await f.task('Settled without a model')
+ expect(await f.models()).toEqual([['codex', null, 1]])
+ await f.execute({ type: 'work.cancel', conversationId: group, assignmentId, reason: 'Not needed any more.' })
+ const report = async (configuration: AgentConfiguration) => {
+ const agent = (await f.store.read(owner, f.tab)).state.agents.find(a => a.id === agentId)!
+ await f.execute({ type: 'agent.configuration', previousVersion: agent.configurationVersion ?? null, configuration }, agentId)
+ }
+ await report(reading)
+ expect(await f.models()).toEqual([['codex', 'gpt-6.1-sol', 1]])
+ await report({ ...reading, model: 'gpt-6.1-luna' })
+ expect(await f.models()).toEqual([['codex', 'gpt-6.1-sol', 1]])
+ })
+})
diff --git a/backend/src/superTabs/commands.test.ts b/backend/src/superTabs/commands.test.ts
index 98ecda907..165a7b517 100644
--- a/backend/src/superTabs/commands.test.ts
+++ b/backend/src/superTabs/commands.test.ts
@@ -4058,3 +4058,79 @@ describe('an engine that cannot run on a contributed machine', () => {
expect(commandSchema.safeParse({ ...resume, engine: 'Not An Engine' }).success).toBe(false)
})
})
+
+// Scholes, 2026-10-30: the sidebar's Models showed "Codex, model not reported". A Codex agent at its own default reported its
+// model only after the work it was assigned 30 s after its start was recorded; the start now settles with what it saw.
+describe('a settling start names the model its agent runs', () => {
+ const contribution = { machineOwnerId: 'target-owner', contributorId: 'owner', hostGrant: 'grant-1' }
+ const reported = { engine: 'codex', model: 'gpt-6.1-sol', effort: 'auto', contextWindow: null, engineVersion: '0.165.0' }
+ const setup = () => {
+ const f = fixture(), lead = f.add('lead', 'owner', 'lead', true), group = f.group()
+ const actor: Actor = { kind: 'agent', agentId: lead, machineOwnerId: 'host-owner' }
+ const start = (harnessId: string) => {
+ const request = { conversationId: group, machineId: 'host', engine: 'codex', name: 'Builder', cwd: '/repo', worktree: true,
+ requirements: { memoryBytes: 100, diskBytes: 200, maxCpuPercent: 80, tools: ['git'], devices: [], quotaRequired: false } }
+ const startId = f.run({ type: 'agent.start', request, ...via }, actor, { contribution, ...decisionIn(group) }).result.startId as string
+ f.run({ type: 'agent.startDispatch', startId }, actor, { contribution })
+ f.state.starts!.find(s => s.id === startId)!.poolGeneration = 'pool-1'
+ // Codex at its own default reports no model when it joins.
+ const agentId = f.run({ type: 'agent.started', startId, harnessId, configuration: { ...reported, model: null, effort: null } }, actor, { contribution })
+ .result.agentId as string
+ return { startId, agentId }
+ }
+ const settle = (startId: string, configuration?: AgentConfiguration, context: Partial<CommandContext> = { contribution }) =>
+ f.run({ type: 'agent.startSettled', startId, warning: null, ...(configuration ? { configuration } : {}) }, actor, context)
+ const worker = (agentId: string) => f.state.agents.find(a => a.id === agentId)!
+ const assign = (agentId: string) => f.run({ type: 'work.assign', conversationId: group, agentId }).result.assignmentId as string
+ const run = () => f.state.conversations.find(c => c.id === group)!.ledger!.runs!.at(-1)!
+ return { f, group, start, settle, worker, assign, run }
+ }
+
+ it('records the model the start saw on the agent, so the work assigned after the settle names it', () => {
+ const t = setup(), { startId, agentId } = t.start('codex-1')
+ const ready = t.settle(startId, reported).messages
+ expect(ready.map(m => m.text)).toEqual(['Builder is ready for an assignment.'])
+ expect(t.worker(agentId).configuration).toEqual(reported)
+ t.assign(agentId)
+ expect(t.run()).toMatchObject({ engine: 'codex', model: 'gpt-6.1-sol', agentId, harnessId: 'codex-1' })
+ })
+
+ it('settles without a model when the agent reported none in time, and its first report later fills the attempt', () => {
+ const t = setup(), { startId, agentId } = t.start('codex-2')
+ expect(t.settle(startId).messages.map(m => m.text)).toEqual(['Builder is ready for an assignment.'])
+ const assignmentId = t.assign(agentId)
+ expect(t.run().model).toBeNull()
+ // Its work ended before the agent's first report.
+ t.f.run({ type: 'work.cancel', conversationId: t.group, assignmentId, reason: 'Not needed any more.' })
+ expect(activeWork(t.f.state.conversations.find(c => c.id === t.group)!)).toBe(false)
+ const agent = t.worker(agentId)
+ t.f.run({ type: 'agent.configuration', previousVersion: agent.configurationVersion!, configuration: reported },
+ { kind: 'agent', agentId, machineOwnerId: 'target-owner' })
+ expect(t.run()).toMatchObject({ assignmentId, model: 'gpt-6.1-sol' })
+ })
+
+ it('takes no reading from another machine grant, for another engine, for a grid model, or once settled', () => {
+ const t = setup()
+ const other = t.start('codex-3')
+ t.settle(other.startId, reported, { contribution: { ...contribution, hostGrant: 'grant-2' } })
+ expect(t.worker(other.agentId).configuration.model).toBeNull()
+ const engine = t.start('codex-4')
+ t.settle(engine.startId, { ...reported, engine: 'claude', model: 'opus' })
+ expect(t.worker(engine.agentId).configuration).toMatchObject({ engine: 'codex', model: null })
+ const grid = t.start('codex-5')
+ t.worker(grid.agentId).gridModel = 'moonshotai/kimi-k3'
+ t.settle(grid.startId, reported)
+ expect(t.worker(grid.agentId).configuration.model).toBeNull()
+ // A settle already made is a replay: it changes nothing, whatever it carries.
+ const settled = t.start('codex-6')
+ t.settle(settled.startId)
+ t.settle(settled.startId, reported)
+ expect(t.worker(settled.agentId).configuration.model).toBeNull()
+ })
+
+ it('a host from before the field still settles, and an unknown field is still refused', () => {
+ const t = setup(), { startId } = t.start('codex-7')
+ expect(t.settle(startId).messages).toHaveLength(1)
+ expect(() => commandSchema.parse({ type: 'agent.startSettled', startId, warning: null, model: 'gpt-6.1-sol' })).toThrow()
+ })
+})
diff --git a/backend/src/superTabs/commands.ts b/backend/src/superTabs/commands.ts
index 76a23be18..315ebf0f5 100644
--- a/backend/src/superTabs/commands.ts
+++ b/backend/src/superTabs/commands.ts
@@ -6,7 +6,7 @@ import { tokensByModelSchema } from './costs/tokens.js'
import {
activeWork, actorKey, agent, agentRole, appendPullRequestUrls, author, conversation, crossProjectActive, fail, isLeads, person, stableId, syncLeads, numberConversations, nextConversationNumber, renderWorkTask,
finishWorker, requireWorkerDecisions, reviewing, seenMachineIds, swarmGridName, visibleState, AGENT_ONLY, STATUS_LABELS, forRecipients,
- type Actor, type AgentStartRequest, type WorkTask, type Agent, type Author, type CommandEffects, type Conversation, type SuperTabState,
+ type Actor, type AgentConfiguration, type AgentStart, type AgentStartRequest, type WorkTask, type Agent, type Author, type CommandEffects, type Conversation, type SuperTabState,
} from './model.js'
import { jobKindOf } from './evidence/jobKind.js'
import { routeRecordSchema, routeTitle, startedAs, type RouteCandidate, type RouteDecision, type RouteFinal, type RouteOverride } from './routeRecord.js'
@@ -175,7 +175,10 @@ export const commandSchema = z.discriminatedUnion('type', [
z.object({ type: z.literal('agent.startDispatch'), startId: id }).strict(),
z.object({ type: z.literal('agent.started'), startId: id, harnessId: id, configuration,
startedSession: z.object({ sessionId: id, createdAt: z.iso.datetime() }).strict().optional() }).strict(),
- z.object({ type: z.literal('agent.startSettled'), startId: id, warning: z.string().max(2000).nullable() }).strict(),
+ // `configuration`: what the agent runs as its start last saw it, so work assigned after the settle records its model (CLI
+ // superTabs/start.ts). Absent from a CLI before it, and when the agent reported none in time.
+ z.object({ type: z.literal('agent.startSettled'), startId: id, warning: z.string().max(2000).nullable(),
+ configuration: configuration.optional() }).strict(),
z.object({ type: z.literal('agent.startFailed'), startId: id, error: text }).strict(),
z.object({ type: z.literal('agent.stopLease'), agentId: id, releaseId: id }).strict(),
z.object({ type: z.literal('agent.stopRefused'), agentId: id, releaseId: id }).strict(),
@@ -651,6 +654,21 @@ export function applyCommand(original: SuperTabState, actor: Actor, input: Comma
const chatOnly = (conversationId: string) => {
if (state.conversations.find(c => c.id === conversationId)?.audience) fail('AUDIENCE_CHAT_ONLY', 'A private conversation is chat only.', 400)
}
+ /** A settling start's own reading of what its agent runs (agent.startSettled): taken as the agent's report, as
+ * agent.configuration takes its host's, so work assigned after the settle records its model. Only from the machine
+ * grant that started it, for the same engine, never for a grid model (its start names it); anything else is left to the
+ * host's own reports. */
+ const settledConfiguration = (start: AgentStart, observed: AgentConfiguration) => {
+ const grant = context.contribution
+ if (!grant || grant.machineOwnerId !== start.machineOwnerId || grant.contributorId !== start.contributorId
+ || (grant.hostGrant ?? null) !== start.hostGrant) return
+ const worker = state.agents.find(a => a.harnessId === start.harnessId && a.machineId === start.request.machineId)
+ if (!worker || worker.gridModel || observed.engine !== worker.configuration.engine) return
+ if (Object.entries(observed).every(([key, value]) => worker.configuration[key as keyof AgentConfiguration] === value)) return
+ worker.configuration = observed
+ worker.configurationVersion = operationId
+ recordReportedModel(state, worker)
+ }
const routed = (routeDecisionId?: string) => {
if (actor.kind === 'agent' && !routeDecisionId) fail('ROUTE_REQUIRED', 'Route this task first, then start or assign the pick with its routeDecisionId.', 400)
}
@@ -1701,6 +1719,7 @@ export function applyCommand(original: SuperTabState, actor: Actor, input: Comma
}
if (command.type === 'agent.startSettled') {
if (!start.poolGeneration || !start.harnessId || start.error) fail('START_PENDING', 'This contributed start is not ready to settle.')
+ if (command.configuration && !start.poolSettled) settledConfiguration(start, command.configuration)
// A Product Manager is never assigned work: its conversation already said where it started.
// A warning is the people's to read (a start that went wrong); being ready is bookkeeping.
if (!start.poolSettled && !start.request.leadFor) message(start.request.conversationId, command.warning
diff --git a/backend/src/superTabs/leaderboard/record.test.ts b/backend/src/superTabs/leaderboard/record.test.ts
index c4705fd5a..6a7602477 100644
--- a/backend/src/superTabs/leaderboard/record.test.ts
+++ b/backend/src/superTabs/leaderboard/record.test.ts
@@ -607,8 +607,9 @@ describe('the model behind each assignment, and its first review (roadmap, Dec:
const f = fixture()
f.at(5_000)
const id = f.create(owner, { checks: independent })
- const { assignmentId } = f.assign(id)
- expect(f.group(id).ledger!.runs).toEqual([{ assignmentId, engine: 'claude', model: 'opus', effort: 'high', at: 5_000 }])
+ const { assignmentId, worker } = f.assign(id)
+ const harnessId = f.state.agents.find(a => a.id === worker)!.harnessId
+ expect(f.group(id).ledger!.runs).toEqual([{ assignmentId, engine: 'claude', model: 'opus', effort: 'high', at: 5_000, agentId: worker, harnessId }])
})
it('records no effort that names none: what Claude Code reports as auto, or a start that left the engine its own', () => {
@@ -637,9 +638,10 @@ describe('the model behind each assignment, and its first review (roadmap, Dec:
}
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()
+ expect(f.group(id).ledger!.runs).toEqual([{ assignmentId, engine: 'codex', model: 'gpt-6.1-sol', effort: 'high', at: 1_000,
+ agentId: worker, harnessId: f.state.agents.find(a => a.id === worker)!.harnessId }])
+ // A task finished before its agent's first report still takes it (Scholes, 2026-10-30): the agent ran that model all along.
+ expect(f.group(done).ledger!.runs![0]!.model).toBe('gpt-6.1-sol')
// 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')
@@ -681,6 +683,45 @@ describe('the model behind each assignment, and its first review (roadmap, Dec:
expect([run(grid!.id), run(other!.id)].map(r => r.engine)).toEqual(['codex', 'codex'])
})
+ it('names the reported model on an attempt handed on before the report, and only on that agent\'s own (Scholes, 2026-10-30)', () => {
+ const f = fixture()
+ const [task] = codexTasks(f, 1)
+ f.run({ type: 'work.cancel', conversationId: task!.id, assignmentId: task!.assignmentId, reason: 'Handing it on.' })
+ const next = f.add('claude-next', task!.id)
+ f.assign(task!.id, next)
+ reportModel(f, task!.worker, { model: 'gpt-6.1-sol' })
+ const runs = f.group(task!.id).ledger!.runs!
+ expect(runs.map(r => [r.agentId, r.model])).toEqual([[task!.worker, 'gpt-6.1-sol'], [next, 'opus']])
+ // Each attempt once: a later report adds no attempt and rewrites none.
+ reportModel(f, task!.worker, { model: 'gpt-6.1-luna' })
+ expect(f.group(task!.id).ledger!.runs!.map(r => r.model)).toEqual(['gpt-6.1-sol', 'opus'])
+ })
+
+ it('names no model on an attempt of the agent\'s earlier terminal: a replacement may run another', () => {
+ const f = fixture()
+ const [task] = codexTasks(f, 1)
+ f.state.agents.find(a => a.id === task!.worker)!.harnessId = 'replacement-terminal'
+ reportModel(f, task!.worker, { model: 'gpt-6.1-sol' })
+ expect(f.group(task!.id).ledger!.runs![0]!.model).toBeNull()
+ })
+
+ it('matches an attempt recorded before attempts named their agent only as its group\'s current one', () => {
+ const f = fixture()
+ const [current, handedOn] = codexTasks(f, 2)
+ for (const id of [current!.id, handedOn!.id]) {
+ const run = f.group(id).ledger!.runs![0]!
+ delete run.agentId
+ delete run.harnessId
+ }
+ // The second agent's attempt was handed on, so its group's current assignment is another agent's.
+ f.run({ type: 'work.cancel', conversationId: handedOn!.id, assignmentId: handedOn!.assignmentId, reason: 'Handing it on.' })
+ f.assign(handedOn!.id, f.add('claude-next', handedOn!.id))
+ reportModel(f, current!.worker, { model: 'gpt-6.1-sol' })
+ reportModel(f, handedOn!.worker, { model: 'gpt-6.1-sol' })
+ expect(f.group(current!.id).ledger!.runs![0]!.model).toBe('gpt-6.1-sol')
+ expect(f.group(handedOn!.id).ledger!.runs![0]!.model).toBeNull()
+ })
+
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 })
@@ -691,7 +732,8 @@ describe('the model behind each assignment, and its first review (roadmap, Dec:
gridModel: 'moonshotai/kimi-k3', gridName: 'swarm-0123456789ab',
requirements: { memoryBytes: 1, diskBytes: 1, maxCpuPercent: 80, tools: [], devices: [], quotaRequired: false } } }]
const { assignmentId } = f.assign(id, worker)
- expect(f.group(id).ledger!.runs).toEqual([{ assignmentId, engine: 'claude', model: 'moonshotai/kimi-k3', effort: 'high', grid: true, at: 1_000 }])
+ expect(f.group(id).ledger!.runs).toEqual([{ assignmentId, engine: 'claude', model: 'moonshotai/kimi-k3', effort: 'high', grid: true, at: 1_000,
+ agentId: worker, harnessId: f.state.agents.find(a => a.id === worker)!.harnessId }])
})
it('keeps the first verdict on an independent check as the assignment\'s first review, and ignores later and other checks', () => {
diff --git a/backend/src/superTabs/leaderboard/record.ts b/backend/src/superTabs/leaderboard/record.ts
index c65372236..674c84a15 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 { activeWork, isLeads, type Actor, type Agent, type AgentConfiguration, type Assignment, type Author, type Check, type Conversation, type SuperTabState, type WorkStatus } from '../model.js'
+import { 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'
@@ -17,6 +17,9 @@ export interface Unblock { personId: string; at: number; waitedMs: number; kind?
* reports none of its own. `firstVerdicts`: each independent check's first verdict during this attempt, by check id.
* `firstReview`: false once any of them failed, true once every independent check passed its first, absent until then. */
export interface Run extends RanOn { assignmentId: string; at: number
+ /** The agent and its terminal that ran it, so the model that terminal reports later fills this attempt only (record
+ * ReportedModel). Absent from attempts recorded before them. */
+ agentId?: string; harnessId?: string
firstVerdicts?: Record<string, boolean>; firstReview?: boolean
/** The step up from a cheaper model this attempt is (stepUp.ts): its attempt number and why. */
stepUp?: { attempt: number; reason: string }
@@ -112,7 +115,8 @@ function shipOn(group: Conversation, run?: Run): void {
function shipAttempt(ledger: GroupLedger, run?: Run): void {
const shipping = run ?? ledger.runs?.filter(r => r.at <= ledger.shippedAt!).at(-1) ?? ledger.runs?.[0]
if (!shipping) return
- const { firstVerdicts: _verdicts, firstReview: _review, reworkRounds: _rounds, reworks: _reworks, ...shippedBy } = shipping
+ const { firstVerdicts: _verdicts, firstReview: _review, reworkRounds: _rounds, reworks: _reworks, agentId: _agent, harnessId: _harness,
+ ...shippedBy } = shipping
ledger.shippedBy = shippedBy
}
@@ -234,6 +238,7 @@ export function waitsNow(group: Conversation): boolean {
/** An assignment records what its agent runs on (ranOn), for the board's models. */
export function recordRun(state: SuperTabState, group: Conversation, assignment: Assignment, worker: Agent, now: number): void {
const run: Run = { assignmentId: assignment.id, ...ranOn(state, worker, assignment.configuration), at: now,
+ agentId: worker.id, harnessId: worker.harnessId,
...(group.stepUp ? { stepUp: { attempt: group.stepUp.attempt, reason: group.stepUp.reason } } : {}),
...(agentTarget(state, worker).launchedDefault ? { engineDefault: true as const } : {}) }
const ledger = group.ledger ??= {}
@@ -241,18 +246,29 @@ 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. */
+/** An agent started on its engine's own model reports which one only once it runs (Codex): its attempts recorded before
+ * then, with none, take 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). That holds for a finished or handed-on attempt too (Scholes, 2026-10-30: a review done before
+ * its agent's first report stayed "model not reported"). Only this agent's own attempts in its current terminal: a
+ * replacement terminal (agent.rebind) may run another model. An attempt recorded before attempts named their agent is
+ * matched as its group's current one. A model on record is never rewritten, nor a grid model's, nor another engine's. */
export function recordReportedModel(state: SuperTabState, worker: Agent): void {
const model = worker.configuration.model
if (!model || worker.gridModel) return
+ const fill = (on: RanOn | undefined) => {
+ if (on && on.model === null && !on.grid && on.engine === worker.configuration.engine) on.model = model
+ }
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
+ const ledger = group.ledger
+ if (!ledger?.runs?.length) continue
+ const current = group.assignment
+ const legacy = current?.agentId === worker.id && current.execution.harnessId === worker.harnessId ? current.id : null
+ for (const run of ledger.runs) {
+ const own = run.agentId !== undefined ? run.agentId === worker.id && run.harnessId === worker.harnessId : run.assignmentId === legacy
+ if (!own) continue
+ fill(run)
+ // The copy kept when its merge was recorded while it still ran.
+ if (ledger.shippedBy?.assignmentId === run.assignmentId) fill(ledger.shippedBy)
}
}
}
diff --git a/backend/src/superTabs/store.ts b/backend/src/superTabs/store.ts
index 1b591c4cc..f63ba0cd6 100644
--- a/backend/src/superTabs/store.ts
+++ b/backend/src/superTabs/store.ts
@@ -1221,6 +1221,12 @@ export class SuperTabStore {
const start = original.starts?.find(s => s.id === command.startId) ?? fail('NOT_FOUND', 'This agent start is unavailable.', 404)
context.contribution = await this.contribution(tx, original, actor, start.request, true)
}
+ // A settle that carries its agent's model is that machine's reading, taken only from the grant that started it
+ // (commands.ts settledConfiguration). A grant that cannot be read leaves the reading out; the settle itself never fails on it.
+ if (command.type === 'agent.startSettled' && command.configuration) {
+ const start = original.starts?.find(s => s.id === command.startId)
+ if (start) context.contribution = await this.contribution(tx, original, actor, start.request, true).catch(() => undefined)
+ }
if (command.type === 'message.send' && command.replyTo) {
const reply = await tx.superTabMessage.findFirst({ where: { id: command.replyTo, tabId, conversationId: command.conversationId } })
// The thread's root says whose proposal the reply answers (buddyNews.ts): the reply itself, or one more read by id.
@@ -1438,7 +1444,8 @@ export class SuperTabStore {
}
await this.endRuns(tx, tabId, original, effects.state)
const committed = await this.save(tx, loaded, effects.state, stamp, touchesFor(command, actor, original, effects, context))
- if (command.type === 'agent.add' || command.type === 'agent.started' || command.type === 'agent.configuration' || command.type === 'agent.rebind') {
+ if (command.type === 'agent.add' || command.type === 'agent.started' || command.type === 'agent.configuration' || command.type === 'agent.rebind'
+ || command.type === 'agent.startSettled') {
for (const target of effects.state.agents) {
if (target.configurationVersion !== receiptId) continue
const previous = original.agents.find(a => a.id === target.id)
diff --git a/backend/vitest.super-tabs.config.ts b/backend/vitest.super-tabs.config.ts
index 191475b98..39cf4ae97 100644
--- a/backend/vitest.super-tabs.config.ts
+++ b/backend/vitest.super-tabs.config.ts
@@ -6,5 +6,5 @@ export default defineConfig({ test: { include: ['integration/superTabs.test.ts',
'integration/superTabHotReads.test.ts', 'integration/swarmSweepStarts.test.ts', 'integration/superTabGroupPlans.test.ts', 'integration/superTabInvitationPlans.test.ts', 'integration/superTabCache.test.ts',
'integration/superTabObserver.test.ts', 'integration/productUsageConflicts.test.ts', 'integration/productUsageReceipts.test.ts', 'integration/schemaRelease.test.ts', 'integration/superTabBuddies.test.ts', 'integration/superTabNotAvailable.test.ts',
'integration/superTabBuddyProbes.test.ts', 'integration/superTabCosts.test.ts', 'integration/harnessSharesList.test.ts', 'integration/atlasSnapshot.test.ts', 'integration/queryStats.test.ts',
- 'integration/superTabEvidence.test.ts', 'integration/superTabNamedReads.test.ts', 'integration/swarmSweepPlans.test.ts', 'integration/workerIndexPlans.test.ts', 'integration/superTabReflection.test.ts'], hookTimeout: 120000, testTimeout: 30000, setupFiles: ['integration/cacheOn.test-support.ts'],
+ 'integration/superTabEvidence.test.ts', 'integration/superTabAttemptModels.test.ts', 'integration/superTabNamedReads.test.ts', 'integration/swarmSweepPlans.test.ts', 'integration/workerIndexPlans.test.ts', 'integration/superTabReflection.test.ts'], hookTimeout: 120000, testTimeout: 30000, setupFiles: ['integration/cacheOn.test-support.ts'],
fileParallelism: false, env: { NODE_ENV: 'test', HARNESS_CREDENTIAL_ENCRYPTION_KEY: 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=' } } })
diff --git a/cli/src/engines/codex/runtimeProfile.ts b/cli/src/engines/codex/runtimeProfile.ts
index 844717715..849f45c19 100644
--- a/cli/src/engines/codex/runtimeProfile.ts
+++ b/cli/src/engines/codex/runtimeProfile.ts
@@ -37,8 +37,14 @@ function decode(raw: Record<string, unknown>): RuntimeRecord | null {
else if (raw.type === 'turn_context') source = payload
const version = parseVersion(cliVersion) ? cliVersion : null
if (!source && !version) return null
+ // A turn's context is the whole of what it runs: one naming a model and no effort runs that model at its own default, which
+ // Codex writes as `reasoning_effort: null` (0.164 and 0.165, 2026-10-30). Read as auto, as the screen's "default" is, so
+ // the agent's model is known from its first turn: without an effort it was never reported, and its Swarm attempts were
+ // recorded with no model (Scholes, 2026-10-30). A settings change names only what it changed, so it keeps the effort.
+ const effort = text(source?.reasoning_effort) || text(source?.effort)
+ const ownDefault = raw.type === 'turn_context' && !!text(source?.model) && !effort
return { version, source: !!source, model: text(source?.model),
- effort: text(source?.reasoning_effort) || text(source?.effort), mode: text(record(source?.collaboration_mode)?.mode) }
+ effort: ownDefault ? 'auto' : effort, mode: text(record(source?.collaboration_mode)?.mode) }
}
function reduce({ session, state, control }: RuntimeContext, evidence: RuntimeRecord): void {
diff --git a/cli/src/lib/runtimeProfile.spec.ts b/cli/src/lib/runtimeProfile.spec.ts
index 0ee20ff4b..657c7f7be 100644
--- a/cli/src/lib/runtimeProfile.spec.ts
+++ b/cli/src/lib/runtimeProfile.spec.ts
@@ -566,7 +566,10 @@ describe('RuntimeProfileManager.transcriptFields', () => {
const codex = session('codex')
expect(manager.transcriptFields(codex, codexLine('turn_context', { model: 'gpt-6', reasoning_effort: 'high', collaboration_mode: { mode: 'plan' } })))
.toEqual(['model', 'effort', 'mode'])
- expect(manager.transcriptFields(codex, codexLine('turn_context', { model: 'gpt-6', collaboration_mode: { mode: 'default' } }))).toEqual(['model', 'mode'])
+ // A turn's context with no effort runs the model at Codex's own default (`reasoning_effort: null`): it sets the effort, as
+ // auto, so a read from the end stops at the last turn rather than walking the whole transcript for one (Scholes, 10-30).
+ expect(manager.transcriptFields(codex, codexLine('turn_context', { model: 'gpt-6', collaboration_mode: { mode: 'default' } }))).toEqual(['model', 'effort', 'mode'])
+ expect(manager.transcriptFields(codex, codexLine('turn_context', { collaboration_mode: { mode: 'default' } }))).toEqual(['mode'])
expect(manager.transcriptFields(codex, codexLine('event_msg', { type: 'thread_settings_applied', thread_settings: { model: 'gpt-6', reasoning_effort: 'low' } })))
.toEqual(['model', 'effort'])
expect(manager.transcriptFields(codex, codexLine('session_meta', { cli_version: '0.159.0' }))).toEqual([])
diff --git a/cli/src/lib/runtimeProfileState.spec.ts b/cli/src/lib/runtimeProfileState.spec.ts
index cdfd30bc5..7a5864393 100644
--- a/cli/src/lib/runtimeProfileState.spec.ts
+++ b/cli/src/lib/runtimeProfileState.spec.ts
@@ -242,6 +242,28 @@ describe('late optional profile observations', () => {
expect(manager.getState(agent.sessionId).model).toBeNull()
})
+ // Codex at its own default effort writes `reasoning_effort: null` in each turn's context (0.164, 0.165): its model was never
+ // reported, so its Swarm attempts were recorded with none (Scholes, 2026-10-30).
+ it('names a Codex agent\'s model from its first turn at Codex\'s own default effort, as auto', () => {
+ const manager = new RuntimeProfileManager(), agent = session('codex')
+ manager.hydrate(agent, [JSON.stringify({ type: 'session_meta', payload: { cli_version: '0.165.0' } }),
+ JSON.stringify({ type: 'turn_context', payload: { model: 'gpt-6.1-sol', collaboration_mode: { mode: 'default', settings: { model: 'gpt-6.1-sol', reasoning_effort: null } } } })])
+ expect(parseRuntimeProfile(manager.selectedModel(agent))).toMatchObject({ engine: 'codex', model: 'gpt-6.1-sol', effort: 'auto' })
+ // A later turn at a named effort says so; one back at the default reads auto again.
+ manager.ingest(agent, JSON.stringify({ type: 'turn_context', payload: { model: 'gpt-6.1-sol', reasoning_effort: 'xhigh' } }), true)
+ expect(parseRuntimeProfile(manager.selectedModel(agent))).toMatchObject({ model: 'gpt-6.1-sol', effort: 'xhigh' })
+ manager.ingest(agent, JSON.stringify({ type: 'turn_context', payload: { model: 'gpt-6.1-sol', reasoning_effort: null } }), true)
+ expect(parseRuntimeProfile(manager.selectedModel(agent))).toMatchObject({ model: 'gpt-6.1-sol', effort: 'auto' })
+ // A settings change that names a model and no effort changed only the model: the effort stays.
+ manager.ingest(agent, JSON.stringify({ type: 'turn_context', payload: { model: 'gpt-6.1-sol', reasoning_effort: 'high' } }), true)
+ manager.ingest(agent, JSON.stringify({ type: 'event_msg', payload: { type: 'thread_settings_applied', thread_settings: { model: 'gpt-6-astra' } } }), true)
+ expect(parseRuntimeProfile(manager.selectedModel(agent))).toMatchObject({ model: 'gpt-6-astra', effort: 'high' })
+ // A context that names no model says nothing about one.
+ const none = new RuntimeProfileManager(), other = session('codex')
+ none.hydrate(other, [JSON.stringify({ type: 'turn_context', payload: { cwd: '/repo' } })])
+ expect(none.selectedModel(other)).toBeNull()
+ })
+
it('cannot commit a staged transcript after forget or newer live evidence', () => {
for (const forget of [true, false]) {
const manager = new RuntimeProfileManager(), agent = session('codex')
diff --git a/cli/src/superTabs/machines.spec.ts b/cli/src/superTabs/machines.spec.ts
index 14ebe8daa..5fb278f16 100644
--- a/cli/src/superTabs/machines.spec.ts
+++ b/cli/src/superTabs/machines.spec.ts
@@ -2084,6 +2084,32 @@ describe('removed machine cleanup', () => {
{ tabId: 'tab', startId: 'new', harnessId: 'h-new', source: '/clone', path: '/worktrees/project/new' }] })
expect(backend.mock.calls.some(c => JSON.stringify(c[3] ?? '').includes('agent.startSettled'))).toBe(true)
})
+
+ // Scholes, 2026-10-30: work is assigned only after the settle, so the settle carries the model the start saw.
+ it('settles with what the agent runs, and without it on a backend that refuses the field', async () => {
+ const reading = { engine: 'codex', model: 'gpt-6.1-sol', effort: 'auto', contextWindow: null, engineVersion: '0.165.0' }
+ for (const [oldBackend, configuration] of [[false, reading], [true, reading], [false, undefined]] as const) {
+ const root = mkdtempSync(join(tmpdir(), 'swarm-settle-')); roots.push(root)
+ const core = fakeCore({ dataDir: root, agents: { byAgent: vi.fn(() => undefined) } })
+ const pool = { tabId: 'tab', machine: { machineId: 'host', generation: 'grant', cwd: '/repo', engines: ['codex'], paused: false },
+ harnessIds: [], starts: [{ id: 'new', dispatched: true, request: { worktree: false, cwd: '/repo' } }], paused: false }
+ const backend = vi.fn(async (_core: unknown, _method: string, path: string, body?: unknown): Promise<unknown> => {
+ if (path.includes('/hosts/host/changes')) return hostForm([], { pools: [pool] })
+ const command = (body as { command?: Record<string, unknown> } | undefined)?.command
+ if (oldBackend && command?.type === 'agent.startSettled' && 'configuration' in command) throw new SuperTabHostError('VALIDATION_ERROR', 'Unrecognized key', 400)
+ return { revision: 1 }
+ })
+ const open = vi.fn(async () => ({ machineId: 'host', request: vi.fn(async () => ({})), close: vi.fn() }))
+ const start = vi.fn(async () => ({ ok: true, harnessId: 'h-new', ...(configuration ? { configuration } : {}) }))
+ await new ContributedMachines(core, 'host', { backend, open, start, now: () => 0,
+ capabilities: vi.fn(async () => ({ ok: true, resources: {}, tools: {} })) } as never).tick()
+ const settles = backend.mock.calls.map(c => c[3] as { operationId: string; command: Record<string, unknown> } | undefined)
+ .filter(b => b?.command?.type === 'agent.startSettled')
+ const plain = { operationId: 'settled-new', command: { type: 'agent.startSettled', startId: 'new', warning: null } }
+ const carried = { operationId: expect.stringMatching(/^settled-model-new-[0-9a-f]{16}$/), command: { ...plain.command, configuration: reading } }
+ expect(settles).toEqual(!configuration ? [plain] : oldBackend ? [carried, plain] : [carried])
+ }
+ })
})
// 2026-10-29: Anthropic answered 5 quick allowance reads, then refused them for 5 minutes (HTTP 429, retry-after 300). Each
diff --git a/cli/src/superTabs/machines.ts b/cli/src/superTabs/machines.ts
index b171e4afa..86ad4fd82 100644
--- a/cli/src/superTabs/machines.ts
+++ b/cli/src/superTabs/machines.ts
@@ -1,3 +1,4 @@
+import { createHash } from 'node:crypto'
import { spawn } from 'node:child_process'
import { existsSync, mkdirSync, readFileSync, renameSync, writeFileSync } from 'node:fs'
import { lstat, readdir, readFile, realpath, rm, stat } from 'node:fs/promises'
@@ -614,8 +615,20 @@ export class ContributedMachines {
this.waiting.delete(start.id)
// Before the start settles: a settled start is no longer listed, so a missed record would never be made.
this.recordWorktree(String(row.tabId), start.id, result.harnessId, object(start.request))
- await scoped({ action: 'command', operationId: `settled-${start.id}`,
- command: { type: 'agent.startSettled', startId: start.id, warning: result.modelWarning ?? null } })
+ // With what the agent runs as its start saw it, so work assigned after the settle records its model. A backend
+ // before that field refuses it, and settles without it under its own operation (the host reports the model later).
+ const settled = { type: 'agent.startSettled', startId: start.id, warning: result.modelWarning ?? null }
+ const configuration = object(result.configuration)
+ if (typeof configuration.model === 'string') {
+ try {
+ // Keyed by the reading too: a later pass may read it again otherwise, and a settle already made ignores the second.
+ const reading = createHash('sha256').update(JSON.stringify(configuration)).digest('hex').slice(0, 16)
+ await scoped({ action: 'command', operationId: `settled-model-${start.id}-${reading}`, command: { ...settled, configuration } })
+ } catch (error) {
+ if (!(error instanceof SuperTabHostError && error.status === 400 && error.code === 'VALIDATION_ERROR')) throw error
+ await scoped({ action: 'command', operationId: `settled-${start.id}`, command: settled })
+ }
+ } else await scoped({ action: 'command', operationId: `settled-${start.id}`, command: settled })
} else if (result.ok !== true) {
const reason = String(result.detail ?? (Array.isArray(result.reasons) ? result.reasons.join(' ') : result.error))
this.noteWaiting(start.id, reason)
diff --git a/cli/src/superTabs/start.spec.ts b/cli/src/superTabs/start.spec.ts
index df3371a8c..d365c652e 100644
--- a/cli/src/superTabs/start.spec.ts
+++ b/cli/src/superTabs/start.spec.ts
@@ -2,7 +2,7 @@ import { describe, expect, it, vi } from 'vitest'
import { join } from 'node:path'
import { existsSync } from 'node:fs'
import { homedir } from 'node:os'
-import { inspectCapacity, startAgent } from './start.js'
+import { inspectCapacity, MODEL_REPORT_WAIT_MS, startAgent } from './start.js'
import { buildEngineCommandArgv } from '../lib/engineLaunch.js'
const teamDaemon = vi.hoisted(() => ({ value: false, relayed: true, offered: null as null | { slugs: string[]; listed: string[] } }))
vi.mock('./teamDaemon.js', async (original) => ({ ...await original<object>(), isTeamDaemon: () => teamDaemon.value }))
@@ -57,6 +57,15 @@ function fixture(options: { state?: Record<string, unknown> | Error; githubApp?:
return { scoped, start, request, open, close, loseJoin: () => { lostJoin = true }, forget: () => { nativeState = 'missing' } }
}
const switchCall = (f: { request: { mock: { calls: unknown[][] } } }) => f.request.mock.calls.find(c => c[0] === 'agent_update')
+/** Runs a start on a fake clock: an agent whose frame names no model is waited for (MODEL_REPORT_WAIT_MS) before it joins. */
+async function onFakeClock<T>(run: () => Promise<T>): Promise<T> {
+ vi.useFakeTimers()
+ try {
+ const result = run()
+ await vi.runAllTimersAsync()
+ return await result
+ } finally { vi.useRealTimers() }
+}
describe('Swarm permission mode', () => {
it('admits installed Claude when an API environment is opaque to the vendor login probe', async () => {
@@ -209,7 +218,7 @@ describe('Swarm permission mode', () => {
f.request.mockImplementation(async (type, payload) => type === 'agent_create_status'
? { creationId: f.start.creationId, state: 'created', agent: { id: 'native', engine: 'claude', permissionMode: 'ask' } }
: request(type, payload))
- expect(await startAgent({ action: 'resume', tabId: 'tab', startId: 'start' }, f.scoped, where, f.open)).toMatchObject({ ok: true })
+ expect(await onFakeClock(() => startAgent({ action: 'resume', tabId: 'tab', startId: 'start' }, f.scoped, where, f.open))).toMatchObject({ ok: true })
expect(f.request.mock.calls.some(c => c[0] === 'agent_create' || c[0] === 'agent_update')).toBe(false)
})
@@ -536,7 +545,7 @@ it.each(['pending', 'unconfirmed', 'created'])('preserves native %s evidence whe
f.request.mockImplementation(async (type, payload) => type === 'agent_create_cancel'
? { creationId: f.start.creationId, state, agent: { id: 'native', engine: 'claude' } }
: request(type, payload))
- const result = await startAgent({ action: 'resume', tabId: 'tab', startId: 'start' }, f.scoped, where, f.open)
+ const result = await onFakeClock(() => startAgent({ action: 'resume', tabId: 'tab', startId: 'start' }, f.scoped, where, f.open))
expect(result).toMatchObject(state === 'created' ? { ok: true, harnessId: 'native' } : { error: 'START_PENDING', state })
expect(f.start.error).toBeNull()
expect(f.request.mock.calls.filter(c => c[0] === 'agent_create')).toHaveLength(1)
@@ -1315,3 +1324,83 @@ describe('a Lead\'s start that fails before its agent exists', () => {
expect(unrouted.of('route.record')).toEqual([])
})
})
+
+// Scholes, 2026-10-30: a Codex agent at its own default named no model when it joined, and the work assigned to it 34 s after its
+// start (median) was recorded with none. The start waits a bounded time for the model, and settles with what the agent runs.
+describe('an agent that joins naming its model', () => {
+ /** A Codex launch whose frame names no model at creation; agents_list names [model] from its [after]th read, or never. */
+ const codexLaunch = (options: { after?: number; model?: string; request?: Record<string, unknown>; joined?: boolean } = {}) => {
+ const f = fixture(), request = f.request.getMockImplementation()!
+ let reads = 0
+ const frame = { id: 'native', engine: 'codex', contextWindow: 400000, engineVersion: '0.165.0' }
+ f.request.mockImplementation(async (type, payload) => {
+ if (type === 'agent_create') { await request(type, payload); return { creationId: f.start.creationId, state: 'created', agent: frame } }
+ if (type === 'agent_create_status') {
+ const answer = await request(type, payload)
+ return answer.state === 'created' ? { ...answer, agent: frame } : answer
+ }
+ if (type === 'agents_list') {
+ reads++
+ const named = options.after !== undefined && reads >= options.after
+ return { agents: [{ ...frame, selectedModel: named ? `runtime-v1:native:codex:${options.model ?? 'gpt-6.1-sol@auto'}` : null }] }
+ }
+ if (type === 'agent_update') return { agent: { ...frame, selectedModel: `runtime-v1:native:codex:${String((payload as { selectedModel: string }).selectedModel).split(':').pop()}` } }
+ return request(type, payload)
+ })
+ Object.assign(f.start.request, { engine: 'codex', ...options.request })
+ if (options.joined) Object.assign(f.start, { harnessId: 'native', dispatched: true })
+ const joined = () => f.scoped.mock.calls.map(c => c[0].command as Record<string, any> | undefined).find(c => c?.type === 'agent.started')
+ return { f, joined, reads: () => reads }
+ }
+ const resume = (f: ReturnType<typeof fixture>) => startAgent({ action: 'resume', tabId: 'tab', startId: 'start', hostDispatch: true }, f.scoped, where, f.open)
+
+ it('joins with the model Codex names at its first turn, and hands it to the settle', async () => {
+ const t = codexLaunch({ after: 3 })
+ const result = await onFakeClock(() => resume(t.f))
+ expect(t.joined()!.configuration).toEqual({ engine: 'codex', model: 'gpt-6.1-sol', effort: 'auto', contextWindow: 400000, engineVersion: '0.165.0' })
+ expect(result).toMatchObject({ ok: true, configuration: { engine: 'codex', model: 'gpt-6.1-sol', effort: 'auto' } })
+ expect(t.reads()).toBe(3)
+ })
+
+ it('joins without a model after the bounded wait when the engine never names one, and hands none to the settle', async () => {
+ const t = codexLaunch()
+ vi.useFakeTimers()
+ try {
+ const began = Date.now()
+ const run = resume(t.f)
+ await vi.runAllTimersAsync()
+ const result = await run
+ expect(Date.now() - began).toBeGreaterThanOrEqual(MODEL_REPORT_WAIT_MS - 1_000)
+ expect(Date.now() - began).toBeLessThanOrEqual(MODEL_REPORT_WAIT_MS + 1_000)
+ expect(t.joined()!.configuration).toMatchObject({ engine: 'codex', model: null, effort: null })
+ expect(result).toMatchObject({ ok: true })
+ expect(result).not.toHaveProperty('configuration')
+ expect(t.reads()).toBeLessThanOrEqual(MODEL_REPORT_WAIT_MS / 1_000 + 1)
+ } finally { vi.useRealTimers() }
+ })
+
+ it('does not wait for a grid model, or for an agent that already joined', async () => {
+ const grid = codexLaunch({ request: { gridModel: 'moonshotai/kimi-k3', gridName: 'swarm-0123456789ab' } })
+ await resume(grid.f)
+ expect(grid.reads()).toBe(0)
+ expect(grid.joined()!.configuration.model).toBeNull()
+ const joined = codexLaunch({ joined: true })
+ expect(await resume(joined.f)).toMatchObject({ ok: true })
+ expect(joined.reads()).toBe(0)
+ expect(joined.joined()).toBeUndefined()
+ })
+
+ it('hands the settle the routed model a switch put in, not the one the engine launched with', async () => {
+ const t = codexLaunch({ after: 1, model: 'gpt-6.1-sol@auto', request: { model: 'gpt-6-astra', effort: 'xhigh' } })
+ const reads = t.f.request.getMockImplementation()!
+ let switched = false
+ t.f.request.mockImplementation(async (type, payload) => {
+ if (type === 'agent_update') switched = true
+ if (type === 'agents_list' && switched) return { agents: [{ id: 'native', engine: 'codex', selectedModel: 'runtime-v1:native:codex:gpt-6-astra@xhigh' }] }
+ return reads(type, payload)
+ })
+ const result = await onFakeClock(() => resume(t.f))
+ expect(switched).toBe(true)
+ expect(result).toMatchObject({ ok: true, configuration: { engine: 'codex', model: 'gpt-6-astra', effort: 'xhigh' } })
+ })
+})
diff --git a/cli/src/superTabs/start.ts b/cli/src/superTabs/start.ts
index 37dfdb73a..8639a09cd 100644
--- a/cli/src/superTabs/start.ts
+++ b/cli/src/superTabs/start.ts
@@ -30,6 +30,10 @@ const LAUNCH_MODEL_REFUSALS = new Set(['LAUNCH_MODEL_UNSUPPORTED', 'INVALID_LAUN
// The join turn must finish before the pane accepts a model switch, and it ends only once the roster shows the agent.
const MODEL_SWITCH_WAIT_MS = 60_000
const MODEL_SWITCH_RETRY_MS = 1_000
+/** How long a start waits for an agent with no model on record to report one before it joins: a Codex agent at its own
+ * default names it at its first turn, which its join prompt starts. Work assigned before it was recorded with none (Scholes,
+ * 2026-10-30, median 34 s after the start). An engine or grid model that never reports one joins without it. */
+export const MODEL_REPORT_WAIT_MS = 30_000
const CANCELLED_START = 'The machine cancelled this request before starting an agent. Review its settings and create a new start request.'
function requireSuccess(reply: Json): Json {
// The code says whether the backend answered (a refusal) or the reply was lost on the way (a transport code, or none).
@@ -297,13 +301,14 @@ async function startOnce(input: Json, scoped: ScopedRequest, where: Where, open:
...(permissionWarning ? { permissionWarning } : {}),
detail: 'Queued on the contributed machine. Resume this start ID to read its receipt.' }
const target = await open(where, request.machineId)
- /** What the agent runs now, as its frame says; null when the frame cannot say. */
- const ranNow = async (agentId: string, engine: string) => {
- const listed = await target.request('agents_list', {}, 10_000).catch((): Json => ({}))
+ /** What the agent runs now, and its frame, as the frame says; null when the frame cannot say. */
+ const seenNow = async (agentId: string, engine: string, ms = 10_000) => {
+ const listed = await target.request('agents_list', {}, ms).catch((): Json => ({}))
const frame = (Array.isArray(listed.agents) ? listed.agents.map(object) : []).find(f => f.id === agentId)
const ran = parseRuntimeProfile(frame?.selectedModel)
- return ran && ran.sessionId === agentId && ran.engine === engine ? ran : null
+ return ran && ran.sessionId === agentId && ran.engine === engine ? { ran, frame: frame! } : null
}
+ const ranNow = async (agentId: string, engine: string) => (await seenNow(agentId, engine))?.ran ?? null
/** The model and effort routed for this start; `default` keeps what the engine launches with. */
const model = text(request.model), effort = text(request.effort)
const routedModel = !!model && !!effort && !(model === 'default' && effort === 'default')
@@ -458,14 +463,12 @@ async function startOnce(input: Json, scoped: ScopedRequest, where: Where, open:
detail: 'The created agent is unavailable, but its stop is not confirmed. Inspect the execution machine before starting another agent.' }
// Reports what the engine launched with; the routed model, once launched or switched, is observed afterwards.
const profile = parseRuntimeProfile(frame.selectedModel)
- const matched = profile && profile.sessionId === nativeId && profile.engine === frame.engine ? profile : null
+ let matched = profile && profile.sessionId === nativeId && profile.engine === frame.engine ? profile : null
+ let seenFrame = frame
// Claude Code does not report an effort it was launched with, so its frame reads auto: the agent runs the effort this
// start launched it with (a resumed start: the one the machine accepted at launch). Builders started with opus high
// were stored as auto until 2026-10-27.
const launchedEffort = launched ? effort : launched === undefined ? text(object(native.launchModel).effort) : null
- const configuration = { engine: text(frame.engine) ?? String(request.engine), model: matched?.model ?? null,
- effort: matched?.effort === 'auto' && launchedEffort ? launchedEffort : matched?.effort ?? null,
- contextWindow: number(frame.contextWindow), engineVersion: text(frame.engineVersion) }
const startedSession = typeof frame.sessionId === 'string' && frame.sessionId && typeof frame.createdAt === 'string' && Number.isFinite(Date.parse(frame.createdAt))
? { sessionId: frame.sessionId, createdAt: frame.createdAt } : undefined
// New native frames have their creation time before the engine binds. Wait for its original session identity.
@@ -473,6 +476,23 @@ async function startOnce(input: Json, scoped: ScopedRequest, where: Where, open:
// (superTabs/machines.ts `abandoned`).
if (typeof frame.createdAt === 'string' && !startedSession) return { error: 'START_PENDING', startId, creationId, harnessId: nativeId,
detail: 'Waiting for the launched engine to record its session identity. Resume this same start request.' }
+ // An agent left on its engine's own model (Codex) names it at its first turn: it joins with it, so the work assigned to
+ // it records it. Bounded: an engine or grid model that never reports one joins without it, and its first report fills
+ // its attempts later (backend leaderboard/record.ts). A routed model is switched in after the join and read then.
+ const engine = text(frame.engine) ?? String(request.engine)
+ if (!matched && !start.harnessId && !routedModel && request.gridModel === undefined && request.gridName === undefined
+ && ['claude', 'codex'].includes(engine)) {
+ const giveUp = Date.now() + MODEL_REPORT_WAIT_MS
+ for (;;) {
+ const seen = await seenNow(nativeId, engine, Math.max(1_000, Math.min(10_000, giveUp - Date.now())))
+ if (seen) { matched = seen.ran; seenFrame = seen.frame; break }
+ if (giveUp - Date.now() < MODEL_SWITCH_RETRY_MS) break
+ await new Promise(resolve => setTimeout(resolve, MODEL_SWITCH_RETRY_MS))
+ }
+ }
+ const configuration = { engine, model: matched?.model ?? null,
+ effort: matched?.effort === 'auto' && launchedEffort ? launchedEffort : matched?.effort ?? null,
+ contextWindow: number(seenFrame.contextWindow), engineVersion: text(seenFrame.engineVersion) }
const join = { type: 'agent.started', startId, harnessId: nativeId, configuration }
let joined: Json = { result: {} }
if (!start.harnessId) {
@@ -538,7 +558,16 @@ async function startOnce(input: Json, scoped: ScopedRequest, where: Where, open:
}
}
}
+ // What the agent runs as this start last saw it, for its settle (superTabs/machines.ts): work is assigned only after the
+ // settle, so it records the model even before the host's own report of it. None when the agent has named no model.
+ const last = switching || routedModel ? await seenNow(nativeId, engine) : matched ? { ran: matched, frame: seenFrame } : null
+ const lastEffort = switching && last?.ran.model === model ? effort : launchedEffort
+ const settledConfiguration = last && last.ran.model.length <= 200 ? { engine, model: last.ran.model,
+ effort: last.ran.effort === 'auto' && lastEffort ? lastEffort : last.ran.effort,
+ contextWindow: Number.isSafeInteger(last.frame.contextWindow) && Number(last.frame.contextWindow) > 0 ? Number(last.frame.contextWindow) : null,
+ engineVersion: text(last.frame.engineVersion)?.slice(0, 160) ?? null } : null
return { ok: true, startId, machineId: request.machineId, harnessId: nativeId, ...object(joined.result),
+ ...(settledConfiguration ? { configuration: settledConfiguration } : {}),
...(permissionWarning ? { permissionWarning } : {}), ...(modelWarning ? { modelWarning } : {}) }
} finally { target.close() }
}
diff --git a/docs/swarms.md b/docs/swarms.md
index db183cae0..ccb95a564 100644
--- a/docs/swarms.md
+++ b/docs/swarms.md
@@ -407,6 +407,13 @@ never records what anyone wrote. The only text it shows is the title of a
conversation the reader can read. Private conversations, Buddy chats among
them, never count and never appear in it.
+Each attempt counts under the model its agent ran on. An agent left on its
+engine's own model (Codex) names it at its first turn; its start waits up to 30
+seconds for that before the agent joins, and settles with what the agent runs,
+so work assigned to it names the model. An agent that names one later, even
+after its work ended, fills in its own attempts that have none. A model already
+recorded is never changed.
+
## Routing
The Lead routes each task before starting or assigning an agent. The route