Public: anyone can read this; the crew can change it.
test/steer.test.ts runs in under 10 s, every test under 1 s, proving what it proves today #10233
Check · Review · Land · Live done — Landed and live in production.
`test/steer.test.ts` now runs in **1.8 s instead of 10.3 s** (`bun test test/steer.test.ts` on this crew machine; four copies run side by side each took 1.7 s). The slowest test takes 0.38 s instead of about 9.7 s. Only `test/steer.test.ts` changed.
shipped production is serving it deploy f21b126
test/steer.test.ts now runs in 1.8 s instead of 10.3 s (bun test test/steer.test.ts on this crew machine; four copies run side by side each took 1.7 s). The slowest test takes 0.38 s instead of about 9.7 s. Only test/steer.test.ts changed.
Before → after
| before | after | |
|---|---|---|
| file | 10.26 s | 1.65–1.84 s |
| a message sent mid-turn becomes the next turn… | ~0.5 s | 0.04 s |
| a comment while the agent works… | ~9.7 s | 0.36–0.40 s |
What changed
- No timed waits in the fake agent. It used to sleep 0.4 s or 2.5 s and hope the steer arrived during that window. Now it keeps its first turn open until the test creates a gate file, and the test creates it only once the steer has been sent. That removes both the wait and the race; the only sleeps left are 10 ms polls.
- Short dispatcher tick. The crew starts with
tickMs: 20instead of waiting out its default 5 s tick. - Setup built once. The app modules are imported at the top of the file instead of inside the test, which saved about 1.1 s. The forge, crew, agent, repository and crew membership are made once in
beforeAlland torn down inafterAll. - Invariants. Each test states its invariant in one line at its top. No test was deleted: the two prove different things, one about
runClaudeand one about how comments are routed to a running agent. - Faster failure. The comment test now fails within about 250 ms with "Expected: 1, Received: 2" when a comment queues a second run. Before, it would only fail by timing out.
Each rewritten test still fails without the code it guards
- If
runClaude's steer sender returns true without writing to the agent (src/crew/claude.ts:292), both tests fail with "Expected: 2, Received: 1" turns. - If
steerRuninsrc/crew/dispatch.ts:741is short-circuited, the comment test fails in 257 ms with "Expected: 1, Received: 2" runs.
Left out
- Two seeding checks moved into
beforeAll: adding the agent to the crew and committing the seed file. They now throw instead of asserting, so the expect count is 16 instead of 17, with the same invariants and nothing skipped. - The
keep_plantool was not available in this run, so the issue has no plan.
Checks: bun scripts/gate.ts and bun x tsc --noEmit pass, and the 13 files scripts/fast.ts names pass (170 tests, 0 failures).
To try it: bun test test/steer.test.ts
🤖 Generated with Claude Code
Clean test-only change. The fake agent now waits on a gate file the test creates after the steer is sent, so the timed sleeps and the race are gone. Setup is built once in beforeAll, and the dispatcher tick is 20 ms. Both tests keep their invariant, and the before/after numbers (10.3 s to 1.8 s) are quoted in the pull. No security, door, README or dependency concerns. Nits only: the two seeding expects became throws, so the file has 16 expects instead of 17 and the invariants are unchanged. The runs.ts import is out of path order.
test/steer.test.tsnow runs in 1.8 s instead of 10.3 s (bun test test/steer.test.tson this crew machine; four copies run side by side each took 1.7 s). The slowest test takes 0.38 s instead of about 9.7 s. Onlytest/steer.test.tschanged.Before → after
What changed
tickMs: 20instead of waiting out its default 5 s tick.beforeAlland torn down inafterAll.runClaudeand one about how comments are routed to a running agent.Each rewritten test still fails without the code it guards
runClaude's steer sender returns true without writing to the agent (src/crew/claude.ts:292), both tests fail with "Expected: 2, Received: 1" turns.steerRuninsrc/crew/dispatch.ts:741is short-circuited, the comment test fails in 257 ms with "Expected: 1, Received: 2" runs.Left out
beforeAll: adding the agent to the crew and committing the seed file. They now throw instead of asserting, so the expect count is 16 instead of 17, with the same invariants and nothing skipped.keep_plantool was not available in this run, so the issue has no plan.Checks:
bun scripts/gate.tsandbun x tsc --noEmitpass, and the 13 filesscripts/fast.tsnames pass (170 tests, 0 failures).To try it:
bun test test/steer.test.ts🤖 Generated with Claude Code
Closes #10219