Retire OpenClaw prompt_sandbox → run-sandbox-command bridge (chat#1813)

Merged
SW
4mo ago
+44-559

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 called tasks.trigger("run-sandbox-command").
  • Delete the prompt_sandbox MCP tool (registerPromptSandboxTool + its test + lib/mcp/tools/sandbox/index.ts) and drop it from registerAllTools.
  • Simplify processCreateSandbox to bare sandbox creation (no prompt, no trigger); drop prompt from validateSandboxBody. POST /api/sandboxes now only provisions a sandbox.
  • Update route + handler JSDoc; prune the prompt-mode tests.

Done-when (verified)

  • grep for triggerPromptSandbox / registerPromptSandboxTool / run-sandbox-command across lib+app (excluding the new explanatory JSDoc) is clean — no code calls the task.
  • lib/sandbox + lib/mcp suites green (392); tsc adds 0 new errors; lint clean.

Scope notes

  • The shared OpenClaw helpers in the tasks repo (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 cosmetic prompt_sandbox text 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, the prompt_sandbox MCP tool, and its registration.
    • Make POST /api/sandboxes create-only: drop prompt from schema/response (no runId) and simplify processCreateSandbox.
    • Update route/handler JSDoc to reference POST /api/chat/runs; prune prompt-mode tests.
    • Remove prompt_sandbox from SYSTEM_PROMPT and the create_knowledge_base tool description; update tests to guard against references.
  • Migration

    • Stop sending prompt to POST /api/sandboxes; expect only sandbox details in the response.
    • Use POST /api/chat/runs to run prompts on runAgentWorkflow.

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).