Skip to content

fix(native): a new dependency cache deletes unreferenced caches at the 64-volume bound (HACK-2576) - #1138

Open
roodboi wants to merge 3 commits into
nextfrom
fix/native-cache-volume-bound
Open

roodboi wants to merge 3 commits into
nextfrom
fix/native-cache-volume-bound

Conversation

@roodboi

@roodboi roodboi commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

HACK-2576, second PR, part 2: the 64-cache-volume dead end from the audit.

Before:

  • Dependency cache volumes are shared by content fingerprint. Every change to a cache's inputs (lockfile, image, command, env) makes a new volume, and a writable cache is scoped per instance.
  • Cleanup only marks a cache released and never deletes it.
  • At 64 per pool owner, every start that needed a new cache refused with graph_cache_capacity for ever.

Now:

  • At the bound, check_cache_capacity deletes cache volumes that nothing refers to, oldest created first and with no force, until there is room. It runs under the start's provider lease.
  • Refers to means the volume's quoted name appears in any of these (cache_retention::references):
    • a graph receipt that is not removed, or its pending journal;
    • a native-authored receipt;
    • a cache quarantine record.
  • A retained run must find every volume it recorded, or its restore refuses graph_data_missing, so those are exactly the records that can need one.
  • Anything unreadable refuses as before. Caches are looked up only by the name in the current receipt, which is saved before resources are created, so the starting run's own caches are protected.
  • DELETE results:
    • refused by the engine (in use): the volume is kept;
    • not found: its place counts as free;
    • any other failure: reported.
  • The refusal now says what to do.

Review: one reviewer (a Claude subagent, read-only), one round. Nothing serious; four minor points, all fixed:

  • DELETE errors were swallowed;
  • read_tree was lenient with what it couldn't read;
  • the state root was derived by walking up from the receipt;
  • the docs' "oldest" wording.

It also traced every place a cache volume name is persisted, and found none that references misses.

Tests (Linux):

  • only unreferenced caches of this owner are offered, oldest first, and a prefix is not a reference;
  • retained, native and quarantine records count as references, a removed run doesn't, and an unreadable entry refuses.

Gaps: nothing exercises check_cache_capacity against an engine, and there is no restore-after-eviction test.

Clippy is clean on Linux and aarch64-apple-darwin --all-targets.

Docs: the guide's dependency cache section is updated.

cache volume room

SVG · source

🤖 Generated with Claude Code


Start Proof
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

roodboi and others added 3 commits November 23, 2026 02:22
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…it cannot read (HACK-2576)

Independent review: only a volume the engine refuses to delete (in use)
is kept, and one already gone frees its place; any other DELETE failure
is reported instead of becoming a capacity refusal. The reference
reader refuses non-file entries and too many entries in a run directory
without a receipt, and takes the state root from the candidate. The
docs say eviction goes in creation order.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
hack-docs Ready Ready Preview Nov 23, 2026 2:50am UTC

Request Review

@linear-code

linear-code Bot commented Nov 23, 2026

Copy link
Copy Markdown

HACK-2576

@roodboi

roodboi commented Nov 23, 2026

Copy link
Copy Markdown
Contributor Author

Ready for lead: #1138 (draft) at c655875b2b, the 64-cache-volume dead end. ls-remote matches. It's based on next 3f2f00e1b8 and independent of #1136 and #1137. About 170 source lines plus tests, docs and the chart. The review found nothing serious; the PR body lists the four small fixes it led to.

A check for the VM, in a throwaway home:

  1. Build up 64 caches: one project with a hack.dependencies cache whose lockfile you change about 64 times, with up and then down --remove-data after each change.
  2. The 65th up must start.
  3. docker volume ls inside the pool (hack native exec, or the runtime's engine socket) must show the oldest unreferenced cache gone and the current one present.
  4. A project left stopped-data-retained that uses a cache must still restore with up.

Order: next for me are the three plausible rows (native graph directories, the 64-image host cache, native environment records), each only where I can show a person reaches it, then HACK-2572's missing state.

@roodboi
roodboi marked this pull request as ready for review November 23, 2026 02:53
@roodboi

roodboi commented Nov 23, 2026

Copy link
Copy Markdown
Contributor Author

Lead read of c655875: accepted. Only this owner's dependency caches, only those no non-removed graph receipt, native-authored receipt, pending journal or quarantine record names (by exact quoted name), oldest created first, deleted without force so the engine keeps one a container uses, and an unreadable record refuses as before.

No VM run for this one: reaching 64 caches on a VM takes 64 dependency installs, and every rule above is decided offline and tested. The VM checks for #1136 (66 removed runs) cover the shared admission path.

🤖 Generated with Claude Code

This branch has not been deployed

No deployments
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.

1 participant