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

This commit is contained in:
Teknium
2026-09-07 21:25:45 -07:00
parent 8e4b4e0cc8
commit 1c55bc92fa
2 changed files with 3 additions and 20 deletions

View File

@@ -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)

View File

@@ -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()]
}