Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

fix(conversations): reattach resumed subagent tasks to their newest spawn

Steven Enamakel0f677771c2c9
diff --git a/app/src/features/conversations/tools/toolPresentation.test.ts b/app/src/features/conversations/tools/toolPresentation.test.ts
index b76c604927..5ef6749ec5 100644
--- a/app/src/features/conversations/tools/toolPresentation.test.ts
+++ b/app/src/features/conversations/tools/toolPresentation.test.ts
@@ -152,6 +152,8 @@ describe('tool labels: regressions', () => {
it('labels named agents and delegations by what they do', () => {
expect(done('subagent:planner')).toBe('Planned next steps');
expect(done('spawn_subagent', { agent_id: 'critic' })).toBe('Reviewed the work');
+ // Older transcripts still contain the former async spawn name.
+ expect(done('spawn_async_subagent', { agent_id: 'critic' })).toBe('Reviewed the work');
expect(done('delegate_gmail')).toBe('Used Gmail');
expect(active('run_code')).toBe('Running code');
expect(
diff --git a/app/src/features/conversations/tools/toolSpecs.ts b/app/src/features/conversations/tools/toolSpecs.ts
index cc8aee564c..77177703bd 100644
--- a/app/src/features/conversations/tools/toolSpecs.ts
+++ b/app/src/features/conversations/tools/toolSpecs.ts
@@ -298,7 +298,8 @@ export const EXACT_TOOL_SPECS: Record<string, ToolSpec> = {
// ── Agents and delegation ──────────────────────────────────────────────
spawn_subagent: spec('delegateTask', BotIcon, 'agent', { chip: chip.text('agent_id') }),
- list_subagents: spec('checkAgents', BotIcon, 'agent'),
+ // Kept for recorded transcripts from before the single-spawn contract.
+ spawn_async_subagent: spec('delegateTask', BotIcon, 'agent', { chip: chip.text('agent_id') }),
wait: spec('wait', HourglassIcon, 'agent'),
wait_loop: spec('wait', HourglassIcon, 'agent'),
ask_user_clarification: spec('askQuestion', MessageCircleQuestionIcon, 'agent', {
diff --git a/app/src/store/__tests__/chatRuntimeSlice.test.ts b/app/src/store/__tests__/chatRuntimeSlice.test.ts
index 1bf5defbfe..99c86f1e94 100644
--- a/app/src/store/__tests__/chatRuntimeSlice.test.ts
+++ b/app/src/store/__tests__/chatRuntimeSlice.test.ts
@@ -1379,6 +1379,45 @@ describe('subagent event reducers (Phase 3)', () => {
expect(rows[0].subagent).toMatchObject({ taskId: 'task-1', agentId: 'researcher' });
});
+ it('reattaches a resumed task to its newest parent spawn call', () => {
+ const rowId = 't1:subagent:task-1:researcher';
+ let state = reducer(
+ undefined,
+ subagentSpawned({
+ threadId: 't1',
+ requestId: 'request-1',
+ round: 0,
+ rowId,
+ taskId: 'task-1',
+ agentId: 'researcher',
+ spawnEventId: 'request-1:4',
+ parentCallId: 'spawn-original',
+ })
+ );
+ state = reducer(state, subagentAwaitingUser({ threadId: 't1', rowId, question: 'Continue?' }));
+
+ state = reducer(
+ state,
+ subagentSpawned({
+ threadId: 't1',
+ requestId: 'request-2',
+ round: 0,
+ rowId,
+ taskId: 'task-1',
+ agentId: 'researcher',
+ spawnEventId: 'request-2:2',
+ parentCallId: 'spawn-resume',
+ })
+ );
+
+ expect(state.toolTimelineByThread.t1[0]).toMatchObject({ status: 'running' });
+ expect(state.toolTimelineByThread.t1[0].subagent).toMatchObject({
+ status: 'running',
+ parentCallId: 'spawn-resume',
+ });
+ expect(state.toolTimelineByThread.t1[0].subagent?.awaitingQuestion).toBeUndefined();
+ });
+
it('subagentToolCallReceived appends and de-dupes on callId; result settles it', () => {
let state = spawn();
const row = 't1:subagent:task-1:researcher';