← Back to Pull requests

fix(rustc): stop seeding incremental state from other checkouts #943

Closed
unknown closed this pull request without merging on Nov 13, 2026 12:30 UTC
View on GitHub
unknown unknown commented on Nov 13, 2026 03:46 UTC
Author

mbx used to seed a checkout's first private incremental compile of a unit by copying another checkout's incremental state for the same unit. This PR removes seeding. Each checkout now keeps only its own incremental state.

Why: rustc does not treat a finished incremental session as immutable. With local ThinLTO, a new session hard-links the previous finished session's files and then rewrites thin-lto-past-keys.bin and each recompiled unit's .pre-lto.bc in place. A seed copied while the donor's rustc was doing that mixed files from two sessions. On a host running many agent worktrees, that produced rlibs that failed to link, with undefined symbols such as anon.<hash>.<n>.llvm.<n>, or drop glue and generic methods. Earlier, hard-linked seeds corrupted their donors (#784). Meanwhile, on real agent lanes, seeded compiles measured no faster than compiles that started empty: only about a third of first private compiles found a donor at all. Keeping seeding correct would need a writer protocol layered over rustc's internal session format, so this PR removes it instead.

Removed:

  • donor selection and copying;

  • the -Zremap-cwd-prefix=. flag mbx injected to make state portable, together with the child-scoped RUSTC_BOOTSTRAP, the probe that checked rustc accepts the flag, the related -Z rules, and the retries it needed;

  • seeded-state reporting.
  • A -Zremap-cwd-prefix you pass yourself goes to rustc unchanged.

    Kept:

  • learned and eager incremental within a checkout;

  • the opt-level and LTO guard;

  • the one-time discard of older hard-linked state;

  • target.seed, which copies registry build units between managed target directories and is unrelated.
  • Upgrading:

  • Private incremental state is now named under a new generation, so state that an older mbx may have seeded, including state for builds that passed -Zremap-cwd-prefix themselves, is never reused. Each checkout's next private compile of a unit starts empty, and collection removes the old units.

  • seed_incremental and MBX_SEED_INCREMENTAL are still accepted, so existing configuration stays valid. They have no effect. Setting either in the configuration file or the environment makes mbx commands log a warning, "seed_incremental has no effect; seeding from other checkouts was removed", in the same way as the retired learned_incremental_max_size.

  • Session rows' incremental_state now records only existing or cold, and mbx analyze reports state reused from the checkout versus started empty.

  • The agent wire protocol moves to version 13.
  • Validation: mise run ci on Linux passes apart from three bats tests that fail the same way on main on the same host: C object restore, gdb debug objects, and objects keeping absolute source paths. Specifically:

  • clippy is clean;

  • cargo test -p mbx --lib (1340), -p mbx-cache-core, and --test build (141) pass;

  • the docs check passes on the regenerated CLI docs.
  • This conflicts with #942 in crates/mbx/tests/build.rs, since both edit the seeding end-to-end tests. Whichever merges second needs a small update.

    AI-assisted — Tool: Claude Code; model: anthropic/claude-opus-5-5; version: unavailable.

    🤖 Generated with Claude Code

    <!-- This is an auto-generated comment: release notes by coderabbit.ai -->
    <!-- coderabbit-ai-generated:v1 -->

    Summary by CodeRabbit

    Behavior Changes
    Cross-checkout reuse of private incremental state has been removed. Incremental state now comes from the current checkout’s saved state or starts empty.
    The seed_incremental setting remains accepted for compatibility but has no effect.
    State collection now uses active checkout leases to protect in-use data. Reports describe empty starts without seeded-state details.

    Documentation
    Updated configuration, analysis, incremental-state, managed-target, and troubleshooting guidance to reflect these changes.
    <!-- end of auto-generated comment: release notes by coderabbit.ai -->

    Diff: 502 lines (+376 / -126) across 6 files Reviewer: jbellis Review duration: 524m
    All Vouch review confidence checks passed
    Residual risk 0.21 = Change Risk (0.48) × (1 − Review Confidence (0.57)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.48 · 502 lines diff across 6 files
    0.48
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    56%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    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.372
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #943"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 56.8% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 47.5% (MEDIUM) · Higher = larger blast radius
    47.5%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 56.8% · Lower = rushed or shallow review
    56.8%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 20.6% · Safe to merge
    20.6%