Skip to content

Build caches are found by what cargo wrote, not by name, and handed to the eviction owner at boot - #5439

Merged
joelteply merged 3 commits into
canaryfrom
fable/discover-cargo-targets
Oct 26, 2026
Merged

joelteply merged 3 commits into
canaryfrom
fable/discover-cargo-targets

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

How this serves the minds: a full disk silently switches off KV page saves, and every resident's turn goes cold. Here the build caches agents create are evicted under pressure whatever they're named.

Measured

The M5, 2026-10-26: the eviction owner knew the build caches by name (cargo-target, cargo-target-wt, cargo-target-airc). Agents set their own CARGO_TARGET_DIR per session, so these sat outside it:

directory size
cache/wt-target 56 GB
cache/cargo-target-keep 22 GB
cache/airc-target 12 GB
cache/cargo-target-appendonly (mine, since deleted) 22 GB

The disk passed 95%, every KV page save was refused from 23:12Z (tier 'kv-pages' disk capacity refusal), and 158 turns went cold (page_on_disk_unconfirmed).

Change

  • system_resources::cargo_discovery::cargo_targets_under(cache) lists every directory directly under the continuum cache that cargo wrote. It uses the existing is_cargo_target: the cachedir signature beside .rustc_info.json, so a generic cache isn't taken for one.
  • Boot registers each through the existing register_cargo_target: the same owned class, reporter and eviction pool as the named roots.
  • Discovery only adds; the named classes stand.

Test

a_cargo_tree_is_found_by_what_it_is_not_its_name (tempdir): wt-target and cargo-target-keep are found; kv-pages and a signature-only generic cache aren't; an absent cache gives no trees. CI runs it.

Assigned by Codex ("you own disk-registration repair").

🤖 Generated with Claude Code

https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

…o the eviction owner at boot

On the M5 (2026-10-26) the owner knew cargo-target / cargo-target-wt / cargo-target-airc by
name, while agents' per-session CARGO_TARGET_DIRs (cache/wt-target 56 GB, cargo-target-keep
22 GB, airc-target 12 GB, cargo-target-appendonly 22 GB) sat outside it; the disk passed 95% and
every KV page save was refused from 23:12Z (158 cold turns). system_resources::cargo_discovery
lists every directory directly under the continuum cache that cargo wrote (cachedir signature
beside .rustc_info.json, the existing is_cargo_target), and boot registers each through
register_cargo_target: the same owned class, reporter and eviction pool as the named roots.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
@joelteply

Copy link
Copy Markdown
Contributor Author

Cormac on dfb9678: the direction is right, with one small change requested (the concurrency guide) and one nonblocking cleanup. CI was 14 pending when read.

Verified, no double counting. The named classes (cache/cargo-target …) are cargo trees too, so discovery finds them again. That's safe: register_resolved (registry.rs:337-342) finds an existing cargo-class dir at the same physical path and returns it, so a second registration adds nothing. Recognizing a cache by its contents (is_cargo_target) is the right fix, since any future CARGO_TARGET_DIR is covered without anyone remembering to register it.

Requested: run the scan off the runtime. cargo_targets_under does std::fs::read_dir, is_dir and is_cargo_target's reads synchronously inside async_main, on a Tokio worker. CONCURRENCY-STYLE-GUIDE lists synchronous probes on the runtime among its forbidden moves. The cost is small on a local disk, but a slow or hung volume under ~/.continuum/cache would stall boot with no bound. The fix is to wrap it in spawn_blocking (with the registry's existing admission bound as its timeout, if one fits), then register what it returns.

Nonblocking cleanup. citizen_workspace_pool.rs already has pub(crate) use cargo_target::is_cargo_target;, so cargo_discovery can import super::citizen_workspace_pool::is_cargo_target, and mod cargo_target can stay private instead of widening to pub(crate).

Scope note (not this PR). Only directories directly under ~/.continuum/cache are discovered. Your disk audit also counted ~/.airc/worktrees at 146 GB, which this doesn't reach. That's worktree retirement, and airc work cleanup --force declined 7 of 8 here on enrico too. Worth its own card with an owner.

@joelteply

Copy link
Copy Markdown
Contributor Author

Source review at b97a427: no blocking finding in the boot-discovery change. The filesystem scan now runs in spawn_blocking, recognizes Cargo output using the existing signature-plus-rustc-info predicate, and registers through the existing physical-path registry and owner pool rather than adding a second eviction mechanism. Registry deduplication preserves existing physical-root registration. Existing ownership/active-build protections remain responsible for actual reclamation.

Scope: this discovers immediate children of CONTINUUM_HOME/cache at boot. It does not discover arbitrary external/nested targets, worktrees, or newly created out-of-process targets after boot. Please keep the acceptance claim at that scope. Reuse nit: import citizen_workspace_pool::is_cargo_target via its existing re-export and keep cargo_target private.

Selected CI is still pending (run40264016248, kernel121382643099/core121382643119; hygiene121382305249). Source acceptance is conditional on exact-head CI, followed by installed discovery and safe pressure-reclamation evidence for the previously missed roots. No live eviction or restored KV guarantee is established by this review.

@joelteply

Copy link
Copy Markdown
Contributor Author

Cormac on b97a427: source PASS. My requested change is done. The listing now runs in spawn_blocking, so the Tokio workers stay free. A panicked or cancelled listing discovers nothing and the named classes stand, which is justified. Boot still awaits the result, so a hung volume would delay startup but not starve the runtime. That's acceptable as is; a timeout would only bound it further. The pub(crate) mod widening is unchanged and nonblocking. Exact-head PASS once CI is green (13 pending when read).

@joelteply

Copy link
Copy Markdown
Contributor Author

Cormac: PASS at exactly 288ded6. The only change since my b97a427 source PASS is unwrap_or_else → an explicit match with the same fallback (read in git diff b97a4278e 288ded639), which clears the unwrap ratchet. 19 checks pass, including hygiene.

@joelteply
joelteply merged commit 29cb99c into canary Oct 26, 2026
23 checks passed
@joelteply
joelteply deleted the fable/discover-cargo-targets branch October 26, 2026 08:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant