Skip to content

feat: implement OpenClaw as sandbox external agent (#2420) - #2555

Merged
yannickmonney merged 2 commits into
mainfrom
feat/openclaw-external-agent-2420
Jul 7, 2026
Merged

yannickmonney merged 2 commits into
mainfrom
feat/openclaw-external-agent-2420

Conversation

@yannickmonney

Copy link
Copy Markdown
Contributor

Implements OpenClaw (agentKind: "openclaw") as a sandbox external agent on the same seam as Claude Code / OpenCode / Hermes / Gemini CLI / Codex.

Closes #2420

What's here

  • Adapter — lib/agent-adapters/openclaw/ (buildExec + createParser), pinned to openclaw 2026.6.11, every mechanism verified against the cloned v2026.6.11 source and a real local run of the pinned CLI.
  • Wrapper — services/sandbox-runtime/tale-openclaw-run. The pinned CLI has no streaming output headlessly (openclaw agent --local --json prints ONE final envelope), so the wrapper owns the translation into Tale NDJSON lifecycle events (run_start / assistant_message / usage / run_end) and stages the three inputs that have no CLI flag: the generated config (OPENCLAW_CONFIG_PATH), the prompt (--message-file — never argv), and the system-prompt append (workspace AGENTS.md, backed up/restored around the run).
  • Managed — generated models.providers.tale config pointing at the gateway's OpenAI-compatible route; the session VK rides OpenClaw's native ${TALE_GATEWAY_TOKEN} SecretInput env template, so the staged config never contains the key. Native web tools (web_search/web_fetch/x_search) denied unless nativeWebTools: true; tools.profile: "coding" already excludes messaging/gateway tools; catalog fallbackModelId armed via OpenClaw's native model.fallbacks chain (VK-allowed alongside the primary).
  • BYO — no gateway env/provider; OpenClaw resolves ANTHROPIC_API_KEY / OPENAI_API_KEY / OPENROUTER_API_KEY natively; byoModelIdSource: 'catalog' (OpenClaw refs are vendor/model, the catalog id's grammar; raw user-typed ids pass through).
  • Sessions — the Tale resume handle IS OpenClaw's explicit --session-id (persisted session key agent:main:explicit:<handle> under OPENCLAW_STATE_DIR=/user/.runtime/home/.openclaw); same handle resumes the same conversation across turns.
  • Product surface — registry/schema/union widenings (appended after codex), agent editor kind picker, builtin-configs/agents/chat/openclaw.json (composer order 46), locales en/de/fr, docs en/de/fr, sandbox image install + wrapper + container-runtime checks.
  • Skills — staged to OpenClaw's managed skills dir (<state>/skills, SKILL.md format — Claude-compatible). MCP: Playwright (headless or CDP) + the integrations dispatch bridge via mcp.servers.

Verified against the real pinned CLI (local, mock OpenAI-compatible gateway)

Ran tale-openclaw-run end-to-end with the adapter's exact stdin payload against [email protected]:

  • request hit <base>/openai/v1/chat/completions with Authorization: Bearer <VK> (the ${TALE_GATEWAY_TOKEN} template resolves) and the slashed gateway model id survived (tale/openrouter/anthropic/claude-sonnet-4.6);
  • the AGENTS.md system-prompt append appeared in the request's system message alongside OpenClaw's core prompt, and was restored/cleaned from the workspace afterwards;
  • a second run with --resume <handle> carried the prior user+assistant turns (session resume);
  • tool policy applied (coding profile removed message/gateway/…; deny removed web_fetch/web_search);
  • fixtures/openclaw/hello-turn.jsonl is the sanitized capture of that run; the container-runtime test's flag check (openclaw agent --help vs wrapper flags) also passes against the pinned CLI locally.

Gates run locally: platform typecheck, adapter/parser/schema/exec-model/readiness/i18n/builtin-agent test suites (all green), model-selector UI test, docs test suite, migrations:check, oxfmt --check, ruff, oxlint (type-aware), knip, lint:sast.

Honest parity gaps (CLI limitations at the pinned version, documented in the docs page)

  • No live tool/text streaming — headless --json is a single final envelope, so a turn renders as run-started → final text → usage → result (no in-run tool timeline). The internal event stream exists only behind the gateway WebSocket/ACP, which would require a daemon in the container; deliberately out of scope.
  • No plan mode, no mid-turn steering (one-shot process; queued messages drain at turn boundaries).
  • maxTurns ignored — the CLI has no per-run tool-iteration cap; the platform exec deadline is the runaway backstop (CLI's own 600 s default disabled via --timeout 0).
  • No vision polyfill (Claude-Code-specific Read-hook).
  • Docker image build not run locally (no local image pipeline); the container-runtime integration test carries the in-image assertions (openclaw --version, wrapper present, flag parity with agent --help).

@yannickmonney
yannickmonney enabled auto-merge (squash) July 7, 2026 12:12
@yannickmonney
yannickmonney merged commit 6ff2abd into main Jul 7, 2026
16 of 18 checks passed
@yannickmonney
yannickmonney deleted the feat/openclaw-external-agent-2420 branch July 7, 2026 12:26
yannickmonney added a commit that referenced this pull request Jul 7, 2026
…leet

The budget was set at 4400 MB when the image was ~4.0 GB; the six external
agent CLIs added since (Cursor #2481, Hermes #2500, Gemini #2535, Codex
#2536, Pi #2550, OpenClaw #2555) grew it to ~4.9 GB and none of those PRs
updated the budget, so the Validate images gate is red on main too. Document
the fleet as a named cost and restore the ~10% headroom convention at 5400.
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.

Feature: Implement OpenClaw as a sandbox external agent (Claude Code parity)

1 participant