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.
This commit is contained in:
@@ -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];
|
||||
|
||||
Reference in New Issue
Block a user