feat(stats): split cache hits by local and remote and record compiler CPU time #1068
All Vouch review confidence checks passed
Residual risk 0.20 = Change Risk (0.50) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.50 · 634 lines diff across 7 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.386
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #1068"
general
weight: 0.35
jdx
mbx statscould say how many compilations were served from cache, but not how many came from the remote cache, or how much compiler CPU those hits saved. Both are now running totals in the savings ledger, so a sampler can readmbx stats --jsonperiodically and take differences. Computing the new totals needs no cache scan, though the rest of that report still walks the store.From a real local run (build, remove the outputs, build again):
This object is
savings.hit_sources. The text report gains matching rows:What counts
mbx prefetchrun.rustcprocess tree, measured at compile time and carried with the invocation's prediction, including through the remote cache. Like wall time it is an estimate: restoring an older result of the same invocation, as after a branch switch, can report a more recent compile's times.rustchits only.cpu_timed_hitssays how many hits had a value, so the rest need not be treated as free.savings.compilations.hitsand are in neither source.Compatibility
mbx-cache-coreandmbx-cache-rustcgain public fields (RestoreStats::avoided_compiler_cpu_ns,RustcInputPrediction::compiler_cpu_ns), which breaks code that builds those structs field by field.The optional Prometheus counters in the issue are not included: this repository has no Prometheus metrics to add them to.
Validation
mise run cipasses on Linux. New tests cover prefetched and on-demand remote hits followed by local ones, the prediction version rule, and ledger accumulation. The real run above exercised local hits only; remote hits are covered against a mock server.Closes #1067
AI-assisted — Tool: Claude Code; model: anthropic/claude-sonnet-5-5; version: unavailable.
🤖 Generated with Claude Code
<!-- CURSOR_SUMMARY -->
---
<!-- /CURSOR_SUMMARY -->
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
<!-- coderabbit-ai-generated:v1 -->
Summary by CodeRabbit
New Features
Cache statistics now distinguish local and remote hits, including hit counts and estimated compiler wall time and CPU time saved.
Text and JSON reports include source-specific savings and indicate when CPU timing is available or not yet tracked.
Compiler CPU time is recorded for builds and cache predictions when measurable, improving estimates of savings from cache hits.
Updated cache protocol support includes compiler CPU-time savings in restore statistics.
Documentation
* Updated statistics and protocol compatibility guidance for the new reporting and protocol details.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->