diff --git a/e2e/perstack-cli/options.test.ts b/e2e/perstack-cli/options.test.ts index c1792d82..3ab1cd56 100644 --- a/e2e/perstack-cli/options.test.ts +++ b/e2e/perstack-cli/options.test.ts @@ -162,35 +162,30 @@ describe.concurrent("CLI Options", () => { describe.concurrent("CLI Options - Filter", () => { /** 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. + * Uses startRun (emitted before LLM calls) to avoid flakiness from LLM + * errors that produce stopRunByError instead of completeRun. */ it( - "should filter events to only completeRun", + "should filter events to only startRun", async () => { - 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 })) - } + const cmdResult = await runCli( + [ + "run", + "--config", + GLOBAL_RUNTIME_CONFIG, + "--filter", + "startRun", + "e2e-global-runtime", + "Say hello", + ], + { timeout: LLM_TIMEOUT }, + ) + const result = withEventParsing(cmdResult) expect(result.exitCode).toBe(0) - // All events should be completeRun + // All events should be startRun const eventTypes = result.events.map((e) => e.type) - expect(eventTypes.every((t) => t === "completeRun")).toBe(true) + expect(eventTypes.every((t) => t === "startRun")).toBe(true) expect(eventTypes.length).toBeGreaterThan(0) }, LLM_TIMEOUT,