Skip to content

Port build-fast cache mode from stale build-cache branch #396

@shiny-code-bot

Description

@shiny-code-bot

Finish Line

./build-fast.sh, local cleanup, and relevant CI cache policy use a documented cache strategy that keeps the primary checkout fast while preventing concurrent Every Code agent worktrees from sharing a writable Cargo target directory.

Current Status

State: Follow-up created from stale local branch cleanup review on 2026-06-06.

Source evidence:

  • Dirty local worktree: /Users/cbusillo/.code/working/code/branches/build-cache-strategy
  • Branch: feat/build-cache-strategy, no commits ahead of origin/main, behind current main, with only uncommitted edits.
  • Recommendation: port selected ideas onto a fresh branch from current origin/main, then delete the stale worktree.

Useful ideas to port selectively:

  • Add BUILD_FAST_CACHE_MODE=auto|shared|isolated to build-fast.sh.
  • Default the primary checkout to a shared target bucket for warm repeated local builds.
  • Default Every Code agent worktrees under .code/working/*/branches/* and CI to isolated branch/worktree target buckets to avoid concurrent writable target sharing.
  • Infer CODE_HOME from .code/working/.../branches/... paths in build-fast.sh and scripts/local/cleanup-space.sh.
  • Consider reading the Rust toolchain from code-rs/rust-toolchain.toml in .github/workflows/upstream-merge.yml instead of hardcoding it.
  • Consider larger or more stable sccache/rust-cache keys for upstream merge validation.

Known risks:

  • Do not apply the stale branch wholesale; current origin/main has newer substrate/docs/build logic.
  • The old workflow diff mixed code-rs/target and codex-rs/target in different env paths, so CI cache changes need deliberate validation.
  • Documentation should be updated only after the implemented cache behavior is finalized.

Acceptance Criteria

  • Fresh task branch from current main ports the selected cache-mode behavior without unrelated stale diffs.
  • build-fast.sh documents and validates BUILD_FAST_CACHE_MODE values.
  • Agent worktrees get isolated target dirs by default; primary checkout keeps a warm shared bucket by default.
  • scripts/local/cleanup-space.sh resolves the same inferred cache home as build-fast.sh for .code/working branches.
  • Workflow cache changes, if included, keep code-rs/codex-rs target paths internally consistent.
  • Repo-required ./build-fast.sh passes cleanly.

Relationships

Metadata

Metadata

Assignees

No one assigned

    Labels

    planDurable planning issueplan:waitingPlan is waiting on non-issue evidence or decision

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions