Skip to content

The agent that grows with you

fix(tui): count children rather than async completion units

Teknium1c55bc92faee
diff --git a/ui-tui/src/__tests__/agentRoster.test.ts b/ui-tui/src/__tests__/agentRoster.test.ts
index 7e2e4170fb5..66ffae6866e 100644
--- a/ui-tui/src/__tests__/agentRoster.test.ts
+++ b/ui-tui/src/__tests__/agentRoster.test.ts
@@ -12,7 +12,7 @@ it('lets the agents shortcut leave the composer without stealing redo', () => {
it('merges one row per actual child and does not notify unchanged snapshots', () => {
const data = {
subagents: [{ subagent_id: 'child', delegation_id: 'batch', goal: 'inspect', started_at: 1 }],
- delegations: [{ delegation_id: 'batch', status: 'running', subagent_ids: ['child'] }]
+ delegations: [{ delegation_id: 'batch-1', status: 'running', subagent_ids: [] }]
}
applyAgentSnapshot('session', data)
diff --git a/ui-tui/src/app/agentRoster.ts b/ui-tui/src/app/agentRoster.ts
index bbae805bb1a..8885168c43a 100644
--- a/ui-tui/src/app/agentRoster.ts
+++ b/ui-tui/src/app/agentRoster.ts
@@ -41,25 +41,8 @@ export function mergeAgentRoster(events: SubagentProgress[], data: SubagentListR
})
}
- for (const d of data.delegations) {
- if (!['running', 'finalizing', 'dispatched', 'queued'].includes(d.status ?? '')) {continue}
-
- if ([...merged.values()].some(s => s.delegationId === d.delegation_id || d.subagent_ids?.includes(s.id))) {continue}
- merged.set(d.delegation_id, {
- id: d.delegation_id,
- goal: d.goal || 'Starting delegation',
- depth: 0,
- index: merged.size,
- parentId: null,
- notes: [],
- thinking: [],
- tools: [],
- taskCount: 1,
- toolCount: 0,
- status: 'queued',
- startedAt: d.dispatched_at == null ? undefined : d.dispatched_at * 1000
- })
- }
+ // Async records are completion units, not agents. Independent completions can
+ // give them different IDs from the actual children; never invent extra rows.
return [...merged.values()]
}