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.

Limit Swarm engines to Claude Code and Codex (#1619)

0xken15e7e5bc4a5515
diff --git a/backend/src/superTabs/commands.test.ts b/backend/src/superTabs/commands.test.ts
index b57196850..e75b4ff61 100644
--- a/backend/src/superTabs/commands.test.ts
+++ b/backend/src/superTabs/commands.test.ts
@@ -475,6 +475,18 @@ it('starts only in the chosen conversation, captures authority, and never assign
expect(() => f.run({ type: 'agent.start', request, ...via }, actor, { contribution, ...decisionIn(group) })).toThrow('paused')
})
+it.each(['opencode', 'kilo'])('refuses to dispatch a stored legacy %s start before native launch', engine => {
+ const f = fixture(), lead = f.add('lead', 'owner', 'lead', true), group = f.group()
+ const actor: Actor = { kind: 'agent', agentId: lead, machineOwnerId: 'host-owner' }
+ const contribution = { machineOwnerId: 'target-owner', contributorId: 'owner', hostGrant: 'grant-1' }
+ const request = { conversationId: group, machineId: 'host', engine: 'claude', 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.state.starts![0]!.request.engine = engine // Simulate a start stored before the engine restriction.
+ expect(() => f.run({ type: 'agent.startDispatch', startId }, actor, { contribution })).toThrow('Claude Code or Codex')
+ expect(f.state.starts![0]!.dispatched).toBe(false)
+})
+
describe('agent.start on the Swarm\'s listed machines', () => {
const request = (group: string, machineId: string) => ({ conversationId: group, machineId, engine: 'claude', name: 'Builder', cwd: '/repo', worktree: true,
requirements: { memoryBytes: 0, diskBytes: 0, maxCpuPercent: 100, tools: [], devices: [], quotaRequired: false } })
@@ -798,15 +810,18 @@ it('assigns stable workgroup numbers through old snapshots, rename, archive and
const third = f.group()
expect(f.state.conversations.map(c => [c.id, c.number])).toEqual([['lead', undefined], [first, 1], [second, 2], [third, 3]])
})
-it('records the lead project once and accepts installed engines beyond Claude and Codex', () => {
+it('records the lead project once and accepts only Claude Code and Codex contributions', () => {
const f = fixture(), project = { cwd: '/repo', repositoryUrl: 'https://github.com/example/project' }
f.run({ type: 'agent.add', conversationId: 'lead', machineId: 'host', harnessId: 'lead', name: 'Lead', configuration: config, lead: true, project }, owner,
{ contribution: { machineOwnerId: 'owner', contributorId: 'owner' } })
expect(f.state.project).toEqual({ machineId: 'host', ...project })
expect(() => f.run({ type: 'tab.project', machineId: 'host', project })).toThrow('already has a project')
- const command = commandSchema.parse({ type: 'machine.contribute', machineId: 'host', name: 'Workstation', cwd: '/repo', engines: ['claude', 'codex', 'pi', 'opencode'], maxAgents: 4 })
+ const command = commandSchema.parse({ type: 'machine.contribute', machineId: 'host', name: 'Workstation', cwd: '/repo', engines: ['claude', 'codex'], maxAgents: 4 })
f.run(command, owner, { contribution: { machineOwnerId: 'owner', contributorId: 'owner' } })
- expect(f.state.machines![0]!.engines).toEqual(['claude', 'codex', 'pi', 'opencode'])
+ expect(f.state.machines![0]!.engines).toEqual(['claude', 'codex'])
+ for (const engine of ['opencode', 'kilo']) {
+ expect(commandSchema.safeParse({ ...command, engines: ['claude', engine] }).success).toBe(false)
+ }
})
it('accepts POSIX, Windows drive and UNC folders and refuses relative, drive-relative and control-character ones', () => {
const contribute = (cwd: string) => commandSchema.safeParse({ type: 'machine.contribute', machineId: 'host', name: 'PC', cwd, engines: ['claude'], maxAgents: 1 })
@@ -1040,6 +1055,21 @@ describe('Reviewer role', () => {
expect(() => f.run({ type: 'agent.start', request: request(group, { role: 'reviewer', engine: 'opencode' }) } as Command, owner, { contribution })).toThrow('Claude Code or Codex')
})
+ it.each(['opencode', 'kilo'])('refuses %s for a Builder before a machine can launch it', engine => {
+ const f = fixture(), group = f.group()
+ const start = { type: 'agent.start', request: request(group, { engine }) }
+ expect(commandSchema.safeParse(start).success).toBe(false)
+ expect(() => f.run(start as Command, owner, { contribution })).toThrow('Claude Code or Codex')
+ })
+
+ it('does not add an existing OpenCode session as a Swarm member', () => {
+ const f = fixture()
+ expect(() => f.run({ type: 'agent.add', conversationId: 'lead', machineId: 'host', harnessId: 'open', name: 'Open',
+ configuration: { ...config, engine: 'opencode' }, lead: false }, owner,
+ { contribution: { machineOwnerId: 'owner', contributorId: 'owner' } })).toThrow('Claude Code or Codex')
+ expect(f.state.agents).toHaveLength(0)
+ })
+
it('refuses to assign, route work to or make a Lead of a Reviewer', () => {
const { f, leadActor, group, reviewer } = reviewed()
expect(() => f.run({ type: 'work.assign', conversationId: group, agentId: reviewer })).toThrow('Reviewer')
diff --git a/backend/src/superTabs/commands.ts b/backend/src/superTabs/commands.ts
index 8a4e25ed4..45c88c3e5 100644
--- a/backend/src/superTabs/commands.ts
+++ b/backend/src/superTabs/commands.ts
@@ -16,6 +16,7 @@ const id = z.string().min(1).max(160).regex(/^[A-Za-z0-9_-]+$/)
const title = z.string().trim().min(1).max(160)
const reason = z.string().trim().min(1).max(300)
const text = z.string().trim().min(1).max(32_000)
+const swarmEngine = z.string().min(1).max(80).refine((engine): boolean => engine === 'claude' || engine === 'codex', 'A Swarm agent runs only Claude Code or Codex.')
const configuration = z.object({
engine: z.string().min(1).max(80), model: z.string().max(200).nullable(),
effort: z.string().max(80).nullable(), contextWindow: z.number().int().positive().safe().nullable(),
@@ -36,7 +37,7 @@ const repositoryUrl = z.string().max(4096).refine(value => {
}, 'Share a repository URL without credentials.')
const project = z.object({ cwd: path, repositoryUrl: repositoryUrl.nullable() }).strict()
export const startRequestSchema = z.object({
- conversationId: id, machineId: id, engine: z.string().min(1).max(80), name: title, cwd: path, role: z.enum(['builder', 'reviewer']).optional(),
+ conversationId: id, machineId: id, engine: swarmEngine, name: title, cwd: path, role: z.enum(['builder', 'reviewer']).optional(),
worktree: z.boolean(), branchRef: z.string().max(1024).regex(/^refs\/(heads|remotes)\/[^\s\x00-\x1f\x7f]+$/).optional(),
model: z.string().trim().min(1).max(200).optional(), effort: z.string().trim().min(1).max(80).optional(),
permissionMode: z.string().min(1).max(80).optional(), codexHome: path.optional(),
@@ -52,7 +53,7 @@ const task = z.object({
}).strict()
export const commandSchema = z.discriminatedUnion('type', [
- z.object({ type: z.literal('machine.contribute'), machineId: id, name: title, cwd: path, scope: z.literal('swarm').optional(), engines: z.array(z.string().regex(/^[a-z][a-z0-9_-]{0,79}$/)).min(1).max(32), maxAgents: z.number().int().min(1).max(16),
+ z.object({ type: z.literal('machine.contribute'), machineId: id, name: title, cwd: path, scope: z.literal('swarm').optional(), engines: z.array(swarmEngine).min(1).max(2), maxAgents: z.number().int().min(1).max(16),
ifMissing: z.literal(true).optional() }).strict(),
z.object({ type: z.literal('machine.pause'), machineId: id, paused: z.boolean() }).strict(),
z.object({ type: z.literal('machine.remove'), machineId: id }).strict(),
@@ -420,6 +421,7 @@ export function applyCommand(original: SuperTabState, actor: Actor, input: Comma
break
}
case 'machine.contribute': {
+ if (command.engines.some(engine => engine !== 'claude' && engine !== 'codex')) fail('SWARM_ENGINE', 'A Swarm machine runs only Claude Code or Codex.', 400)
if (actor.kind !== 'person' || context.contribution?.machineOwnerId !== actor.userId) fail('OWNER_REQUIRED', 'Only the machine owner can contribute it.', 403)
const contributor = person(state, actor.userId)
state.machines ??= []
@@ -575,6 +577,7 @@ export function applyCommand(original: SuperTabState, actor: Actor, input: Comma
break
}
case 'agent.add': {
+ if (!['claude', 'codex'].includes(command.configuration.engine)) fail('SWARM_ENGINE', 'A Swarm agent runs only Claude Code or Codex.', 400)
controls(state, actor, command.conversationId)
const group = open(state, command.conversationId)
const project = groupProject(state, group)
@@ -624,8 +627,8 @@ export function applyCommand(original: SuperTabState, actor: Actor, input: Comma
routed(command.routeDecisionId)
requireWorkerDecisions(state, actor, open(state, command.request.conversationId))
if (state.paused) fail('PAUSED', 'New work is paused in this Super Tab.')
- if (command.request.role === 'reviewer' && !['claude', 'codex'].includes(command.request.engine)) {
- fail('REVIEWER_ENGINE', 'A Reviewer runs on Claude Code or Codex.', 400)
+ if (!['claude', 'codex'].includes(command.request.engine)) {
+ fail('SWARM_ENGINE', 'A Swarm agent runs only Claude Code or Codex.', 400)
}
// The Lead's account has machines the Swarm never prepared (no clone of the project), so a Lead may start only where the
// Swarm already lists a machine: a contributed one, or one an agent of the Swarm runs on. A person's start may name any
@@ -668,6 +671,9 @@ export function applyCommand(original: SuperTabState, actor: Actor, input: Comma
controls(state, actor, start.request.conversationId)
if (command.type === 'agent.startDispatch') {
if (state.paused) fail('PAUSED', 'New work is paused in this Super Tab.')
+ if (!['claude', 'codex'].includes(start.request.engine)) {
+ fail('SWARM_ENGINE', 'A Swarm agent runs only Claude Code or Codex.', 400)
+ }
// A start recorded before a rule was added is not launched past it, unless a person asked for it by hand.
const why = actor.kind === 'agent' && !(start.routeDecisionId && context.routeDecision?.override?.by === 'person') && broken(groupRules(start.request.conversationId), startTarget(start.request))
if (why) fail('RULE_BROKEN', `${why} This start was not launched. Route again.`, 403)
diff --git a/backend/src/superTabs/machines.test.ts b/backend/src/superTabs/machines.test.ts
index 7b8d86914..52353ea42 100644
--- a/backend/src/superTabs/machines.test.ts
+++ b/backend/src/superTabs/machines.test.ts
@@ -79,6 +79,16 @@ describe('a start on a contributed machine', () => {
expect(refusal(f.state, f.request())!.message).toContain('it contributes no engines')
})
+ it('uses only installed Claude or Codex from an older contribution with unsupported engines', () => {
+ const f = setup()
+ const pool = f.state.machines![0]!
+ pool.engines = ['opencode', 'kilo']
+ pool.observation = { ...observation, quotas: [{ engine: 'claude', known: false, windows: [] }] }
+ expect(refusal(f.state, f.request({ engine: 'claude' }))).toBeNull()
+ expect(refusal(f.state, f.request({ engine: 'codex' }))).toMatchObject({ code: 'OUTSIDE_CONTRIBUTION' })
+ expect(refusal(f.state, f.request({ engine: 'opencode' }))).toMatchObject({ code: 'OUTSIDE_CONTRIBUTION' })
+ })
+
it.each(['codexHome', 'gridModel', 'gridName'] as const)('names %s as the refused account setting, and not its value', field => {
const f = setup()
const error = refusal(f.state, f.request({ [field]: '/Users/lead/.secret-profile' }))!
diff --git a/backend/src/superTabs/machines.ts b/backend/src/superTabs/machines.ts
index ae1e93be9..7a8b78083 100644
--- a/backend/src/superTabs/machines.ts
+++ b/backend/src/superTabs/machines.ts
@@ -17,6 +17,14 @@ export interface ContributedMachine {
paused: boolean
observation?: MachineObservation & { receivedAt: number }
}
+/** Older contributions may name engines that Swarm no longer starts. Their fresh
+ * observation lists the supported engines that are actually installed. */
+export function contributedEngines(pool: ContributedMachine, observation: MachineObservation | undefined = pool.observation): string[] {
+ const supported = (engine: string) => engine === 'claude' || engine === 'codex'
+ return pool.engines.some(engine => !supported(engine))
+ ? (observation?.quotas ?? []).map(quota => quota.engine).filter(supported)
+ : pool.engines.filter(supported)
+}
const measure = z.number().finite().nonnegative().nullable()
const percent = z.number().min(0).max(100).nullable()
const resource = z.object({
@@ -109,7 +117,8 @@ export function admitMachineStart(state: SuperTabState, request: AgentStartReque
// setting can be a path or a name of the caller's own.
const refused: string[] = []
if (request.cwd !== cwd) refused.push(`cwd (this project uses ${cwd} on it)`)
- if (!pool.engines.includes(request.engine)) refused.push(`engine (it contributes ${pool.engines.join(', ') || 'no engines'})`)
+ const engines = contributedEngines(pool)
+ if (!engines.includes(request.engine)) refused.push(`engine (it contributes ${engines.join(', ') || 'no engines'})`)
const settings = (['codexHome', 'gridModel', 'gridName'] as const).filter(key => request[key])
if (settings.length) refused.push(`${settings.join(', ')} (it runs with its own default account settings, so leave ${settings.length > 1 ? 'them' : 'it'} out)`)
if (request.permissionMode !== undefined && request.permissionMode !== 'full') {
diff --git a/backend/src/superTabs/store.ts b/backend/src/superTabs/store.ts
index 23bb53fc3..cadbf1b41 100644
--- a/backend/src/superTabs/store.ts
+++ b/backend/src/superTabs/store.ts
@@ -1,4 +1,4 @@
-import { machineContribution, machineObservationSchema, machineSlots, recordAgentPresence, type MachineObservation } from './machines.js'
+import { contributedEngines, machineContribution, machineObservationSchema, machineSlots, recordAgentPresence, type MachineObservation } from './machines.js'
import { createHash } from 'node:crypto'
import type { Prisma, PrismaClient, SuperTab, SuperTabDelivery } from '@prisma/client'
import type { AuthUser } from '../lib/ssoAuth.js'
@@ -770,7 +770,7 @@ export class SuperTabStore {
const owned = await tx.machine.findFirst({ where: { machineId, userId: user.sub, autonomousEnv: user.autonomousEnv, ...machineAlive } })
if (!owned || !machineBillingAllowsDataPlane(owned)) fail('HOST_UNAVAILABLE', 'This execution host is unavailable.', 403)
recordAgentPresence(state, machineId, observation.runningHarnessIds, this.now())
- pool.observation = { ...observation, quotas: observation.quotas.filter(q => pool.engines.includes(q.engine)), receivedAt: this.now() }
+ pool.observation = { ...observation, quotas: observation.quotas.filter(q => contributedEngines(pool, observation).includes(q.engine)), receivedAt: this.now() }
// Current-generation physical stop proof also finishes a close whose membership was already withdrawn.
for (const proof of observation.stoppedReservations ?? []) {
if (!observation.stoppedHarnessIds.includes(proof.harnessId)) continue
diff --git a/cli/src/superTabs/capacity.spec.ts b/cli/src/superTabs/capacity.spec.ts
index c1bef3504..c0e99f224 100644
--- a/cli/src/superTabs/capacity.spec.ts
+++ b/cli/src/superTabs/capacity.spec.ts
@@ -25,7 +25,7 @@ it('keeps unknown quota distinct from unused quota and honors all limiting windo
const result = admission(capacity, { installed: true }, quota, requirements)
expect(result.allowed).toBe(false)
expect(result.reasons).toHaveLength(6)
- expect(admission({}, { installed: true, signedIn: false }, quotaOf({}, 'codex', false), requirements).reasons).toContain('The selected agent engine is not signed in on this machine.')
+ expect(admission({}, { installed: true, signedIn: false }, quotaOf({}, 'codex', false), requirements).reasons).not.toContain('The selected agent engine is not signed in on this machine.')
expect(admission({}, {}, quotaOf({}, 'claude', false), { ...requirements, quotaRequired: true }).reasons).toContain('The requested subscription allowance could not be verified.')
})
it('distinguishes a missing tool from a failed probe and keeps the failure detail', async () => {
diff --git a/cli/src/superTabs/capacity.ts b/cli/src/superTabs/capacity.ts
index 09bfd8c3c..65049ab1d 100644
--- a/cli/src/superTabs/capacity.ts
+++ b/cli/src/superTabs/capacity.ts
@@ -90,7 +90,6 @@ export function admission(capacity: Json, engine: Json, quota: ReturnType<typeof
const reasons: string[] = [], unknown: string[] = []
const resources = object(capacity.resources), tools = object(capacity.tools), devices = object(capacity.devices), toolProbeErrors = object(capacity.toolProbeErrors)
if (engine.installed !== true) reasons.push('The selected agent engine is not installed on this machine.')
- if (engine.signedIn === false && !customAccount) reasons.push('The selected agent engine is not signed in on this machine.')
const memory = finite(resources.memoryTotalBytes) && finite(resources.memoryUsedBytes)
? resources.memoryTotalBytes - resources.memoryUsedBytes : null
for (const [label, value, needed] of [
diff --git a/cli/src/superTabs/contribution.spec.ts b/cli/src/superTabs/contribution.spec.ts
index c7955b984..f01ae6bcf 100644
--- a/cli/src/superTabs/contribution.spec.ts
+++ b/cli/src/superTabs/contribution.spec.ts
@@ -34,7 +34,7 @@ describe('one-field machine preparation', () => {
const core = fakeCore({ dataDir })
const result = await prepareContribution(core, { tabId: 'tab', scope: 'swarm' }, f.deps as never)
const cwd = join(homedir(), 'harnesses', 'swarms', 'tab')
- expect(result).toMatchObject({ scope: 'swarm', cwd, engines: ['claude', 'pi'] })
+ expect(result).toMatchObject({ scope: 'swarm', cwd, engines: ['claude', 'codex'] })
expect((await stat(cwd)).isDirectory()).toBe(true)
expect(f.deps.prepare).not.toHaveBeenCalled()
expect(f.deps.capacity).toHaveBeenCalledWith({ cwd, tools: ['git'], devices: [] })
@@ -45,11 +45,21 @@ describe('one-field machine preparation', () => {
})
it('uses the lead project on its host and probes all engines without inventing authentication', async () => {
const f = fixture()
- expect(await f.run()).toEqual({ ok: true, state: 'ready', cwd: '/repo', engines: ['claude', 'pi'], maxAgents: 8, maxAvailableAgents: 16 })
- expect(f.request).toHaveBeenCalledWith('engines_probe', { accounts: true }, 20000)
+ expect(await f.run()).toEqual({ ok: true, state: 'ready', cwd: '/repo', engines: ['claude', 'codex'], maxAgents: 8, maxAvailableAgents: 16 })
+ expect(f.request).toHaveBeenCalledWith('engines_probe', { engines: ['claude', 'codex'], accounts: true }, 20000)
expect(f.deps.prepare).not.toHaveBeenCalled()
expect(f.close).toHaveBeenCalledOnce()
})
+ it('offers installed Claude and Codex even when the account probe reports no vendor login', async () => {
+ const f = fixture()
+ f.request.mockResolvedValueOnce({ engines: [
+ { engine: 'claude', installed: true, signedIn: false },
+ { engine: 'codex', installed: true, signedIn: false },
+ { engine: 'opencode', installed: true, signedIn: true },
+ { engine: 'kilo', installed: true, signedIn: true },
+ ] })
+ expect(await f.run()).toMatchObject({ engines: ['claude', 'codex'] })
+ })
it.each([
{ totalGiB: 32, usedGiB: 30, maxAgents: 8, maxAvailableAgents: 16 },
{ totalGiB: 16, usedGiB: 15, maxAgents: 4, maxAvailableAgents: 8 },
@@ -92,7 +102,7 @@ describe('one-field machine preparation', () => {
it('fails when no installed engine or project disk can be read and closes the connection', async () => {
const f = fixture()
f.request.mockResolvedValueOnce({ engines: [] })
- await expect(f.run()).rejects.toThrow('Sign in')
+ await expect(f.run()).rejects.toThrow('Install Claude Code or Codex')
f.deps.capacity.mockResolvedValueOnce({ error: 'INVALID_REQUEST' } as never)
await expect(f.run()).rejects.toThrow('project folder')
expect(f.close).toHaveBeenCalledTimes(2)
diff --git a/cli/src/superTabs/contribution.ts b/cli/src/superTabs/contribution.ts
index e257f0710..c134d83ae 100644
--- a/cli/src/superTabs/contribution.ts
+++ b/cli/src/superTabs/contribution.ts
@@ -36,13 +36,13 @@ export async function prepareContribution(core: CoreApi, input: Json, deps = {
const connection = await deps.open({ dataDir: core.dataDir, port: core.daemon.port, machineId })
try {
const [probe, capability] = await Promise.all([
- connection.request('engines_probe', { accounts: true }, 20_000),
+ connection.request('engines_probe', { engines: ['claude', 'codex'], accounts: true }, 20_000),
deps.capacity({ cwd, tools: ['git'], devices: [] }),
])
const engines = (Array.isArray(probe.engines) ? probe.engines.map(object) : [])
- .filter(e => identifier(e.engine) && e.engine !== 'terminal' && e.installed === true && e.signedIn !== false)
+ .filter(e => (e.engine === 'claude' || e.engine === 'codex') && e.installed === true)
.map(e => e.engine as string)
- if (!engines.length) throw new Error('Sign in to an agent on this machine, then try again.')
+ if (!engines.length) throw new Error('Install Claude Code or Codex on this machine, then try again.')
const resources = object('resources' in capability ? capability.resources : null)
if (capability.ok !== true || typeof resources.projectDiskFreeBytes !== 'number') throw new Error('The project folder is unavailable on this machine.')
const total = typeof resources.memoryTotalBytes === 'number' ? resources.memoryTotalBytes : 0
diff --git a/cli/src/superTabs/machines.spec.ts b/cli/src/superTabs/machines.spec.ts
index fc0474dcc..1d09c6b02 100644
--- a/cli/src/superTabs/machines.spec.ts
+++ b/cli/src/superTabs/machines.spec.ts
@@ -13,17 +13,29 @@ function fixture() {
const pool = { tabId: 'tab', machine: { machineId: 'host', generation: 'grant', cwd: '/repo', engines: ['codex'], paused: false },
harnessIds: ['running', 'stopped'], starts: [{ id: 'start', dispatched: false }], paused: false }
const backend = vi.fn(async (_core: unknown, method: string, path: string, _body?: unknown): Promise<unknown> => path.endsWith('/pools') ? [pool] : { revision: 1 })
- const request = vi.fn(async () => ({ providers: [{ provider: 'codex', outcome: 'answered', httpStatus: 200,
+ const request = vi.fn(async (_type: string): Promise<Record<string, unknown>> => ({ providers: [{ provider: 'codex', outcome: 'answered', httpStatus: 200,
body: { account_email: '[email protected]', secret: 'private-token', rate_limit: { primary_window: { used_percent: 25, reset_at: 1234567890 } } } }] }))
const close = vi.fn(), open = vi.fn(async () => ({ machineId: 'host', request, close }))
const capabilities = vi.fn(async (_input: { cwd: string; tools: string[]; devices: string[] }) => ({ ok: true, resources: { cpuPercent: 20, memoryTotalBytes: 1000, memoryUsedBytes: 200, projectDiskFreeBytes: 1000 }, tools: { git: true } }))
const start = vi.fn(async () => ({ ok: true }))
const prepare = vi.fn(async () => {})
const machine = new ContributedMachines(core, 'host', { backend, open, capabilities, start, prepare, now: () => now } as never)
- return { machine, pool, core, backend, open, close, capabilities, start, prepare, advance: () => { now += 16000 }, step: (ms: number) => { now += ms } }
+ return { machine, pool, core, backend, open, request, close, capabilities, start, prepare, advance: () => { now += 16000 }, step: (ms: number) => { now += ms } }
}
describe('contributed machine executor', () => {
+ it('reports only installed supported engines for a legacy OpenCode contribution', async () => {
+ const f = fixture()
+ f.pool.machine.engines = ['opencode']
+ const usage = f.request.getMockImplementation()!
+ f.request.mockImplementation(async type => type === 'engines_probe'
+ ? { engines: [{ engine: 'claude', installed: true, signedIn: false }, { engine: 'codex', installed: false }] }
+ : usage(type))
+ await f.machine.tick()
+ const body = f.backend.mock.calls.find(c => c[1] === 'POST')![3]
+ expect(body).toMatchObject({ quotas: [{ engine: 'claude' }] })
+ expect(f.request).toHaveBeenCalledWith('engines_probe', { engines: ['claude', 'codex'] }, 20_000)
+ })
it('prepares a swarm project before dispatch and durably rejects an unsafe checkout', async () => {
const f = fixture()
Object.assign(f.pool.machine, { scope: 'swarm' })
@@ -144,7 +156,7 @@ describe('contributed machine executor', () => {
it('a lead queues a contributed start without connecting to that computer', async () => {
const open = vi.fn()
- const scoped = vi.fn(async () => ({ ok: true, value: { creationId: 'creation', poolGeneration: 'grant', request: { machineId: 'host' } } }))
+ const scoped = vi.fn(async () => ({ ok: true, value: { creationId: 'creation', poolGeneration: 'grant', request: { machineId: 'host', engine: 'claude' } } }))
const reply = await startAgent({ startId: 'start' }, scoped, { port: 14001, machineId: 'lead', dataDir: '/fixture' }, open)
expect(reply).toMatchObject({ ok: true, queued: true, startId: 'start', machineId: 'host' })
expect(open).not.toHaveBeenCalled()
diff --git a/cli/src/superTabs/machines.ts b/cli/src/superTabs/machines.ts
index 24f4af9b9..fd204c32d 100644
--- a/cli/src/superTabs/machines.ts
+++ b/cli/src/superTabs/machines.ts
@@ -105,6 +105,14 @@ export class ContributedMachines {
if (result?.value !== null && result?.value !== undefined) reportedTools[name] = result.value
else toolProbeErrors[name] = result?.detail ?? 'The tool probe did not complete.'
}
+ const listedEngines = Array.isArray(pool.engines) ? pool.engines.filter((engine): engine is string => typeof engine === 'string') : []
+ const supported = (engine: string) => engine === 'claude' || engine === 'codex'
+ // Older contributions may name only OpenCode or another retired Swarm engine. Probe this host so their
+ // replacement choices reflect the engines actually installed here, without changing the owner's slot limit.
+ const engines = listedEngines.some(engine => !supported(engine))
+ ? list(object(await local.request('engines_probe', { engines: ['claude', 'codex'] }, 20_000).catch(() => ({}))).engines)
+ .filter(engine => supported(String(engine.engine)) && engine.installed === true).map(engine => String(engine.engine))
+ : listedEngines.filter(supported)
const observation = { generation: pool.generation, tools: reportedTools,
...(Object.keys(toolProbeErrors).length ? { toolProbeErrors } : {}),
resources: { cpuPercent: finite(resources.cpuPercent), memoryUsedBytes: finite(resources.memoryUsedBytes), memoryTotalBytes: finite(resources.memoryTotalBytes),
@@ -112,7 +120,7 @@ export class ContributedMachines {
deviceType: typeof resources.deviceType === 'string' ? resources.deviceType : null,
chip: typeof resources.chip === 'string' ? resources.chip : null, os: typeof resources.os === 'string' ? resources.os : null,
gpuPercent: gpus.length ? Math.max(...gpus) : null },
- quotas: (Array.isArray(pool.engines) ? pool.engines : []).filter((e): e is string => typeof e === 'string').map(engine => {
+ quotas: engines.map(engine => {
const q = quotaOf(readings, engine, false)
return { engine, known: q.known, windows: q.windows }
}), runningHarnessIds: running, stoppedHarnessIds: stopped,
diff --git a/cli/src/superTabs/routeCommand.spec.ts b/cli/src/superTabs/routeCommand.spec.ts
index 787d17947..00f7d0777 100644
--- a/cli/src/superTabs/routeCommand.spec.ts
+++ b/cli/src/superTabs/routeCommand.spec.ts
@@ -59,6 +59,17 @@ const recorded = (s: ReturnType<typeof scoped>) => s.mock.calls.find(c => c[0].a
const labels = (s: ReturnType<typeof scoped>) => (recorded(s).command.decision.candidates as Array<{ label: string }>).map(c => c.label)
describe('routeTask', () => {
+ it('never offers OpenCode or Kilo even if an old policy enables them', async () => {
+ const oldPolicy = { ...policy, models: [...policy.models.map(model => ({ ...model, enabled: false })),
+ { engine: 'opencode', model: 'default', effort: 'default', quality: 3, cost: 1, enabled: true },
+ { engine: 'kilo', model: 'default', effort: 'default', quality: 3, cost: 1, enabled: true }] }
+ const oldTab = tab(); oldTab.state.agents = [agents[1]]
+ const s = scoped({ context: { ok: true, value: { agentId: 'lead', tab: oldTab, policy: { policy: oldPolicy },
+ machines: [{ machineId: 'm1', name: 'remote-1' }] } } })
+ const result = await routeTask(input, s, where as never, opener(id => daemon(id, { agents: id === 'm1' ? ['h1'] : [],
+ engines: [{ engine: 'claude', installed: true }, { engine: 'opencode', installed: true }, { engine: 'kilo', installed: true }] })))
+ expect(result).toMatchObject({ error: 'NO_CANDIDATE' })
+ })
it('offers the same member after Change agent when only its replacement terminal is live', async () => {
const rebound = tab()
rebound.state.agents = agents.map(a => a.id === 'a1' ? { ...a, harnessId: 'replacement' } : a)
@@ -636,6 +647,13 @@ describe('routing contributed capacity', () => {
const member = await runPool(healthy(), true)
expect(member.answer.ok).toBe(true)
})
+ it('reads an old OpenCode contribution as its installed Claude observation', async () => {
+ const pool = healthy()
+ pool.engines = ['opencode']
+ const { answer, s } = await runPool(pool)
+ expect(answer).toMatchObject({ ok: true, pick: { engine: 'claude' } })
+ expect(recorded(s).command.decision.candidates.every((c: { engine: string }) => c.engine === 'claude')).toBe(true)
+ })
it('keeps a healthy contributed member pickable', async () => {
const { answer, s } = await runPool(healthy(), true)
expect(answer.ok).toBe(true)
diff --git a/cli/src/superTabs/routeCommand.ts b/cli/src/superTabs/routeCommand.ts
index 6ef077bac..1c085b542 100644
--- a/cli/src/superTabs/routeCommand.ts
+++ b/cli/src/superTabs/routeCommand.ts
@@ -155,7 +155,7 @@ export async function routeTask(input: { tabId: string; conversationId: string;
}
machines.set(String(pool.machineId), { name: String(pool.name), status: 'contributed', account: false, pool })
}
- const enabled = policy.models.filter(m => m.enabled)
+ const enabled = policy.models.filter(m => m.enabled && ENGINES.includes(m.engine))
// The probes do not wait for the context reads: the machines, the task's folder and the group's talk and log are read
// together, and each read that is only context gives up after three seconds. What needs several of them (whether a
@@ -207,7 +207,10 @@ export async function routeTask(input: { tabId: string; conversationId: string;
async function probeMachine(machineId: string, { name: machineName, status, account, pool }: { name: string; status: string; account: boolean; pool?: Json },
members: Json[], allModels: Policy['models'], policy: Policy, a: Assessment, where: Where, open: typeof openDaemon): Promise<Probe[]> {
- const models = pool ? allModels.filter(m => Array.isArray(pool.engines) && pool.engines.includes(m.engine)) : account ? allModels : []
+ const listedEngines = Array.isArray(pool?.engines) ? pool.engines.filter((engine): engine is string => typeof engine === 'string') : []
+ const legacy = listedEngines.some(engine => !ENGINES.includes(engine))
+ const installed = legacy ? list(object(pool?.observation).quotas).map(quota => quota.engine) : listedEngines
+ const models = pool ? allModels.filter(m => installed.includes(m.engine)) : account ? allModels : []
const engines = [...new Set([...models.map(m => m.engine), ...members.map(m => String(object(m.configuration).engine) as 'claude' | 'codex')])]
const memberProbe = (m: Json, refusals: string[] = [], quota = UNKNOWN_QUOTA, frame: MemberFrame | null = null, terminalUnverified = false): Probe => {
const c = object(m.configuration), engine = String(c.engine) as 'claude' | 'codex'
diff --git a/cli/src/superTabs/start.spec.ts b/cli/src/superTabs/start.spec.ts
index 80932b420..3fdf3c249 100644
--- a/cli/src/superTabs/start.spec.ts
+++ b/cli/src/superTabs/start.spec.ts
@@ -1,12 +1,5 @@
import { describe, expect, it, vi } from 'vitest'
-import { startAgent } from './start.js'
-import { mkdtempSync, rmSync } from 'node:fs'
-import { tmpdir } from 'node:os'
-import { join } from 'node:path'
-import { createLaunchRequests } from '../core/agents/launches.js'
-import { AgentCreationReceipts } from '../lib/agentCreationReceipt.js'
-import type { RegisteredSession } from '../lib/registry.js'
-import type { AgentFrame } from '../lib/agentFrame.js'
+import { inspectCapacity, startAgent } from './start.js'
import { buildEngineCommandArgv } from '../lib/engineLaunch.js'
const where = { port: 14001, machineId: 'lead-machine', dataDir: '/fixture' }
function fixture(options: { state?: Record<string, unknown> | Error; refuse?: string; loseCancel?: boolean; loseFailure?: boolean; launchModel?: string[]; refuseModel?: string; frame?: string; guest?: boolean; identity?: { sessionId: string; createdAt: string } } = {}) {
@@ -58,6 +51,13 @@ function fixture(options: { state?: Record<string, unknown> | Error; refuse?: st
const switchCall = (f: { request: { mock: { calls: unknown[][] } } }) => f.request.mock.calls.find(c => c[0] === 'agent_update')
describe('Swarm permission mode', () => {
+ it('admits installed Claude when an API environment is opaque to the vendor login probe', async () => {
+ const f = fixture(), request = f.request.getMockImplementation()!
+ f.request.mockImplementation(async (type, payload, ms) => type === 'engines_probe'
+ ? { engines: [{ engine: 'claude', installed: true, signedIn: false }] }
+ : request(type, payload, ms))
+ expect(await inspectCapacity(await f.open() as never, f.start.request)).toMatchObject({ allowed: true, engine: { installed: true, signedIn: false } })
+ })
it.each(['claude', 'codex'] as const)('starts %s in full mode on direct and contributed hosts', async engine => {
for (const hostDispatch of [false, true]) {
const f = fixture()
@@ -72,34 +72,39 @@ describe('Swarm permission mode', () => {
}
})
- it.each(['opencode', 'hermes'])('keeps %s launchable through the real native permission validator', async engine => {
+ it.each(['opencode', 'kilo'])('fails a pending legacy %s Swarm start before native creation', async engine => {
+ const f = fixture()
+ Object.assign(f.start.request, { engine })
+ expect(await startAgent({ action: 'resume', tabId: 'tab', startId: 'start' }, f.scoped, where, f.open)).toMatchObject({ error: 'SWARM_ENGINE' })
+ expect(f.start.error).toContain('Claude Code or Codex')
+ expect(f.open).not.toHaveBeenCalled()
+ })
+
+ it.each(['opencode', 'kilo'])('keeps a dispatched legacy %s start uncertain without marking it failed', async engine => {
+ const f = fixture()
+ Object.assign(f.start.request, { engine })
+ f.start.dispatched = true
+ expect(await startAgent({ action: 'resume', tabId: 'tab', startId: 'start' }, f.scoped, where, f.open))
+ .toMatchObject({ error: 'START_UNCERTAIN', creationId: f.start.creationId })
+ expect(f.start.error).toBeNull()
+ expect(f.scoped.mock.calls.some(c => (c[0].command as any)?.type === 'agent.startFailed')).toBe(false)
+ expect(f.request.mock.calls.map(c => c[0])).toEqual(['agent_create_status'])
+ })
+
+ it('reconciles an already-created legacy OpenCode agent instead of orphaning it', async () => {
const f = fixture(), request = f.request.getMockImplementation()!
- Object.assign(f.start.request, { engine, worktree: false })
- const folder = mkdtempSync(join(tmpdir(), 'swarm-native-'))
- const created: Array<Record<string, unknown>> = []
- const native = createLaunchRequests({
- receipts: new AgentCreationReceipts(folder),
- createAgent: () => async input => {
- created.push(input)
- return { ok: true, session: { agentId: 'native', engine } as RegisteredSession }
- },
- forkAgent: () => null, resumeAgent: () => null, restartAgent: () => null,
- byAgent: () => undefined, toProject: async () => ({ id: 'native', engine }) as AgentFrame,
- modelTarget: async () => null,
- })
- f.request.mockImplementation(async (type, payload) => {
- if (type === 'agent_create') {
- let reply: Record<string, unknown> = {}
- await native.create({ ...payload, creationId: undefined }, { local: true }, value => { reply = value })
- if (reply.error) return reply
- }
- return request(type, payload)
- })
- try {
- expect(await startAgent({ action: 'resume', tabId: 'tab', startId: 'start' }, f.scoped, where, f.open)).toMatchObject({ ok: true })
- expect(created).toHaveLength(1)
- expect(created[0]).toMatchObject({ permissionMode: null, bypassPermission: true })
- } finally { native.stop(); rmSync(folder, { recursive: true, force: true }) }
+ Object.assign(f.start.request, { engine: 'opencode' })
+ f.start.dispatched = true
+ f.request.mockImplementation(async (type, payload, ms) => type === 'agent_create_status'
+ ? { creationId: f.start.creationId, state: 'created', agent: { id: 'native', engine: 'opencode' } }
+ : request(type, payload, ms))
+ expect(await startAgent({ action: 'resume', tabId: 'tab', startId: 'start' }, f.scoped, where, f.open))
+ .toMatchObject({ ok: true, harnessId: 'native' })
+ expect(f.start.error).toBeNull()
+ const commands = f.scoped.mock.calls.map(c => c[0].command as Record<string, any> | undefined)
+ expect(commands.find(c => c?.type === 'agent.started')).toMatchObject({ configuration: { engine: 'opencode' } })
+ expect(commands.some(c => c?.type === 'agent.startFailed')).toBe(false)
+ expect(f.request.mock.calls.some(c => c[0] === 'agent_create')).toBe(false)
})
it('recovers the same legacy start after its accepted reply is lost', async () => {
@@ -205,18 +210,13 @@ const expectSwitchTo = (f: Parameters<typeof switchCall>[0], selectedModel: stri
expect(call[2]).toBeGreaterThan(50_000)
expect(call[2]).toBeLessThanOrEqual(60_000)
}
-it.each(['claude', 'codex', 'opencode'])('only tells supported %s workers to use their built-in skill', async engine => {
+it.each(['claude', 'codex'])('tells supported %s workers to use their built-in skill', async engine => {
const f = fixture()
f.start.request.engine = engine
await startAgent({ action: 'start', tabId: 'tab', operationId: 'role-prompt', request: f.start.request }, f.scoped, where, f.open)
const payload = f.request.mock.calls.find(call => call[0] === 'agent_create')![1]!
- if (engine === 'claude' || engine === 'codex') {
- expect(payload.prompt).toContain('swarm-dev')
- expect(payload.swarmRole).toBe('dev')
- } else {
- expect(payload.prompt).not.toContain('swarm-dev')
- expect(payload.swarmRole).toBeUndefined()
- }
+ expect(payload.prompt).toContain('swarm-dev')
+ expect(payload.swarmRole).toBe('dev')
})
it.each(['claude', 'codex'])('starts a %s Reviewer with the built-in swarm-review skill', async engine => {
diff --git a/cli/src/superTabs/start.ts b/cli/src/superTabs/start.ts
index 1bd751303..ed6ac5b91 100644
--- a/cli/src/superTabs/start.ts
+++ b/cli/src/superTabs/start.ts
@@ -98,6 +98,12 @@ export async function startAgent(input: Json, scoped: ScopedRequest, where: Wher
const request = object(start.request), creationId = start.creationId
if (!identifier(request.machineId) || !identifier(creationId)) throw new Error('This start receipt is invalid.')
if (start.error) return { error: 'START_FAILED', startId, detail: start.error }
+ if (!start.dispatched && !start.harnessId && request.engine !== 'claude' && request.engine !== 'codex') {
+ const detail = 'A Swarm agent runs only Claude Code or Codex.'
+ requireSuccess(await scoped({ action: 'command', operationId: `unsupported-${randomUUID()}`,
+ command: { type: 'agent.startFailed', startId, error: detail } }))
+ return { error: 'SWARM_ENGINE', startId, detail }
+ }
if (start.harnessId && (!start.poolGeneration || start.poolSettled)) return { ok: true, startId, machineId: request.machineId, harnessId: start.harnessId,
...(permissionWarning ? { permissionWarning } : {}) }
// Contributed capacity is executed by its owner. A collaborator receives no
diff --git a/desktop/lib/screens/swarm_screen.dart b/desktop/lib/screens/swarm_screen.dart
index a08b137be..2dab61668 100644
--- a/desktop/lib/screens/swarm_screen.dart
+++ b/desktop/lib/screens/swarm_screen.dart
@@ -6265,6 +6265,18 @@ class _SwarmScreenState extends State<SwarmScreen> {
agent.harnessId == row.agentId,
)
.firstOrNull;
+ final native = app
+ .stateOf(row.machineId ?? '')
+ ?.agents
+ .where((agent) => agent.id == row.agentId)
+ .firstOrNull;
+ final engine = agent?.engine ?? native?.engine ?? row.engine;
+ if (engine != null &&
+ engine != 'terminal' &&
+ engine != 'claude' &&
+ engine != 'codex') {
+ return 'Only Claude Code or Codex can join this Swarm.';
+ }
if (agent != null) {
if (agent.projectId != contributionProject?.id) {
return 'This agent belongs to another project. Create a new agent here.';
@@ -6277,11 +6289,6 @@ class _SwarmScreenState extends State<SwarmScreen> {
? 'Already in this conversation.'
: null;
}
- final native = app
- .stateOf(row.machineId ?? '')
- ?.agents
- .where((agent) => agent.id == row.agentId)
- .firstOrNull;
return native != null &&
native.engine != 'terminal' &&
native.terminalAvailable &&
diff --git a/desktop/lib/super_tabs/machines.dart b/desktop/lib/super_tabs/machines.dart
index b964a0276..ac8cb3e69 100644
--- a/desktop/lib/super_tabs/machines.dart
+++ b/desktop/lib/super_tabs/machines.dart
@@ -650,6 +650,19 @@ class _SuperTabMachinesState extends State<SuperTabMachines> {
}
if (!context.mounted || !c.canWrite) return;
final machine = app.stateOf(selected);
+ final engines =
+ (prepared['engines'] as List?)
+ ?.whereType<String>()
+ .where((engine) => _chipEngines.contains(engine))
+ .toSet()
+ .toList() ??
+ <String>[];
+ if (engines.isEmpty) {
+ throw const SuperTabFailure(
+ 'NO_SWARM_ENGINE',
+ 'Install Claude Code or Codex on this machine, then try again.',
+ );
+ }
// A machine with no number of its own whose reading failed,
// or had not answered yet, is showing the floor rather than
// a suggestion. The owner never chose that, so send what
@@ -690,7 +703,7 @@ class _SuperTabMachinesState extends State<SuperTabMachines> {
'name': machine!.machine.displayName,
'cwd': prepared['cwd'],
if (prepared['scope'] != null) 'scope': prepared['scope'],
- 'engines': prepared['engines'],
+ 'engines': engines,
'maxAgents': slots,
});
if (result == null) {
@@ -954,7 +967,17 @@ class _SuperTabMachinesState extends State<SuperTabMachines> {
shared?['name'] as String? ??
state?.machine.displayName ??
'Unavailable machine';
- final allowed = (shared?['engines'] as List?)?.cast<String>();
+ final configured = (shared?['engines'] as List?)
+ ?.whereType<String>()
+ .toList();
+ final allowed =
+ configured?.any((engine) => !_chipEngines.contains(engine)) == true
+ ? [
+ for (final raw in observation['quotas'] as List? ?? [])
+ if (_chipEngines.contains(superTabMap(raw)['engine']))
+ superTabMap(raw)['engine'] as String,
+ ]
+ : configured?.where(_chipEngines.contains).toList();
var accounts =
_usage?.rows
.where(
diff --git a/desktop/test/super_tab_machines_test.dart b/desktop/test/super_tab_machines_test.dart
index 86146c3bf..0ef302f55 100644
--- a/desktop/test/super_tab_machines_test.dart
+++ b/desktop/test/super_tab_machines_test.dart
@@ -1425,7 +1425,7 @@ void main() {
'name': f.app.stateOf('m')!.machine.displayName,
'cwd': '/work/project',
'scope': 'swarm',
- 'engines': ['claude', 'codex', 'pi'],
+ 'engines': ['claude', 'codex'],
'maxAgents': 8,
});
expect(f.connection.calls.where((c) => c.$1 == 'agent_create'), isEmpty);
@@ -1799,6 +1799,7 @@ void main() {
{
'machineId': 'm',
'contributorId': 'owner',
+ 'engines': ['opencode'],
'observation': {
'receivedAt': DateTime.now().millisecondsSinceEpoch,
'quotas': [
@@ -1843,6 +1844,7 @@ void main() {
);
await tester.tap(find.byKey(const ValueKey('super-machine-m')));
await tester.pumpAndSettle();
+ expect(find.text('OpenCode'), findsNothing);
expect(
tester
.widgetList<EngineMark>(find.byType(EngineMark))
@@ -1957,7 +1959,7 @@ void main() {
'name': f.app.stateOf('m')!.machine.displayName,
'cwd': '/work/project',
'scope': 'swarm',
- 'engines': ['claude', 'codex', 'pi'],
+ 'engines': ['claude', 'codex'],
'maxAgents': 4,
});
expect(tester.takeException(), isNull);
@@ -2099,7 +2101,7 @@ void main() {
'name': f.app.stateOf('m')!.machine.displayName,
'cwd': '/work/project',
'scope': 'swarm',
- 'engines': ['claude', 'codex', 'pi'],
+ 'engines': ['claude', 'codex'],
'maxAgents': 4,
});
expect(tester.takeException(), isNull);
@@ -2281,7 +2283,7 @@ void main() {
'name': f.app.stateOf('m')!.machine.displayName,
'cwd': '/work/project',
'scope': 'swarm',
- 'engines': ['claude', 'codex', 'pi'],
+ 'engines': ['claude', 'codex'],
'maxAgents': 16,
});
expect(tester.takeException(), isNull);
diff --git a/desktop/test/super_tab_picker_test.dart b/desktop/test/super_tab_picker_test.dart
index 636dbf734..9d1fbd158 100644
--- a/desktop/test/super_tab_picker_test.dart
+++ b/desktop/test/super_tab_picker_test.dart
@@ -34,6 +34,7 @@ void main() {
Size size = const Size(1280, 800),
Brightness brightness = Brightness.dark,
double scale = 1,
+ List<Agent> extraLocalAgents = const [],
}) async {
final oldEntry = newHarnessOpensInBox;
newHarnessOpensInBox = true;
@@ -69,6 +70,7 @@ void main() {
engine: 'terminal',
terminalAvailable: true,
),
+ ...extraLocalAgents,
];
final c = await f.app.superTabs.open(tabId);
await c.refresh();
@@ -116,7 +118,9 @@ void main() {
),
);
await tester.pumpAndSettle();
- final machine = find.byKey(const ValueKey('super-machine-teammate-machine'));
+ final machine = find.byKey(
+ const ValueKey('super-machine-teammate-machine'),
+ );
if (machine.evaluate().isEmpty &&
find.byTooltip('Conversations').evaluate().isNotEmpty) {
await tester.tap(find.byTooltip('Conversations'));
@@ -250,6 +254,49 @@ void main() {
},
);
+ testWidgets(
+ 'Add agent disables running engines outside Claude Code and Codex',
+ (tester) async {
+ final f = await open(
+ tester,
+ extraLocalAgents: const [
+ Agent(
+ id: 'open-code',
+ name: 'OpenCode builder',
+ engine: 'opencode',
+ terminalAvailable: true,
+ ),
+ Agent(
+ id: 'pi-agent',
+ name: 'Pi builder',
+ engine: 'pi',
+ terminalAvailable: true,
+ ),
+ ],
+ );
+ final search = tester
+ .widget<SwarmSearchResults>(find.byType(SwarmSearchResults))
+ .search;
+ for (final id in ['open-code', 'pi-agent']) {
+ final row = search.rows.singleWhere((row) => row.agentId == id);
+ expect(
+ search.sessionUnavailable(row),
+ 'Only Claude Code or Codex can join this Swarm.',
+ );
+ expect(search.canSubmit(row), isFalse);
+ }
+ expect(
+ search.canSubmit(
+ search.rows.singleWhere((row) => row.agentId == 'local-agent'),
+ ),
+ isTrue,
+ );
+ await tester.pumpWidget(const SizedBox());
+ await f.app.superTabs.peek(tabId)!.flush();
+ f.app.superTabs.dispose();
+ },
+ );
+
testWidgets(
'withdrawing conversation access closes Add agent without contributing',
(tester) async {