From d3fee89993a87b045a381f9a8bd4b62e5d0e6df9 Mon Sep 17 00:00:00 2001 From: David Metcalfe <80915+DavidMetcalfe@users.noreply.github.com> Date: Thu, 13 Aug 2026 11:18:56 -0700 Subject: [PATCH] fix(desktop): prefer synthesized timeout summary over stale progress text Review feedback: prev?.summary could shadow the 'Timed out after Xs' reason when a live event had populated it. timeoutSummary() now wins for raw timeout status; add coverage for the missing-duration placeholder. --- apps/desktop/src/store/subagents.test.ts | 7 +++++++ apps/desktop/src/store/subagents.ts | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) 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 } }