Skip to content

docs: Explain the Claude Code sandbox EPERM boundary for Unity IPC - #2015

Merged
hatayama merged 2 commits into
feature/cli-discoverability-integrationfrom
docs/claude-code-sandbox
Jul 26, 2026
Merged

docs: Explain the Claude Code sandbox EPERM boundary for Unity IPC#2015
hatayama merged 2 commits into
feature/cli-discoverability-integrationfrom
docs/claude-code-sandbox

Conversation

@hatayama

@hatayama hatayama commented Jul 26, 2026

Copy link
Copy Markdown
Owner

Why

On 2026-07-26 a full investigation chased a healthy Unity Editor as an IPC bug because a sandboxed agent shell denies Unix domain socket connect()/bind() with EPERM, and the CLI reports that as a retryable dial unix ...: i/o timeout (the misreporting itself is tracked separately as round12 PR-7). The confusing part is that plain uloop ... commands kept working in other sandboxed sessions: a typical personal Claude Code settings entry excludes "uloop *" from sandboxing, and the exclusion matches the typed command text, not the binary that ends up doing the work. This repository's own validation rule (always run the built dist/<platform>/uloop) produces exactly the command shape the exclusion does not match, so this checkout gets hit while game projects never notice.

What

  • Add docs/claude-code-sandbox.md: symptom, cause, the verified invocation matrix (plain dispatcher / env-var prefix / ULOOP_PROJECT_RUNNER_PATH incl. a prior export / dist/... direct / raw socket), and the two remedies.
  • Point to it from the Native Go CLI Validation section in AGENTS.md (CLAUDE.md is its symlink) so the doc is found before anyone re-investigates the Editor side.

All matrix rows were measured in a live sandboxed session on 2026-07-26.

Verification

Docs-only change; no code paths affected. Repository CI does not fire on integration-branch PRs (pull_request.branches is [main, v3-beta]).

Review in cubic

…exclusion boundary

A sandboxed agent shell denies Unix domain socket connect/bind with
EPERM, which the CLI currently misreports as a retryable i/o timeout;
one full investigation (2026-07-26) chased this as an IPC bug while the
Editor was healthy the whole time. The sandbox exclusion that saves
game projects matches on the typed command text (`uloop *`), so this
repository's dev-binary rule (`dist/<platform>/uloop`) is exactly the
shape it does not cover. Record the verified invocation matrix, the
remedies, and a pointer from the dev-binary validation section in
AGENTS.md so the next agent reads this before re-investigating the
Editor side.
@coderabbitai

coderabbitai Bot commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@hatayama, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 46 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: cb44a078-2db7-429a-8241-20da89fe5025

📥 Commits

Reviewing files that changed from the base of the PR and between cb99c91 and 8199153.

📒 Files selected for processing (1)
  • docs/claude-code-sandbox.md
📝 Walkthrough

Walkthrough

The changes document sandbox-related failures in uloop commands that communicate with Unity over Unix sockets, explain misleading timeout symptoms caused by EPERM, and link the troubleshooting guidance from AGENTS.md.

Changes

Sandboxed Unity IPC documentation

Layer / File(s) Summary
Document sandboxed uloop failures
docs/claude-code-sandbox.md, AGENTS.md
Adds troubleshooting guidance for Unix-socket IPC blocked by sandbox policies, including observed errors, command matching behavior, and two remediation options.

Estimated code review effort: 1 (Trivial) | ~3 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the doc-only change about Claude Code sandbox EPERM behavior and Unity IPC.
Description check ✅ Passed The description is directly related to the docs update and accurately summarizes the sandbox issue and remedies.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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 unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch docs/claude-code-sandbox

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.

❤️ Share

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

@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: 2

🤖 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 `@docs/claude-code-sandbox.md`:
- Around line 60-63: Update the excludedCommands example in the sandbox
documentation to cover the Windows development binary documented in AGENTS.md,
such as dist/windows-amd64/uloop.exe, while retaining coverage for the Unix
dev-binary form.
- Around line 60-63: Add a brief warning under the Remedies section stating that
both options bypass Claude Code sandbox protections, and advise using only
trusted uloop dev binaries while following organizational policies for
unsandboxed execution. Keep the existing remedy instructions unchanged.
🪄 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 7217a44c-6cb6-4009-9f1d-adc634361665

📥 Commits

Reviewing files that changed from the base of the PR and between e0022fa and cb99c91.

📒 Files selected for processing (2)
  • AGENTS.md
  • docs/claude-code-sandbox.md

Comment thread docs/claude-code-sandbox.md Outdated
Comment on lines +60 to +63
1. Run dev-binary commands with the sandbox disabled for that command (Claude Code:
`dangerouslyDisableSandbox`; users can manage restrictions via `/sandbox`).
2. Add the dev-binary shape to `excludedCommands` in the personal Claude Code settings, e.g.
`"dist/*/uloop *"`, alongside the existing `"uloop *"`.

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.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Cover the Windows development binary in the exclusion example.

