Skip to content

feat: add --cleanup-bak to cefs gc + weekly GC workflow#2028

Merged
mattgodbolt merged 5 commits intomainfrom
molty/cefs-bak-cleanup
Mar 12, 2026
Merged

feat: add --cleanup-bak to cefs gc + weekly GC workflow#2028
mattgodbolt merged 5 commits intomainfrom
molty/cefs-bak-cleanup

Conversation

@mattgodbolt-molty
Copy link
Copy Markdown
Contributor

Summary

Adds .bak/.DELETE_ME_* cleanup to cefs gc, and a new weekly scheduled workflow to run it automatically.

Changes

bin/lib/cli/cefs.py

  • New --cleanup-bak flag on gc: scans for stale .bak and .DELETE_ME_* items and removes them before running image GC, so the GC sees a clean reference picture
  • Reuses existing find_files_by_pattern() from fsck infrastructure at NFS_MAX_RECURSION_DEPTH=3
  • --min-age applies to both bak cleanup and image GC; default changed from 1h2d for gc specifically (GC_DEFAULT_MIN_AGE; DEFAULT_MIN_AGE unchanged for other commands)
  • Respects --force (skip confirmation) and dry-run mode throughout

.github/workflows/cefs-gc.yml (new)

  • Weekly schedule: Sunday 09:00 UTC (cron: '0 9 * * 0') — after nightly install (05:30) and consolidation (07:15) have finished
  • Runs on ['admin'] (needs NFS access)
  • Command: sudo bin/ce_install cefs gc --force --cleanup-bak --min-age 2d
  • Manual dispatch with configurable min-age and include-broken
  • Uses ${{ github.event.inputs.min-age || '2d' }} to avoid the empty-default-on-schedule bug

bin/test/cefs/bak_cleanup_test.py (new)

10 tests covering: file/symlink/dir removal, age filtering, dry-run, mixed types, error handling, edge cases.

Test results

562 passed.


(I'm Molty, an AI assistant acting on behalf of @mattgodbolt)

@mattgodbolt
Copy link
Copy Markdown
Member

Testing...

The CEFS system creates .bak directories on NFS when replacing compiler
dirs with symlinks. These accumulate over time and need periodic cleanup.

- Add --cleanup-bak flag to `cefs gc` that removes old .bak and
  .DELETE_ME_* items before running image GC, reusing the existing
  discovery infrastructure from fsck
- Change gc default --min-age from 1h to 2d (other commands still use
  the global 1h default) for safer scheduled runs
- Add weekly GitHub Actions workflow (Sunday 09:00 UTC) for automated GC
  with --cleanup-bak
- Add cleanup_bak_items() and delete_bak_item() to gc module with tests

🤖 Generated by LLM (Claude, via OpenClaw)
🤖 Generated by LLM (Claude, via OpenClaw)
🤖 Generated by LLM (Claude, via OpenClaw)
Instead of os.walk() over all of /opt/compiler-explorer (very slow on EFS),
derive the paths to check from CEFS manifests. Each manifest records the
exact NFS destination path, so we can do O(n_compilers) lstat() calls
rather than an O(all_files_on_NFS) tree walk.

DELETE_ME_* items are found via targeted parent.glob() on each known path.

🤖 Generated by LLM (Claude, via OpenClaw)
@mattgodbolt mattgodbolt merged commit b88cf41 into main Mar 12, 2026
1 check passed
@mattgodbolt mattgodbolt deleted the molty/cefs-bak-cleanup branch March 12, 2026 22:43
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