From 2c021f9104de75613a3c2ee9ad5518e2e9e70368 Mon Sep 17 00:00:00 2001 From: woai3c <411020382@qq.com> Date: Fri, 21 Aug 2026 00:50:50 +0800 Subject: [PATCH] test(cli): wait for interrupted turns to become idle --- packages/cli/tests/pty/tui-interrupt.test.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/cli/tests/pty/tui-interrupt.test.ts b/packages/cli/tests/pty/tui-interrupt.test.ts index a1d650a..1b38185 100644 --- a/packages/cli/tests/pty/tui-interrupt.test.ts +++ b/packages/cli/tests/pty/tui-interrupt.test.ts @@ -105,6 +105,11 @@ describe('TUI interruption', () => { ) expect(await pathExists(target)).toBe(false) + await harness.waitForScreen( + (screen) => screen.includes('[Request interrupted by user') && !screen.includes('Working'), + 'idle prompt after permission interrupt', + ) + await submitInput(harness, 'hi') await harness.waitForText('permission-interrupt-recovery') expect(await pathExists(target)).toBe(false) @@ -169,7 +174,10 @@ describe('TUI interruption', () => { harness.key('ctrl-c') await harness.waitForText('Press Ctrl+C again to exit') await waitFor(() => provider.mainRequests()[1]?.cancelled === true, 'sub-agent request cancellation', 5000) - await harness.waitForText('[Request interrupted by user') + await harness.waitForScreen( + (screen) => screen.includes('[Request interrupted by user') && !screen.includes('Working'), + 'idle prompt after sub-agent interrupt', + ) await submitInput(harness, 'hi') await harness.waitForText('sub-agent-recovery-ok', 10_000)