Fix Claude Code sandbox environment on Linux VMs#210
Conversation
…ermissions On Linux VMs (especially running as root), Claude Code requires IS_SANDBOX=1 in the environment when using --dangerously-skip-permissions. Without it, Claude exits with a non-zero code, causing ralph-tui doctor to mark the agent as UNHEALTHY. Automatically inject IS_SANDBOX=1 into the spawned process environment when skipPermissions is enabled. User-provided env vars can still override this if needed. https://claude.ai/code/session_01RESU72861v9zKL3p41DM2V
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
WalkthroughWhen Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
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 |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #210 +/- ##
==========================================
+ Coverage 44.87% 44.93% +0.06%
==========================================
Files 84 84
Lines 24466 24475 +9
==========================================
+ Hits 10978 10998 +20
+ Misses 13488 13477 -11
🚀 New features to boost your workflow:
|
Verifies that: - IS_SANDBOX=1 is set when skipPermissions is true (default) - IS_SANDBOX is not set when skipPermissions is false - User-provided env vars can override the sandbox env Uses a test subclass that spawns /bin/sh to echo the env var, allowing direct verification of environment propagation. https://claude.ai/code/session_01RESU72861v9zKL3p41DM2V
The previous tests spawned /bin/sh to verify IS_SANDBOX propagation, which failed in CI due to environment differences. Rewrite to spy on BaseAgentPlugin.prototype.execute and verify the env options passed to it directly, making the tests deterministic and CI-friendly. https://claude.ai/code/session_01RESU72861v9zKL3p41DM2V
…-Qk9LF Fix Claude Code sandbox environment on Linux VMs
Summary
This PR fixes Claude Code execution failures on Linux VMs (particularly when running as root) by automatically setting the
IS_SANDBOX=1environment variable when theskipPermissionsoption is enabled.Changes
skipPermissionsis enabled, theIS_SANDBOX=1environment variable is now automatically injected into the Claude Code execution environmentIS_SANDBOX=1on Linux VMs running as rootImplementation Details
skipPermissionsflagenvoptions to override the default sandbox setting if neededSummary by CodeRabbit
New Features
Documentation
Tests
✏️ Tip: You can customize this high-level summary in your review settings.