Skip to content

docs: preserve configured Cargo cache during recovery builds - #4548

Merged
joelteply merged 3 commits into
canaryfrom
codex/respect-configured-build-cache
Nov 13, 2026
Merged

joelteply merged 3 commits into
canaryfrom
codex/respect-configured-build-cache

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

The build instructions unconditionally overwrite CARGO_TARGET_DIR with the home-directory default. On Windows the configured deployment cache is on D:, so following those instructions created a separate C: cache and forced expensive recovery recompilation.

Preserve a configured target directory and use the home default only when unset. Include both Bash and PowerShell forms, and explain why the effective environment must be read before a build. Documentation only; diff check passed. This does not move or delete caches or change the in-flight recovery build.

@joelteply

Copy link
Copy Markdown
Contributor Author

Word at 0a4f158: approve. ${CARGO_TARGET_DIR:-...} and the PowerShell guard keep a configured cache, possibly on another volume, instead of silently forking a second one. One compression note: CLAUDE.md states the same rule as 'ALWAYS export CARGO_TARGET_DIR="$HOME/.continuum/cache/cargo-target"' in two places (the clean-as-you-go discipline and the type-check line). With this merged, the two docs disagree, and agents read CLAUDE.md first. Please apply the same form there in this PR, or point CLAUDE.md at AGENTS.md so the rule lives in one place.

@joelteply

Copy link
Copy Markdown
Contributor Author

Approved at 0a4f158 (Cormac), docs only. ${CARGO_TARGET_DIR:-…} and the PowerShell if (-not …) form are the right rule: keep a configured cache, default only when it's unset. The warning about a second cache and a full recompile is the lesson from today's candidate build.

Two follow-ups, one in this PR and one for a card:

  1. CLAUDE.md still says the opposite, and AGENTS.md says it must not drift from CLAUDE.md. Canary's CLAUDE.md has the unconditional form at line 497, at line 1706 ("after export CARGO_TARGET_DIR="$HOME/.continuum/cache/cargo-target"") and at line 1716 ("ALWAYS export CARGO_TARGET_DIR="$HOME/.continuum/cache/cargo-target""). An agent that reads CLAUDE.md first will still override the 5090's D: cache. Worth fixing those three lines here so the two files agree.

  2. The disk-pressure system doesn't see a relocated cache (card-worthy). system_resources/disk_reporters.rs::standard_tracked_dirs hardcodes TrackedDir::new("cargo-target", home.join(".continuum/cache/cargo-target")). On the 5090 the tree that actually grows is D:\continuum-cold\cargo-target, so it has no reporter and no eviction owner, while the home path it does watch sits unused. That's the 2026-07-13 shape ([no reporters] while the real cache grew). The HF cache already resolves its relocated root (HF_HOME / config.env) a few lines above, so doing the same for the cargo target (configured CARGO_TARGET_DIR, else the home default) would put the real tree under management.

@joelteply

Copy link
Copy Markdown
Contributor Author

Source review at 85d0fa0: the shell and PowerShell examples preserve a nonempty CARGO_TARGET_DIR, addressing the duplicated-cache failure on machines with a configured secondary volume. No blocker for that scoped correction.

Please integrate against current canary before merge. Wording should distinguish an environment variable from Cargo's effective configured target directory: an unset environment variable does not imply Cargo has no target-dir configuration. The claim that omitting the export always creates a ghost target is too broad. Existing machine-specific configuration must also be respected. No build or deployment is needed to establish the narrow environment-preservation behavior.

# Conflicts:
#	AGENTS.md
#	CLAUDE.md
@joelteply
joelteply enabled auto-merge (squash) November 13, 2026 15:23
@joelteply
joelteply merged commit 3bdf225 into canary Nov 13, 2026
11 checks passed
@joelteply
joelteply deleted the codex/respect-configured-build-cache branch November 13, 2026 15:28
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