AGENTS.md documents dist/windows-amd64/uloop.exe, but "dist/*/uloop *" only covers the extensionless Unix form. Add a Windows-specific pattern (or adjust the example) so Windows users do not remain sandboxed.

🤖 Prompt for 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.

In `@docs/claude-code-sandbox.md` around lines 60 - 63, Update the
excludedCommands example in the sandbox documentation to cover the Windows
development binary documented in AGENTS.md, such as
dist/windows-amd64/uloop.exe, while retaining coverage for the Unix dev-binary
form.

🔒 Security & Privacy | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf 'Files matching docs/claude-code-sandbox.md:\n'
fd -a 'claude-code-sandbox\.md$' . || true

printf '\nRelevant line context:\n'
if [ -f docs/claude-code-sandbox.md ]; then
  nl -ba docs/claude-code-sandbox.md | sed -n '1,110p'
fi

printf '\nSearch for sandbox/excludedCommands in docs and related files:\n'
rg -n "dangerouslyDisableSandbox|excludedCommands|sandbox|allowUnsandboxedCommands|Claude Code" docs .uloop Packages cli 2>/dev/null || true

Repository: hatayama/unity-cli-loop

Length of output: 316


🌐 Web query:

Claude Code sandboxing excludedCommands runs outside sandbox allowUnsandboxedCommands=false

💡 Result:

When allowUnsandboxedCommands is set to false, the dangerouslyDisableSandbox escape hatch is disabled [1][2][3]. In this "strict sandbox mode," Claude is prevented from automatically retrying failed sandboxed commands outside the sandbox [1][4][5]. Consequently, any command that cannot function within the sandbox must be explicitly listed in excludedCommands to run outside of it [1][2][3]. However, the practical behavior of excludedCommands is subject to several nuances and documented issues: 1. Mandatory Inclusion: When allowUnsandboxedCommands is false, adding necessary tools (like docker) to excludedCommands is the only way to allow them to function, as the agent cannot otherwise request a one-off unsandboxed execution [4]. 2. Execution Flow: Users have reported that commands in excludedCommands may still be attempted inside the sandbox first and only run outside upon failure, or may require specific syntax (e.g., using :* to ensure matching) to be recognized correctly [6][7][8]. 3. Network Limitations: Even when a command is included in excludedCommands, it may still be subject to global network sandbox restrictions (such as blocked SSH ports), as excludedCommands primarily targets filesystem-level sandboxing [9]. 4. Security Implications of Globs: Using glob patterns (e.g., cmd:*) in excludedCommands can result in the entire shell invocation being run unsandboxed, meaning commands chained via operators like && or | may also execute outside the sandbox [10]. Due to these complexities, some users recommend using fine-grained permissions rules (e.g., Read() or Edit() with specific paths) to grant necessary access within the sandbox, rather than relying solely on excludedCommands [6][11]. [1][4][6][10][2][5][3][7][8][9]

Citations:


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf 'Relevant line context:\n'
awk 'NR>=1 && NR<=110 { printf "%6d\t%s\n", NR, $0 }' docs/claude-code-sandbox.md

printf '\nSearch for sandbox/excludedCommands/dangerouslyDisableSandbox:\n'
rg -n "dangerouslyDisableSandbox|excludedCommands|sandbox|allowUnsandboxedCommands|Claude Code" docs .uloop Packages cli 2>/dev/null || true

Repository: hatayama/unity-cli-loop

Length of output: 7971


Warn that both remedies bypass sandbox protections.

Add a brief warning under Remedies: these options allow uloop execution outside the Claude Code sandbox, so only use trusted dev binaries and follow any organization policy for unsandboxed execution.

🤖 Prompt for 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.

In `@docs/claude-code-sandbox.md` around lines 60 - 63, Add a brief warning under
the Remedies section stating that both options bypass Claude Code sandbox
protections, and advise using only trusted uloop dev binaries while following
organizational policies for unsandboxed execution. Keep the existing remedy
instructions unchanged.

Blind review of #2015: the documented socket filename did not match
createEndpointName (UnityCliLoop-<sha256[:16]>, not the project name),
the symptom bullet implied server bind logs exist without ULOOP_DEBUG,
and the remedies omitted the ULOOP_PROJECT_RUNNER_PATH route the
invocation table itself measures as working. Also mark the suggested
excludedCommands glob as unverified, add the Windows named-pipe
open question, and fix five awkward English spots.
@hatayama
hatayama merged commit 745d114 into feature/cli-discoverability-integration Jul 26, 2026
2 checks passed
@hatayama
hatayama deleted the docs/claude-code-sandbox branch July 26, 2026 15:37
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.

1 participant