Skip to content

[codex] Stabilize incremental rebuild caching#33

Merged
Sunrisepeak merged 4 commits into
mainfrom
codex/fix-bmi-cache-staging
May 15, 2026
Merged

[codex] Stabilize incremental rebuild caching#33
Sunrisepeak merged 4 commits into
mainfrom
codex/fix-bmi-cache-staging

Conversation

@Sunrisepeak
Copy link
Copy Markdown
Member

@Sunrisepeak Sunrisepeak commented May 13, 2026

Summary

  • Change BMI cache staging to only copy missing cached artifacts into the project target directory; existing .gcm/.o outputs are no longer overwritten or touched.
  • Add normalized compiler driver identity (Toolchain::driverIdent) and use it for fingerprint field 3 instead of hashing the compiler binary contents when available.
  • Normalize local install path fragments in compiler --version output so equivalent xlings toolchains installed under different prefixes share a fingerprint.
  • Add regression coverage for BMI staging, driver output normalization, toolchain detection, and fingerprint stability.
  • Add .agents/docs/2026-05-15-fingerprint-stability-and-fastpath-coherence.md with the PR comparison and follow-up design notes.

Root Cause

There were two related incremental rebuild problems:

  1. BMI cache staging copied cached dependency artifacts into the active target directory on every full prepare and refreshed mtimes. That dirtied downstream modules after ordinary source edits.
  2. Fingerprint field 3 used hash_file(tc.binaryPath). Equivalent xlings GCC packages installed under different registry prefixes can have different binary bytes, so switching between local/dev mcpp and installed mcpp could silently select a new target/<triple>/<fingerprint> directory and look like a full rebuild.

Validation

  • target/x86_64-linux-gnu/b2f2305667355830/bin/test_bmi_cache
  • target/x86_64-linux-gnu/b2f2305667355830/bin/test_toolchain_detect
  • target/x86_64-linux-gnu/b2f2305667355830/bin/test_fingerprint
  • git diff --check -- <changed files>
  • mcpp build --verbose no-change path in the new fingerprint dir: ninja: no work to do
  • touch src/main.cpp && mcpp build --verbose: 4 Ninja edges, 0.36s locally

Scope Notes

This PR intentionally does not change .build_cache format or cxx_scan restat behavior. Those are documented as follow-up P1/P2 items in the analysis doc so the 0.0.15 fix stays focused.

@Sunrisepeak Sunrisepeak changed the title [codex] Fix BMI cache staging incremental rebuilds [codex] Stabilize incremental rebuild caching May 15, 2026
@Sunrisepeak Sunrisepeak marked this pull request as ready for review May 15, 2026 06:14
@Sunrisepeak Sunrisepeak merged commit 77ffe2d into main May 15, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant