Conversation
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Central YAML (base), Organization UI (inherited) Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (3)
Included review availability: Your plan provides up to 2 included reviews per hour; 1 remains after this review. 📝 WalkthroughWalkthroughThe change adds per-session leases for binary shim directories. ChangesSession shim lease lifecycle
Priority: ⬇️ Low Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Bug fix Sequence Diagram(s)sequenceDiagram
participant SessionStartup
participant CacheSession
participant ShimLease
participant ShimCollector
SessionStartup->>ShimLease: acquire Rust shim directory lease
ShimLease-->>SessionStartup: return lease
SessionStartup->>CacheSession: store lease
ShimCollector->>ShimLease: check live leases
ShimLease-->>ShimCollector: return lease state
ShimCollector->>ShimCollector: remove eligible superseded directory
Suggested reviewers: Merge Risk: ⚪ Minimal · up to The lease lifecycle and cleanup behavior are internally consistent, with no concrete merge-blocking risk identified. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
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. Comment |
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 06956bf. Configure here.
Instruction counts
No instruction-count regression above 1%. Only instruction counts gate. Wall clock is shown for context — on identical hardware it moves 4-20% run to run. Measured by tak — instruction-counted CLI benchmarks, stored in this repository's git notes.
|
Each session now holds a lease file in its per-binary rust/<id> directory for its whole lifetime. Collection removes a rust/ directory whose wrapper resolves to a binary with a different identity (an upgrade in place) once it has gone unused for the usual window and no running session holds a lease, so a long-running session keeps its RUSTC_WRAPPER. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
06956bf to
f244ef5
Compare
… removal A rust/ directory no session ever leased was installed by a binary older than leases, whose still-running sessions cannot be seen, so it is never judged superseded. Release a lease's lock before deleting its file so Windows can remove it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

https://entire.io/gh/jdx/mr-boxington/trails/25
Problem
mbx installs the persistent
RUSTC_WRAPPERat<shims_dir>/rust/<binary identity>/mbx-rustc, where the identity hashes the executable's path, size and mtime. Every in-place upgrade or rebuild of mbx at the same path creates a newrust/<id>directory. The old directory's symlink still resolves (to the new binary at that path), so the collector added in #516 (which only removes directories whose links all dangle) never removes it. One development machine had accumulated 206 of these directories.Collecting them only by age isn't safe. A session that started before an upgrade, such as a long-lived
mbx execshell, keeps using its old wrapper and can outlive the 7-day unused window.Fix
rust/<id>directory for as long as it runs: a locked file underrust/<id>/.mbx-leases/, removed when the session ends. A lease file whose lock can be taken belongs to a session that is gone, and collection deletes it.rust/<id>directory when itsmbx-rustclink resolves to a binary whose identity no longer matches the directory name (i.e. the binary was upgraded in place), no session has started with it for 7 days, and no running session holds a lease on it. Only directories installed by a lease-aware mbx are judged this way. A directory from an older mbx may belong to a session that is still running and can't hold a lease, so it is still removed only once all its links dangle.rust/directories, so a session in another container sharing the cache keeps its wrapper even if it runs longer than 7 days.rust/.registrar), and collection judges and removes eachrust/directory under the same lock, so a directory can't be removed between a session creating it and taking its lease.native/directories are unchanged. They are keyed by install path on Unix, so upgrades already reuse them.No configuration changes. Windows shims are still never collected.
Limitations:
rust/directories left by mbx versions before this change aren't removed by the upgrade rule, so directories that have already piled up (like the 206 above) stay until deleted by hand. Leases use advisory file locks. On a shared filesystem where locks don't reach other hosts (some NFS setups), a session on another host is protected only by the 7-day window, as before.Validation
superseded_rustc_shims_go_once_no_session_holds_them: a superseded, unleased wrapper directory is removed. Directories are kept while a session holds a lease, while they were used recently, when they belong to the binary the path currently holds, and when a lease is held even though their links dangle. A crashed session's leftover lease file doesn't protect its directory, and a superseded directory that no session ever leased is kept. After a leased session drops, its lease file is gone and the next collection removes the directory.only_shim_directories_nothing_can_use_are_collectednow keeps its superseded rustc directory because a session holds a lease on it, not because the collector skipped superseded directories. Both tests fail when the lease check is removed.mise run cipasses locally (macOS).🤖 Generated with Claude Code
Note
Medium Risk
Changes shim lifecycle and concurrent collection around persistent
RUSTC_WRAPPERpaths; mistakes could delete wrappers still in use or leave leaks, though registrar locking and lease checks aim to prevent races.Overview
Fixes persistent
RUSTC_WRAPPERdirectories undershims/rust/<binary identity>/that never went away after in-place mbx upgrades, because old symlinks still resolve to the new binary and the prior collector only removed dirs whose links all dangled.Each
CacheSessionnow holds aShimLeasefor its wrapper directory for the whole session (advisory lock file under.mbx-leases/, dropped on session end).install_session_shimscreates the per-binary dir and takes the lease under a sharedrust/.registrarlock, andremove_stranded_binary_shimsuses the same lock when judgingrust/dirs so nothing is deleted between create and lease.On Unix, collection may also remove a
rust/dir when itsmbx-rustctarget’s identity no longer matches the directory name (superseded by upgrade), the dir has been unused for the configured age, and no live session holds a lease—including long-running pre-upgrade sessions and shared-cache containers with dangling links.native/behavior is unchanged; Windows still skips collection.Tests cover lease retention, stale lease cleanup, superseded removal, and updated stranded-shim scenarios (including
mbx-rustcsymlinks).Reviewed by Cursor Bugbot for commit f244ef5. Bugbot is set up for automated code reviews on this repo. Configure here.
Summary by CodeRabbit