fix(agent-loop): await final session flush

This commit is contained in:
Tianyi Cui
2026-07-27 23:41:27 +08:00
parent cb12fa7b90
commit fe22273e28
9 changed files with 100 additions and 17 deletions

View File

@@ -79,8 +79,9 @@ describe('startInProcessRun', () => {
const result = await run.result
const child = ctx.agents.get(run.id)!
expect(injected).toBe(true)
expect(child.session.events.findLast(event => event.type === 'turn/end'))
.toMatchObject({ data: { reason: { kind: 'max-tokens' } } })
.toMatchObject({ data: { reason: { kind: 'completed' } } })
expect(result.stopReason).toBe('max-tokens')
await run.dispose()
})