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.
This commit is contained in:
David Metcalfe
2026-08-13 11:18:56 -07:00
committed by Teknium
parent 09b1726a1d
commit d3fee89993
2 changed files with 8 additions and 1 deletions
+7
View File
@@ -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).
+1 -1
View File
@@ -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
}
}