Skip to content

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

fix(chatRuntime): match resumed subagents to async spawn calls

Steven Enamakel89073afceaf6
diff --git a/app/src/features/conversations/tools/__fixtures__/coreToolNames.json b/app/src/features/conversations/tools/__fixtures__/coreToolNames.json
index 2d82e2b111..012f308d3b 100644
--- a/app/src/features/conversations/tools/__fixtures__/coreToolNames.json
+++ b/app/src/features/conversations/tools/__fixtures__/coreToolNames.json
@@ -162,8 +162,6 @@
"update_check",
"use_skill",
"validate_workflow",
- "wait",
- "wait_loop",
"wallet_chain_status",
"wallet_lookup_tx",
"wallet_prepare_transfer",
diff --git a/app/src/features/conversations/tools/toolSpecs.ts b/app/src/features/conversations/tools/toolSpecs.ts
index 77177703bd..5bc8afb8da 100644
--- a/app/src/features/conversations/tools/toolSpecs.ts
+++ b/app/src/features/conversations/tools/toolSpecs.ts
@@ -300,8 +300,6 @@ export const EXACT_TOOL_SPECS: Record<string, ToolSpec> = {
spawn_subagent: spec('delegateTask', BotIcon, 'agent', { chip: chip.text('agent_id') }),
// 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', {
chip: chip.text('question'),
}),
diff --git a/app/src/store/__tests__/chatRuntimeSlice.test.ts b/app/src/store/__tests__/chatRuntimeSlice.test.ts
index 99c86f1e94..610243d5b8 100644
--- a/app/src/store/__tests__/chatRuntimeSlice.test.ts
+++ b/app/src/store/__tests__/chatRuntimeSlice.test.ts
@@ -1382,7 +1382,28 @@ describe('subagent event reducers (Phase 3)', () => {
it('reattaches a resumed task to its newest parent spawn call', () => {
const rowId = 't1:subagent:task-1:researcher';
let state = reducer(
- undefined,
+ reducer(
+ undefined,
+ setToolTimelineForThread({
+ threadId: 't1',
+ entries: [
+ {
+ id: 'spawn-original',
+ name: 'spawn_subagent',
+ round: 0,
+ seq: 0,
+ status: 'success',
+ },
+ {
+ id: 'spawn-resume',
+ name: 'spawn_subagent',
+ round: 0,
+ seq: 1,
+ status: 'running',
+ },
+ ],
+ })
+ ),
subagentSpawned({
threadId: 't1',
requestId: 'request-1',
@@ -1416,6 +1437,9 @@ describe('subagent event reducers (Phase 3)', () => {
parentCallId: 'spawn-resume',
});
expect(state.toolTimelineByThread.t1[0].subagent?.awaitingQuestion).toBeUndefined();
+ expect(state.toolTimelineByThread.t1.find(entry => entry.id === 'spawn-resume')?.name).toBe(
+ 'spawn_subagent'
+ );
});
it('subagentToolCallReceived appends and de-dupes on callId; result settles it', () => {
diff --git a/app/src/store/chatRuntimeSlice.ts b/app/src/store/chatRuntimeSlice.ts
index dd9d624895..aa065f61a9 100644
--- a/app/src/store/chatRuntimeSlice.ts
+++ b/app/src/store/chatRuntimeSlice.ts
@@ -119,7 +119,7 @@ export interface SubagentActivity {
*/
spawnEventId?: string;
/**
- * Provider-assigned id of the `spawn_subagent`/`spawn_subagent`/
+ * Provider-assigned id of the `spawn_subagent`/`spawn_async_subagent`/
* `delegate_*` tool call that started this delegation
* (`SubagentProgressDetail.parent_call_id` on the `subagent_spawned`
* event). When present, `assistantUiMessages.ts` renders this activity's
@@ -361,7 +361,7 @@ export function findPendingDelegationContext(
const entry = entries[i];
if (entry.status !== 'running' || entry.round !== round) continue;
if (
- ['spawn_subagent', 'spawn_subagent'].includes(entry.name) ||
+ ['spawn_subagent', 'spawn_async_subagent'].includes(entry.name) ||
entry.name.startsWith('delegate_')
) {
return {
@@ -2008,6 +2008,10 @@ const chatRuntimeSlice = createSlice({
// transcript. Keep its live card attached to that call so the
// previous call's card does not claim the resumed work.
if (parentCallId) existing.subagent.parentCallId = parentCallId;
+ // A resumed task belongs to the latest spawn call in the parent
+ // transcript. Keep its live card attached to that call so the
+ // previous call's card does not claim the resumed work.
+ if (parentCallId) existing.subagent.parentCallId = parentCallId;
}
}
return;