Skip to content

ci: free up runner disk space before build - #13

Merged
kim-em merged 9 commits into
mainfrom
ci/free-disk-space
Apr 17, 2026
Merged

ci: free up runner disk space before build#13
kim-em merged 9 commits into
mainfrom
ci/free-disk-space

Conversation

@kim-em

@kim-em kim-em commented Apr 16, 2026

Copy link
Copy Markdown
Collaborator

Summary

CI on main has been failing on every run since 2026-04-12 with No space left on device on the GitHub Actions runner. Root cause: within a single CI job, we build at least two Mathlib caches (~7 GB each):

  1. Root project via leanprover/lean-action@v1 with use-mathlib-cache: true — downloads and extracts olean files into ./.lake/packages/mathlib/.
  2. Temp workspace in scripts/check_comparator_installation.py — copies generated/two_plus_two to a tempdir, runs lake exe cache get which downloads another ~7 GB of oleans.

ubuntu-latest starts with ~14 GB free, so these two alone saturate the disk. The subsequent check_generated_builds.py step would multiply by the number of generated workspaces (each has its own Mathlib dependency), making things strictly worse. Every recent failure has died in exactly the same place: after "Run Evaluate Submission Tests" passes, before "Run Comparator Installation Checks" can finish.

Adding jlumbroso/free-disk-space@v1.3.1 as the first step reclaims ~30 GB of preinstalled tooling we don't use (Android SDK, .NET, Docker images, Haskell, large apt packages, swap). That gives enough headroom for multiple Mathlib caches plus the generated-workspaces build.

tool-cache is left disabled because the runner uses it for Python, which we need for the CI scripts.

Test plan

  • This PR's CI run reaches all steps including "Build Generated Workspaces" without OOM.
  • Runtime does not regress materially from the ~15-18 min currently observed up to the crash point.

🤖 Generated with Claude Code

kim-em and others added 9 commits April 16, 2026 19:55
GitHub ubuntu-latest runners start with ~14 GB free disk. Our CI
currently builds at least two Mathlib caches in a single job (the
root project's via `lean-action@v1`, and a temp `two_plus_two`
workspace's during `check_comparator_installation.py`), each ~7 GB
of olean files. The subsequent `check_generated_builds.py` step
would multiply this by the number of generated workspaces (each has
its own `mathlib` dependency), making the problem worse.

The net result: every main-branch CI run since 2026-04-12 has died
with "No space left on device" before reaching the comparator
installation or generated-builds steps.

Add `jlumbroso/free-disk-space@v1.3.1` to reclaim ~30 GB of
preinstalled tooling we don't use (Android SDK, .NET, Docker images,
Haskell, large apt packages, swap). This buys enough headroom for
multiple Mathlib caches plus the generated-workspaces build.

The `tool-cache` option is left disabled because the runner uses
it for Python, which we need for the CI scripts.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Brings the committed generated workspaces back in sync with the manifest
and the current mathlib pin in lake-manifest.json:

- Adds the 5 generated workspace directories that recent eval PRs
  (oppenheim, cayley, entrywise, normal product, catalan) committed
  source + manifest entries for but did not regenerate.
- Updates the mathlib `rev` field in every existing workspace
  `lakefile.toml` from `v4.30.0-rc1` to `50d5513e83c` to match the
  bump in #9.
- Updates `generated/index.json` accordingly.

This unblocks `Run Eval Workflow Check` and `Verify Generated Output`,
which both call `generate(check=True)` and were failing on these
discrepancies once the disk-space crash was fixed.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
`run_eval.score_problems` computes
`workspace_path.relative_to(gp.REPO_ROOT)`, which raises `ValueError`
when the workspace path is outside `REPO_ROOT`. `evaluate_submission.py`
already documents and works around this by putting its tempdir under
`REPO_ROOT`. `check_eval_workflow.py` did not, so once CI got past the
disk-space and missing-workspace issues it crashed here instead.

Mirror the `evaluate_submission.py` pattern: pass
`dir=gp.REPO_ROOT` to `tempfile.TemporaryDirectory`.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
When a problem is defined inside namespace blocks (e.g.
`namespace FormalMathEval / namespace Combinatorics`), ChallengeDeps.lean
wraps the extracted definitions in those namespaces. But Challenge.lean
used unqualified names without opening those namespaces, causing
"Unknown identifier" errors (e.g. `markoffGraph`).

Fix `extract_context_opens` to track namespace/end blocks from the
source file and emit a corresponding `open` statement. The open is only
emitted when `ChallengeDeps.lean` exists (i.e. when the namespace is
actually defined in the workspace); without ChallengeDeps, the namespace
doesn't exist and `open` would error.

Regenerated all workspaces.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1. Push trigger restricted to main only — branch pushes no longer fire
   a redundant CI run alongside the pull_request-triggered one. This
   halves the number of runs for every PR.

2. "Build Generated Workspaces" is now conditional on generated/ files
   actually changing. Problem-author PRs that only touch FormalMathEval/
   and manifests/ skip the expensive workspace-build step entirely.

3. Shared Mathlib cache across generated workspaces — before building,
   a new step downloads Mathlib olean files once (via `lake update` +
   `lake exe cache get` in the first workspace), then hard-links the
   `.lake/packages/` tree into every other workspace. This turns 22
   independent ~2 GB downloads into a single download + fast hard-link
   copies.

Together these reduce typical PR CI from ~90 min / 2 runs down to
~15 min / 1 run for problem-author PRs, and from ~90 min × 2 to
~30 min × 1 for PRs that touch generated/ files.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Merge main into the CI fix branch and regenerate all workspaces to
include the newly added problems (Schur-Weyl duality, exceptional Lie
tensor squares, von Neumann DCT, Cerf gamma_4, and others).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The statement extractor used a non-greedy regex that matched the first
`:= by` in the declaration text. For theorems whose type contains
`haveI ... := by` clauses (e.g. `substInv_X_sub_X_sq_eq_catalan`),
this truncated the statement at the inner `:= by` instead of the
outer proof marker.

Use `rfind(":= by")` to locate the last occurrence, which is always
the outer proof start. Regenerated the affected workspace.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@kim-em
kim-em merged commit 09132fd into main Apr 17, 2026
1 check passed
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