Repository navigation
build(cargo): slice 3 — shared CARGO_TARGET_DIR for airc worktrees - #1531
Merged
Merged
Conversation
Extends card 424deb5e (build-time accelerators) with slice 3: collapse N per-worktree target/ dirs into ONE shared `~/.airc/cargo-target`. Mirrors the opt-in pattern from slices 1 (sccache) and 2 (linker selection): config block is checked-in guidance, an opt-in script does the per-machine setup. ## Why Per [[local-worktree-is-temp-dir]] — worktrees are L1 cache, not durable state. Each airc worktree currently carries its own 5-10 GB target/ dir. With ~10 active worktrees the dev-artifact sprawl reaches 50-100 GB and saturates the disk. Direct observation today (2026-06-05): a hung Docker daemon pinned `cargo test`, target/ accumulation across worktrees maxed the disk, the bash tool's output buffer couldn't write, and the metal_monitor #163 fix was blocked mid-build until Joel manually cleaned worktree target/ dirs. Shared CARGO_TARGET_DIR is the structural fix: one shared tree instead of N copies. Single biggest disk lever in the build-time efficiency series. ## What this commit ships ### `src/workers/.cargo/config.toml` slice 3 Opt-in block (commented like slices 1+2) documenting: - The shared-target pattern + how to enable it - Trade-offs: sequential cargo builds (target lock), branch- switch rebuilds when Cargo.lock differs - Composition with slices 1+2 (all three stack) - Why the absolute path is necessary (cargo config doesn't expand `~` or env vars in [env] values — cargo issue #14149) ### `scripts/airc-shared-target-opt-in.sh` Operator helper that: 1. Creates `~/.airc/cargo-target/` if missing 2. Appends `export CARGO_TARGET_DIR=...` to the user's shell init (auto-detects zsh/bash/sh) 3. Reports current per-worktree target/ sprawl with sizes so the operator knows how much reclaim is available Modes: - Interactive (default): asks before modifying the shell rc - `--no-prompt`: CI / scripted opt-in (still safe; idempotent detection skips if already present) ### Memory update `[[local-worktree-is-temp-dir]]` gets a footer pointing at slice 3 + the opt-in script as the canonical lever, plus the airc-side automation follow-up. ## Trade-offs documented up front (no fallbacks doctrine) - **Sequential builds only**: cargo's target lock serializes concurrent `cargo build` calls across worktrees. Invisible for the typical one-PR-at-a-time flow. - **Branch-switch rebuilds**: when Cargo.lock differs between branches, the affected crates rebuild on switch. Cargo handles incrementally; sccache (slice 1) absorbs the rest. - **Opt-in by design**: single-target-dir is a tradeoff, not a universal win. Devs with one-worktree flows lose nothing by leaving it off; devs juggling many airc worktrees gain the most. ## Composition with the build-time series - **Slice 1** (sccache): per-worktree target/ + shared rustc cache. Useful even without slice 3. - **Slice 2** (lld/mold linker): cuts link time from 30-60s to 2-5s. Useful at any target-dir configuration. - **Slice 3** (this commit): collapses N target/ into ONE. Stacks with slices 1+2 — sccache + fast linker + shared target = minimum-friction multi-worktree flow. ## What this commit does NOT do - Does NOT delete existing per-worktree target/ dirs — the script reports them with sizes; reclaim is operator-driven. - Does NOT auto-set CARGO_TARGET_DIR from `airc work claim` — that's cross-repo airc-side work, tracked separately. - Does NOT extend `airc work cleanup --force` to wipe target/ on Closed/Merged — also airc-side follow-up. ## Doctrine - `[[local-worktree-is-temp-dir]]` — the architectural frame - `[[every-error-is-an-opportunity-to-battle-harden]]` — the disk-full incident today drove this slice - `[[organization-purity-as-we-migrate]]` — mirrors the existing slice 1+2 pattern (config + opt-in script + memory) - `[[no-fallbacks-ever]]` — opt-in shape (commented config, operator-driven script); no silent "tries shared target, falls back to per-worktree" behavior card: 80ef9cd1-5bb9-4777-a174-ced9926c8484 Co-Authored-By: Claude Opus 4.7 <[email protected]>
joelteply
added a commit
that referenced
this pull request
Oct 4, 2026
…ay's airc-lib fixes (#4735) Kimi on the 5090 kept hitting "settled work is not claimable" on her own card with her daemon already at #1532: the claim gate is airc-lib, compiled into this core at the pinned rev, and 7499136 predates every airc fix of 2026-10-04. A daemon update cannot deliver an airc-lib fix to personas; only this pin can. Adopts #1528 (right-sized payloads), #1529 (per-channel ring byte bound; channel_count and ring_bytes_total in status), #1530 (verbs are never room names), #1531 (the owner resumes her own card after her lease lapses), #1532 (ownership durable, the lease is presence, from 2026-10-04T16:00Z), #1533 (test) and #1534 (work claim/update/link --room). continuum-core lib + bins + tests type-check clean against it (mac-cpu-only features), 0 errors. Lockfile changes outside airc are only windows-sys / windows-core versions inside airc crates' dependency lists (#1480). Card 86c5eb48. Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
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.
Summary
Slice 3 of the build-time efficiency series (card 424deb5e). Collapses N per-worktree
target/dirs into ONE shared~/.airc/cargo-target, mirroring the opt-in pattern from slices 1 (sccache) and 2 (linker selection).Why
Per
[[local-worktree-is-temp-dir]]— worktrees are L1 cache, not durable state. Each airc worktree currently carries its own 5-10 GBtarget/dir. With ~10 active worktrees the dev-artifact sprawl reaches 50-100 GB.Direct observation today (2026-06-05): a hung Docker daemon pinned
cargo test, target/ accumulation across worktrees maxed the disk, the bash tool's output buffer couldn't write, and the metal_monitor #163 fix was blocked mid-build until manual cleanup.Shared
CARGO_TARGET_DIRis the structural fix — single biggest disk lever in the build-time efficiency series.What ships
src/workers/.cargo/config.tomlslice 3Opt-in block (commented like slices 1+2) documenting the shared-target pattern, trade-offs, and composition with prior slices. Notes cargo issue #14149 (config doesn't expand
~or env vars) as the reason absolute paths are required.scripts/airc-shared-target-opt-in.shOperator helper:
~/.airc/cargo-target/export CARGO_TARGET_DIR=...to the user's shell init (auto-detects zsh/bash/sh, idempotent)Modes: interactive (default) +
--no-promptfor CI.Trade-offs (documented up front per no-fallbacks doctrine)
cargo buildacross worktrees. Invisible for one-PR-at-a-time flow.Composition with slices 1+2
What this PR does NOT do
CARGO_TARGET_DIRfromairc work claim— cross-repo airc-side work, tracked as follow-upairc work cleanup --forceto wipe target/ on Closed/Merged — also airc-side follow-upTest plan
--no-promptmode and reports current sprawl (verified 33 GB in fa25de80 worktree before this commit)cargo buildfrom any airc worktree → verify build lands in shared treeDoctrine
[[local-worktree-is-temp-dir]]— the architectural frame[[every-error-is-an-opportunity-to-battle-harden]]— today's disk-full incident drove the slice[[organization-purity-as-we-migrate]]— mirrors existing slice 1+2 pattern[[no-fallbacks-ever]]— opt-in shape; no silent "tries shared target, falls back" behaviorcard:
80ef9cd1-5bb9-4777-a174-ced9926c8484