fix: replace opencode with openclaw in prompt param conversion#234
Conversation
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]>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthroughThe 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
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~5 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 1✅ Passed checks (1 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 |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
lib/mcp/tools/sandbox/registerRunSandboxCommandTool.ts (1)
18-30: Mutual exclusivity ofpromptandcommandis documented but not enforced.The descriptions on both
prompt(line 22) andcommand(line 15) say "Cannot be used with…", but the schema has no.refine()guard. A caller who passes both will silently havecommand/argsoverridden inprocessCreateSandboxwithout 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.
Summary
processCreateSandboxto convertprompttoopenclaw agent --agent main --messageinstead ofopencode runTest plan
run_sandbox_commandtool withpromptparam🤖 Generated with Claude Code
Summary by CodeRabbit