Repository navigation
CI: save caches only on main, so PR runs stop evicting the caches they need - #7990
Conversation
|
@codex review |
|
Codex Review: Didn't find any major issues. Nice work! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
CI status: the two red checks are pre-existing, not from this PR
Every non-cancelled The mechanism rules this PR out: the scanner resolves Fixing it means seven individually triaged baseline entries keyed on One real issue found and fixed here
Added a Diff re-verified
|
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 39f4aa514a
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| push: | ||
| branches: [main] |
There was a problem hiding this comment.
Restrict the weekly file-edit matrix on push events
Adding this push event also activates the existing file-edit job because its condition is only github.event_name != 'pull_request'. Consequently, every matching main push launches six model-heavy matrix jobs that may each run for up to an hour, despite the workflow explicitly designating that job as weekly/dispatch-only. Gate file-edit to schedule or workflow_dispatch, or separate cache seeding from the full workflow.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in d45124c. Correct catch, and it was a real side effect of the push trigger I added one commit earlier: file-edit was gated as "not a pull_request", which a push satisfies, so every matching merge to main would have started its 2-job matrix at 60 minutes each.
Verified that excluding it costs no seeding, which was the only reason the trigger exists: connection writes the identical gguf key (same GGUF_REPO unsloth/gemma-4-E4B-it-GGUF and same GGUF_FILE), and prompt-cache covers the separate hf key. file-edit seeds nothing connection has not already seeded.
Gated it positively on schedule or workflow_dispatch rather than negatively, so a future trigger cannot pull it back in by accident. On a main push the workflow now runs connection and prompt-cache only.
One correction to the item: the count is four jobs on a matching push before this fix (connection 1, file-edit 2, prompt-cache 1), not six. resume is workflow_dispatch-only and was never in scope. The substance stands.
|
@codex review |
|
Codex Review: Didn't find any major issues. 🎉 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
…y need Measured on unslothai/unsloth: 33.3GB across 30 caches against GitHub's 10GB per-repo limit, 3.3x over. The single worst offender is one 4.6GB model, Linux-gguf-unsloth/gemma-4-E4B-it, held FOUR times on four different PR refs (7633, 7870, 7938, 7973) for 18.4GB total, with no copy on main at all. None of those four copies is reachable from any other run: GitHub scopes a cache created on a PR to that merge ref, and its docs say such a cache "can only be restored by re-runs of the pull request". That produces a self-sustaining thrash loop. A PR misses, downloads the model, saves a copy only it can ever use, and pushes the repo further over the 10GB budget; GitHub then evicts by least-recently-used, which deletes main's copies -- the ones every PR is allowed to restore -- so the next PR misses too. Every PR run can restore from the default branch, so the fix is to keep exactly one copy per key, on main. All 20 cache/save steps across 10 workflows are now gated on github.ref == 'refs/heads/main'. Restores are untouched: a PR still restores from main, and still falls back to downloading when it misses, so no job can break on this. Nine of the ten workflows already run on push to main and will repopulate immediately. local-agent-guides-ci.yml has no push trigger, but its weekly schedule runs on the default branch, so its save still lands on main -- just once a week, which is also roughly the 7-day unused-cache retention window. If its cache proves to expire between runs, giving it a push trigger on the same paths filter is the follow-up. Expected effect: the four orphaned PR copies stop being created, freeing about 13.8GB, and what remains is the shared main-branch copy that every PR can hit.
Same reasoning as the model caches, applied to the other producer that writes from PR runs. swatinem/rust-cache saves on every ref by default, and the rust caches here are 550-840MB each. A PR-scoped copy can only be restored by re-runs of that same PR, yet it still counts against the 10GB per-repo budget and pushes LRU eviction onto main's copy, which every PR is allowed to restore. Covers the three uses in workflows that run on pull_request: security-audit.yml and both jobs in studio-tauri-smoke.yml. release-desktop.yml is left alone -- it is workflow_dispatch only and already runs against main, so it has no PR refs to pollute. Restores are unaffected: PRs still restore main's rust cache and still fall back to a cold build on a miss.
…eeded This workflow's four cache saves are now gated to refs/heads/main, but unlike the other ten workflows in that change it had no main-ref trigger at all: only a weekly cron, workflow_dispatch and pull_request. So main's copy of the 4.6GB gemma-4-E4B GGUF could be written at most once a week. That is a poor match for a 7-day unused-cache retention on a repo that is over the 10GB budget. Once LRU evicts main's copy, every PR touching these paths re-downloads 4.6GB until the Monday cron repairs it, and PR runs can no longer self-heal from a PR-scoped copy because those are exactly what the gate stops creating. Seeding on merge fixes it. The push trigger carries the same 13-entry paths filter as the pull_request trigger, so it only runs when the guarded sources actually change rather than on every commit to main.
The push trigger added for cache seeding also activated file-edit, because that job was gated as "not a pull_request" rather than on the events it actually wants. A push satisfies that, so every matching merge to main would have started its 2-job matrix at 60 minutes each. That runtime buys nothing. The seeding only needs the jobs that write the cache keys, and connection already writes the identical gguf key: same GGUF_REPO (unsloth/gemma-4-E4B-it-GGUF) and same GGUF_FILE, so file-edit seeds nothing connection has not already seeded. prompt-cache covers the separate hf key. Stating the intent positively (schedule or workflow_dispatch) also stops the next added trigger from silently pulling this job in again. On a main push the workflow now runs connection and prompt-cache only, which is exactly the pair that populates the caches the save steps are gated to main for.
d45124c to
9850393
Compare
|
Rebased onto main after #7974, #7975, #7980 landed. One conflict, and it resolved by deletion rather than by merge: #7975 absorbed File count went 12 to 11 for that reason. Re-audited the whole tree afterwards rather than trusting the rebase: 22 main-gated save steps, 0 ungated on any PR-triggered workflow. The single remaining ungated Merging on the existing review, since the rebase only narrowed the diff. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9850393920
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| push: | ||
| branches: [main] |
There was a problem hiding this comment.
Isolate scheduled runs from push cancellation
When a matching main push occurs while Monday's scheduled run is active, both runs use ${{ github.workflow }}-refs/heads/main; with cancel-in-progress: true, the push cancels the scheduled workflow. Because file-edit is now restricted to schedule/workflow_dispatch and does not run in the replacement push workflow, its weekly six-agent matrix is silently lost until the next cron or a manual dispatch. Include the event name in the concurrency group or otherwise prevent push runs from cancelling scheduled runs.
Useful? React with 👍 / 👎.
| push: | ||
| branches: [main] |
There was a problem hiding this comment.
Seed the model without running the full connection matrix
Although the new file-edit predicate removes the earlier six-cell side effect, connection remains unconditional and expands to six agents for every matching main push. When the main cache has been evicted—the exact scenario this trigger is intended to repair—all six runners restore the same missing key concurrently, each downloads the same 4.6 GB GGUF, and each then runs up to 40 minutes of agent testing before racing to save one immutable cache entry. Use a single seed job or restrict push events to one matrix cell so cache repair does not consume roughly six downloads and runner slots.
Useful? React with 👍 / 👎.
…gate #7990 gated every cache save on refs/heads/main, and this branch had renamed the three phases' step ids and cache dirs so one job could hold all three. Both are kept: the ref gate, and download-gguf-tools / gguf-cache-tools and download-gguf-vision / gguf-cache-vision in place of the shared names. The save step names stay literal rather than env.GGUF_REPO, which is now reassigned three times in the one job.
Summary
Measured on this repo: 33.3 GB across 30 caches against GitHub's 10 GB per-repo limit — 3.3x over.
Being over the limit is not a soft condition. GitHub evicts by least-recently-used until usage is back under, which its own docs call "cache thrashing."
The worst case
One 4.6 GB model,
Linux-gguf-unsloth/gemma-4-E4B-it, is held four times on four different PR refs — and not on main at all:None of those four copies is reachable from any other run. GitHub scopes a cache created on a PR to that merge ref; the docs say such a cache "can only be restored by re-runs of the pull request."
So this is a self-sustaining loop:
The fix
Every PR run can restore from the default branch. So keep exactly one copy per key, on main.
All 20
cache/savesteps across 10 workflows are now gated ongithub.ref == 'refs/heads/main'.Restores are untouched. A PR still restores from main, and still falls back to downloading on a miss, so no job can break on this — the worst case for any PR is exactly what it experiences today.
Coverage of the gate
push: [main, pip]— repopulates immediatelylocal-agent-guides-ci.ymlschedule(schedules run on the default branch)Worth watching: that weekly cron sits right at the 7-day unused-cache retention window. If its cache proves to expire between runs, the follow-up is to give it a push trigger on the same paths filter. I did not add one here, since it would run four
ubuntu-latestjobs on every matching main push.Expected effect
The four orphaned PR copies stop being created — roughly 13.8 GB freed — and what remains is the shared main-branch copy every PR can hit.
Still over budget after this
~19.5 GB remains, and main alone is 14.5 GB, so eviction will continue. The difference is that every evicted entry is now one all PRs could have used, rather than a dead PR-scoped copy.
Bringing it under 10 GB needs a separate decision I did not want to make unilaterally, because there is a real trade-off. Measured on staging, cache restore runs at ~57-61 MB/s and the HF download at ~55 MB/s — essentially identical. So caching a multi-GB GGUF buys little or no time while consuming most of the budget that keeps the small, genuinely fast caches (pip, rust, setup-python) alive. Against that, the cache does buy resilience when Hugging Face is flaky, which is presumably why
hf-download-with-retry.shexists. Happy to take that on as a follow-up with numbers if you want it.