fix: close recovery review gaps

This commit is contained in:
Tianyi Cui
2026-07-20 22:11:26 +08:00
parent 40f7195266
commit cc2e14f76e
10 changed files with 62 additions and 11 deletions
+2 -5
View File
@@ -1124,11 +1124,8 @@ export function streamSessionEventUpdate(
return
}
case 'turn/end': {
if (event.data.reason.kind !== 'error') return
const message = 'failure' in event.data.reason
? event.data.reason.failure.message
: event.data.reason.message
const text = `\n\n[Model attempt failed; any partial output above is discarded: ${message}]\n\n`
if (event.data.reason.kind !== 'error' || !('failure' in event.data.reason)) return
const text = `\n\n[Model attempt failed; any partial output above is discarded: ${event.data.reason.failure.message}]\n\n`
notify({ sessionId, update: { sessionUpdate: 'agent_message_chunk', content: { type: 'text', text } } })
return
}
+5 -1
View File
@@ -65,7 +65,7 @@ describe('streamSessionEventUpdate', () => {
.toEqual([])
})
it('marks retry and terminal failure boundaries in the append-only update stream', () => {
it('marks retry and terminal model failure boundaries but not ordinary turn errors', () => {
expect(updatesFor(evt('llm/retry', {
turn: 1,
step: 1,
@@ -90,6 +90,10 @@ describe('streamSessionEventUpdate', () => {
text: '\n\n[Model attempt failed; any partial output above is discarded: still busy]\n\n',
},
}])
expect(updatesFor(evt('turn/end', {
turn: 1,
reason: { kind: 'error', step: 2, message: 'post-step failed' },
}))).toEqual([])
})
it('maps tool/call to an in_progress tool_call with kind other and parsed rawInput (generic fallback, no presenter)', () => {