fix(agent-loop): report turn failures at source

This commit is contained in:
_Kerman
2026-07-31 13:54:36 +08:00
parent 7a463dbe44
commit 741fc7dc79
12 changed files with 125 additions and 44 deletions
@@ -359,7 +359,12 @@ describe('request stability across the loop', () => {
await waitForIdle(ctx, agent)
expect(agent.session.events.findLast(event => event.type === 'turn/end')).toMatchObject({
data: { reason: { kind: 'error', error: failure.message } },
data: {
reason: {
kind: 'error',
error: failure instanceof LlmError ? failure.failure : failure.message,
},
},
})
expect(adapter.requests).toHaveLength(0)
},