Skip to content

The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.

test(cli): heldLaunches steps its fake timers to the next due timer, not 1 ms at a time (#2376)

harness-for-autonomous[bot]de3d22fc85c1
diff --git a/cli/src/core/agents/heldLaunches.spec.ts b/cli/src/core/agents/heldLaunches.spec.ts
index cf0d89eca..e835f6a13 100644
--- a/cli/src/core/agents/heldLaunches.spec.ts
+++ b/cli/src/core/agents/heldLaunches.spec.ts
@@ -342,11 +342,15 @@ it('climbs again from the start once a pass launches an agent, and when a person
await h.held.boot(async () => {})
await h.held.restoreHeld()
await vi.advanceTimersByTimeAsync(2_000 + 4_000 + 8_000 + 16_000 + 30_000)
+ // How long until the next pass, timer to timer. Stepping 1 ms at a time took 30,000 event-loop turns a call: at
+ // load ~85 (MacBook-Pro-19, 2026-10-30) it ran 17 s and timed the test out.
const nextPass = async () => {
- const before = h.restore.mock.calls.length
- for (let ms = 1; ms <= 30_000; ms++) {
- await vi.advanceTimersByTimeAsync(1)
- if (h.restore.mock.calls.length > before) return ms
+ const before = h.restore.mock.calls.length, start = Date.now()
+ while (vi.getTimerCount() > 0) {
+ await vi.advanceTimersToNextTimerAsync()
+ const waited = Date.now() - start
+ if (waited > 30_000) return null
+ if (h.restore.mock.calls.length > before) return waited
}
return null
}