- All playbooks
- Caching and setup
- Cache the directories the build actually uses
Cache the directories the build actually uses
Align restored and saved cache paths with the tool’s real output directories so the next run can use the cached work.
How companies used this technique
Read what each company changed and follow the original sources.
Cache the directory the build actually uses
Codex restored a home-directory cache while Windows Bazel could write to a different drive. The change exports one path, uses it for both restore and save, removes the conflicting Bazel setting, and falls back to a cold build when the cache service errors.
Restore, build and save share one cache path on Windows Source
- Use it when
- A restore reports success but the tool still downloads or rebuilds.
- Before applying it
- Path conventions differ across runners. A cache-service error falls back to a real build and leaves test and lint results untouched.
Cache the paths the build actually writes
SubmitQueue originally cached ~/.cache/bazel while its build wrote separate disk and repository caches. The correction saves those actual paths, gives each job its own cache entries, and adds a per-run suffix with stable restore prefixes so the content-addressed cache can grow. OPT61 is adapted to repairing an existing cache.
The author links a first run of about 10m and a second run of 1m24s; the same PR also changes application and test code. Source
- Use it when
- Cache steps report success but warm runs still download dependencies or rebuild unchanged targets.
- Before applying it
- Confirm the paths hold reusable inputs and outputs. The run-specific save key suits a content-addressed cache with stable restore prefixes. Measure restore and upload time, eviction and cold misses, and restrict cache writes across trust boundaries.
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