fix: improve shutdown and project continuity

This commit is contained in:
lofyer
2026-08-07 18:46:26 +08:00
parent 53d18e2b06
commit 954b42ef55
10 changed files with 245 additions and 34 deletions
+25
View File
@@ -135,6 +135,31 @@ describe('AgentRuntimeController', () => {
await controller.dispose()
})
it('forces runtime disposal when active work does not stop during shutdown', async () => {
const runtime = new TestRuntime(true)
const controller = new AgentRuntimeController(runtime, 1)
const stream = controller.run(
{
requestId: '1c608898-ecb7-4081-8174-2b6a52f53b12',
conversationId: 'conversation-shutdown',
prompt: 'test',
workMode: 'ask'
},
new AbortController().signal
)
const pendingEvent = stream.next()
await runtime.started
await controller.dispose()
expect(runtime.dispose).toHaveBeenCalledOnce()
runtime.finish()
await expect(pendingEvent).resolves.toMatchObject({
value: { type: 'text' }
})
await stream.return()
})
it.each(['ask', 'plan'] as const)(
'denies tool authorization in %s mode without prompting the user',
async (workMode) => {