diff --git a/apps/desktop/src/store/subagents.test.ts b/apps/desktop/src/store/subagents.test.ts index 57045fe5f0..e486cbca0a 100644 --- a/apps/desktop/src/store/subagents.test.ts +++ b/apps/desktop/src/store/subagents.test.ts @@ -251,6 +251,13 @@ describe('subagent store', () => { expect(listFor('s1')).toHaveLength(0) }) + it('falls back to a placeholder when timeout duration is missing', () => { + upsertSubagent('s1', { goal: 'scan files', status: 'running', subagent_id: 't2', task_index: 0 }) + upsertSubagent('s1', { status: 'timeout', subagent_id: 't2', task_index: 0 }, false, 'subagent.complete') + + expect(listFor('s1')[0]?.summary).toBe('Timed out after ?s') + }) + // Fail-closed guard: subagent.complete is terminal by definition, so an // unrecognized status on it must not resurrect a row as 'running'. Live // events keep the lenient fallback (a status we don't know is still active). diff --git a/apps/desktop/src/store/subagents.ts b/apps/desktop/src/store/subagents.ts index b962a64501..3f7b15bbce 100644 --- a/apps/desktop/src/store/subagents.ts +++ b/apps/desktop/src/store/subagents.ts @@ -203,7 +203,7 @@ function toProgress(payload: SubagentPayload, prev: SubagentProgress | undefined filesRead: filesRead.length ? filesRead : (prev?.filesRead ?? []), filesWritten: filesWritten.length ? filesWritten : (prev?.filesWritten ?? []), stream, - summary: str(payload.summary) || prev?.summary || timeoutSummary(payload) || undefined, + summary: str(payload.summary) || timeoutSummary(payload) || prev?.summary || undefined, currentTool: TERMINAL.has(status) ? undefined : tool || prev?.currentTool } }