8000 fix(sandbox2): truncate long box names to fit AF_UNIX sun_path limit by gominimal-aw-bot[bot] · Pull Request #1862 · gominimal/minimal · GitHub
[go: up one dir, main page]

Skip to content

fix(sandbox2): truncate long box names to fit AF_UNIX sun_path limit - #1862

Merged
norrietaylor merged 2 commits into
mainfrom
inbox-patch/sun-path-name-truncation-dce5f12c9c93d43f
Oct 3, 2026
Merged

norrietaylor merged 2 commits into
mainfrom
inbox-patch/sun-path-name-truncation-dce5f12c9c93d43f

Conversation

@gominimal-aw-bot
@gominimal-aw-bot gominimal-aw-bot Bot commented Oct 3, 2026 •
Copy link
Copy Markdown
Contributor

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_path limit, making UnixListener::bind fail with EINVAL.

The socket lives at <base_dir>/<name>-<timestamp>-<attempt>-<id>/run/minenv_sock. This change truncates 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 existing attempt loop 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 in Config::build when 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: add hex and sha2 workspace dependencies.
  • crates/sandbox2/src/config.rs tests: the truncation lives in fit_box_name, unit-tested for fit, determinism, prefix uniqueness, char boundaries and the no-room refusal.

Verification

  • cargo fmt --all --check — clean
  • cargo clippy --workspace --locked — clean (only pre-existing warnings in other crates)
  • cargo build --workspace --locked — clean
  • cargo test -p sandbox2 --locked — 42 passed, 0 failed
  • cargo test --workspace --locked — all crates pass except 2 pre-existing checkouts git-clone failures (environmental /tmp destination collisions, reproducible on main without this change)

Routing-Key: inbox-route/I_kwDOSUhdos8AAAABUvU-Lw

Summary by CodeRabbit

  • Bug Fixes
    • Long sandbox names are now shortened when needed to keep environment socket paths within system limits.
    • Short names remain unchanged, and shortened names retain distinct identifiers to avoid collisions.

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>
@gominimal-aw-bot
gominimal-aw-bot Bot requested a review from a team as a code owner October 3, 2026 07:16
@gominimal-aw-bot gominimal-aw-bot Bot added the agent:fix Agentic fix PR eligible for review iteration; min-aw's worker-iterate gates on it. label Oct 3, 2026
@coderabbitai
coderabbitai Bot commented Oct 3, 2026 •
Copy link
Copy Markdown
Contributor

Review in Change Stack →

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
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Essentials
  • Run ID: 6c270e01-ad19-4756-8031-7bc9f536787e
📥 Commits

Reviewing files that changed from the base of the PR and between 480defc and 1b7f828.

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

Included review availability: This review used your included allowance. Your plan provides up to 5 included reviews per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

Config::build now limits generated sandbox directory names to fit the Unix socket path limit. Long names are truncated at a UTF-8 character boundary and receive a deterministic SHA-256 suffix.

Changes

Sandbox Name Bounds

Layer / File(s) Summary
Fit and use sandbox names
crates/sandbox2/Cargo.toml, crates/sandbox2/src/config.rs
Adds hex and sha2 dependencies. Config::build reserves space for the remaining path components, fits the configured name to the available budget, and returns an InvalidInput error if no name fits. Tests cover preserved short names, deterministic truncation, distinct suffixes, UTF-8 boundaries, and insufficient budgets.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: 0chroma

Merge Risk: ⚪ Minimal · up to 1b7f8

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)
Check name Status Explanation
Title check ✅ Passed The title uses the Conventional Commit format and clearly describes the change: truncating long box names to fit the AF_UNIX socket path limit.
Description check ✅ Passed The description explains the problem and solution, lists the main changes, and provides test commands and results. It omits the template’s Checklist section, but the description is otherwise complete.
Docstring Coverage ✅ Passed Docstring coverage is 90.91% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 11 functions across 2 files.
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.
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

A rabbit checks the name’s length,
Then trims it at a letter’s edge.
A hash keeps long names distinct,
The socket path stays in its bounds,
And rabbits hop along their way.

Comment @coderabbi 8000 tai help to get the list of available commands.

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.
@norrietaylor norrietaylor changed the title fix: truncate long box names to fit AF_UNIX sun_path limit fix(sandbox2): truncate long box names to fit AF_UNIX sun_path limit Oct 3, 2026
@gominimal-aw-bot gominimal-aw-bot Bot added the agent:resolve Consent gate: pr-conflict-resolver may rewrite this branch label Oct 3, 2026
@norrietaylor
Copy link
Copy Markdown
Member

/review

@minimal-foundry
minimal-foundry Bot commented Oct 3, 2026 •
Copy link
Copy Markdown
Contributor

Approved: no findings at 1b7f828df381.

Nothing to do.

Clobber: none: git log on config.rs and the lockfile shows only this PR's commits on top of unrelated work; nothing reverts a recent fix.

@minimal-foundry minimal-foundry 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.

minimal-review — approved

Verdict APPROVE — No findings.

@minimal-foundry minimal-foundry Bot added the review:approved minimal-review approved the current head label Oct 3, 2026
@norrietaylor
Copy link
Copy Markdown
Member

@coderabbitai review

@coderabbitai
coderabbitai Bot commented Oct 3, 2026 •
Copy link
Copy Markdown
Contributor
⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@norrietaylor
Copy link
Copy Markdown
Member

@coderabbitai review

@coderabbitai
coderabbitai Bot commented Oct 3, 2026 •
Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@norrietaylor norrietaylor left a comment
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

CodeRabbit approved and finished its incremental review of the head with no new findings; minimal-review approved at head; all lanes green.

@norrietaylor
norrietaylor added this pull request to the merge queue Oct 3, 2026
Merged via the queue into main with commit 0d8f2fb Oct 3, 2026
38 of 40 checks passed
@norrietaylor
norrietaylor deleted the inbox-patch/sun-path-name-truncation-dce5f12c9c93d43f branch October 3, 2026 17:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent:fix Agentic fix PR eligible for review iteration; min-aw's worker-iterate gates on it. agent:resolve Consent gate: pr-conflict-resolver may rewrite this branch review:approved minimal-review approved the current head

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

0