Repository navigation
feat: run Meta models through the Muse Code CLI agent runtime - #170487
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesAdds an external Muse Code plugin that runs Meta agent turns through Muse while retaining OpenClaw approvals, transcripts, and session bindings. Example: Configure meta/muse-spark-1.3 with agentRuntime.id set to muse.
Review scores
ProductKind: Feature · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this maintainer-authored PR adds a useful opt-in runtime with credible live proof and no actionable code findings; current-head CI remains pending. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe plugin sits between OpenClaw's prepared agent attempts and Muse's native runtime, translating prompts, images, approvals, events, and durable session identities. flowchart LR
A[Channel or CLI] --> B[OpenClaw agent attempt]
B --> C[Muse plugin]
C --> D[Muse SDK and serve process]
D --> E[Meta model and native tools]
D --> C
C --> F[OpenClaw approvals and transcript]
C --> G[Plugin session bindings]
Technical reviewBest possible solution: Land the opt-in plugin through normal CI gates while preserving its explicit permission limits and documented runtime limitations. Do we have a high-confidence way to reproduce the issue? This is a new capability; supplied live output exercises its production Gateway path, and no target code was executed during review. Is this the best way to solve the issue? The existing harness and keyed-state contracts fit this integration, and its approval-preserving MSP path provides a concrete distinction from the community CLI adapter. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 5b742a7c787e. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +1129, Tests +1176, Docs +338, Config +45, Generated 0, Other +672. Total +3360 across 33 files. Added test files: 3. View PR surface stats
Review metrics
LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (6 earlier review cycles)
Reviewed October 13, 2026, 5:19 PM ET / 21:19 UTC (Revision 7). |
|
ClawSweeper reviews are opt-in for maintainers. If a review is required, finish the work and validation first, then comment |
|
…ard images, report tool errors, reset context
|
@clawsweeper review |
|
🦞👀 Re-review progress:
|
… workspace context; prove deny and cancel live
|
Landed as 1c147d4.
|
…aw#170487) ## What Problem This Solves OpenClaw cannot run agents through Meta's Muse Code CLI. Muse has no ACP support, so the acpx route does not work, and `meta/*` models only run on the built-in runtime. ## User Impact Users can install the external `@openclaw/muse` plugin and set `agentRuntime: { id: "muse" }` on a `meta/*` model or on the `meta` provider. Turns then run through `muse serve`, using Muse's own sign-in (subscription browser login, stored key, or `META_API_KEY`). Muse owns its native tools, sandbox, MCP servers and session state. OpenClaw keeps channels, approvals, the transcript and session mapping. The runtime is opt-in and never auto-selected. ## Why This Change Was Made - New external plugin `extensions/muse`. It registers an `AgentHarnessV2` with id `muse` and talks to Muse through the official `@muse-code/sdk` over the Muse Session Protocol. The SDK is pinned to 1.4.2, the newest version the repo's `minimumReleaseAge` policy admits. - **Exec policy.** The effective policy is resolved through the SDK `execPolicy` contract across the global, agent and override layers, including `tools.exec.mode`, then tightened by the host-local exec-approval floors (`loadExecApprovalsReadOnlyAsync`, `minSecurity`/`maxAsk`). An explicit full-session elevation is the only bypass. Deny becomes `muse serve --disable-shell --disable-write` with `denyUnmatched`. Full with `ask: off` becomes `allowAll`. Everything else becomes `promptUnmatched`, and each Muse request goes to OpenClaw's approval flow (allow-once or deny, server-offered choices only, 120-second wait). Exec allowlist, `ask: always`, OpenClaw sandbox, workspace-only file access, restricted tool policy and `adaptive` thinking are refused before Muse starts, with a user-visible message. - **Settlement.** On abort, timeout, approval failure or transcript failure, the harness interrupts and then waits for the native turn's terminal outcome before releasing the attempt. If no terminal arrives, it closes the host after 5 seconds. - **Sessions.** - Bindings live in plugin keyed state (SQLite) and are published only after Muse accepts the turn. A Muse session is resumed only when workspace, model, credential, read-only posture and approval mode are unchanged. - A server-authored resume refusal starts a new session and logs why. Muse ran nothing in that case. - `reset` and `withSessionContextReset` (after a committed history cut) drop the binding. - **Context.** A fresh Muse session (first turn, model change, refused resume, or committed context reset) is seeded once with OpenClaw workspace bootstrap context (`resolveBootstrapContextForRun`) and the retained conversation (`openModelContextAsync`, bounded by `resolveAgentHarnessHistoryLimits`). If the retained context cannot be read, the turn fails visibly before anything is dispatched. - **Input and results.** Prepared images are forwarded as MSP image parts. Native tool failures carry `lastToolError` back to core. - **Failure reporting.** Failures are logged to the Gateway log with Muse's stderr tail. Muse's `authRequired` failure becomes "not signed in on the Gateway host; run `muse login`". - **Config baseline (maintainer-approved).** The plugin config budget goes from 4553 to 4575. 21 entries are the generic `plugins.entries.muse.*` entries every plugin gets; 1 is `binaryPath`, which is needed when the Gateway service's PATH lacks `~/.local/bin`. - **Data-model compatibility.** The plugin is new. It adds no tables or columns and uses only its own plugin keyed-state namespace, so there is no existing stored data to migrate. Known gaps (documented in `docs/plugins/muse.md`): - OpenClaw agent tools are not bridged: MSP has no client-tool contract. - No live steering, compaction, isolated completion or `/btw` through Muse. - Model Setup cannot activate a new `meta` API key while `meta/*` routes to `muse`. - Chat shows a generic failure notice; the actionable cause is in the Gateway log. ## Evidence Redacted real-Muse output for these runs is in openclaw#170487 (comment). All runs use real Muse, signed in through Meta's device OAuth flow. The flow was approved in the browser for the host and for each Docker container. | Check | Result | |---|---| | `OPENCLAW_MUSE_LIVE_AUTH=device pnpm test:docker:live-muse` on the current tree: package-installed OpenClaw, real Muse from Meta's installer, `muse login` inside the container | Pass. Real reply. Recall after a Gateway restart (wire `session/resume`). Recall in a replacement native session after a model change (history seeding). An approved `bash` command ran. A denied command did not run (no file). A run aborted with `chat.abort` 3 s after approving `sleep 20 && printf late > file` left no late file after 25 s. After `muse logout`, the Gateway log shows "Muse Code is not signed in on the Gateway host … `muse login`". | | `pnpm test:docker:muse-runtime` on the current tree: offline fake MSP host behind a real Gateway | Pass. Fresh session, cached reuse, resume after restart, allow and deny with server-minted choice ids, `/reset` starts a new session, allowlist refused before any Muse process starts. | | Host `pnpm openclaw agent --local`, two separate processes, real Muse login | Pass. Turn 2 recalled a per-run fact from turn 1. | | `runtime.live.test.ts` against real Muse 1.3.0 (no credentials) | Pass. Handshake, start/resume, invalid key, interrupt, process exit. | | `extensions/muse/harness.test.ts` | 47 pass. Regressions fail on the old code for each fixed defect. | | Extension test typecheck, `oxfmt`, `oxlint`, scoped `tsgo`, docs checks, plugin-inventory, plugin npm-release test, config baseline check | Pass | Defects found by the e2e runs and review, all fixed here: - An unlimited Gateway budget fired the turn timer immediately. - Approval failures showed up as aborts, and an approval that failed before the turn started was missed. - The run handle did not match tool authority. - `supports()` refused the official endpoint. - A refused resume blocked later turns. - Final text was assembled from racing deltas. - Exec `mode` and agent layers were ignored. - Interrupts did not wait for settlement. - Images were dropped. - `lastToolError` was lost. - The session binding survived context resets. Co-authored-by: Ayaan Zaidi <[email protected]>
…se (#172299) mcp-relay (#168233) and muse (#170487) were added without the assets/icon.png and assets/activity.svg every bundled plugin must ship, so bundled-plugin-icons.test.ts fails with ENOENT in the plugin sweep. mcp-relay is OpenClaw infrastructure: reuse the shared OpenClaw mascot identity and add a functional relay glyph in the Connections and sharing activity family. muse is Meta's Muse Code runtime for the Meta provider: reuse the Meta identity and activity artwork byte-for-byte.
…se (openclaw#172299) mcp-relay (openclaw#168233) and muse (openclaw#170487) were added without the assets/icon.png and assets/activity.svg every bundled plugin must ship, so bundled-plugin-icons.test.ts fails with ENOENT in the plugin sweep. mcp-relay is OpenClaw infrastructure: reuse the shared OpenClaw mascot identity and add a functional relay glyph in the Connections and sharing activity family. muse is Meta's Muse Code runtime for the Meta provider: reuse the Meta identity and activity artwork byte-for-byte.
What Problem This Solves
OpenClaw cannot run agents through Meta's Muse Code CLI. Muse has no ACP support, so the acpx route does not work, and
meta/*models only run on the built-in runtime.User Impact
Users can install the external
@openclaw/museplugin and setagentRuntime: { id: "muse" }on ameta/*model or on themetaprovider. Turns then run throughmuse serve, using Muse's own sign-in (subscription browser login, stored key, orMETA_API_KEY). Muse owns its native tools, sandbox, MCP servers and session state. OpenClaw keeps channels, approvals, the transcript and session mapping. The runtime is opt-in and never auto-selected.Why This Change Was Made
extensions/muse. It registers anAgentHarnessV2with idmuseand talks to Muse through the official@muse-code/sdkover the Muse Session Protocol. The SDK is pinned to 1.4.2, the newest version the repo'sminimumReleaseAgepolicy admits.execPolicycontract across the global, agent and override layers, includingtools.exec.mode, then tightened by the host-local exec-approval floors (loadExecApprovalsReadOnlyAsync,minSecurity/maxAsk). An explicit full-session elevation is the only bypass. Deny becomesmuse serve --disable-shell --disable-writewithdenyUnmatched. Full withask: offbecomesallowAll. Everything else becomespromptUnmatched, and each Muse request goes to OpenClaw's approval flow (allow-once or deny, server-offered choices only, 120-second wait). Exec allowlist,ask: always, OpenClaw sandbox, workspace-only file access, restricted tool policy andadaptivethinking are refused before Muse starts, with a user-visible message.resetandwithSessionContextReset(after a committed history cut) drop the binding.resolveBootstrapContextForRun) and the retained conversation (openModelContextAsync, bounded byresolveAgentHarnessHistoryLimits). If the retained context cannot be read, the turn fails visibly before anything is dispatched.lastToolErrorback to core.authRequiredfailure becomes "not signed in on the Gateway host; runmuse login".plugins.entries.muse.*entries every plugin gets; 1 isbinaryPath, which is needed when the Gateway service's PATH lacks~/.local/bin.Known gaps (documented in
docs/plugins/muse.md):/btwthrough Muse.metaAPI key whilemeta/*routes tomuse.Evidence
Redacted real-Muse output for these runs is in #170487 (comment).
All runs use real Muse, signed in through Meta's device OAuth flow. The flow was approved in the browser for the host and for each Docker container.
OPENCLAW_MUSE_LIVE_AUTH=device pnpm test:docker:live-museon the current tree: package-installed OpenClaw, real Muse from Meta's installer,muse logininside the containersession/resume). Recall in a replacement native session after a model change (history seeding). An approvedbashcommand ran. A denied command did not run (no file). A run aborted withchat.abort3 s after approvingsleep 20 && printf late > fileleft no late file after 25 s. Aftermuse logout, the Gateway log shows "Muse Code is not signed in on the Gateway host …muse login".pnpm test:docker:muse-runtimeon the current tree: offline fake MSP host behind a real Gateway/resetstarts a new session, allowlist refused before any Muse process starts.pnpm openclaw agent --local, two separate processes, real Muse loginruntime.live.test.tsagainst real Muse 1.3.0 (no credentials)extensions/muse/harness.test.tsoxfmt,oxlint, scopedtsgo, docs checks, plugin-inventory, plugin npm-release test, config baseline checkDefects found by the e2e runs and review, all fixed here:
supports()refused the official endpoint.modeand agent layers were ignored.lastToolErrorwas lost.