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 worker that never had an assignment can be stopped by its Lead, and stops by itself when idle
bitcoinbuilder0116734e0f59
diff --git a/backend/src/superTabs/commands.test.ts b/backend/src/superTabs/commands.test.tsindex 23b4655e7..fabd55dbf 100644--- a/backend/src/superTabs/commands.test.ts+++ b/backend/src/superTabs/commands.test.ts@@ -1089,6 +1089,19 @@ it('requires the exact stop request for host acknowledgement and prevents promotexpect(() => f.add('worker', 'owner', group, true)).toThrow('stopping')})+// Swarm autonomous-harness, 2026-10-29: a Builder started by hand never got a task, and its Lead could not stop it ("this+// worker has no finished assignment to release"); only a person by hand could.+it('lets the Lead stop a worker that never had an assignment, but keep only one with finished work, and never a Buddy', () => {+ const f = fixture(), lead = f.add('lead', 'owner', 'lead', true), group = f.group(), worker = f.add('worker', 'owner', group)+ const leadActor: Actor = { kind: 'agent', agentId: lead, machineOwnerId: 'host-owner' }+ expect(() => f.run({ type: 'agent.release', agentId: worker, decision: 'keep' }, leadActor)).toThrow('no finished assignment to keep')+ f.run({ type: 'agent.release', agentId: worker, decision: 'stop' }, leadActor)+ expect(f.state.agents.find(a => a.id === worker)).toMatchObject({ workDecision: 'stop', releaseId: expect.any(String) })+ const buddy = f.add('buddy', 'owner', group)+ f.state.agents.find(a => a.id === buddy)!.buddyOf = { personId: 'owner', projectId: 'lead', generation: 'g' } as never+ expect(() => f.run({ type: 'agent.release', agentId: buddy, decision: 'stop' }, leadActor)).toThrow('never released')+})+it('allows the contributor to keep a completed worker and refuses another project’s Lead', () => {const f = fixture(); f.invite()teamMachine(f, 'peer')@@ -1605,13 +1618,15 @@ describe('Reviewer role', () => {f.run({ type: 'work.assign', conversationId: next, agentId: builder, ...via }, leadActor, decisionIn(next))})- it('lets the Lead keep or stop a Reviewer that never had work, but not such a Builder', () => {+ it('lets the Lead keep or stop a Reviewer that never had work, and only stop such a Builder', () => {const { f, leadActor, reviewer, builder } = reviewed()f.run({ type: 'agent.release', agentId: reviewer, decision: 'keep' }, leadActor)expect(f.state.agents.find(a => a.id === reviewer)).toHaveProperty('workDecision', 'keep')f.run({ type: 'agent.release', agentId: reviewer, decision: 'stop' }, leadActor)expect(f.state.agents.find(a => a.id === reviewer)).toHaveProperty('workDecision', 'stop')- expect(() => f.run({ type: 'agent.release', agentId: builder, decision: 'stop' }, leadActor)).toThrow('no finished assignment')+ expect(() => f.run({ type: 'agent.release', agentId: builder, decision: 'keep' }, leadActor)).toThrow('no finished assignment')+ f.run({ type: 'agent.release', agentId: builder, decision: 'stop' }, leadActor)+ expect(f.state.agents.find(a => a.id === builder)).toHaveProperty('workDecision', 'stop')})it('keeps the group\'s idle Reviewers when its work ends, waiting for no decision, and counts adding one to a group as reuse', () => {diff --git a/backend/src/superTabs/commands.ts b/backend/src/superTabs/commands.tsindex c07356f83..48149afec 100644--- a/backend/src/superTabs/commands.ts+++ b/backend/src/superTabs/commands.ts@@ -1654,9 +1654,14 @@ export function applyCommand(original: SuperTabState, actor: Actor, input: Commaif (state.conversations.some(c => c.leadId === target.id)) fail('LEAD_REQUIRED', 'Release workers only; keep the Lead running.')// Only its own active work holds a decision back, not the active work of a group it sits in (a Reviewer's).if (state.conversations.some(c => activeWork(c) && c.assignment?.agentId === target.id)) fail('WORK_ACTIVE', 'Finish active work before releasing this worker.')- // A Reviewer is never assigned work, so the Lead may keep or stop it at any time.- if (!target.workDecision && agentRole(target) !== 'reviewer' && !state.conversations.some(c => c.assignment?.agentId === target.id)) {- fail('WORK_REQUIRED', 'This worker has no finished assignment to release.')+ // A Buddy is its owner's to stop (buddies.ts); it never had work, which was all that kept it from here before.+ if (isBuddy(target)) fail('BUDDY_NOT_RELEASED', 'A Buddy is stopped by its owner, or by turning Buddies off, never released.')+ // A Reviewer is never assigned work, so the Lead may keep or stop it at any time. Any other worker may be stopped with+ // no assignment at all: one a person started by hand, or whose task went elsewhere, sat idle with nobody able to stop+ // it but by hand (Swarm autonomous-harness, 2026-10-29). Keeping it still needs finished work to keep it for.+ if (command.decision !== 'stop' && !target.workDecision && agentRole(target) !== 'reviewer'+ && !state.conversations.some(c => c.assignment?.agentId === target.id)) {+ fail('WORK_REQUIRED', 'This worker has no finished assignment to keep. Stop it instead.')}if (target.workDecision === 'stop' && command.decision !== 'stop') fail('STOP_REQUESTED', 'This worker is stopping. Wait for its execution host.')if (command.decision === 'stop' && target.workDecision !== 'stop') target.releaseId = operationIddiff --git a/backend/src/superTabs/tidy.test.ts b/backend/src/superTabs/tidy.test.tsindex 0f44fd85d..4ef7570e2 100644--- a/backend/src/superTabs/tidy.test.ts+++ b/backend/src/superTabs/tidy.test.ts@@ -69,6 +69,20 @@ describe('stopping idle workers', () => {expect(target(state).workDecision).toBe('stop')})+ // Swarm autonomous-harness, 2026-10-29: a Builder started by hand in a busy task's group never got that task, and every+ // message there kept it up, idle, for 18+ minutes.+ it('stops a worker that never had a task 15 minutes after its start, however busy a group it only sits in is', () => {+ const busyGroup = group({ assignment: { ...done(), agentId: 'other', status: 'working' }, agentIds: ['L', 'other', 'w'], lastActivityAt: iso(at - MINUTE) })+ const state = swarm({ groups: [busyGroup] })+ expect(stopIdleWorkers(state, 'lead', at, new Set())).toEqual([expect.objectContaining({ source: { kind: 'idle-stop', agentId: 'w' } })])+ // A Reviewer is never assigned work: a group's messages are its work, so they keep it as before.+ const reviewer = swarm({ agents: [worker({ role: 'reviewer' } as Partial<Agent>)], groups: [busyGroup] })+ expect(stopIdleWorkers(reviewer, 'lead', at, new Set())).toEqual([])+ // Nor is one that had a task of its own and finished it: its group's last message still counts.+ const finished = swarm({ groups: [group({ lastActivityAt: iso(at - MINUTE) })] })+ expect(stopIdleWorkers(finished, 'lead', at, new Set())).toEqual([])+ })+it('never stops a worker with active work, a queued delivery, or uncommitted changes', () => {expect(stopIdleWorkers(swarm({ groups: [group({ assignment: done({ status: 'working' }) })] }), 'lead', at, new Set())).toEqual([])expect(stopIdleWorkers(swarm(), 'lead', at, new Set(['w']))).toEqual([])diff --git a/backend/src/superTabs/tidy.ts b/backend/src/superTabs/tidy.tsindex 589589f91..1622b438a 100644--- a/backend/src/superTabs/tidy.ts+++ b/backend/src/superTabs/tidy.ts@@ -47,9 +47,14 @@ const groupsOf = (state: SuperTabState, worker: Agent, asleep: readonly GroupAct[...state.conversations, ...asleep.filter(g => !state.conversations.some(c => c.id === g.id))].filter(c => c.agentIds.includes(worker.id) || c.assignment?.agentId === worker.id)-/** When the worker last had anything to do: its start, its Lead's keep, its own progress, or a message in one of its groups. */+/** When the worker last had anything to do: its start, its Lead's keep, its own progress, or a message in one of its groups.+ * A worker that never had an assignment (no task of its own, never lost one, not a Reviewer) only sits in its groups, and+ * their messages are about others' work: it is idle from its start or keep. One started by hand in a busy task's group+ * stayed up with nothing to do for 18+ minutes, its idle time renewed by each message there (Swarm autonomous-harness,+ * 2026-10-29). A message waiting for it still keeps it (`busy`). */function idleSince(state: SuperTabState, worker: Agent, groups: GroupActivity[]): number {- const seen = [time(worker.startedSession?.createdAt), worker.keptAt, ...groups.flatMap(g => [time(g.lastActivityAt),+ const worked = agentRole(worker) === 'reviewer' || !!worker.lostTask || groups.some(g => g.assignment?.agentId === worker.id)+ const seen = [time(worker.startedSession?.createdAt), worker.keptAt, ...(worked ? groups : []).flatMap(g => [time(g.lastActivityAt),...g.assignment?.agentId === worker.id ? [g.assignment.progressAt, g.assignment.lost?.at] : []])]return Math.max(...seen.filter((t): t is number => t !== undefined && Number.isFinite(t)))}