feat: enable exec tool for openclaw during sandbox setup#42
Conversation
Adds group:runtime to tools.allow in openclaw.json config during setup, giving the agent access to exec/bash/process tools needed for cloning repos, running CLI commands, and setup scripts. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
📝 WalkthroughWalkthroughAdded logic to setupOpenClaw.ts to create and configure a tools object with a coding profile in the injected openclaw.json configuration. A corresponding test case was added to verify the tools profile is properly included. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
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 |
The coding profile includes group:fs, group:runtime, group:sessions, group:memory, and image — covering all tools the sandbox agent needs. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/sandboxes/__tests__/setupOpenClaw.test.ts (1)
104-120: Consider a more precise assertion for the tools profile.The test verifies that "tools" and "coding" strings appear in the script, but this is a weak assertion that could pass even if the actual assignment structure is wrong. A more precise check would verify the exact assignment pattern.
🔧 Suggested improvement for more precise assertion
expect(injectCall).toBeDefined(); const script = injectCall![0].args[1]; - expect(script).toContain("tools"); - expect(script).toContain("coding"); + expect(script).toContain("c.tools = c.tools || {}"); + expect(script).toContain("c.tools.profile = 'coding'"); });🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/sandboxes/__tests__/setupOpenClaw.test.ts` around lines 104 - 120, The current test in setupOpenClaw.test.ts uses loose substring checks for "tools" and "coding"; tighten it by locating the injected script (from sandbox.runCommand.mock.calls via injectCall) and assert the exact assignment pattern for the tools profile—either parse the script as JSON and assert tools.profile === "coding" or use a strict regex that matches the assignment (e.g., tools object with profile set to "coding"); update the assertions around the injectCall and script variables in the it("sets coding tools profile in openclaw.json", ...) test so it fails on malformed structure rather than just substring presence.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@src/sandboxes/__tests__/setupOpenClaw.test.ts`:
- Around line 104-120: The current test in setupOpenClaw.test.ts uses loose
substring checks for "tools" and "coding"; tighten it by locating the injected
script (from sandbox.runCommand.mock.calls via injectCall) and assert the exact
assignment pattern for the tools profile—either parse the script as JSON and
assert tools.profile === "coding" or use a strict regex that matches the
assignment (e.g., tools object with profile set to "coding"); update the
assertions around the injectCall and script variables in the it("sets coding
tools profile in openclaw.json", ...) test so it fails on malformed structure
rather than just substring presence.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 638bcf8f-08ab-4dad-8921-e641b8b338d4
📒 Files selected for processing (2)
src/sandboxes/__tests__/setupOpenClaw.test.tssrc/sandboxes/setupOpenClaw.ts
Summary
group:runtimetotools.allowinopenclaw.jsonduring sandbox setupexec,bash, andprocesstools needed for cloning repos, running CLI commands, and setup scriptsProblem
OpenClaw agents in sandboxes were failing with "I don't have shell/exec access" because the default config didn't include the runtime tool group. All tasks requiring shell execution (clone repos, install CLI, setup sandbox/artist) were blocked.
Test plan
group:runtimeis added to tools.allow in openclaw.json🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Tests