Skip to content

feat(core): warm compiler caches across worktrees for compiled stacks#412

Open
OBenner wants to merge 1 commit into
developfrom
feat/build-cache-env
Open

feat(core): warm compiler caches across worktrees for compiled stacks#412
OBenner wants to merge 1 commit into
developfrom
feat/build-cache-env

Conversation

@OBenner

@OBenner OBenner commented Jul 12, 2026

Copy link
Copy Markdown
Owner

Summary

Roadmap phase 4, second slice (follows #402's targeted test commands).

Auto Code builds every spec in a fresh worktree, so compiled projects cold-build on every coder → QA → fixer iteration. ccache/sccache keep their caches outside the worktree — pointing builds at them makes a brand-new worktree reuse object files from all previous builds.

New core/build_cache.py, wired into create_client():

Project Env injected Condition
CMake (C/C++) CMAKE_C_COMPILER_LAUNCHER=ccache, CMAKE_CXX_COMPILER_LAUNCHER=ccache ccache installed
Cargo (Rust) RUSTC_WRAPPER=sccache sccache installed

Safety properties:

  • Never overrides user-set variables (checked against both os.environ and the collected SDK env)
  • No-op when the cache tool is missing or the project is not a compiled stack
  • Plain Make projects deliberately untouched — overriding CC/CXX can break builds expecting a bare compiler path
  • sccache added to the rust command allowlist

Testing

tests/test_build_cache.py: 7 tests (injection per stack, missing tool, user-override respect via env dict and os.environ, non-compiled and Make-only no-ops). Ruff check + format clean; core.client import verified.

🤖 Generated with Claude Code

Fresh worktrees always cold-build, making every coder -> QA -> fixer
iteration expensive for C/C++ and Rust projects. New core/build_cache
module injects opt-in cache wrappers into the agent session env:

- CMAKE_C/CXX_COMPILER_LAUNCHER=ccache for CMake projects
- RUSTC_WRAPPER=sccache for Cargo projects

Only when the tool is installed and the variable is not already set
by the user. Plain Make projects are left alone (overriding CC/CXX
can break builds expecting a bare compiler path). sccache added to
the rust allowlist.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Oleg Miagkov <mrobenner@gmail.com>
@coderabbitai

coderabbitai Bot commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@OBenner, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 28 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 1c784a33-8a02-47f8-ab97-fc06613b4161

📥 Commits

Reviewing files that changed from the base of the PR and between e873cab and 12e4e13.

📒 Files selected for processing (4)
  • apps/backend/core/build_cache.py
  • apps/backend/core/client.py
  • apps/backend/project/command_registry/languages.py
  • tests/test_build_cache.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/build-cache-env

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant