Skip to content

crates/sandbox2: setup /run directory as writeable - #188

Merged
twitchyliquid64 merged 1 commit into
mainfrom
tom/attrs
May 7, 2026
Merged

twitchyliquid64 merged 1 commit into
mainfrom
tom/attrs

Conversation

@twitchyliquid64

@twitchyliquid64 twitchyliquid64 commented May 7, 2026 •

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • Bug Fixes
    • Ensures the sandbox creates a dedicated /run directory with secure permissions and mounts it into containers so the runtime socket is available at /run.
    • Sets the container runtime directory variable so in-container processes correctly find runtime resources, improving environment stability and isolation.

@coderabbitai

coderabbitai Bot commented May 7, 2026 •

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: b87dc390-8efa-47b8-98f0-8150b07ff81a

📥 Commits

Reviewing files that changed from the base of the PR and between a9d1782 and 45f5fd9.

📒 Files selected for processing (1)
  • crates/sandbox2/src/lib.rs

📝 Walkthrough

Walkthrough

The sandbox now creates base_dir/run, sets its permissions to 0o700, creates the minenv_sock listener there, bind-mounts base_dir/run into the container at /run, and sets the container XDG_RUNTIME_DIR=/run. No public signatures changed.

Changes

Sandbox Runtime Directory Setup

Layer / File(s) Summary
Imports
crates/sandbox2/src/lib.rs
Adds std::fs::{self, Permissions} and std::os::unix::fs::PermissionsExt for explicit permission setting.
Directory Initialization
crates/sandbox2/src/lib.rs
Creates base_dir/run (instead of rootfs/run) during sandbox init and sets mode to 0o700 before creating the minenv_sock listener.
Container Environment
crates/sandbox2/src/lib.rs
Sets XDG_RUNTIME_DIR=/run in the container environment for runtime socket discovery.
Container Mounting / Wiring
crates/sandbox2/src/lib.rs
Bind-mounts host base_dir/run into the container at /run so the host-created socket is reachable inside the container.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 I dug a little run so neat,
Locks set tight, a cozy seat,
Socket waits in dim-lit sun,
Mount it in, the job is done,
Hop, bind, and bounce — the runtime's fun!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: setting up the /run directory with appropriate write permissions in the sandbox initialization.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch tom/attrs

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@crates/sandbox2/src/lib.rs`:
- Around line 213-214: The error mapping for listener::Listener::new currently
reports rootfs.join("minenv_sock") which is incorrect; change the map_err
closure to pass the actual socket path (sock_path or sock_path.to_path_buf())
into Error::IO so the error context shows the real socket location used when
creating the listener rather than rootfs/minenv_sock.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 32579631-3a5a-428b-bd41-e27fe0afda6b

📥 Commits

Reviewing files that changed from the base of the PR and between 3ba358f and a9d1782.

📒 Files selected for processing (1)
  • crates/sandbox2/src/lib.rs

Comment thread crates/sandbox2/src/lib.rs Resolved
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.

2 participants