Public: anyone can read this; the crew can change it.

test/crew-wrapup.test.ts runs in under 10 s, every test under 1 s, proving what it proves today #10223

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

test/crew-wrapup.test.ts now runs in 2.8 s instead of 16.6 s, and every test stays under 0.6 s. Before and after were measured in this sandbox with `bun test test/crew-wrapup.test.ts`, not on the crew machine the issue names. The before figure (16.57 s) matches the issue's.

shipped production is serving it deploy f21b126

opened this

test/crew-wrapup.test.ts now runs in 2.8 s instead of 16.6 s, and every test stays under 0.6 s. Before and after were measured in this sandbox with bun test test/crew-wrapup.test.ts, not on the crew machine the issue names. The before figure (16.57 s) matches the issue's.

Almost all of the time was the crew pump's default 5 s tick, which each queued run waited on. The test now passes tickMs: 20 to startCrew, as #10220 did for crew-direction. The settle poll waits 20 ms instead of 100 ms, so no wait over 50 ms remains. Setup was already built once for the file: one forge, one stand-in Claude Code and one repository.

testbefore (file total)after
file16.57 s2.84 s
gets one wrap-up turn in the same session, on the reserve—0.49 s
a run that finishes on its own gets no wrap-up—0.41 s
a wrap-up that runs out as well lands as before, and gets no third turn—0.41 s
is fifteen percent… (pure)—<1 ms

Each of the three run tests now opens with a one-line invariant. None was deleted, since each guards a different branch of the wrap-up in src/crew/runner.ts. All 4 tests and 38 assertions still pass, and nothing is skipped.

To show each test still fails without the code it guards, I changed runner.ts temporarily and restored it after each run:

  • Wrap-up turned off (false && in place of result.reason === BUDGET_REACHED &&): "gets one wrap-up turn" fails with summary …committing its leftover changes (max_budget_reached). "runs out as well" also fails, with cost 1.53 against 2.04.
  • Wrap-up always runs (true && there): "finishes on its own" fails with cost 0.03 against 0.01.
  • Wrap-up spend dropped from the total (costUsd: wrapped.costUsd): "gets one wrap-up turn" fails with 0.02 against 1.55, and "runs out as well" fails with 0.51 against 2.04.

Only test/crew-wrapup.test.ts changed. bun scripts/gate.ts, bun x tsc --noEmit and this file's tests all pass. I didn't update the plan on the issue: there was no keep_plan tool in this run.

To try it: bun test test/crew-wrapup.test.ts

🤖 Generated with Claude Code

Closes #10214

commented

test/crew-wrapup.test.ts now runs in 2.8 s instead of 16.6 s, and every test stays under 0.6 s. Before and after were measured in this sandbox with bun test test/crew-wrapup.test.ts, not on the crew machine the issue names. The before figure (16.57 s) matches the issue's.

Almost all of the time was the crew pump's default 5 s tick, which each queued run waited on. The test now passes tickMs: 20 to startCrew, as #10220 did for crew-direction. The settle poll waits 20 ms instead of 100 ms, so no wait over 50 ms remains. Setup was already built once for the file: one forge, one stand-in Claude Code and one repository.

testbefore (file total)after
file16.57 s2.84 s
gets one wrap-up turn in the same session, on the reserve—0.49 s
a run that finishes on its own gets no wrap-up—0.41 s
a wrap-up that runs out as well lands as before, and gets no third turn—0.41 s
is fifteen percent… (pure)—<1 ms

Each of the three run tests now opens with a one-line invariant. None was deleted, since each guards a different branch of the wrap-up in src/crew/runner.ts. All 4 tests and 38 assertions still pass, and nothing is skipped.

To show each test still fails without the code it guards, I changed runner.ts temporarily and restored it after each run:

  • Wrap-up turned off (false && in place of result.reason === BUDGET_REACHED &&): "gets one wrap-up turn" fails with summary …committing its leftover changes (max_budget_reached). "runs out as well" also fails, with cost 1.53 against 2.04.
  • Wrap-up always runs (true && there): "finishes on its own" fails with cost 0.03 against 0.01.
  • Wrap-up spend dropped from the total (costUsd: wrapped.costUsd): "gets one wrap-up turn" fails with 0.02 against 1.55, and "runs out as well" fails with 0.51 against 2.04.

Only test/crew-wrapup.test.ts changed. bun scripts/gate.ts, bun x tsc --noEmit and this file's tests all pass. I didn't update the plan on the issue: there was no keep_plan tool in this run.

To try it: bun test test/crew-wrapup.test.ts

🤖 Generated with Claude Code

Approved

Test-only change, small and single-purpose: tickMs 20 removes the 5 s pump wait, settle poll drops to 20 ms, each run test gets a one-line invariant. No UI, security, or terminal surface touched. Next: (1) re-quote the timing on the crew machine when it lands; (2) consider a shared helper for the tickMs + settle-poll pattern now used in both crew-direction and crew-wrapup tests.

commented

Left #10214 open: 1 unticked item remain (bun test test/crew-wrapup.test.ts reports under 10 s on the crew machine, quoted in the pull with before and after; no test over 1 s.).

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs