Repository navigation
fix(sandbox): remove package caches an organization stopped using - #4547
Merged
Merged
Conversation
yannickmonney
force-pushed
the
fix/sandbox-package-cache-retention
branch
from
October 8, 2026 15:28
10a6e7e to
c17ec21
Compare
yannickmonney
force-pushed
the
fix/sandbox-package-cache-retention
branch
2 times, most recently
from
October 9, 2026 02:40
7eaa129 to
720b1d0
Compare
yannickmonney
enabled auto-merge
October 9, 2026 02:40
yannickmonney
force-pushed
the
fix/sandbox-package-cache-retention
branch
from
October 9, 2026 02:55
720b1d0 to
b8ac7a4
Compare
Every Docker session without Docker inside mounts its organization's pip, npm and bun cache volumes. None of these tools evicts on its own, and the volumes were removed only when the organization was deleted, so a cache only grew: one CUDA wheel set alone is 2-3 GB, kept for organizations that stopped using their sandboxes months ago, and invisible to disk relief. Each create now records its organization's last cache use under the session root (.package-caches/<organization>.used). The hourly look in the host sweep removes an organization's three volumes once no session container of the organization exists (any state, any spawner on the daemon) and that use is older than SANDBOX_PACKAGE_CACHE_RETENTION: 14 days by default, as for the stopped build caches; off keeps them. Caches without a recorded use (hosts upgraded from an earlier release) get one at first sight, so nothing goes before a full retention. A create holds its organization's caches from before it ensures them until its container exists; no removal starts while one is held, a create that arrives during a removal waits for it, and the removal judges the organization again under its claim. Docker refusing to remove a mounted volume stays the second safety net. The organization's next session after a removal starts with empty caches.
yannickmonney
force-pushed
the
fix/sandbox-package-cache-retention
branch
from
October 9, 2026 03:02
b8ac7a4 to
c719a31
Compare
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.
Per-organization pip/npm/bun cache volumes only ever grew: none of these tools evicts, and the volumes went only when the organization was deleted.
Changes
fix(sandbox): remove package caches an organization stopped using
Every Docker session without Docker inside mounts its organization's pip,
npm and bun cache volumes. None of these tools evicts on its own, and the
volumes were removed only when the organization was deleted, so a cache
only grew: one CUDA wheel set alone is 2-3 GB, kept for organizations that
stopped using their sandboxes months ago, and invisible to disk relief.
Each create now records its organization's last cache use under the
session root (.package-caches/.used). The hourly look in the
host sweep removes an organization's three volumes once no session
container of the organization exists (any state, any spawner on the
daemon) and that use is older than SANDBOX_PACKAGE_CACHE_RETENTION:
14 days by default, as for the stopped build caches; off keeps them.
Caches without a recorded use (hosts upgraded from an earlier release)
get one at first sight, so nothing goes before a full retention.
A create holds its organization's caches from before it ensures them
until its container exists; no removal starts while one is held, a create
that arrives during a removal waits for it, and the removal judges the
organization again under its claim. Docker refusing to remove a mounted
volume stays the second safety net. The organization's next session after
a removal starts with empty caches.
Verification
package-cache-retention.test.ts,docker-session-cache-volumes.test.ts,config.test.ts,volume.test.ts,docker-session-backend.test.ts(128 pass);@tale/sandboxtypecheck and lint clean; lint:manual ok.Part of the sandbox footprint and robustness pass (#4533, #4538 and siblings).