From c74c5f6d6768b4c2cd5aec8fcd06fe188c2dbf30 Mon Sep 17 00:00:00 2001 From: gsxdsm Date: Wed, 8 Jul 2026 22:37:29 -0700 Subject: [PATCH] perf(test): fast-forward fake timers in step-session terminal-activity test (was 22.6s real-time wait) The 'publishes failed terminal workflow step activity' test awaited executeAll() directly while the executor retried a failing step 3x with sleep() delays. Under useFakeTimers({ shouldAdvanceTime: true }) those sleeps consumed REAL wall-clock time (~22.6s locally, ballooning under CI load and busting the shard-2 watchdog). Fast-forward the retry sleeps via vi.advanceTimersByTimeAsync like sibling retry tests; the loop now completes in milliseconds. --- .../engine/src/__tests__/step-session-executor.test.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/engine/src/__tests__/step-session-executor.test.ts b/packages/engine/src/__tests__/step-session-executor.test.ts index dfd754189d..4fffc446f4 100644 --- a/packages/engine/src/__tests__/step-session-executor.test.ts +++ b/packages/engine/src/__tests__/step-session-executor.test.ts @@ -1399,7 +1399,15 @@ describe("StepSessionExecutor", () => { agentStore: { saveRun } as any, } as any); - const results = await executor.executeAll(); + // FNXC:EngineTests 2026-07-09-06:00: + // executeAll retries the failing step 3× with sleep() delays between attempts. With + // useFakeTimers({ shouldAdvanceTime: true }) these sleeps advance REAL wall-clock time if + // the test awaits executeAll directly (was 22.6s, ballooning under CI load and busting the + // shard-2 watchdog). Fast-forward the retry sleeps via fake timers like the sibling retry + // tests below, so the loop completes in milliseconds. + const resultsPromise = executor.executeAll(); + await vi.advanceTimersByTimeAsync(60_000); + const results = await resultsPromise; expect(results).toEqual([{ stepIndex: 0, success: false, error: "boom", retries: 3, tokenUsage: undefined }]); const terminalRun = saveRun.mock.calls.at(-1)?.[0];