Retire OpenClaw prompt_sandbox → run-sandbox-command bridge (chat#1813)
Merged
SW
4mo ago+44+44+01234567890123456789-559-559-012345678901234567890123456789
PR 3 (api) of the async chat-generation migration tracked in recoupable/chat#1813. Builds on the re-point (api#704) — once generation runs on runAgentWorkflow, the OpenClaw offload bridge is dead weight.
What
- Delete
lib/trigger/triggerPromptSandbox.ts— the only thing that calledtasks.trigger("run-sandbox-command"). - Delete the
prompt_sandboxMCP tool (registerPromptSandboxTool+ its test +lib/mcp/tools/sandbox/index.ts) and drop it fromregisterAllTools. - Simplify
processCreateSandboxto bare sandbox creation (noprompt, no trigger); droppromptfromvalidateSandboxBody.POST /api/sandboxesnow only provisions a sandbox. - Update route + handler JSDoc; prune the prompt-mode tests.
Done-when (verified)
grepfortriggerPromptSandbox/registerPromptSandboxTool/run-sandbox-commandacrosslib+app(excluding the new explanatory JSDoc) is clean — no code calls the task.lib/sandbox+lib/mcpsuites green (392);tscadds 0 new errors; lint clean.
Scope notes
- The shared OpenClaw helpers in the
tasksrepo (installOpenClaw, etc.) stay until their other consumers migrate — that's the issue's gated Phase 2. - The now-dead legacy generate stack (
SYSTEM_PROMPT,getGeneralAgent,getMcpTools,setupToolsForRequest) still has cosmeticprompt_sandboxtext references; left for a focused follow-up cleanup so this PR stays scoped to the bridge.
🤖 Generated with Claude Code
Summary by cubic
Retires the OpenClaw prompt_sandbox → run-sandbox-command bridge and makes POST /api/sandboxes create-only. Async agent work now runs on the durable runAgentWorkflow via POST /api/chat/runs (chat#1813).
-
Refactors
- Remove
lib/trigger/triggerPromptSandbox.ts, theprompt_sandboxMCP tool, and its registration. - Make POST /api/sandboxes create-only: drop
promptfrom schema/response (norunId) and simplifyprocessCreateSandbox. - Update route/handler JSDoc to reference POST /api/chat/runs; prune prompt-mode tests.
- Remove
prompt_sandboxfromSYSTEM_PROMPTand thecreate_knowledge_basetool description; update tests to guard against references.
- Remove
-
Migration
- Stop sending
promptto POST /api/sandboxes; expect only sandbox details in the response. - Use POST /api/chat/runs to run prompts on runAgentWorkflow.
- Stop sending
Summary by CodeRabbit
-
Bug Fixes / Behavior Changes
- Sandbox creation now provisions an ephemeral sandbox only; the response includes sandbox details only (no optional execution/run identifier).
- Prompt-based sandbox requests are no longer accepted.
- Removed the sandbox MCP tool from tool registrations (including the prompt_sandbox tool).
-
Documentation
- Updated API and handler guidance for sandbox creation to reflect the retired prompt mode and the durable agent workflow (POST /api/chat/runs).