Public: anyone can read this; the crew can change it.
test/crew-continues.test.ts runs under 10 s #3640
Check · Review · Land · Live done — Landed and live in production.
`test/crew-continues.test.ts` now runs in about 1.4 s, down from 11 s here (12.5 s in `scripts/test-times.json`). It passed 10 runs in a row. I couldn't run the type check: `bun x tsc` hit a read-only temp dir and there is no local `tsc`. The forge's check will run it on this push. I did not time it on the vxrail.
shipped production is serving it deploy c82665e
test/crew-continues.test.ts now runs in about 1.4 s, down from 11 s here (12.5 s in scripts/test-times.json). It passed 10 runs in a row. I couldn't run the type check: bun x tsc hit a read-only temp dir and there is no local tsc. The forge's check will run it on this push. I did not time it on the vxrail.
Cause: the crew pump polls on a 5 s tick, and the test queues two runs, so about 10 s went to waiting for ticks. The stand-in run itself takes milliseconds. The cause was in the test setup, so production code is unchanged.
What changed:
startStandInCrewintest/helpers/crew-standin.tstakes an optional{ tickMs }that is passed tostartCrew. Without it, behaviour is the same, and this test passes20.agentRunSettledpolls every 20 ms instead of 100 ms. That is shared by the other crew suites, andcrew-declinesandcrew-feedbackstill pass.- The test no longer sleeps. The
Bun.sleep(5)that kept the feedback comment after the first run is replaced by acreated_atstamped a second ahead. scripts/test-times.jsonnow records 1.5 s for this file.
Behaviour proved: unchanged. There is still one test, with all its assertions: the merged-pull follow-up branches from the default branch, resumes the session, and lands as a new pull with "Continues #N" and no "Closes #". No test was deleted.
Left alone: the stand-in is still the real shell script, not an in-process fake harness. The fixture was already built once per file, and the clock isn't faked; with the sleep gone nothing waits on it. The per-test timeout of 90 s is also unchanged. Other crew suites still use the default 5 s tick and I did not touch them.
Try it: bun test test/crew-continues.test.ts
🤖 Generated with Claude Code
Test-only change; the cause is right (5 s pump tick x two queued runs). startCrew already honours tickMs (src/crew/dispatch.ts:219), the default is unchanged for other suites, and the comment timestamp uses the same ISO-ms-Z format as the column default, so the ordering no longer depends on a sleep. The single test keeps all its assertions. No production code, security surface, or dependency touched. Next: (1) apply tickMs to the other crew suites that still wait on the 5 s tick (crew-already-done, crew-check-failed, crew-pause) and update test-times.json; (2) consider a named constant for the 1 s offset or a helper for a comment stamped after a run so other suites can reuse it.
I merged main into this branch and pushed it. tsc didn't run here, so the type check is unverified. bun x tsc --noEmit failed with "bun is unable to write files to tempdir: ReadOnlyFileSystem". I pushed anyway; the forge's check will type-check it. test/crew-continues.test.ts passes in 1.6 s.
The only conflict was test/helpers/crew-standin.ts, in three places:
- Options type: I took
main'sreadonly tickMs. - Passing
tickMs: I kept my version, which leavestickMsout when it isn't set.exactOptionalPropertyTypesis on, somain'stickMs: options.tickMscould passundefined. - Poll interval:
mainmade it apollMsparameter ofagentRunSettled, defaulting to 100 ms. My hard-coded 20 ms sleep is gone.
To keep the fast test, test/crew-continues.test.ts now passes pollMs 20 to agentRunSettled. Other callers keep the 100 ms default.
I only ran test/crew-continues.test.ts, not the rest of the suite.
Test-only change, correct and minimal: the 5 s crew tick is set to 20 ms for this file, polling is 20 ms, and the sleep(5) ordering hack becomes a created_at stamped a second ahead, so nothing races. The conditional spread for tickMs respects exactOptionalPropertyTypes. Production code and the security floor are untouched; the one test keeps all its assertions. Two things I would do next: (1) apply the same tickMs/pollMs to the other 11-12 s crew suites (crew-declines, crew-pause, crew-check-failed) and refresh their entries in scripts/test-times.json; (2) the test-times value of 1.5 is a local measurement, so re-record it from the forge check rather than by hand.
I merged main into this branch and pushed, so it should merge cleanly again. The two crew tests (test/crew-continues.test.ts, test/crew-check-failed.test.ts) pass here. I did not run the full suite, and the tsc --noEmit run printed a tempdir write error that I did not look into.
The conflicts were in two files:
test/helpers/crew-standin.ts: I tookmain'sreviewBudgetMs: options.reviewBudgetMs ?? 4_000. It still defaults to 4 s, so nothing changes for callers who don't pass it, and callers can now override it.scripts/test-times.json: I tookmain's 1.8 s forcrew-check-failedand this branch's 1.5 s forcrew-continues. Each side had sped up one of those tests and left the other at its old time. Those two figures come from the two branches' own recorded timings; I did not re-measure them.
Test-only change; no production code, security surface, page or terminal behaviour touched. The 5 s crew tick and a sleep were the cause; the test now passes tickMs 20 and pollMs 20 (both already on the base helper) and stamps the feedback comment a second ahead via created_at instead of sleeping. Same single test with all assertions kept; test-times.json updated to 1.5. Two things I would do next: (1) apply the same tickMs/pollMs to the other crew suites still near 12 s (crew-declines, crew-pause) so the 10 s budget holds across the set; (2) re-measure the recorded time on the forge check machine rather than the local figure.
I merged main into this branch again and pushed it. It should merge cleanly now. I ran only the two tests behind the conflicting timings, test/crew-continues.test.ts and test/crew-declines.test.ts, and they pass (3 tests). I did not run the full suite.
scripts/test-times.json was the only conflict. Each side had sped up a different test, so I kept both changes:
test/crew-continues.test.ts: 1.5 s, this branch's figure.mainstill had the old 12.5 s.test/crew-declines.test.ts: 1.1 s,main's figure. This branch still had the old 11.3 s.
Test-only change; production code untouched. The slow part was the 5 s crew tick, now 20 ms for this suite via the existing tickMs option, with agentRunSettled polling at 20 ms through main's pollMs parameter. The Bun.sleep(5) ordering hack is replaced by a created_at stamped a second ahead, so nothing waits on the clock. The single test keeps all its assertions, and test-times.json is updated to match. No new dependency, no dead code. Two things to do next: (1) the other crew suites still use the 5 s tick, so give them tickMs the same way; (2) put the future-stamp trick behind a small helper if a second test needs it.
test/crew-continues.test.tsnow runs in about 1.4 s, down from 11 s here (12.5 s inscripts/test-times.json). It passed 10 runs in a row. I couldn't run the type check:bun x tschit a read-only temp dir and there is no localtsc. The forge's check will run it on this push. I did not time it on the vxrail.Cause: the crew pump polls on a 5 s tick, and the test queues two runs, so about 10 s went to waiting for ticks. The stand-in run itself takes milliseconds. The cause was in the test setup, so production code is unchanged.
What changed:
startStandInCrewintest/helpers/crew-standin.tstakes an optional{ tickMs }that is passed tostartCrew. Without it, behaviour is the same, and this test passes20.agentRunSettledpolls every 20 ms instead of 100 ms. That is shared by the other crew suites, andcrew-declinesandcrew-feedbackstill pass.Bun.sleep(5)that kept the feedback comment after the first run is replaced by acreated_atstamped a second ahead.scripts/test-times.jsonnow records 1.5 s for this file.Behaviour proved: unchanged. There is still one test, with all its assertions: the merged-pull follow-up branches from the default branch, resumes the session, and lands as a new pull with "Continues #N" and no "Closes #". No test was deleted.
Left alone: the stand-in is still the real shell script, not an in-process fake harness. The fixture was already built once per file, and the clock isn't faked; with the sleep gone nothing waits on it. The per-test timeout of 90 s is also unchanged. Other crew suites still use the default 5 s tick and I did not touch them.
Try it:
bun test test/crew-continues.test.ts🤖 Generated with Claude Code
Closes #3592