Repository navigation
fix(sandbox2): truncate long box names to fit AF_UNIX sun_path limit - #1862
Conversation
When a session or task name is long, the minenv socket path (<base_dir>/<name>-<timestamp>-<attempt>-<id>/run/minenv_sock) can exceed the 107-byte sockaddr_un::sun_path limit, causing the bind to fail with EINVAL. Truncate the name portion in Config::build to fit within the remaining budget, appending the first 8 hex digits of SHA-256 of the full name for uniqueness. The attempt loop already handles collisions, so the hash only needs to distinguish long names that share a prefix. Routing-Key: inbox-route/I_kwDOSUhdos8AAAABUvU-Lw Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
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 configuration
📒 Files selected for processing (1)
Included review availability: This review used your included allowance. Your plan provides up to 5 included reviews per hour; 0 remain after this review. 📝 WalkthroughWalkthrough
ChangesSandbox Name Bounds
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix Suggested reviewers: Merge Risk: ⚪ Minimal · up to Sandbox creation with long names should now stay within the socket path limit. No merge-blocking risk is evident from the supplied review. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
A rabbit checks the name’s length, Comment |
The two tests added with the fix called Sandbox::new directly, which never runs Config::build, so neither reached the truncation: the socket path was short because the tempdir base is, and the two box dirs differed because they were two tempdirs. Move the truncation into fit_box_name and unit-test it for fit, determinism, prefix uniqueness, char boundaries and the no-room refusal.
|
/review |
|
Approved: no findings at Nothing to do. Clobber: none: |
|
@coderabbitai review |
|
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
CodeRabbit approved and finished its incremental review of the head with no new findings; minimal-review approved at head; all lanes green.
Summary
Long session or task names cause sandbox creation to fail because the minenv Unix domain socket path exceeds the 107-byte
sockaddr_un::sun_pathlimit, makingUnixListener::bindfail withEINVAL.The socket lives at
<base_dir>/<name>-<timestamp>-<attempt>-<id>/run/minenv_sock. This change truncates the name portion inConfig::buildto fit within the remaining budget, appending the first 8 hex digits of SHA-256 of the full name for uniqueness. The existingattemptloop already handles collisions, so the hash only needs to distinguish long names that share a prefix.Changes
crates/sandbox2/src/config.rs: truncate the box name inConfig::buildwhen it would push the socket path past 107 bytes; return a clear error if the base directory alone leaves no room.crates/sandbox2/Cargo.toml+Cargo.lock: addhexandsha2workspace dependencies.crates/sandbox2/src/config.rstests: the truncation lives infit_box_name, unit-tested for fit, determinism, prefix uniqueness, char boundaries and the no-room refusal.Verification
cargo fmt --all --check— cleancargo clippy --workspace --locked— clean (only pre-existing warnings in other crates)cargo build --workspace --locked— cleancargo test -p sandbox2 --locked— 42 passed, 0 failedcargo test --workspace --locked— all crates pass except 2 pre-existingcheckoutsgit-clone failures (environmental/tmpdestination collisions, reproducible onmainwithout this change)Routing-Key: inbox-route/I_kwDOSUhdos8AAAABUvU-Lw
Summary by CodeRabbit