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.
TypeScript 3d-modelingagent-frameworkagent-harnessai-agentscadclaude-codecodexcoding-agentsdeveloper-toolsesp32game-developmentmcp-servermulti-agentopen-hardwareopencodeopenharnesspcbroboticsterminaltmux
fix(super-tabs): a start held on a missing dependency says why, and fails at 5 minutes instead of 15 (#1922)
0xken15699fc7f58644
diff --git a/cli/src/superTabs/machines.spec.ts b/cli/src/superTabs/machines.spec.tsindex d7648f648..08b005f9c 100644--- a/cli/src/superTabs/machines.spec.ts+++ b/cli/src/superTabs/machines.spec.ts@@ -15,6 +15,7 @@ import { startAgent } from './start.js'import { hostForm, swarmReply } from './fixtures/read/index.js'import { HostFeed } from './hostFeed.js'import { SwarmReads } from './swarmReads.js'+import { object } from './wire.js'import { processCoreApi } from '../services/processCoreApi.js'import type { PrivacyObservation } from '../team/privacy.js'@@ -995,6 +996,66 @@ describe('contributed machine executor', () => {}})+ // Diego's Mac, 2026-10-28: a Harness Team account's creation was held on its engine for the whole 15 minutes; the+ // backend then failed it "still preparing", and nobody could read what it waited for.+ describe('held on a dependency', () => {+ const held = { service: 'native', detail: 'Waiting to confirm access to the selected engine executable.' }+ const heldCreation = { ...pendingCreation, held, detail: `${held.detail} ${pendingCreation.detail}` }+ const commands = (f: ReturnType<typeof fixture>) => f.backend.mock.calls+ .filter(c => String(c[2]).includes('/starts/tab/start')).map(c => object(c[3]).command).filter(Boolean)+ const launched = (result: Record<string, unknown>, cancel: Record<string, unknown> = { creationId: 'creation', state: 'cancelled' }) => {+ const f = fixture()+ f.pool.starts[0]!.dispatched = true+ f.start.mockResolvedValue(result as never)+ const usage = f.request.getMockImplementation()!+ f.request.mockImplementation(async (type, ...rest) => type === 'agent_create_cancel' ? cancel : usage(type, ...rest as []))+ return f+ }++ it('is stopped on this machine and failed with what it waited for, once held 5 minutes', async () => {+ const f = launched(heldCreation)+ await f.machine.tick()+ f.step(295_000); await f.machine.tick()+ expect(f.request.mock.calls.filter(c => c[0] === 'agent_create_cancel')).toHaveLength(0)+ f.step(5_000); await f.machine.tick()+ expect(f.request.mock.calls.filter(c => c[0] === 'agent_create_cancel')).toEqual([['agent_create_cancel', { creationId: 'creation' }, 10_000]])+ expect(commands(f)).toEqual([{ type: 'agent.startFailed', startId: 'start',+ error: 'This machine held the agent\'s launch for 5 minutes and stopped it: Waiting to confirm access to the selected engine executable.' }])+ expect(f.log).toHaveBeenCalledWith(`Swarm start start is waiting: ${heldCreation.detail}`)+ })++ it('is never failed while its creation is under way, or Harness installs its engine', async () => {+ for (const result of [pendingCreation, { ...heldCreation, held: { service: 'install', detail: 'Installing Claude Code.' } }]) {+ const f = launched(result)+ await f.machine.tick()+ f.step(600_000); await f.machine.tick()+ expect(f.request.mock.calls.filter(c => c[0] === 'agent_create_cancel')).toHaveLength(0)+ expect(commands(f)).toEqual([])+ }+ })++ it('counts its 5 minutes again after a pass that found it no longer held', async () => {+ const f = launched(heldCreation)+ await f.machine.tick()+ f.step(200_000); f.start.mockResolvedValue(pendingCreation as never); await f.machine.tick()+ f.step(20_000); f.start.mockResolvedValue(heldCreation as never); await f.machine.tick()+ f.step(200_000); await f.machine.tick()+ expect(commands(f)).toEqual([])+ f.step(100_000); await f.machine.tick()+ expect(commands(f)).toHaveLength(1)+ })++ it('is not failed when the machine does not confirm the cancellation: its launch may have won', async () => {+ for (const cancel of [{ creationId: 'creation', state: 'pending' }, { error: 'INTERNAL' }, { creationId: 'other', state: 'cancelled' }]) {+ const f = launched(heldCreation, cancel)+ await f.machine.tick()+ f.step(300_000); await f.machine.tick()+ expect(f.request.mock.calls.filter(c => c[0] === 'agent_create_cancel')).toHaveLength(1)+ expect(commands(f)).toEqual([])+ }+ })+ })+it('is left out for a backend that refuses it, which then fails it at 3 minutes as before, and offered again ten minutes later', async () => {const f = fixture()f.start.mockResolvedValue(pendingCreation as never)diff --git a/cli/src/superTabs/machines.ts b/cli/src/superTabs/machines.tsindex c6081e97f..1e8920913 100644--- a/cli/src/superTabs/machines.ts+++ b/cli/src/superTabs/machines.ts@@ -57,6 +57,12 @@ const START_REFUSED_MS = 60_000/** What a start answers while its launch may already have happened or is under way: never failed from here, or an agent* could run with no start to show for it. The failures already reported say so themselves. */const NOT_REFUSED = new Set(['START_UNCERTAIN', 'START_PENDING', 'START_REFUSED', 'START_FAILED', 'SWARM_ENGINE'])+/** How long a launched start's creation may wait on a dependency it names (the engine's executable, its launch+ * environment, a model) before this machine cancels it and fails the start with that reason. Past the three minutes the+ * daemon gives a credential preparation (core/agents/pendingLaunches.ts), well inside the backend's 15 (liveness.ts):+ * on Diego's Mac's Harness Team account a held creation used them all, and the Lead read only "still preparing"+ * (2026-10-28). Not while Harness installs the engine, which the backend's 15 minutes cover. */+const START_HELD_MS = 300_000/** How often the executor asks the backend what its tabs want of it (a start waiting, a pause) and compares what it* would report with what it last did. Only this read is this frequent: the resource readers run when there is@@ -217,6 +223,8 @@ export class ContributedMachines {* last pass found them. Reported so the backend waits past its 3 minutes (backend liveness.ts): Diego's Mac fetched and* checked out a 470 MB project, and the start failed while it did (2026-10-27). */private readonly preparing = new Set<string>()+ /** Per launched start whose creation is held on a dependency, since when without a break. */+ private readonly heldSince = new Map<string, number>()/** Starts this host launched whose engine has not yet recorded its session: the agent each created, by start id. */private readonly unconfirmed = new Map<string, Unconfirmed>()/** Removals cleaned and acknowledged by this host, and the one in progress per removal. */@@ -472,6 +480,7 @@ export class ContributedMachines {for (const id of this.waiting.keys()) if (!pendingIds.has(id)) this.waiting.delete(id)for (const id of this.refusedSince.keys()) if (!pendingIds.has(id)) this.refusedSince.delete(id)for (const id of this.preparing) if (!pendingIds.has(id)) this.preparing.delete(id)+ for (const id of this.heldSince.keys()) if (!pendingIds.has(id)) this.heldSince.delete(id)this.loadUnconfirmed()for (const [id, launch] of this.unconfirmed) if (!pendingIds.has(id) && !launch.checking) void this.abandoned(id, launch)for (const tab of this.published.keys()) if (!pools.some(row => row.tabId === tab)) this.published.delete(tab)@@ -686,6 +695,26 @@ export class ContributedMachines {if ((result.error === 'START_PENDING' || typeof result.refused === 'string') && identifier(result.harnessId) && identifier(result.creationId)) {this.remember(String(start.id), { path, harnessId: result.harnessId, creationId: result.creationId, tries: 0, checking: false })} else this.forget(String(start.id))+ const held = result.error === 'START_PENDING' && result.state === 'pending' ? object(result.held) : {}+ if (typeof held.detail !== 'string' || held.service === 'install') this.heldSince.delete(start.id)+ else {+ const since = this.heldSince.get(start.id) ?? began+ this.heldSince.set(start.id, since)+ if (began - since >= START_HELD_MS && identifier(result.creationId)) {+ // Only a cancellation the daemon confirms fails the start: a launch that won the race is reconciled next pass.+ local ??= await this.deps.open(where)+ const cancelled = object(await local.request('agent_create_cancel', { creationId: result.creationId }, 10_000).catch(() => null))+ if (cancelled.creationId === result.creationId && cancelled.state === 'cancelled') {+ await local.request('super_tabs', { action: 'observeCapacity', creationId: result.creationId }, 10_000).catch(() => {})+ this.preparing.delete(String(start.id))+ // Its creation was cancelled here: nothing it launched is left to stop as abandoned.+ this.forget(String(start.id))+ await scoped({ action: 'command', operationId: `held-${start.id}`, command: { type: 'agent.startFailed', startId: start.id,+ error: `This machine held the agent's launch for ${START_HELD_MS / 60_000} minutes and stopped it: ${held.detail}` } })+ continue+ }+ }+ }if (!refused) this.refusedSince.delete(start.id)if (result.ok === true && identifier(result.harnessId)) {this.waiting.delete(start.id)diff --git a/cli/src/superTabs/start.spec.ts b/cli/src/superTabs/start.spec.tsindex 1285d6228..1929a7ee7 100644--- a/cli/src/superTabs/start.spec.ts+++ b/cli/src/superTabs/start.spec.ts@@ -752,6 +752,22 @@ it.each(['pending', 'unconfirmed', 'created'])('preserves native %s evidence wheexpect(f.request.mock.calls.filter(c => c[0] === 'agent_create')).toHaveLength(1)})+// Diego's Mac, 2026-10-28: a Team account's creation sat held for the whole 15 minutes, and the start said only "pending".+it('says what a pending native creation is held on, and nothing of a hold for one under way', async () => {+ const f = fixture(), request = f.request.getMockImplementation()!+ f.start.dispatched = true+ const held = { service: 'native', detail: 'Waiting to confirm access to the selected engine executable.' }+ let answer: Record<string, unknown> = { creationId: f.start.creationId, state: 'pending', held }+ f.request.mockImplementation(async (type, payload) => type === 'agent_create_status' ? answer : request(type, payload))+ const input = { action: 'resume', tabId: 'tab', startId: 'start', hostDispatch: true }+ expect(await startAgent(input, f.scoped, where, f.open)).toMatchObject({ error: 'START_PENDING', state: 'pending', held,+ detail: 'Waiting to confirm access to the selected engine executable. Keep this start ID. Run resume with it to check the same native creation; do not make another start request.' })+ answer = { creationId: f.start.creationId, state: 'pending' }+ const underWay = await startAgent(input, f.scoped, where, f.open)+ expect(underWay).toMatchObject({ error: 'START_PENDING', state: 'pending' })+ expect(underWay).not.toHaveProperty('held')+})+it.each([{ error: 'CAPACITY_UNAVAILABLE', detail: 'Memory was reserved by another start.' },{ error: 'UNSUPPORTED' },diff --git a/cli/src/superTabs/start.ts b/cli/src/superTabs/start.tsindex bcc41941f..be0fc79f5 100644--- a/cli/src/superTabs/start.ts+++ b/cli/src/superTabs/start.ts@@ -478,8 +478,13 @@ async function startOnce(input: Json, scoped: ScopedRequest, where: Where, open:const frame = object(native.agent)const nativeId = native.state === 'unavailable' ? native.createdAgentId : frame.idif (!['created', 'unavailable'].includes(String(native.state)) || !identifier(nativeId)) {- return { error: 'START_PENDING', startId, creationId, state: native.state ?? 'unknown',- detail: 'Keep this start ID. Run resume with it to check the same native creation; do not make another start request.' }+ // A creation not yet claimed waits on a dependency (the engine, its executable, a model) and says which. Kept, so+ // the machine logs it and can fail a start held for good with it: on Diego's Mac's Harness Team account one sat held+ // for the whole 15 minutes and every report said only "preparing" (2026-10-28).+ const hold = object(native.held)+ const held = native.state === 'pending' && text(hold.service) && text(hold.detail) ? { service: String(hold.service), detail: String(hold.detail) } : null+ return { error: 'START_PENDING', startId, creationId, state: native.state ?? 'unknown', ...(held ? { held } : {}),+ detail: `${held ? `${held.detail} ` : ''}Keep this start ID. Run resume with it to check the same native creation; do not make another start request.` }}const reservation = await target.request('super_tabs', { action: 'observeCapacity', creationId }, 10_000).catch(() => null)if (reservation?.ok !== true || reservation.reservationId !== creationId || reservation.harnessId !== nativeId) {