- All playbooks
- Slow tests
- Shorten deliberate test waits
Shorten deliberate test waits
Reduce waits whose timing requirements are known, preserving the timeout or consistency behavior the test is intended to cover.
How companies used this technique
Read what each company changed and follow the original sources.
Shorten deliberate sleeps in tests and examples
The Claude Agent SDK's error-handling example, which CI runs on every pull request, asked for a 60-second sleep to trigger a 10-second timeout. The change asks for 5 seconds and times out at 3, so the timeout path still runs.
The PR's estimate is that the shorter sleep removes 50+ seconds from the examples job; the same PR also raises that step's timeout. Source
- Use it when
- A test or a CI-run example sleeps for a fixed time only to exercise a timeout or a slow path.
- Before applying it
- The sleep and the timeout it triggers shrink together, so the timeout branch still runs and is asserted.
Shorten only waits whose consistency is already proved
Chroma reduced 80 fixed 2-second waits, from three call sites, to 200 milliseconds; Couchbase reduced per-operation waits while adding a service readiness probe.
Chroma’s PR estimates the Run Chroma tests step drops from 160 seconds of sleeping to about 16 seconds. Source
- Use it when
- A service exposes no usable readiness predicate and repeated conservative waits dominate tests.
- Before applying it
- Prefer a real completion signal; retain coverage and stress slow runners before choosing a lower bound.
Company Playbooks
- Read Anthropic’s playbookRun only affected tests
- Read DoorDash’s playbookRun build and test in parallel, sharded across CI agents
- Read Linear’s playbookBenchmark the same job on faster hardware
- Read Mastra’s playbookStarSling runners for the slowest test workflow
- Read OpenAI’s playbookRank CI fixes by the minutes they save
- Read Ramp’s playbookMove a CPU-bound test suite to a faster CPU
- Read Shopify’s playbookLet an agent iterate against one CI metric
- Read Spotify’s playbookBuild arm64 on native arm64 runners
- Read Stripe’s playbookRun only the tests a change can reach
- Read Uber’s playbookBuild the merge-queue speculations most likely to be needed