From 616ee55372ed511a0b5e6be29516a9750e1a57ee Mon Sep 17 00:00:00 2001 From: _Kerman Date: Mon, 3 Aug 2026 12:32:54 +0800 Subject: [PATCH] test(snapshot): cover minimum child turn waits --- .../support/acp-snapshot/tests/harness.spec.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/packages/support/acp-snapshot/tests/harness.spec.ts b/packages/support/acp-snapshot/tests/harness.spec.ts index 8ac8e2cfd8..ab16badeb9 100644 --- a/packages/support/acp-snapshot/tests/harness.spec.ts +++ b/packages/support/acp-snapshot/tests/harness.spec.ts @@ -826,6 +826,16 @@ describe('runScenario', () => { { agent: AGENT, mode: 'replay', fixtureFile: closed.fixtureFile }, ) expect(result.sessionLogs[1]?.parentSession).toBe(result.sessionId) + await expect(runScenario( + { + steps: [ + ...boot, + { op: 'promptAndCancel', text: 'hang' }, + { op: 'waitForSubagentTurnEnd', minimumTurn: 2, timeoutMs: 20 }, + ], + }, + { agent: AGENT, mode: 'replay', fixtureFile: closed.fixtureFile }, + )).rejects.toThrow(/subagent child #1 did not persist closed turn 2 within 20ms/) const seedOnly = await scenario({ prompt: 'hang-until-cancel', @@ -859,13 +869,13 @@ describe('runScenario', () => { ], }, { agent: AGENT, mode: 'replay', fixtureFile: seedOnly.fixtureFile }, - )).rejects.toThrow(/subagent child #1 did not persist a closed work turn within 20ms/) + )).rejects.toThrow(/subagent child #1 did not persist closed turn 1 within 20ms/) const missing = await scenario({}) await expect(runScenario( { steps: [...boot, { op: 'waitForSubagentTurnEnd', child: 2, timeoutMs: 20 }] }, { agent: AGENT, mode: 'replay', fixtureFile: missing.fixtureFile }, - )).rejects.toThrow(/subagent child #2 did not persist a closed work turn within 20ms/) + )).rejects.toThrow(/subagent child #2 did not persist closed turn 1 within 20ms/) }) it('waitForTitleAfterTurnEnd times out when the title precedes the boundary', { timeout: 20_000 }, async () => {