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
Swarm: a settling start whose agent is already gone no longer blocks deleting its project (#2868)
Dee0a4101159edc
diff --git a/backend/src/superTabs/commands.ts b/backend/src/superTabs/commands.tsindex 69d78f563..dfdbca3f3 100644--- a/backend/src/superTabs/commands.ts+++ b/backend/src/superTabs/commands.ts@@ -1621,12 +1621,15 @@ function applyCommandOnce(original: SuperTabState, actor: Actor, input: Command,// Its owner confirmed a permanent delete, so the project takes its own agents with it, its Lead included, and their// hosts close their sessions.const project = manageProject(state, actor, command.projectId)+ // Read before its agents go: a contributed start still settling whose agent is already gone never settles (projects.ts).+ const orphaned = new Set((state.starts ?? []).filter(s => s.poolGeneration && s.harnessId && !s.poolSettled && !s.error+ && !state.agents.some(a => a.machineId === s.request.machineId && a.harnessId === s.harnessId)).map(s => s.id))for (const target of state.agents.filter(a => agentProjectId(state, a) === project.id)) removeAgent(target, { lead: true })// Its sessions still starting in people's one Buddy chats go with it (their chats belong to no project).for (const start of state.starts ?? []) {if (start.request.buddySession?.projectId === project.id && !start.harnessId && !start.error) start.error = 'Its project was deleted.'}- deleteProject(state, actor, command.projectId)+ deleteProject(state, actor, command.projectId, orphaned)// No machine keeps it any more; one kept only for it now serves none (machines.ts machineProjectRefusal).for (const pool of state.machines ?? []) if (pool.projects) pool.projects = pool.projects.filter(id => id !== project.id)breakdiff --git a/backend/src/superTabs/projects.test.ts b/backend/src/superTabs/projects.test.tsindex 0cd1a15df..c2ed20449 100644--- a/backend/src/superTabs/projects.test.ts+++ b/backend/src/superTabs/projects.test.ts@@ -199,9 +199,14 @@ describe('projects inside an invite-only swarm', () => {cwd: '/work', worktree: true,requirements: { memoryBytes: 0, diskBytes: 0, maxCpuPercent: 100, tools: [], devices: [], quotaRequired: false } }const startId = String(f.run({ type: 'agent.start', request }).startId)- const start = f.state.starts!.find(s => s.id === startId)!+ let start = f.state.starts!.find(s => s.id === startId)!start.dispatched = phase !== 'queued'- if (phase === 'settling') { start.poolGeneration = 'pool'; start.harnessId = 'native'; start.poolSettled = false }+ if (phase === 'settling') {+ start.poolGeneration = 'pool'; start.harnessId = 'native'; start.poolSettled = false+ // Its agent is up while its machine settles it (agent.started adds it); one whose agent is gone is a test below.+ f.add(request.conversationId, 'native', false)+ start = f.state.starts!.find(s => s.id === startId)!+ }expect(() => f.run({ type: 'project.delete', projectId: p.projectId })).toThrow('pending agent starts')if (phase === 'settling') start.poolSettled = trueelse f.run({ type: 'agent.startFailed', startId, error: 'The machine confirmed nothing started.' })@@ -222,6 +227,20 @@ describe('projects inside an invite-only swarm', () => {expect(f.state.starts).toEqual([])})+ it('deletes past a settling start whose agent was removed earlier, which its machine never settles', () => {+ const f = setup(), p = f.project()+ const conversationId = f.task(p.projectId)+ const request = { conversationId, machineId: 'machine', engine: 'codex', name: 'Builder', cwd: '/work', worktree: true,+ requirements: { memoryBytes: 0, diskBytes: 0, maxCpuPercent: 100, tools: [], devices: [], quotaRequired: false } }+ const startId = String(f.run({ type: 'agent.start', request }).startId)+ Object.assign(f.state.starts!.find(s => s.id === startId)!, { dispatched: true, poolGeneration: 'pool', harnessId: 'native', poolSettled: false })+ const agentId = f.add(conversationId, 'native', false)+ f.run({ type: 'agent.remove', agentId })+ f.run({ type: 'project.delete', projectId: p.projectId })+ expect(projectsOf(f.state).map(p => p.id)).toEqual(['lead'])+ expect(f.state.starts).toEqual([])+ })+it('still refuses a dispatched start in an archived task: its machine may be starting the agent', () => {const f = setup(), p = f.project()const conversationId = f.task(p.projectId)diff --git a/backend/src/superTabs/projects.ts b/backend/src/superTabs/projects.tsindex b69f54f69..ecf55080a 100644--- a/backend/src/superTabs/projects.ts+++ b/backend/src/superTabs/projects.ts@@ -470,8 +470,11 @@ export function manageProject(state: SuperTabState, actor: Actor, projectId: str}/** Removes coordination only; the command removes the project's agents first.- * Pending starts must be reconciled first; terminal-history privacy bindings remain permanent. */-export function deleteProject(state: SuperTabState, actor: Actor, projectId: string): void {+ * Pending starts must be reconciled first; terminal-history privacy bindings remain permanent. [orphaned] names the+ * contributed starts still settling whose agent was already removed before this delete: only their machine settles one,+ * and it closed that agent's session when it was removed, so none of them ever settles (2026-11-04: 17 such starts on four+ * Macs, from agents stopped while a project was cleaned up, kept its owner from deleting it). */+export function deleteProject(state: SuperTabState, actor: Actor, projectId: string, orphaned: ReadonlySet<string> = new Set()): void {const project = manageProject(state, actor, projectId)// A person's one Buddy chat belongs to no project and stays; that project's sessions in it go with their agents.const groups = state.conversations.filter(c => !isLeads(c) && !isSwarmBuddyChat(c) && groupProject(state, c).id === project.id)@@ -482,7 +485,7 @@ export function deleteProject(state: SuperTabState, actor: Actor, projectId: strconst archived = new Set(groups.filter(c => c.archived).map(c => c.id))if (state.starts?.some(s => groupIds.has(s.request.conversationId) && !s.error &&!(!s.dispatched && !s.harnessId && archived.has(s.request.conversationId)) &&- (!s.harnessId || s.poolGeneration && !s.poolSettled))) {+ (!s.harnessId || s.poolGeneration && !s.poolSettled && !orphaned.has(s.id)))) {fail('STARTS_PENDING', 'Resolve this project’s pending agent starts before deleting it.')}if (groups.some(activeWork)) fail('WORK_ACTIVE', 'Resolve this project’s active work before deleting it.')