Repository navigation
Prune idle workspace Gradle caches at startup - #35
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VMtFpc22vNkYXSGLTHES97
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VMtFpc22vNkYXSGLTHES97
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VMtFpc22vNkYXSGLTHES97
Wire pruneIdleGradleCaches into createApp (real Docker runtime, not demo, GRADLE_CACHE_PRUNE_DAYS > 0), add isCodeContainerRunning to the Docker runtime provider, and document the setting and decision 049. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VMtFpc22vNkYXSGLTHES97
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VMtFpc22vNkYXSGLTHES97
- Treat docker inspect failures other than "no such container" as an error so the prune skips the workspace instead of assuming it's stopped. - Keep workspaces whose last_accessed_at is unparseable. - Re-check idleness right before the rename so a sign-in during the running check keeps the cache. - Log the prune as disabled in demo mode. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
On 2026-11-16 the prod data disk (50 GB) filled up during a class. Every workspace request then failed with
SQLITE_FULL, and students saw "Something went wrong!" and "Run channel disconnected". Each of the 20 workspaces held a 1.2–2.2 GBhome/.gradle/caches, mostly a copy of the image's pre-filled cache. Nothing ever removed it, so disk use grew by ~1.5 GB for every student who had ever signed in. As a stopgap the disk was grown to 100 GB and the caches of idle workspaces were cleared by hand.What
Every time the control plane starts, it deletes
home/.gradle/cachesfor each<dataDir>/users/ws_*workspace that nobody has used in more thanGRADLE_CACHE_PRUNE_DAYSdays (default 14;0turns it off).docker inspect.caches.pruning-<ts>(an atomic step), then deleted. A container that starts mid-prune therefore sees nocaches/and gets a clean fresh copy from the image. Leftovercaches.pruning-*folders are deleted on the next start.It runs at startup rather than on a timer because the prod VM is stopped between classes, and changing the VM startup script through Terraform would replace the instance. Decision log:
docs/decisions/049-startup-gradle-cache-prune.md. Design and plan:docs/superpowers/specs|plans/2026-11-16-gradle-cache-prune*.Testing
bun run typecheckandbun run checkare clean.bun run test: 577 pass.bun run test:web: 164 pass.gradle-cache-prune.test.tscovers:users/foldercreateAppboot, with pruning on and with00, blank values, and invalid values.Known limitations
These are minor, and neither loses student data:
🤖 Generated with Claude Code
https://claude.ai/code/session_01VMtFpc22vNkYXSGLTHES97