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.

fix: Swarm agent rows never show "unknown"; the daemon reads Claude's effort (#1966)

0xken15f81ffe48d4b7
diff --git a/cli/src/core/engines/runtimeSessions.spec.ts b/cli/src/core/engines/runtimeSessions.spec.ts
index 560da0e95..f9f055053 100644
--- a/cli/src/core/engines/runtimeSessions.spec.ts
+++ b/cli/src/core/engines/runtimeSessions.spec.ts
@@ -305,6 +305,19 @@ describe('core runtime profile authority', () => {
expect(t.sessions.getState(t.s.agentId).model).toBe('different')
})
+ // A confirmed switch is the session's effort, even one equal to what the settings filled (#1966 delta review).
+ it.each(['effort', 'profile'] as const)('a confirmed %s is no longer the settings\' effort', async confirmed => {
+ const t = setup()
+ t.read.mockImplementationOnce(async (_engine, context) => ({ ...result(context, { kind: 'config' }),
+ state: { ...context.state, effort: 'high', settingsEffort: 'high' } }))
+ await t.sessions.read(t.s, { kind: 'config' })
+ expect(t.sessions.getState(t.s.agentId).settingsEffort).toBe('high')
+ if (confirmed === 'effort') t.sessions.confirmEffort(t.s.sessionId, 'high')
+ else t.sessions.confirmControlProfile(profile(t.s, 'new', 'high'))
+ expect(t.sessions.getState(t.s.agentId).effort).toBe('high')
+ expect(t.sessions.getState(t.s.agentId)).not.toHaveProperty('settingsEffort')
+ })
+
it('commits prepared live evidence only while its binding and control revision remain current', async () => {
const t = setup(); await t.seed()
const commit = await t.sessions.prepare(t.s, [{ model: 'new', effort: 'high', version: '2.1.210' }])
diff --git a/cli/src/core/engines/runtimeSessions.ts b/cli/src/core/engines/runtimeSessions.ts
index 241c845a1..febfa38b1 100644
--- a/cli/src/core/engines/runtimeSessions.ts
+++ b/cli/src/core/engines/runtimeSessions.ts
@@ -248,7 +248,9 @@ export function createRuntimeSessions(deps: RuntimeSessionDeps) {
const view = byId(id)
if (!view?.sessionId || !RUNTIME_EFFORTS.has(effort)) return
// Confirmation comes from core's checked control driver, never an arbitrary transcript field.
- view.state = { ...view.state, effort, observedAt: Date.now() }
+ // A confirmed effort is the session's, never the settings' (#1966 delta review).
+ const { settingsEffort: _, ...state } = view.state
+ view.state = { ...state, effort, observedAt: Date.now() }
const selection = parseRuntimeProfile(view.selected)
const s = deps.resolve(view.agentId)!
if (selection) view.selected = encodeRuntimeProfile({ sessionId: s.agentId, engine: s.engine, model: selection.model, effort })
@@ -258,7 +260,8 @@ export function createRuntimeSessions(deps: RuntimeSessionDeps) {
confirmControlProfile(target: RuntimeProfile): void {
const view = byId(target.sessionId)
if (!view) return
- view.state = { ...view.state, model: target.model, effort: target.effort, observedAt: Date.now() }
+ const { settingsEffort: _, ...state } = view.state
+ view.state = { ...state, model: target.model, effort: target.effort, observedAt: Date.now() }
view.selected = encodeRuntimeProfile({ ...target, sessionId: view.agentId })
if (view.control?.target.id === target.id) { view.control.modelConfirmed = true; view.control.effortConfirmed = true }
view.revision++; wake(view.sessionId)
diff --git a/cli/src/core/transcripts/attach.runtime.spec.ts b/cli/src/core/transcripts/attach.runtime.spec.ts
index 183810fda..97e1b6e72 100644
--- a/cli/src/core/transcripts/attach.runtime.spec.ts
+++ b/cli/src/core/transcripts/attach.runtime.spec.ts
@@ -15,11 +15,11 @@ afterEach(() => {
for (const root of roots.splice(0)) rmSync(root, { recursive: true, force: true })
})
-function setup() {
+function setup(replyEffort?: string) {
const root = mkdtempSync(join(tmpdir(), 'attach-profile-'))
roots.push(root)
const path = join(root, 'session.jsonl')
- writeFileSync(path, `${JSON.stringify({ type: 'assistant', version: '2.1.209',
+ writeFileSync(path, `${JSON.stringify({ type: 'assistant', version: '2.1.209', ...(replyEffort ? { effort: replyEffort } : {}),
message: { role: 'assistant', model: 'claude-opus-5', content: [] } })}\n`)
const session = { agentId: 'agent', sessionId: 'session', engine: 'claude', cwd: root,
transcriptPath: path, cliVersion: '2.1.100', model: 'claude-sonnet-4-6' } as RegisteredSession
@@ -75,3 +75,14 @@ it.each(['expired', 'superseded', 'failed', 'installed'] as const)(
p.profiles.forget(p.session.sessionId)
},
)
+
+// Attach reads the settings after the transcript. Their default replaced the effort a reply recorded, so an adopted agent
+// or a restarted daemon reported "auto" (or the settings' effort) until its next reply (#1966 review).
+it.each(['low', 'auto'])('keeps the effort a reply recorded when the settings answer %s', async configured => {
+ const p = setup('medium')
+ await vi.waitFor(() => expect(p.configuredEffort).toHaveBeenCalledOnce())
+ p.finish(configured)
+ expect(await p.attaching).toBe(true)
+ expect(p.profiles.getState(p.session.sessionId)).toMatchObject({ model: 'claude-opus-5', effort: 'medium' })
+ p.profiles.forget(p.session.sessionId)
+})
diff --git a/cli/src/engines/claude/runtimeProfile.ts b/cli/src/engines/claude/runtimeProfile.ts
index afd149540..ea837fd43 100644
--- a/cli/src/engines/claude/runtimeProfile.ts
+++ b/cli/src/engines/claude/runtimeProfile.ts
@@ -2,7 +2,7 @@
import { join } from 'node:path'
import { sessionClaudeHome } from '../../lib/engineHomes.js'
import type { EngineRuntime, RuntimeContext, RuntimeModelOption, RuntimeRecord, RuntimeSession, RuntimeState } from '../facets/runtime.js'
-import { addOption, currentPaneUi, encodeRuntimeProfile, flattenContent, parseVersion, readJson, record, stripAnsi, text, versionAtLeast } from '../kit/runtime.js'
+import { addOption, currentPaneUi, encodeRuntimeProfile, flattenContent, parseVersion, readJson, record, showEffort, stripAnsi, text, versionAtLeast } from '../kit/runtime.js'
const CLAUDE_EFFORTS = new Set(['auto', 'low', 'medium', 'high', 'xhigh', 'max', 'ultracode'])
const BASIC_EFFORTS = ['low', 'medium', 'high', 'xhigh', 'max'] as const
@@ -124,7 +124,12 @@ function decode(raw: Record<string, unknown>): RuntimeRecord | null {
const setModel = !!modelMatch
const nextModel = modelMatch ? normalizeClaudeDisplay(modelMatch[1]) : null
const effortMatch = /Set effort level to\s+(low|medium|high|xhigh|max|ultracode)/i.exec(content)
- const effort = effortMatch?.[1].toLowerCase() ?? (confirmsClaudeAutoEffort(content) ? 'auto' : null)
+ // Each reply records the effort it ran with. A session launched with --effort, or adopted, prints no "Set effort
+ // level" and its banner names none: without this its Lead read as "opus unknown" in the Swarm sidebar (2026-10-28).
+ const replyEffort = raw.type === 'assistant' ? text(raw.effort).toLowerCase() : ''
+ const effort = effortMatch?.[1].toLowerCase()
+ ?? (CLAUDE_EFFORTS.has(replyEffort) ? replyEffort : null)
+ ?? (confirmsClaudeAutoEffort(content) ? 'auto' : null)
const version = parseVersion(cliVersion) ? cliVersion : null
return version || model || setModel || effort ? { version, model, setModel, nextModel, effort } : null
}
@@ -141,15 +146,14 @@ function reduce({ session, state, control }: RuntimeContext, evidence: RuntimeRe
const nextModel = control?.target.model ?? (text(evidence.nextModel) || state.model)
state.model = nextModel
if (!control && nextModel && state.effort && !claudeEfforts(nextModel, session.cliVersion).includes(state.effort)) {
- state.effort = 'auto'
+ showEffort(state, 'auto')
}
state.observedAt = Date.now()
if (control) control.modelConfirmed = true
}
const effort = text(evidence.effort)
if (effort) {
- state.effort = effort
- state.observedAt = Date.now()
+ showEffort(state, effort)
if (control) control.effortConfirmed = control.target.effort === 'auto' || state.effort === control.target.effort
}
}
@@ -165,7 +169,7 @@ function pane({ state }: RuntimeContext, paneText: string): void {
const banner = !state.model ? claudeStartupBanner(paneText) : null
if (banner) {
state.model = banner.model
- if (banner.effort) state.effort = banner.effort
+ if (banner.effort) showEffort(state, banner.effort)
state.observedAt = Date.now()
}
const header = /(Fable|Opus|Sonnet|Haiku)\s+(\d+(?:\.\d+)*)(\s+\(1M context\))?\s+with\s+(low|medium|high|xhigh|max|ultracode)\s+effort/gi
@@ -173,14 +177,10 @@ function pane({ state }: RuntimeContext, paneText: string): void {
const latest = matches[matches.length - 1]
if (latest) {
state.model = `claude-${latest[1].toLowerCase()}-${latest[2].replace(/\./g, '-')}${latest[3] ? '[1m]' : ''}`
- state.effort = latest[4].toLowerCase()
- state.observedAt = Date.now()
+ showEffort(state, latest[4].toLowerCase())
}
const footer = paneText.split('\n').slice(-8).join('\n')
- if (/─+\s*ultracode\s*─+/i.test(footer)) {
- state.effort = 'ultracode'
- state.observedAt = Date.now()
- }
+ if (/─+\s*ultracode\s*─+/i.test(footer)) showEffort(state, 'ultracode')
if (/\bplan mode on\b/i.test(currentUi)) state.mode = 'plan'
else if (/\b(?:auto|default) mode on\b/i.test(currentUi)) state.mode = 'default'
}
diff --git a/cli/src/engines/facets/runtime.ts b/cli/src/engines/facets/runtime.ts
index 139181b08..3fc698616 100644
--- a/cli/src/engines/facets/runtime.ts
+++ b/cli/src/engines/facets/runtime.ts
@@ -17,6 +17,9 @@ export interface RuntimeState {
mode: 'default' | 'plan' | 'unknown'
cliVersion: string | null
observedAt: number | null
+ /** The effort the settings last filled in. While [effort] is still that one, the session has shown none of its own, and
+ * a later settings read may change it; an effort the session showed is never replaced by the settings. */
+ settingsEffort?: string
}
export type RuntimeField = 'model' | 'effort' | 'mode'
@@ -54,6 +57,8 @@ export interface EngineRuntime {
reduce(context: RuntimeContext, record: RuntimeRecord): void
transcript(context: RuntimeContext, record: Record<string, unknown>): void
pane(context: RuntimeContext, text: string): void
+ /** The effort the engine's settings start a session with: a default, which fills an effort the session has not shown
+ * and never replaces one it has (a reply's, a pane's), as `fillConfiguredEffort` applies it. */
configuredEffort?(session: RuntimeSession): Promise<string>
selectedModel(session: RuntimeSession, state: RuntimeState): string | null
models(session: RuntimeSession, state: RuntimeState | undefined): Promise<RuntimeModelOption[]>
diff --git a/cli/src/engines/kit/runtime.ts b/cli/src/engines/kit/runtime.ts
index 84900c8ab..6f08f28e7 100644
--- a/cli/src/engines/kit/runtime.ts
+++ b/cli/src/engines/kit/runtime.ts
@@ -13,6 +13,26 @@ export function record(value: unknown): Record<string, unknown> | null {
return value && typeof value === 'object' && !Array.isArray(value) ? value as Record<string, unknown> : null
}
+/** Puts [configured], the settings' default, where the session has shown no effort: none yet, or the one an earlier
+ * settings read put there, which follows the settings (moved homes, the project override last). Read after the
+ * transcript on attach, it replaced the effort a reply recorded, so an adopted agent or a restarted daemon reported it
+ * wrong (#1966 review). */
+export function fillConfiguredEffort(state: RuntimeState, configured: string): void {
+ if (state.effort !== null && state.effort !== state.settingsEffort) return
+ state.effort = configured
+ state.settingsEffort = configured
+ state.observedAt = Date.now()
+}
+
+/** Records [effort] as one the session showed (a reply, the screen): the settings never replace it, even when it
+ * equals what they filled. Kept as theirs, settings that filled high, then a reply showing high, then settings
+ * changed to medium made the row say medium while the session ran high (#1966 delta review). */
+export function showEffort(state: RuntimeState, effort: string): void {
+ state.effort = effort
+ delete state.settingsEffort
+ state.observedAt = Date.now()
+}
+
export function text(value: unknown): string {
return typeof value === 'string' ? value : ''
}
diff --git a/cli/src/engines/worker/runtimeProtocol.ts b/cli/src/engines/worker/runtimeProtocol.ts
index 148202e2f..b103c1f3b 100644
--- a/cli/src/engines/worker/runtimeProtocol.ts
+++ b/cli/src/engines/worker/runtimeProtocol.ts
@@ -40,6 +40,7 @@ export function runtimeState(value: unknown): value is RuntimeState {
return record(value) && nullable(value.model) && nullable(value.effort) && nullable(value.cliVersion)
&& ['unknown', 'default', 'plan'].includes(value.mode as string)
&& (value.observedAt === null || (typeof value.observedAt === 'number' && Number.isFinite(value.observedAt) && Math.abs(value.observedAt) <= 8.64e15))
+ && (value.settingsEffort === undefined || label(value.settingsEffort))
}
function controlOf(value: unknown, session: RuntimeSession): RuntimeControl | undefined | null {
@@ -66,8 +67,9 @@ export function runtimeContext(value: unknown, engine: ReaderEngine): RuntimeCon
cwd: s.cwd, transcriptPath: s.transcriptPath, ...(s.codexHome === undefined ? {} : { codexHome: s.codexHome }) }
const control = controlOf(value.control, session)
if (control === null) return null
- const { model, effort, mode, cliVersion, observedAt } = value.state
- return { session, state: { model, effort, mode, cliVersion, observedAt }, ...(control ? { control } : {}) }
+ const { model, effort, mode, cliVersion, observedAt, settingsEffort } = value.state
+ return { session, state: { model, effort, mode, cliVersion, observedAt, ...(settingsEffort === undefined ? {} : { settingsEffort }) },
+ ...(control ? { control } : {}) }
}
export function runtimeRecord(value: unknown): value is RuntimeRecord {
diff --git a/cli/src/engines/worker/runtimeRequests.spec.ts b/cli/src/engines/worker/runtimeRequests.spec.ts
index 9edf0b2f5..d5b556895 100644
--- a/cli/src/engines/worker/runtimeRequests.spec.ts
+++ b/cli/src/engines/worker/runtimeRequests.spec.ts
@@ -93,6 +93,24 @@ describe('runtime worker contract', () => {
expect(legacyReply.answer.control.target).toEqual(legacyTarget)
expect(runtimeAnswer(legacyReply.answer, legacy, { kind: 'records', records: [data] })).toBe(true)
expect((await t.send({ operation: { kind: 'config' } })).answer.state.effort).toBe('high')
+ // The settings fill an effort the session has not shown; one it has (a reply's, a pane's) stays (#1966 review).
+ const shown = context()
+ shown.state.effort = 'medium'
+ expect((await t.send({ context: shown, operation: { kind: 'config' } })).answer.state.effort).toBe('medium')
+ t.adapter.configuredEffort.mockResolvedValueOnce('auto')
+ expect((await t.send({ context: shown, operation: { kind: 'config' } })).answer.state.effort).toBe('medium')
+ // An effort the settings filled follows them when they change: the marker crosses to the worker and back.
+ const filled = (await t.send({ operation: { kind: 'config' } })).answer.state
+ t.adapter.configuredEffort.mockResolvedValueOnce('medium')
+ expect((await t.send({ context: { ...context(), state: filled }, operation: { kind: 'config' } })).answer.state.effort).toBe('medium')
+ // A reply or the screen showing the settings' own effort makes it the session's: a later change leaves it (#1966 delta review).
+ const highReply = t.adapter.decode({ type: 'assistant', effort: 'high', message: { model: 'claude-opus-5-5' } })!
+ for (const operation of [{ kind: 'records', records: [highReply] }, { kind: 'pane', text: 'Opus 5.5 with high effort' }]) {
+ const shownHigh = (await t.send({ context: { ...context(), state: filled }, operation })).answer.state
+ expect(shownHigh.settingsEffort).toBeUndefined()
+ t.adapter.configuredEffort.mockResolvedValueOnce('medium')
+ expect((await t.send({ context: { ...context(), state: shownHigh }, operation: { kind: 'config' } })).answer.state.effort).toBe('high')
+ }
expect((await t.send({ operation: { kind: 'pane', text: 'Opus 5 with high effort' } })).answer.state.model).toBe('claude-opus-5')
expect((await t.send({ operation: { kind: 'models' } })).answer.models).toEqual([])
expect((await t.send({ operation: { kind: 'catalog' } })).answer.catalog).toEqual([])
diff --git a/cli/src/engines/worker/runtimeRequests.ts b/cli/src/engines/worker/runtimeRequests.ts
index 8411d1f3f..58139bca0 100644
--- a/cli/src/engines/worker/runtimeRequests.ts
+++ b/cli/src/engines/worker/runtimeRequests.ts
@@ -1,5 +1,6 @@
import type { ServiceRequests } from '../../core/api.js'
import type { EngineRuntime } from '../facets/runtime.js'
+import { fillConfiguredEffort } from '../kit/runtime.js'
import { type ReaderEngine } from './protocol.js'
import { runtimeContext, runtimeOperation, RUNTIME_CAPABILITIES, RUNTIME_IN_FLIGHT, RUNTIME_READ,
RUNTIME_REPLY_BYTES, RUNTIME_REQUEST_BYTES, RUNTIME_VERSION, RUNTIME_WAIT_MS, type RuntimeAnswer } from './runtimeProtocol.js'
@@ -40,10 +41,8 @@ export function engineRuntimeRequests(engine: ReaderEngine, deps: RuntimeRequest
const extra: Partial<RuntimeAnswer> = {}
if (operation.kind === 'records') for (const evidence of operation.records) adapter.reduce(context, evidence)
else if (operation.kind === 'pane') adapter.pane(context, operation.text)
- else if (operation.kind === 'config' && adapter.configuredEffort) {
- state.effort = await adapter.configuredEffort(session)
- state.observedAt = Date.now()
- } else if (operation.kind === 'models') extra.models = await adapter.models(session, state)
+ else if (operation.kind === 'config' && adapter.configuredEffort) fillConfiguredEffort(state, await adapter.configuredEffort(session))
+ else if (operation.kind === 'models') extra.models = await adapter.models(session, state)
else if (operation.kind === 'catalog') extra.catalog = await adapter.catalog?.(session) ?? []
else if (operation.kind === 'effort') extra.effortAllowed = adapter.effortAllowed?.(operation.model, operation.effort, operation.listed) ?? false
if (closed?.aborted) return failure('ENGINE_UNAVAILABLE')
diff --git a/cli/src/lib/runtimeProfile.spec.ts b/cli/src/lib/runtimeProfile.spec.ts
index 28ad3f09d..0ee20ff4b 100644
--- a/cli/src/lib/runtimeProfile.spec.ts
+++ b/cli/src/lib/runtimeProfile.spec.ts
@@ -389,6 +389,47 @@ describe('RuntimeProfileManager', () => {
expect(parseRuntimeProfile(manager.selectedModel(value))).toMatchObject({ model: 'opus', effort: 'low' })
})
+ // The settings name only the effort a session starts with. Read after the transcript on attach, they replaced the
+ // effort a reply recorded with their default, so an adopted agent or a restarted daemon reported it wrong (#1966 review).
+ it.each([['another effort', 'low'], ['none', null]])('keeps the effort a reply recorded over the settings default (%s), on both attach paths', async (_, configured) => {
+ const cwd = await mkdtemp(join(tmpdir(), 'machine-runtime-'))
+ cleanup.push(cwd)
+ await mkdir(join(cwd, '.claude'))
+ if (configured) await writeFile(join(cwd, '.claude', 'settings.local.json'), JSON.stringify({ effortLevel: configured }))
+ const reply = JSON.stringify({ type: 'assistant', effort: 'medium', message: { model: 'claude-opus-5-5' } })
+
+ const read = new RuntimeProfileManager(), whole = { ...session('claude'), cwd }
+ read.hydrate(whole, [reply])
+ await read.ingestConfig(whole, true)
+ expect(parseRuntimeProfile(read.selectedModel(whole))).toMatchObject({ model: 'opus', effort: 'medium' })
+
+ const staged = new RuntimeProfileManager(), fromEnd = { ...session('claude'), cwd }
+ const stage = staged.beginHydrate(fromEnd)
+ stage.ingest(reply)
+ await stage.config!()
+ stage.commit()
+ expect(parseRuntimeProfile(staged.selectedModel(fromEnd))).toMatchObject({ model: 'opus', effort: 'medium' })
+ })
+
+ // Settings fill high, a reply (or the screen) shows high, then the settings change to medium: the session still runs
+ // high, and the row said medium (#1966 delta review). Showing an effort makes it the session's, even an equal one.
+ it.each(['a reply', 'the screen'])('keeps an effort %s showed that equals the settings when they change', async by => {
+ const cwd = await mkdtemp(join(tmpdir(), 'machine-runtime-'))
+ cleanup.push(cwd)
+ await mkdir(join(cwd, '.claude'))
+ const settings = (effortLevel: string) => writeFile(join(cwd, '.claude', 'settings.local.json'), JSON.stringify({ effortLevel }))
+ await settings('high')
+ const manager = new RuntimeProfileManager(), value = { ...session('claude'), cwd }
+ manager.hydrate(value, [JSON.stringify({ type: 'assistant', message: { model: 'claude-opus-5-5' } })])
+ await manager.ingestConfig(value, true)
+ expect(parseRuntimeProfile(manager.selectedModel(value))).toMatchObject({ effort: 'high' })
+ if (by === 'a reply') manager.ingest(value, JSON.stringify({ type: 'assistant', effort: 'high', message: { model: 'claude-opus-5-5' } }))
+ else manager.ingestPane(value, 'Opus 5.5 with high effort\n❯ ', true)
+ await settings('medium')
+ await manager.ingestConfig(value, true)
+ expect(parseRuntimeProfile(manager.selectedModel(value))).toMatchObject({ effort: 'high' })
+ })
+
it('keeps supported Claude effort on a local model change and falls back to auto otherwise', () => {
const manager = new RuntimeProfileManager()
const value = session('claude')
@@ -466,6 +507,26 @@ describe('RuntimeProfileManager', () => {
expect(parseRuntimeProfile(manager.selectedModel(value))).toMatchObject({ model: 'opus', effort: 'ultracode' })
})
+ // A session launched with --effort, or adopted, never prints "Set effort level", and its banner names no effort:
+ // its Lead read as "opus unknown" in the Swarm sidebar (2026-10-28). Claude Code records the effort on each reply.
+ it('observes the effort Claude Code records on each assistant reply', () => {
+ const manager = new RuntimeProfileManager()
+ const value = session('claude')
+ const reply = (effort: unknown) => JSON.stringify({
+ type: 'assistant', effort, perTurnEffort: effort, message: { model: 'claude-opus-5-5' },
+ })
+ manager.hydrate(value, [reply('medium')])
+ expect(parseRuntimeProfile(manager.selectedModel(value))).toMatchObject({ model: 'opus', effort: 'medium' })
+
+ manager.ingest(value, reply('high'))
+ expect(parseRuntimeProfile(manager.selectedModel(value))).toMatchObject({ model: 'opus', effort: 'high' })
+
+ // A word Claude Code does not offer is not an effort: the last real one stays.
+ manager.ingest(value, reply('turbo'))
+ manager.ingest(value, reply(7))
+ expect(parseRuntimeProfile(manager.selectedModel(value))).toMatchObject({ effort: 'high' })
+ })
+
it('observes Codex model, effort, and plan mode from rollout settings', () => {
const manager = new RuntimeProfileManager()
const value = session('codex')
@@ -520,6 +581,8 @@ describe('RuntimeProfileManager.transcriptFields', () => {
expect(manager.transcriptFields(claude, assistant('<synthetic>'))).toEqual([])
const local = (text: string) => JSON.stringify({ type: 'user', message: { role: 'user', content: `<local-command-stdout>${text}</local-command-stdout>` } })
expect(manager.transcriptFields(claude, local('Set effort level to high'))).toEqual(['effort'])
+ expect(manager.transcriptFields(claude, JSON.stringify({ type: 'assistant', effort: 'high', message: { model: 'claude-opus-5-5' } })))
+ .toEqual(['model', 'effort'])
expect(manager.transcriptFields(claude, JSON.stringify({ type: 'user', message: { role: 'user', content: 'plain' } }))).toEqual([])
})
diff --git a/cli/src/lib/runtimeProfileState.spec.ts b/cli/src/lib/runtimeProfileState.spec.ts
index ce4c3b308..cdfd30bc5 100644
--- a/cli/src/lib/runtimeProfileState.spec.ts
+++ b/cli/src/lib/runtimeProfileState.spec.ts
@@ -309,6 +309,20 @@ describe('late optional profile observations', () => {
expect(manager.getState(agent.sessionId).effort).toBe('high')
})
+ // A confirmed switch is the session's effort, even one equal to what the settings filled (#1966 delta review).
+ it.each(['effort', 'profile'] as const)('keeps a confirmed %s equal to the settings when they change', async confirmed => {
+ let configured = 'high'
+ const manager = new RuntimeProfileState(() => ({ ...claudeRuntime, configuredEffort: async () => configured })), agent = session('claude')
+ manager.hydrate(agent, [])
+ await manager.ingestConfig(agent, true)
+ expect(manager.getState(agent.sessionId).effort).toBe('high')
+ if (confirmed === 'effort') manager.confirmEffort(agent.sessionId, 'high')
+ else manager.confirmControlProfile({ id: 'target', sessionId: agent.sessionId, engine: agent.engine, model: 'opus', effort: 'high' })
+ configured = 'medium'
+ await manager.ingestConfig(agent, true)
+ expect(manager.getState(agent.sessionId).effort).toBe('high')
+ })
+
it('does not notify for a read completed after the session was forgotten', async () => {
vi.useFakeTimers()
let finish!: (effort: string) => void
diff --git a/cli/src/lib/runtimeProfileState.ts b/cli/src/lib/runtimeProfileState.ts
index 91cf0268a..2eb8b0a41 100644
--- a/cli/src/lib/runtimeProfileState.ts
+++ b/cli/src/lib/runtimeProfileState.ts
@@ -5,7 +5,7 @@ import type { RegisteredSession } from './registry.js'
import type { RuntimeFor, RuntimeProfile, RuntimeModelOption, RuntimeState, RuntimeField, RuntimeControl, RuntimeCatalogModel } from '../engines/facets/runtime.js'
import type { InlineRuntimeContext, InlineRuntimeReader } from '../engines/facets/inlineRuntime.js'
export type { RuntimeProfile, RuntimeModelOption, RuntimeState, RuntimeField } from '../engines/facets/runtime.js'
-import { encodeRuntimeProfile, record, stripAnsi, transcriptFields, RUNTIME_EFFORTS } from '../engines/kit/runtime.js'
+import { encodeRuntimeProfile, fillConfiguredEffort, record, showEffort, stripAnsi, transcriptFields, RUNTIME_EFFORTS } from '../engines/kit/runtime.js'
export { encodeRuntimeProfile, runtimeModelLabel } from '../engines/kit/runtime.js'
import { engineNow, isOtherEngine, loadEngine } from '../engines/inProcess.js'
import { processIdentityKey } from './terminalRuntime.js'
@@ -182,10 +182,8 @@ export class RuntimeProfileState {
if (!current() || (!runtime?.configuredEffort && !reader?.config)) return false
const before = this.selectedModel(session)
const context = { ...this.context(session, silent), session: { ...session }, state: { ...state }, control: copyControl(control) }
- if (runtime?.configuredEffort) {
- context.state.effort = await runtime.configuredEffort(context.session)
- context.state.observedAt = Date.now()
- } else if (!await reader!.config!(context)) return false
+ if (runtime?.configuredEffort) fillConfiguredEffort(context.state, await runtime.configuredEffort(context.session))
+ else if (!await reader!.config!(context)) return false
// An optional reader cannot publish into a forgotten/rebound row or replace newer evidence.
if (!current()) return false
Object.assign(state, context.state)
@@ -243,10 +241,8 @@ export class RuntimeProfileState {
if (!current()) return
try {
const runtime = this.runtimeFor(stagedSession.engine)
- if (runtime?.configuredEffort) {
- staged.effort = await runtime.configuredEffort(stagedSession)
- staged.observedAt = Date.now()
- } else if (!runtime) {
+ if (runtime?.configuredEffort) fillConfiguredEffort(staged, await runtime.configuredEffort(stagedSession))
+ else if (!runtime) {
const reader = await this.reader(stagedSession.engine)
if (current()) await reader?.config?.({ session: stagedSession, state: staged, control: stagedControl, refreshConfig: () => {} })
}
@@ -321,8 +317,7 @@ export class RuntimeProfileState {
confirmEffort(sessionId: string, effort: string): void {
if (!EFFORTS.has(effort)) return
const state = this.state(sessionId)
- state.effort = effort
- state.observedAt = Date.now()
+ showEffort(state, effort)
this.authoritative(state)
const control = this.controls.get(sessionId)
if (control) control.effortConfirmed = control.target.effort === effort
@@ -332,8 +327,7 @@ export class RuntimeProfileState {
confirmControlProfile(target: RuntimeProfile): void {
const state = this.state(target.sessionId)
state.model = target.model
- state.effort = target.effort
- state.observedAt = Date.now()
+ showEffort(state, target.effort)
this.authoritative(state)
const control = this.controls.get(target.sessionId)
if (control?.target.id === target.id) {
diff --git a/desktop/lib/core/runtime_model_name.dart b/desktop/lib/core/runtime_model_name.dart
index be965a9c9..7b4af47f6 100644
--- a/desktop/lib/core/runtime_model_name.dart
+++ b/desktop/lib/core/runtime_model_name.dart
@@ -38,33 +38,7 @@ String? runtimeModelName(
RegExp(r'[\x00-\x1f\x7f]').hasMatch(model)) {
return null;
}
- // Claude may report only a family alias. Never invent a version for it.
- final claude = RegExp(
- r'^(?:claude-)?(fable|opus|sonnet|haiku)(?:-(\d+(?:[-.]\d{1,2})*))?(\[1m\])?$',
- caseSensitive: false,
- ).firstMatch(model);
- if (claude != null) {
- final family = claude[1]!.toLowerCase();
- final version = claude[2]?.replaceAll('-', '.');
- final name =
- '${family[0].toUpperCase()}${family.substring(1)}'
- '${version == null ? '' : ' $version'}${claude[3] ?? ''}';
- return (name: name, effort: match[4]!.toLowerCase());
- }
- final gpt = RegExp(
- r'^gpt-(\d+(?:\.\d+)*)(?:-(astra|sol|terra|luna|codex))?$',
- caseSensitive: false,
- ).firstMatch(model);
- if (gpt != null) {
- final family = gpt[2]?.toLowerCase();
- return (
- name:
- 'GPT-${gpt[1]}${family == null ? '' : ' ${family[0].toUpperCase()}${family.substring(1)}'}',
- effort: match[4]!.toLowerCase(),
- );
- }
- // Unknown names, dated IDs and local/provider-qualified IDs stay exact.
- return (name: model, effort: match[4]!.toLowerCase());
+ return (name: modelDisplayName(model), effort: match[4]!.toLowerCase());
} on ArgumentError {
return null;
} on FormatException {
@@ -72,6 +46,32 @@ String? runtimeModelName(
}
}
+/// A model as people know it: "Opus 5.5" for `claude-opus-5-5`, "Opus" for the `opus` alias, "GPT-5.6 Sol" for
+/// `gpt-5.6-sol`. Other names stay exact.
+String modelDisplayName(String model) {
+ // Claude may report only a family alias. Never invent a version for it.
+ final claude = RegExp(
+ r'^(?:claude-)?(fable|opus|sonnet|haiku)(?:-(\d+(?:[-.]\d{1,2})*))?(\[1m\])?$',
+ caseSensitive: false,
+ ).firstMatch(model);
+ if (claude != null) {
+ final family = claude[1]!.toLowerCase();
+ final version = claude[2]?.replaceAll('-', '.');
+ return '${family[0].toUpperCase()}${family.substring(1)}'
+ '${version == null ? '' : ' $version'}${claude[3] ?? ''}';
+ }
+ final gpt = RegExp(
+ r'^gpt-(\d+(?:\.\d+)*)(?:-(astra|sol|terra|luna|codex))?$',
+ caseSensitive: false,
+ ).firstMatch(model);
+ if (gpt != null) {
+ final family = gpt[2]?.toLowerCase();
+ return 'GPT-${gpt[1]}${family == null ? '' : ' ${family[0].toUpperCase()}${family.substring(1)}'}';
+ }
+ // Unknown names, dated IDs and local/provider-qualified IDs stay exact.
+ return model;
+}
+
/// One compact label for native and Flutter model controls. Unknown effort
/// words stay exact so a newer daemon does not get mislabeled by an older app.
String modelLabelWithEffort(String model, String? effort) {
diff --git a/desktop/lib/super_tabs/agent_details.dart b/desktop/lib/super_tabs/agent_details.dart
index 35846b56a..be4933814 100644
--- a/desktop/lib/super_tabs/agent_details.dart
+++ b/desktop/lib/super_tabs/agent_details.dart
@@ -6,6 +6,7 @@ import 'package:url_launcher/url_launcher.dart';
import '../core/models.dart';
import '../core/permission_modes.dart';
import '../core/relative_time.dart';
+import '../core/runtime_model_name.dart';
import '../shared/widgets/app_dialog.dart';
import '../state/app_state.dart';
import '../state/harness_activity.dart';
@@ -68,9 +69,14 @@ class SuperTabAgentInfo {
final Agent? native;
final SuperTabConversation? taskGroup;
+ /// The model as people know it ("Opus 5.5"): the native agent's reading is already one; the configuration holds the
+ /// engine's own word ("opus", "claude-opus-5-5").
String? get model =>
_known(native?.modelName) ??
- _known(agent.configuration['model'] as String?);
+ switch (_known(agent.configuration['model'] as String?)) {
+ final String id => modelDisplayName(id),
+ null => null,
+ };
String? get engine =>
_known(agent.engine) == null ? null : engineIdentity(agent.engine).label;
diff --git a/desktop/lib/super_tabs/team_glance.dart b/desktop/lib/super_tabs/team_glance.dart
index 1314139f3..0a079535c 100644
--- a/desktop/lib/super_tabs/team_glance.dart
+++ b/desktop/lib/super_tabs/team_glance.dart
@@ -25,7 +25,7 @@ enum SuperTabAgentState {
paused,
}
-/// One agent in one line: "Working · Mac Studio · opus high".
+/// One agent in one line: "Working · Mac Studio · Opus 5.5 · high".
class SuperTabAgentGlance {
const SuperTabAgentGlance({
required this.state,
@@ -44,8 +44,9 @@ class SuperTabAgentGlance {
final String label;
final String? machine, model;
- /// The effort to show: the recorded one, else its start's, else "unknown".
- final String effort;
+ /// The effort to show: the recorded one, else its start's; null when neither names one. A row says only what is
+ /// known: the PM's row read "opus unknown" (2026-10-28).
+ final String? effort;
/// Holding a task: what the Swarm counts as this agent's load.
final bool busy;
@@ -53,8 +54,10 @@ class SuperTabAgentGlance {
/// The effort the agent's configuration records, and the one its start asked for; null when not known.
final String? recordedEffort, requestedEffort;
- /// "opus high"; null when the model is not known (an agent read before it reported one).
- String? get modelEffort => model == null ? null : '$model $effort';
+ /// "Opus 5.5 · high", or "Opus 5.5" when no effort is known; null when the model is not known (an agent read
+ /// before it reported one).
+ String? get modelEffort =>
+ model == null ? null : [model, ?effort].join(' · ');
String get line => [label, ?machine, ?modelEffort].join(' · ');
}
@@ -139,7 +142,7 @@ SuperTabAgentGlance superTabAgentGlance(
label: label,
machine: info.machine,
model: info.model,
- effort: recorded ?? requested ?? 'unknown',
+ effort: recorded ?? requested,
busy: _activeWork.contains(work),
recordedEffort: recorded,
requestedEffort: requested,
diff --git a/desktop/test/super_tab_roster_test.dart b/desktop/test/super_tab_roster_test.dart
index 4d3f9e917..9c9eb1eeb 100644
--- a/desktop/test/super_tab_roster_test.dart
+++ b/desktop/test/super_tab_roster_test.dart
@@ -248,14 +248,14 @@ void main() {
expect(
rowTooltip(tester, f, 1),
contains(
- 'Claude opus · Test host · Working on "Offline editing" · Last active 2 hours ago',
+ 'Claude Opus · Test host · Working on "Offline editing" · Last active 2 hours ago',
),
);
expect(
rowTooltip(tester, f, 1),
contains('Sage · Engineer · openharness'),
);
- expect(f.lineText(tester, 1), 'Working · Test host · opus unknown');
+ expect(f.lineText(tester, 1), 'Working · Test host · Opus');
final mouse = await tester.createGesture(kind: PointerDeviceKind.mouse);
await mouse.addPointer(location: Offset.zero);
await mouse.moveTo(tester.getCenter(f.row(1)));
@@ -266,6 +266,34 @@ void main() {
},
);
+ // The PM's row and details read the configuration's raw "opus" or "claude-opus-5-5" (2026-10-28): both name the
+ // model as people know it.
+ testWidgets('agent details name the model by its display name', (
+ tester,
+ ) async {
+ final f = await fixture(tester);
+ (f.server.state['agents'] as List)[1]['configuration'] = {
+ 'engine': 'claude',
+ 'model': 'claude-opus-5-5',
+ 'effort': 'auto',
+ };
+ await f.controller.refresh();
+ await f.show(tester);
+ expect(f.lineText(tester, 1), contains('Opus 5.5'));
+ expect(f.lineText(tester, 1), isNot(contains('unknown')));
+ await tester.tap(f.row(1));
+ await tester.pumpAndSettle();
+ expect(
+ find.descendant(
+ of: find.byType(AlertDialog),
+ matching: find.text('Opus 5.5'),
+ ),
+ findsOneWidget,
+ );
+ expect(find.textContaining('claude-opus-5-5'), findsNothing);
+ await f.close(tester);
+ });
+
testWidgets('agent tooltip omits data that neither state nor host knows', (
tester,
) async {
@@ -678,7 +706,7 @@ void main() {
await tester.tap(f.row(0));
await tester.pumpAndSettle();
expect(find.text('Claude'), findsOneWidget);
- expect(find.text('sonnet'), findsOneWidget);
+ expect(find.text('Sonnet'), findsOneWidget);
await tester.tap(find.widgetWithText(TextButton, 'Close'));
await tester.pumpAndSettle();
await f.close(tester);
diff --git a/desktop/test/super_tab_team_glance_test.dart b/desktop/test/super_tab_team_glance_test.dart
index 106fbfbae..8464b7b27 100644
--- a/desktop/test/super_tab_team_glance_test.dart
+++ b/desktop/test/super_tab_team_glance_test.dart
@@ -155,11 +155,11 @@ void main() {
);
// Holding a task with no turn seen running: assigned, never claimed as working.
expect(
- _line('Atlas', 'Assigned · Mac Studio · opus high'),
+ _line('Atlas', 'Assigned · Mac Studio · Opus · high'),
findsOneWidget,
);
expect(
- _line('Sage', 'Idle · MacBook Pro · sonnet medium'),
+ _line('Sage', 'Idle · MacBook Pro · Sonnet · medium'),
findsOneWidget,
);
},
@@ -177,9 +177,12 @@ void main() {
String line(HarnessActivity? activity) => superTabAgentGlance(
SuperTabAgentInfo(c, null, atlas, activity: activity),
).line;
- expect(line(HarnessActivity.working), 'Working · Mac Studio · opus high');
- expect(line(HarnessActivity.idle), 'Assigned · Mac Studio · opus high');
- expect(line(null), 'Assigned · Mac Studio · opus high');
+ expect(
+ line(HarnessActivity.working),
+ 'Working · Mac Studio · Opus · high',
+ );
+ expect(line(HarnessActivity.idle), 'Assigned · Mac Studio · Opus · high');
+ expect(line(null), 'Assigned · Mac Studio · Opus · high');
});
testWidgets(
@@ -212,16 +215,22 @@ void main() {
_task('Teal', 'review'),
],
);
- expect(_line('Moss', 'Stuck · Mac Studio · opus high'), findsOneWidget);
expect(
- _line('Teal', 'In review · Mac Studio · opus high'),
+ _line('Moss', 'Stuck · Mac Studio · Opus · high'),
+ findsOneWidget,
+ );
+ expect(
+ _line('Teal', 'In review · Mac Studio · Opus · high'),
+ findsOneWidget,
+ );
+ expect(
+ _line('Wren', 'Waiting · Mac Studio · Opus · high'),
findsOneWidget,
);
expect(
- _line('Wren', 'Waiting · Mac Studio · opus high'),
+ _line('Lark', 'Lost · Mac Studio · Opus · high'),
findsOneWidget,
);
- expect(_line('Lark', 'Lost · Mac Studio · opus high'), findsOneWidget);
final tip = tester
.widgetList<Tooltip>(
find.ancestor(of: _row('Lark'), matching: find.byType(Tooltip)),
@@ -229,11 +238,14 @@ void main() {
.single
.message!;
expect(tip, contains('Lost "Task of Lark"'));
- expect(_line('Kite', 'Down · MacBook Pro · opus high'), findsOneWidget);
+ expect(
+ _line('Kite', 'Down · MacBook Pro · Opus · high'),
+ findsOneWidget,
+ );
expect(
_line(
'Rook',
- 'Limited until ${two(until.hour)}:${two(until.minute)} · MacBook Pro · opus high',
+ 'Limited until ${two(until.hour)}:${two(until.minute)} · MacBook Pro · Opus · high',
),
findsOneWidget,
);
@@ -241,9 +253,10 @@ void main() {
);
// Builders started with opus high were stored as auto (fixed in the CLI, 2026-10-27); one stored before the fix
- // shows what its start asked for while the start still says, and otherwise that the effort is not known.
+ // shows what its start asked for while the start still says. An effort nobody reported is left out: the PM's row
+ // read "opus unknown" (2026-10-28), and a row says only what is known.
testWidgets(
- 'shows the requested effort for an auto reading its start still names, else unknown',
+ 'shows the requested effort for an auto reading its start still names, else no effort',
(tester) async {
await _swarm(
tester,
@@ -254,13 +267,40 @@ void main() {
],
starts: [_start('Nico', 'high')],
);
- expect(_line('Nico', 'Idle · Mac Studio · opus high'), findsOneWidget);
expect(
- _line('Quinn', 'Idle · Mac Studio · opus unknown'),
+ _line('Nico', 'Idle · Mac Studio · Opus · high'),
+ findsOneWidget,
+ );
+ expect(_line('Quinn', 'Idle · Mac Studio · Opus'), findsOneWidget);
+ expect(_line('Avery', 'Idle · Mac Studio · Opus'), findsOneWidget);
+ expect(find.textContaining('unknown'), findsNothing);
+ },
+ );
+
+ testWidgets(
+ 'names the model by its display name, with its version when reported',
+ (tester) async {
+ await _swarm(
+ tester,
+ agents: [
+ _agent('Iris', 'm1', model: 'claude-opus-5-5'),
+ _agent('Juno', 'm1', model: 'claude-sonnet-5-5', effort: null),
+ _agent(
+ 'Kai',
+ 'm2',
+ engine: 'codex',
+ model: 'gpt-5.6-sol',
+ effort: 'xhigh',
+ ),
+ ],
+ );
+ expect(
+ _line('Iris', 'Idle · Mac Studio · Opus 5.5 · high'),
findsOneWidget,
);
+ expect(_line('Juno', 'Idle · Mac Studio · Sonnet 5.5'), findsOneWidget);
expect(
- _line('Avery', 'Idle · Mac Studio · opus unknown'),
+ _line('Kai', 'Idle · MacBook Pro · GPT-5.6 Sol · xhigh'),
findsOneWidget,
);
},
@@ -274,7 +314,7 @@ void main() {
agents: [_agent('Echo', 'm1')],
starts: [_start('Echo', 'high')],
);
- expect(_line('Echo', 'Idle · Mac Studio · opus high'), findsOneWidget);
+ expect(_line('Echo', 'Idle · Mac Studio · Opus · high'), findsOneWidget);
});
});
@@ -334,16 +374,16 @@ void main() {
await _openGlance(tester);
final counts = find.byKey(const ValueKey('glance-models'));
expect(
- find.descendant(of: counts, matching: find.text('opus high · 3')),
+ find.descendant(of: counts, matching: find.text('Opus · high · 3')),
findsOneWidget,
);
expect(
- find.descendant(of: counts, matching: find.text('sonnet medium · 1')),
+ find.descendant(of: counts, matching: find.text('Sonnet · medium · 1')),
findsOneWidget,
);
expect(
- tester.getTopLeft(find.text('opus high · 3')).dy,
- lessThan(tester.getTopLeft(find.text('sonnet medium · 1')).dy),
+ tester.getTopLeft(find.text('Opus · high · 3')).dy,
+ lessThan(tester.getTopLeft(find.text('Sonnet · medium · 1')).dy),
);
});