Skip to content

feat: enable exec tool for openclaw during sandbox setup#42

Merged
sweetmantech merged 2 commits intomainfrom
sweetmantech/myc-4396-tasks-enable-exec-tool-for-openclaw-during-sandbox-setup
Mar 4, 2026
Merged

feat: enable exec tool for openclaw during sandbox setup#42
sweetmantech merged 2 commits intomainfrom
sweetmantech/myc-4396-tasks-enable-exec-tool-for-openclaw-during-sandbox-setup

Conversation

@sweetmantech
Copy link
Copy Markdown
Contributor

@sweetmantech sweetmantech commented Mar 4, 2026

Summary

  • Adds group:runtime to tools.allow in openclaw.json during sandbox setup
  • This gives the OpenClaw agent access to exec, bash, and process tools needed for cloning repos, running CLI commands, and setup scripts

Problem

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

  • New test: verifies group:runtime is added to tools.allow in openclaw.json
  • All 7 existing setupOpenClaw tests pass

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Improved openclaw.json configuration initialization to ensure the tools section and coding profile are automatically established during setup.
  • Tests

    • Added test case to verify that openclaw.json injection properly includes a tools profile containing coding tools.

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>
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 4, 2026

📝 Walkthrough

Walkthrough

Added 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

Cohort / File(s) Summary
Tools Profile Setup
src/sandboxes/setupOpenClaw.ts, src/sandboxes/__tests__/setupOpenClaw.test.ts
Added c.tools object initialization with profile = 'coding' in openclaw.json injection logic, and added test case to verify the coding tools profile is present in the configuration.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Poem

🐰 A coding profile, neat and fine,
With tools aligned in perfect line,
The sandbox configured, tests all green,
The cleanest setup you've ever seen!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: enable exec tool for openclaw during sandbox setup' is directly related to the main change, which adds the coding profile to OpenClaw's tools configuration to grant access to exec and other runtime tools.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

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

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch sweetmantech/myc-4396-tasks-enable-exec-tool-for-openclaw-during-sandbox-setup

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 and usage tips.

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>
Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 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

📥 Commits

Reviewing files that changed from the base of the PR and between 172d971 and 120f9fd.

📒 Files selected for processing (2)
  • src/sandboxes/__tests__/setupOpenClaw.test.ts
  • src/sandboxes/setupOpenClaw.ts

@sweetmantech sweetmantech merged commit 1d86db2 into main Mar 4, 2026
2 checks passed
@sweetmantech sweetmantech deleted the sweetmantech/myc-4396-tasks-enable-exec-tool-for-openclaw-during-sandbox-setup branch March 4, 2026 14:28
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