From 1c55bc92faee4620b853f87896884bdf538fe87f Mon Sep 17 00:00:00 2001 From: Teknium <127238744+teknium1@users.noreply.github.com> Date: Mon, 7 Sep 2026 21:25:45 -0700 Subject: [PATCH] fix(tui): count children rather than async completion units --- ui-tui/src/__tests__/agentRoster.test.ts | 2 +- ui-tui/src/app/agentRoster.ts | 21 ++------------------- 2 files changed, 3 insertions(+), 20 deletions(-) diff --git a/ui-tui/src/__tests__/agentRoster.test.ts b/ui-tui/src/__tests__/agentRoster.test.ts index 7e2e4170fb..66ffae6866 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 bbae805bb1..8885168c43 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()] }