Skip to content

CI: keep one generation of prefix-restored caches, share Core's pip cache - #14263

Merged
danielhanchen merged 1 commit into
mainfrom
ci-cache-keep-one
Oct 19, 2026
Merged

danielhanchen merged 1 commit into
mainfrom
ci-cache-keep-one

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

The repo's Actions cache is at 50.2 of its 50 GiB, so GitHub is evicting entries by last access regardless of whether they are live. That is the slow outcome for CI: the entry that goes can be main's pip cache or a multi-GB GGUF model, and the next run re-downloads it. This PR removes duplicate copies only; every family keeps its newest entry.

Where the space was

GiB Entries What
21.9 22 pip-v2-*: 11 job families, most with 2 generations
12.1 6 GGUF / HF model files (exact keys, untouched here)
6.3 6 uv-*: 3 OSes x 2 generations
6.0 8 v0-rust-*: 4 jobs x 2 generations
3.7 92 ccache shards, Playwright, apt, fe-dist, misc

Seven pip families (consolidated, consolidated-zoo, repo-cpu-tests, studio-backend x2, mlx, llama-cpp-smoke) all key on pyproject.toml + studio/backend/requirements/*.txt, so every edit to those files writes a new generation in all seven at once (about 8.7 GiB), and keep: 2 then holds the previous set beside it.

Changes

  1. cache-janitor: keep 1 generation for pip-v2-*, uv-* and v0-rust-*. All three restore with a prefix fallback (restore-keys: <prefix> in pip-cache-restore and uv-cache-restore; rust-cache's restore key is its key minus the lockfile hash), so a run whose exact key was pruned still starts from the newest generation and downloads only the wheels or crates that changed. The second copy only ever answered an exact revert, or a re-run on a merge ref older than the last requirements bump. pip-v2-notebooks-colab-* already worked this way; its special case is folded into the general rule. fe-dist-* has no fallback, so it still follows the keep input.
  2. consolidated-zoo restores consolidated's pip entry read-only. Both jobs run the same core-cpu-setup call on the same matrix (already asserted by test_zoo_suite_parallel_isolation.py), so the separate ~1.4 GiB entry held the same wheels twice. The shared-name rule exists because two writers of one key race and the loser's extras are never saved; with the save step removed there is one writer and nothing to lose.
  3. Tests. test_pip_cache_naming.py gains a READ_ONLY_BORROWERS allowlist and a test that the borrower restores only its owner's name, never saves, keys on the same files, and that the owner has exactly one saving job. test_cache_budget_discipline.py accepts restore-without-save for that one job only. The preamble-parity test now compares the restore step whole, name included.

Verification

  • tests/studio/test_pip_cache_naming.py, test_cache_budget_discipline.py, test_zoo_suite_parallel_isolation.py, test_uv_cache_discipline.py: 279 passed.
  • Mutations: putting back name: consolidated-zoo fails 2 tests; putting back the zoo save step fails 2 tests.
  • Janitor replay: the prune script from base and head was run against the live cache inventory (127 entries) with a stubbed gh.
    • Base: would prune 3 entries / 1.1 GiB, leaving 49.1 GiB.
    • Head: would prune 18 entries / 16.0 GiB, leaving 34.2 GiB.
    • Every deletion is an older generation of a pip-v2 / uv / rust family (plus the fe-dist entry base also prunes). No model cache or newest generation is touched, and no pip-v2 / uv / rust family keeps more than one entry per (ref, version).

Trade-off

A run that would have hit the older generation exactly now takes the prefix fallback and downloads the delta. That is a few wheels on a requirements bump, against a cache that otherwise sits over its ceiling and evicts live entries. The old consolidated-zoo entries are left for the janitor and GitHub's 7-day idle timer.

…ache

The repo sat at 50.2 of 50 GiB, so GitHub was evicting by last access. 14.8 GiB
of that was second generations of pip-v2, uv and rust-cache entries. All three
restore with a prefix fallback, so the older copy answers only an exact revert;
a run whose key is gone still starts from the newest generation and downloads
only what changed. The janitor now keeps 1 for those families (fe-dist, which
has no fallback, still follows the keep input).

consolidated-zoo runs the same core-cpu-setup install on the same matrix as
consolidated but held its own ~1.4 GiB pip entry. It now restores consolidated's
entry read-only and never saves, so there is one writer per key. The naming and
budget tests allow exactly this borrower and fail if it saves, renames, or keys
on different files.
@danielhanchen
danielhanchen marked this pull request as ready for review October 19, 2026 13:42
@danielhanchen
danielhanchen merged commit e632df1 into main Oct 19, 2026
@danielhanchen
danielhanchen deleted the ci-cache-keep-one branch October 19, 2026 13:43
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-19T13:43:02.826252Z 10c1551 Draft marked ready
🔒 Security Review ⚠️ Failed 2026-10-19T13:43:04.029550Z 10c1551 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

danielhanchen added a commit that referenced this pull request Oct 19, 2026
## Summary

Main is over the startup bundle budget again, by 189 B raw, so `Frontend
build + bundle sanity` fails on every PR based on it:

```
over the startup budget: raw 6682.2 KB > 6682.0 KB      (main at 6ccf0e4)
```

#14258 set both limits to the measured build plus a 160 B raw / 189 B
transfer margin. #11937 (a setting to hide the macOS menu bar icon) then
added 349 B raw / 78 B transfer to the startup chunks, and merged
without raising them.

## Cause

#11937 adds strings to `i18n/locales/en.ts`, which ships in the startup
chunks, and entries to the settings search index (`settings-search.ts`,
`dialog-search-index.ts`). That is small real growth. I measured each
commit since #14258 on its own:

| tree | raw B | transfer B |
|---|---|---|
| `46e4f50bea` (#14258) | 6,842,183 | 2,060,321 |
| `2b20770c91` (+ #11937) | 6,842,532 | 2,060,399 |
| `f5e91f1ca5` (+ #14223) | 6,842,532 | 2,060,421 |
| main `6ccf0e4e74` (+ #14232) | 6,842,532 | 2,060,400 |

#14223 and #14232 add no raw bytes. #14021 and #14263 change no frontend
code.

## Change

- **`check-bundle-budget.ts`:** a BUDGET comment entry for #11937, and
both limits moved to the measured build at main plus the same margin:
  - `rawBytes`: 6,842,343 -> 6,842,692.
  - `transferBytes`: 2,060,510 -> 2,060,589.

## Testing

One machine and build, Node 24, exact byte totals from the budget
script, 96 chunks.

- **Main against the old limits:** `over the startup budget: raw 6682.2
KB > 6682.0 KB`.
- **With this change:** `within budget (0.2 KB transfer, 0.2 KB raw to
spare)`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant