From 62d2193f7809298ae88f84f497e40fc8afa2732a Mon Sep 17 00:00:00 2001 From: HiranoMasaaki Date: Mon, 23 Feb 2026 16:48:13 +0000 Subject: [PATCH] fix: add retry logic to filter E2E test for LLM non-determinism When --filter completeRun is used and the LLM call errors, the runtime emits stopRunByError (blocked by the filter) and exits 0 with zero events. Add retry (up to 3 attempts) to handle this case. Co-Authored-By: Claude Opus 4.6 --- e2e/perstack-cli/options.test.ts | 36 +++++++++++++++++++------------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/e2e/perstack-cli/options.test.ts b/e2e/perstack-cli/options.test.ts index ffec484a..c1792d82 100644 --- a/e2e/perstack-cli/options.test.ts +++ b/e2e/perstack-cli/options.test.ts @@ -161,23 +161,31 @@ describe.concurrent("CLI Options", () => { }) describe.concurrent("CLI Options - Filter", () => { - /** Verifies --filter option with single type */ + /** Verifies --filter option with single type. + * Retries up to 3 times because --filter completeRun only outputs the final + * event; when the LLM call errors the runtime emits stopRunByError (blocked + * by the filter) and exits 0 with zero events. + */ it( "should filter events to only completeRun", async () => { - const cmdResult = await runCli( - [ - "run", - "--config", - GLOBAL_RUNTIME_CONFIG, - "--filter", - "completeRun", - "e2e-global-runtime", - "Say hello", - ], - { timeout: LLM_TIMEOUT }, - ) - const result = withEventParsing(cmdResult) + const args = [ + "run", + "--config", + GLOBAL_RUNTIME_CONFIG, + "--filter", + "completeRun", + "e2e-global-runtime", + "Say hello", + ] + let result = withEventParsing(await runCli(args, { timeout: LLM_TIMEOUT })) + for ( + let attempt = 1; + attempt < 3 && result.exitCode === 0 && result.events.length === 0; + attempt++ + ) { + result = withEventParsing(await runCli(args, { timeout: LLM_TIMEOUT })) + } expect(result.exitCode).toBe(0) // All events should be completeRun