fix(agent-loop): scope blocked admission cleanup

This commit is contained in:
_Kerman
2026-07-31 14:35:58 +08:00
parent 12a48558f2
commit c2ff9ddec8
18 changed files with 162 additions and 51 deletions

View File

@@ -448,14 +448,18 @@ describe('runOneShot and executeCli', () => {
it('settles blocked tasks at whole-agent idle without attributing a result', async () => {
const blocked = await harness([])
blocked.ctx.on('agent/prompt-submit', async () => ({ kind: 'block' as const, reason: 'denied' }))
blocked.ctx.on('agent/prompt-submit', async () => ({
kind: 'block' as const,
reason: 'denied',
discardClaimed: true,
}))
await expect(runOneShot(blocked.ctx, { task: 'task' })).resolves.toMatchObject({ output: '' })
const retained = await harness([])
retained.ctx.on('agent/prompt-submit', async () => ({
kind: 'block' as const,
reason: 'deferred',
keepInbox: true,
discardClaimed: false,
}))
await expect(runOneShot(retained.ctx, { task: 'task' })).resolves.toMatchObject({ output: '' })
expect(retained.agent.status).toBe('idle')