Public: anyone can read this; the crew can change it.

The data volume has under 15% free #13735

opened this in answer to

Merged 18d 12h ago, live in production

Kept clones idle for a week are now removed whole (#13734). This gives back about 90 MB per clone on the crew volume. It is one step toward the 15% line and may not clear it alone.

Notes

opened this

Kept clones idle for a week are now removed whole (#13734). This gives back about 90 MB per clone on the crew volume. It is one step toward the 15% line and may not clear it alone.

  • What changed: until now the hourly sweep only removed node_modules from idle clones. A clone kept for an open issue or pull kept its sources and .git for as long as the issue stayed open. The new sweepStaleClones in src/crew/orphans.ts removes the whole clone once nothing has touched it for seven days and no live run holds it. It runs in the same hourly clone sweep in src/crew/dispatch.ts, right after the existing steps.
  • Why it is safe: the code says every run fetches and resets to the remote, and clones afresh when the directory is missing. A resumed run costs one clone, not work. The one case that loses anything is a clone holding commits that were never pushed. I did not add a check for that.
  • Not done: I left apps/ (41 GiB) alone. Its checkouts are already dropped for dormant previews. I can't read /data/apps from the sandbox to see what else is in it. I also did not lower the 7-day or 8 GiB run-log limits.
  • Tests: a new test in test/orphan-clones.test.ts covers that only a week-idle, unheld clone goes. That file passes, bun x tsc --noEmit is clean, and bun scripts/gate.ts --fix was clean. I ran no other tests.
  • Docs: docs/features/disk-free.md has a new section on this.
  • To try it: push the pull to the forge and watch for "removed clones idle for a week" in the logs. Free space on the data volume should rise as old clones go.

Closes #13734

2 earlier comments
commented

Kept clones idle for a week are now removed whole (#13734). This gives back about 90 MB per clone on the crew volume. It is one step toward the 15% line and may not clear it alone.

  • What changed: until now the hourly sweep only removed node_modules from idle clones. A clone kept for an open issue or pull kept its sources and .git for as long as the issue stayed open. The new sweepStaleClones in src/crew/orphans.ts removes the whole clone once nothing has touched it for seven days and no live run holds it. It runs in the same hourly clone sweep in src/crew/dispatch.ts, right after the existing steps.
  • Why it is safe: the code says every run fetches and resets to the remote, and clones afresh when the directory is missing. A resumed run costs one clone, not work. The one case that loses anything is a clone holding commits that were never pushed. I did not add a check for that.
  • Not done: I left apps/ (41 GiB) alone. Its checkouts are already dropped for dormant previews. I can't read /data/apps from the sandbox to see what else is in it. I also did not lower the 7-day or 8 GiB run-log limits.
  • Tests: a new test in test/orphan-clones.test.ts covers that only a week-idle, unheld clone goes. That file passes, bun x tsc --noEmit is clean, and bun scripts/gate.ts --fix was clean. I ran no other tests.
  • Docs: docs/features/disk-free.md has a new section on this.
  • To try it: push the pull to the forge and watch for "removed clones idle for a week" in the logs. Free space on the data volume should rise as old clones go.
commented

Week-idle clones are now removed whole, unless they hold work the remote lacks. This answers all three of juniper's points. I ran test/orphan-clones.test.ts (6 pass) and tsc (clean). scripts/gate.ts --fix rewrapped comments in one file, and that rewrap is in the pushed commit. I ran no other tests.

  • Unpushed work: sweepStaleClones now calls holdsUnpushedWork before rm.
    • It keeps a clone when git status --porcelain is non-empty, or when git log --branches --not --remotes -1 finds a commit no remote ref has.
    • If git cannot answer, the clone stays too.
    • Both commands use a fixed argv with cwd set to the clone. They run with GIT_OPTIONAL_LOCKS=0, so the check does not refresh the index and stamp .git as touched.
    • The sweep now returns { removed, kept }, and the dispatcher logs "kept idle clones holding unpushed work" with the count.
  • Idle clock: idleness is now read from .git only. Trimming node_modules at one day touches only the clone directory, so it no longer restarts the week.
  • Tests (real git repos, in test/orphan-clones.test.ts):
    • A pushed, week-idle clone goes; a recent clone and a held clone stay.
    • A clone with a local-only commit, and one with uncommitted edits, both survive.
    • A clone whose node_modules was just trimmed is still removed.
  • Docs: docs/features/disk-free.md now describes the .git-based week and the unpushed-work guard, and the stray trailing blank line is gone.

I did not change anything in apps/ or the run-log limits.

commented

This pull fixes the two failing tests by registering src/crew/orphans.ts, the new module that starts git, in both spawn registries. I ran test/spawn-pipes.test.ts, test/spawn-sites.test.ts and test/orphan-clones.test.ts (12 pass), then tsc and scripts/gate.ts --fix (clean). I did not run the full suite; the forge's check does that on the push.

  • What was missing: the orphan-clone sweep from #13734 spawns git with a fixed argv in a clone directory. It pipes stdout, reads it to the end alongside the exit, and ignores stderr. It was listed in neither test/spawn-pipes.test.ts nor test/spawn-sites.test.ts.
  • The entries: test/spawn-pipes.test.ts now records it as a stdout pipe with that reason. test/spawn-sites.test.ts records why the argv is safe: no person's text reaches it.
  • Behaviour: no source files changed.

The pull still does what #13734 asked. The hourly sweep removes a clone that has been idle for a week, counted from .git. A clone that holds unpushed work stays.

Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs