Skip to content

Stop leaking warm snapshots; sweep the self-hosted Macs' disks - #182

Merged
danbugs merged 3 commits into
mainfrom
runner-disk
Oct 22, 2026
Merged

danbugs merged 3 commits into
mainfrom
runner-disk

Conversation

@danbugs

@danbugs danbugs commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Every hluk upgrade left each guest's warm snapshots in the cache, about 1 GB per build for the agent and python images. The self-hosted Macs keep their disk between jobs, so every commit that changed the kernel added a set, until Simons-Mac-mini's disk was full and its jobs, hyperlight's included, started failing with No space left on device.

  • hluk run now prunes snapshots of the same rootfs saved by another hluk build, which no run can restore.
  • The self-hosted arm64 jobs keep hluk's cache in the job's temp directory (HLUK_CACHE_DIR=$RUNNER_TEMP/hluk-cache), which the runner empties when the job ends, so a job's snapshots and pulls go with it.
  • They first run dev/ci-disk.sh, which prints what fills the disk and removes what hluk and its tests leave there: snapshots and pulled images untouched for days, hluk-test-* dirs left by killed tests, and, under 20 GB free, the checkout's target/ and cargo's download cache.
  • runner-disk.yml sweeps every runner of both Macs (all of hluk's cache, temp dirs and this repo's build dirs), one job per runner, and lists any runner it missed so it can be run again. It runs on this PR, and can be dispatched later. Other repos' files are reported, never removed.

A snapshot's stamp names the hluk build that saved it (key=), and
another build refuses it, but pruning only removed the snapshots of a
rebuilt rootfs: every hluk upgrade left each guest's warm snapshots in
the cache for good, about 1 GB for the agent and python images.  On the
self-hosted Macs, whose runners keep their disk, every commit that
changed the kernel added a set, until a Mac's disk was full.

Prune those of the same rootfs too when saving one, and test what goes
and what stays.

Signed-off-by: danbugs <danilochiarlone@gmail.com>
Copilot AI balanced review requested due to automatic review settings October 22, 2026 00:27

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Failed cleanup-script downloads can be reported as successful sweeps, making runner coverage inaccurate.

1 open issue
What changed in this PR

This PR limits warm-snapshot cache growth and adds disk cleanup for self-hosted runners to prevent disk exhaustion.

Changes:

  • Prunes snapshots from incompatible hluk builds for the same rootfs, with regression coverage.
  • Adds disk reporting and cleanup before non-Windows arm64 host setup.
  • Adds a Mac runner sweep workflow with coverage reporting.
File Description
src/​cli/​rootfs.rs Prunes incompatible snapshots and tests retention behavior.
dev/​ci-disk.sh Reports disk usage and removes caches and build artifacts.
CHANGELOG.md Documents the snapshot cleanup fix.
.github/​workflows/​runner-disk.yml Adds runner sweeps and reports missed runners.
.github/​actions/​arm64-host/​action.yml Runs cleanup before host setup.

Review effort: Balanced

SCRIPT: https://raw.githubusercontent.com/${{ github.repository }}/${{ github.event.pull_request.head.sha || github.sha }}/dev/ci-disk.sh
run: |
echo "runner: $RUNNER_NAME ($(whoami))"
curl -fsSL --retry 3 "$SCRIPT" | bash

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in bf43566: the step runs with shell: bash, which is bash -eo pipefail, so a failed download fails the job and coverage does not count that runner as swept.

…s, and sweep every runner

The Macs' runners keep their disk between jobs, and a Mac's runners
share it with hyperlight's jobs; the Linux and Windows arm64 hosts are
fresh machines each time.  dev/ci-disk.sh shows what fills the disk and
removes what hluk and its tests leave there: warm snapshots and pulled
images untouched for days, hluk-test-* directories a killed test left,
and, under 20 GB free, the checkout's target/ and cargo's download
cache.  The arm64-host action runs it first, before anything that needs
room.

runner-disk.yml (dispatched, or on a change to it or the script) sweeps
each runner of both Macs: the whole hluk cache, every hluk-* temp
directory and this repo's build directories, one job per runner, each
holding its runner so they spread, and lists any runner none reached.
Other repos' files are shown, not removed.

Signed-off-by: danbugs <danilochiarlone@gmail.com>
Point HLUK_CACHE_DIR at the job's temp directory on the self-hosted
hosts, which the runner empties when the job ends, cancelled or not, so
the images a job pulls and the warm snapshots it saves go with it,
instead of staying in the runner user's home for later jobs, and
hyperlight's, to find the disk full.

Signed-off-by: danbugs <danilochiarlone@gmail.com>
@danbugs
danbugs merged commit b11c33e into main Oct 22, 2026
69 checks passed
@danbugs
danbugs deleted the runner-disk branch October 22, 2026 00:58
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.

2 participants