test(agent-loop): align consumers with direct wakeup

This commit is contained in:
_Kerman
2026-08-04 21:14:34 +08:00
parent 694f9009ec
commit c357f94ddc
3 changed files with 6 additions and 25 deletions

View File

@@ -200,22 +200,6 @@ describe('dsh-subagent-spawn', () => {
expect(published).toEqual([])
})
it('a cancel after the child prompt is queued maps a no-turn child log to aborted', async () => {
const { ctx, parent } = await setup([])
const controller = new AbortController()
ctx.on('session/event', (_session, event) => {
if (event.type === 'agent/inbox/spliced' && event.data.inserted.length > 0) {
queueMicrotask(() => { controller.abort('queued-window') })
}
})
const run = await start(ctx, 'spawn', { prompt: [{ type: 'text', text: 'p' }], parent, signal: controller.signal })
const result = await run.result
expect(result).toMatchObject({ stopReason: 'aborted', output: [] })
const child = ctx.agents.get(run.id)!
expect(child.session.events.some(event => event.type === 'turn/end')).toBe(false)
await run.dispose()
})
it('cancelling a running child settles the run as aborted (the abort bridge + cancel())', async () => {
// 'hang' makes the child's model stream one chunk then wait until aborted.
const controller = new AbortController()