improvement(ci): bound the local Turborepo cache - #7214
Merged
Conversation
Turborepo's local cache eviction is opt-in until 3.0, so without cacheMaxAge and cacheMaxSize the filesystem cache grows forever. In CI each cache dir lives on a Blacksmith sticky disk that is mounted many times a day, so it never idles long enough for Blacksmith's own 7-day inactivity purge to fire, and one cache-missing app build writes a ~400 MB artifact. The build cache disk reached 206 GB over 43 days — roughly 4.8 GB/day of sediment — at ~$0.51/GB-month. Size is the real bound; age is hygiene. A cache hit only happens when a task's input hash is unchanged, which recurs within hours, not weeks, so nothing written days ago can ever be read again — the sibling PR-keyed disk does the same job in 30 GB. The cache still earns its keep: the app build hits ~17% of the time and a hit saves ~7 minutes, so this is a ceiling, not a removal. That distinguishes it from the Turbopack persistent cache, which was removed because it measured 3.2x SLOWER; this one is measurably faster, just unbounded. Set in turbo.json rather than per-step env vars so there is one source of truth and turbo validates it. Verified against the installed 2.9.14: both keys are in its schema, turbo parses them, and the task hash is byte-identical with and without them, so enabling eviction does not invalidate the existing cache.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
Greptile SummaryThis PR bounds Turborepo’s filesystem cache by adding seven-day and 40 GB global retention limits.
Confidence Score: 4/5The PR appears safe to merge from a runtime perspective, with one non-blocking repository documentation-rule violation to address. The cache-limit settings have no established functional defect, but their explanatory block uses a comment form prohibited by the repository’s global standards. Files Needing Attention: turbo.json
|
| Filename | Overview |
|---|---|
| turbo.json | Adds valid-looking global cache-retention limits, but the accompanying comment block violates the repository-wide documentation convention. |
Reviews (1): Last reviewed commit: "improvement(ci): bound the local Turbore..." | Re-trigger Greptile
This was referenced Aug 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Turborepo's local cache eviction is opt-in until 3.0, so without
cacheMaxAge/cacheMaxSizethe filesystem cache grows forever. In CI each cache dir lives on a Blacksmith sticky disk that's mounted many times a day, so it never idles long enough for Blacksmith's own 7-day inactivity purge to fire — and one cache-missing app build writes a ~400 MB artifact.Result:
sim-turbo-cache-build-pushreached 206 GB over 43 days (~4.8 GB/day of sediment) at ~$0.51/GB-month. The siblingbuild-pull_requestkey does the same job in 30 GB.Size is the real bound; age is hygiene. A cache hit only happens when a task's input hash is unchanged — a re-run, or a commit touching only unrelated workspaces — and that recurs within hours, not weeks. Nothing written days ago can ever be read again.
This is a ceiling, not a removal. The app build hits
>>> FULL TURBO~17% of the time and a hit saves ~7 minutes, so the cache clearly earns its keep. That's what distinguishes it from the Turbopack persistent cache removed earlier, which was dropped because it measured 3.2× slower — this one is measurably faster, just unbounded.Set in
turbo.jsonrather than per-step env vars so there's one source of truth and turbo validates it.Verification
Against the installed turbo 2.9.14 (not assumed — run):
$schemaURL, so no schema bump is needed.turbo run --dry=jsonparses the config with no unknown-key error.94bbd3189c137ec2both ways), so enabling eviction does not invalidate the existing cache.Expected: ~246 GB → ~75 GB across the four turbo keys, roughly $125/mo → $38/mo, with no loss of realized hits (all observed hits were same-day).
Notes for the reviewer
turbo run, so the existing 206 GB drains over several runs rather than in one. It can be reclaimed immediately with a one-shot sticky-disk delete if we'd rather not wait — that costs exactly one cold build, which 83% of pushes already pay.TURBO_CACHE_DIR: .turbois set on the build and test steps but not onturbo run type-check, so that job's cache splits across.turbo/and.turbo/cache/. Each invocation evicts its own dir so both are now bounded, but unifying them naively would strand the existing cache in the dir eviction no longer looks at.Type of Change
Testing
Verified as above against the installed turbo binary.
bun run lintand all 38check:auditspass.Checklist