Skip to content

fix: replace opencode with openclaw in prompt param conversion#234

Merged
sweetmantech merged 1 commit intotestfrom
sweetmantech/myc-4296-mcp-create-sandbox-prompt-param
Feb 20, 2026
Merged

fix: replace opencode with openclaw in prompt param conversion#234
sweetmantech merged 1 commit intotestfrom
sweetmantech/myc-4296-mcp-create-sandbox-prompt-param

Conversation

@sweetmantech
Copy link
Contributor

@sweetmantech sweetmantech commented Feb 20, 2026

Summary

  • Updates processCreateSandbox to convert prompt to openclaw agent --agent main --message instead of opencode run
  • Updates MCP tool descriptions to reference OpenClaw instead of OpenCode
  • Updates test to assert the new openclaw command format

Test plan

  • Existing tests updated and passing (8/8)
  • Test MCP run_sandbox_command tool with prompt param

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores
    • Updated sandbox command tool references from OpenCode to OpenClaw, including corresponding updates to command syntax and descriptions.

The prompt param was being converted to `opencode run "<prompt>"` which
no longer exists after the OpenCode→OpenClaw migration. Updates to use
`openclaw agent --agent main --message "<prompt>"` instead. Also updates
MCP tool descriptions to reference OpenClaw.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@vercel
Copy link
Contributor

vercel bot commented Feb 20, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
recoup-api Ready Ready Preview Feb 20, 2026 0:11am

Request Review

@coderabbitai
Copy link

coderabbitai bot commented Feb 20, 2026

📝 Walkthrough

Walkthrough

The pull request updates command references from OpenCode to OpenClaw across sandbox tooling, changing the command structure from "opencode run" to "openclaw agent --agent main --message" in both the tool registration and sandbox creation process. This is a textual configuration update with no functional logic changes.

Changes

Cohort / File(s) Summary
Sandbox Tool Registration
lib/mcp/tools/sandbox/registerRunSandboxCommandTool.ts
Updated prompt description and tool description to reflect OpenClaw branding and command syntax change from "opencode run" to "openclaw agent --agent main --message".
Sandbox Creation Process
lib/sandbox/processCreateSandbox.ts
Updated command mapping to use openclaw agent command structure with --agent and --message flags instead of opencode run syntax.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Possibly related PRs

Poem

When code became a grasping Claw,
Commands evolved without a flaw,
OpenCode rests, its work is done,
OpenClaw's reign has just begun 🦅

🚥 Pre-merge checks | ✅ 1
✅ Passed checks (1 passed)
Check name Status Explanation
Solid & Clean Code ✅ Passed PR maintains strong adherence to SOLID and Clean Code principles with proper separation of concerns, DRY implementation, and comprehensive test coverage.

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

✨ Finishing Touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch sweetmantech/myc-4296-mcp-create-sandbox-prompt-param

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.

Copy link

@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)
lib/mcp/tools/sandbox/registerRunSandboxCommandTool.ts (1)

18-30: Mutual exclusivity of prompt and command is documented but not enforced.

The descriptions on both prompt (line 22) and command (line 15) say "Cannot be used with…", but the schema has no .refine() guard. A caller who passes both will silently have command/args overridden in processCreateSandbox without any error signal. Worth adding a Zod refinement here so the contract is both documented and enforced at the boundary.

♻️ Proposed refinement to enforce mutual exclusivity
-const runSandboxCommandSchema = z.object({
+const runSandboxCommandSchema = z
+  .object({
   command: z
     .string()
     .optional()
     .describe("The command to run in the sandbox. Cannot be used with prompt."),
   args: z.array(z.string()).optional().describe("Arguments for the command."),
   cwd: z.string().optional().describe("Working directory for the command."),
   prompt: z
     .string()
     .optional()
     .describe(
       'A prompt to pass to OpenClaw. Runs `openclaw agent --agent main --message "<prompt>"` in the sandbox. Cannot be used with command.',
     ),
   account_id: z
     .string()
     .optional()
     .describe(
       "The account ID to run the sandbox command for. Only applicable for organization API keys — org keys can target any account within their organization. Do not use with personal API keys.",
     ),
-});
+  })
+  .refine((data) => !(data.prompt && data.command), {
+    message: "prompt and command are mutually exclusive — provide one or the other, not both.",
+    path: ["prompt"],
+  });
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@lib/mcp/tools/sandbox/registerRunSandboxCommandTool.ts` around lines 18 - 30,
The schema documents that prompt and command/args are mutually exclusive but
doesn't enforce it, so add a Zod refinement on the root schema used in
registerRunSandboxCommandTool to reject inputs that include both prompt and
command/args; implement schema.refine(data => !(data.prompt && (data.command ||
(data.args && data.args.length > 0))), { message: "Cannot specify both prompt
and command/args", path: ["prompt","command"] }) (or equivalent) so callers
passing both prompt and command/args get a validation error instead of silent
override in processCreateSandbox.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@lib/mcp/tools/sandbox/registerRunSandboxCommandTool.ts`:
- Around line 18-30: The schema documents that prompt and command/args are
mutually exclusive but doesn't enforce it, so add a Zod refinement on the root
schema used in registerRunSandboxCommandTool to reject inputs that include both
prompt and command/args; implement schema.refine(data => !(data.prompt &&
(data.command || (data.args && data.args.length > 0))), { message: "Cannot
specify both prompt and command/args", path: ["prompt","command"] }) (or
equivalent) so callers passing both prompt and command/args get a validation
error instead of silent override in processCreateSandbox.

@sweetmantech sweetmantech merged commit 3d17671 into test Feb 20, 2026
3 checks passed
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