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.

Swarm: a task's assignee owns its steps while it is in the Swarm, its own work done or not (#2531)

0xken15765245946820
diff --git a/backend/src/superTabs/commands.ts b/backend/src/superTabs/commands.ts
index 77351115e..608a08b11 100644
--- a/backend/src/superTabs/commands.ts
+++ b/backend/src/superTabs/commands.ts
@@ -9,7 +9,7 @@ import {
type Actor, type AgentConfiguration, type AgentStart, type AgentStartRequest, type BuddySessionEntry, type WorkTask, type Agent, type Author, type Check, type CommandEffects, type Conversation, type SuperTabState,
} from './model.js'
import { jobKindOf } from './evidence/jobKind.js'
-import { endSteps, holdsStepOf, isStep, taskOwner } from './steps.js'
+import { endSteps, holdsStepOf, isStep, ownerOf, taskOwner } from './steps.js'
import { routeRecordSchema, routeTitle, startedAs, type RouteCandidate, type RouteDecision, type RouteFinal, type RouteOverride } from './routeRecord.js'
import { routingOverrideSaveSchema } from './routingPolicy.js'
import { askedInSchema, RULE_MESSAGE_MS, ruleSchema, ruleTextSchema } from './rules.js'
@@ -2545,7 +2545,8 @@ export function applyCommand(original: SuperTabState, actor: Actor, input: Comma
// the 486 messages it got in a day were such copies). The assigned worker keeps its own rule above; a note to itself
// stays its own.
// In a task, an agent holding one of its open steps reaches the task's owner instead (task steps design).
- const ownerHere = actor.kind === 'agent' && assigned && assigned !== actor.agentId && holdsStepOf(state, group.id, actor.agentId) ? assigned : null
+ const owner = ownerOf(state, group)
+ const ownerHere = actor.kind === 'agent' && owner && owner !== actor.agentId && holdsStepOf(state, group.id, actor.agentId) ? owner : null
const memberToLead = actor.kind === 'agent' && !command.agentOnly && !addressed.length && assigned !== actor.agentId && ownerHere ? [ownerHere]
: actor.kind === 'agent' && !command.agentOnly && !addressed.length && assigned !== actor.agentId && group.leadId
&& group.leadId !== actor.agentId && group.agentIds.includes(group.leadId) ? [group.leadId] : []
diff --git a/backend/src/superTabs/steps.test.ts b/backend/src/superTabs/steps.test.ts
index edb0cddb5..ada3e9dfe 100644
--- a/backend/src/superTabs/steps.test.ts
+++ b/backend/src/superTabs/steps.test.ts
@@ -187,10 +187,24 @@ describe('who hears a step', () => {
expect(to(status('done', 'Passed'), id)).toEqual([[f.dev]])
})
- it('with no owner, a step\'s done reaches the coordinator', () => {
+ // Ken, 2026-11-02 (screenshot): a Builder set its task done before its Tester's verdict, and the verdict reached the PM.
+ // The task's assignee owns it while that agent is in the Swarm, its work done or not.
+ it('a step\'s done reaches the owner after the owner\'s own work is done', () => {
const { f, id, status } = reviewing()
- // The task's own work is over: nobody owns it now.
status('done', 'Merged', f.task, f.dev)
+ expect(to(status('done', 'Passed'), id)).toEqual([[f.dev]])
+ })
+
+ it('an unnamed post in the task reaches the owner after the owner\'s own work is done', () => {
+ const { f, post, status } = reviewing()
+ status('done', 'Merged', f.task, f.dev)
+ expect(to(post(f.task), f.task)).toEqual([[f.dev]])
+ })
+
+ it('with the owner gone from the Swarm, a step\'s done reaches the coordinator', () => {
+ const { f, id, status } = reviewing()
+ status('done', 'Merged', f.task, f.dev)
+ f.run({ type: 'agent.remove', agentId: f.dev } as Command)
expect(to(status('done', 'Passed'), id)).toEqual([[f.lead]])
})
diff --git a/backend/src/superTabs/steps.ts b/backend/src/superTabs/steps.ts
index e3772a04d..7b862ca19 100644
--- a/backend/src/superTabs/steps.ts
+++ b/backend/src/superTabs/steps.ts
@@ -40,10 +40,18 @@ export function endSteps(state: SuperTabState, task: Conversation, reason: strin
* its verdict, and one asleep under a done task was not loaded when that task was archived later, so it stayed open in an
* archived task (final review, minor 5). */
export const stepSleeps = (task: { archived: boolean; dormant: boolean } | null): boolean => !task || task.archived
-/** The task's owner for [step]: the agent assigned its task while that work is open, else null (the coordinator's then). */
+/** The agent that owns [task]: its assignee while that agent is in the Swarm, its own work done or not, else null (the
+ * coordinator's then). Ken, 2026-11-02: a Builder set its task done before its Tester's verdict, and the verdict reached
+ * the PM; the verdict is still the Builder's to act on. */
+export function ownerOf(state: SuperTabState, task: Conversation): string | null {
+ const agentId = task.assignment?.agentId
+ return agentId && state.agents.some(a => a.id === agentId) ? agentId : null
+}
+
+/** The task's owner for [step] (ownerOf its task), or null. */
export function taskOwner(state: SuperTabState, step: Conversation): string | null {
const task = isStep(step) ? state.conversations.find(c => c.id === step.reviewOf) : undefined
- return task && activeWork(task) ? task.assignment!.agentId : null
+ return task ? ownerOf(state, task) : null
}
/** Whether [agentId] holds an open step of task [taskId]. */
diff --git a/docs/swarms.md b/docs/swarms.md
index 44e62e9e5..16cc993f6 100644
--- a/docs/swarms.md
+++ b/docs/swarms.md
@@ -1128,7 +1128,9 @@ lease, attempts, costs and checks; readers show it inside its task.
talked over.
- **Who hears it**: its agent's Ready and Done go to the task's owner, not the
coordinator; an unnamed post from its agent, in the step or in the task, does
- too. With no owner, the coordinator hears them.
+ too. The owner is the task's assignee while that agent is in the Swarm, its
+ own work done or not (a late verdict is still its to act on); with none, the
+ coordinator hears them.
- **Closing**: a step archives and sleeps with its task, never on its own clock;
archiving a task cancels its open steps and tells their agents.
- **Reading**: `status` prints steps under their task; `mine` and `task GROUP`