Skip to content

Cache janitor: sweep every two hours, drop dead buildkit blobs on sight, keep one CodeQL overlay base - #10488

Merged
danielhanchen merged 1 commit into
mainfrom
ci/janitor-every-2h
Sep 8, 2026
Merged

danielhanchen merged 1 commit into
mainfrom
ci/janitor-every-2h

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

Why

The repo sat at 48.4 GB of its 50 GB Actions cache allowance with 131 entries. An inventory (2026-09-08) showed where it went:

  • 67 entries / 20.1 GB of buildkit-blob-* and index-studio-* from docker/build-push type=gha, all written by one run before Publish Docker on the daily schedule, and move layer cache off the Actions quota #10429 moved the image build to registry cache. Nothing reads them any more.
  • 31 entries / 10.3 GB of codeql-overlay-base-database-* and codeql-trap-*. CodeQL default setup writes a fresh overlay base on every push to main; a PR analysis restores by prefix and only ever takes the newest one.
  • The janitor ran once a day, so a busy day could stack 20 GB of dead or superseded entries before the next sweep, and with the cap reached GitHub evicts LRU, which is the live hf-* model caches the test jobs actually need.

The 98 dead entries were deleted by hand already; the repo is at 30 GiB now. This PR keeps it that way.

What changes

.github/workflows/cache-janitor.yml:

  • Schedule 17 */2 * * * (every two hours) instead of once a day.
  • A dead-family pass before the generation grouping: buildkit-blob-*, buildkit-index-*, index-* are deleted on sight. Backstop for any future type=gha cache in a docker workflow.
  • Per-family keep counts. codeql-overlay-base-database-* and codeql-trap-* keep one generation per prefix (their suffixes -<sha>-<run>-<attempt> and -<sha> are stripped for grouping). Everything else keeps KEEP (default 2) as before.
  • Step summary gains a dead-family candidates row.

CodeQL scanning itself is untouched. Stopping the overlay writes at the source is a repository property (github-codeql-disable-overlay) that needs an org custom property schema, which the tokens here cannot create; noted separately.

Verification

The step script was run locally in report mode against unslothai/unsloth with the same token scopes the workflow gets:

| mode | report only |
| caches total | 41 |
| dead-family candidates | 0 |
| superseded candidates | 4 |
| candidates would prune | 4 |
| freed | 0.8 GiB |
| usage before | 30.4 GiB of 50 GiB |

Zero dead-family hits because the 67 buildkit entries were already removed; the rule is exercised by the same case statement that matched them in the inventory. A workflow_dispatch mode=report run of this branch (34199388011) is queued behind the org runner backlog and will show the same table.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for security reviews. Please try again later.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 8, 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 ✅ Completed 2026-09-08T08:20:24.725602Z bcb9847 PR opened
ℹ️ 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

Copy link
Copy Markdown
Member Author

Report-mode dispatch of this branch finished: run 34199388011.

48 caches, 34.3 GiB, delete=no keep=2
would prune 6 caches, 1.5 GiB

No dead-family hits because the 67 buildkit entries were removed by hand before the run; the six candidates are superseded generations, same as the local report.

@danielhanchen
danielhanchen merged commit 3e5412e into main Sep 8, 2026
10 checks passed
@danielhanchen
danielhanchen deleted the ci/janitor-every-2h branch September 8, 2026 12:26
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