Repository navigation
feat: node-hosted plugins — dynamic tools, MCP servers, and skills - #90431
Conversation
|
Codex review: stale review; fresh review needed. Summary Next step Review history (2 earlier review cycles)
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f59bcb83ca
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| scopes?: string[]; | ||
| caps?: string[]; | ||
| commands?: string[]; | ||
| nodePluginTools?: NodePluginToolDescriptor[]; |
There was a problem hiding this comment.
Serialize advertised node plugin tools on connect
When a node client passes the new nodePluginTools option to GatewayClient, the option is never copied in assembleConnectParams (the connect payload only includes caps, commands, permissions, and pathEnv), so the gateway registers the node with an empty tool catalog until some separate node.pluginTools.update call happens. This breaks the newly exposed package-level connect option for any node client that relies on advertising tools during hello/reconnect rather than the OpenClaw node-host's post-hello update path; wire opts.nodePluginTools into the ConnectParams payload or remove the option from the public client surface.
Useful? React with 👍 / 👎.
|
Follow-up pushed in What changed after review:
Verification:
Crabbox pond status:
|
|
Additional CI fix pushed in Additional verification after that commit:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e5c70a96b0
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| @@ -133,6 +137,7 @@ export type GatewayClientOptions = { | |||
| scopes?: string[]; | |||
| caps?: string[]; | |||
| commands?: string[]; | |||
| nodePluginTools?: NodePluginToolDescriptor[]; | |||
There was a problem hiding this comment.
Remove the unused node plugin tools option
When a node client sets this newly exposed GatewayClient option, the wrapper only forwards it through the constructor spread, but the underlying package client never reads it while assembling the connect payload, and the new connect test asserts nodePluginTools is omitted from initial frames. That makes this public option a no-op for callers expecting connect-time advertisement; either remove it from this type or wire option users into the post-hello node.pluginTools.update path. Fresh evidence: the current diff still adds the option here while the base package client has no matching serialized field.
Useful? React with 👍 / 👎.
e5c70a9 to
be6e4bb
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b8197c3408
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| @@ -67,6 +68,7 @@ public struct ConnectParams: Codable, Sendable { | |||
| client: [String: AnyCodable], | |||
| caps: [String]?, | |||
| commands: [String]?, | |||
| nodeplugintools: [NodePluginToolDescriptor]?, | |||
There was a problem hiding this comment.
Preserve Swift ConnectParams source compatibility
When existing Swift clients construct ConnectParams through this public initializer, the new optional nodePluginTools field is still introduced as a non-defaulted initializer argument, so every existing call site outside this repo now has to add nodeplugintools: nil just to compile. Keep the wire field optional but give this new initializer parameter a default of nil or add a compatibility overload so older OpenClawKit consumers are not source-broken by an additive protocol field.
Useful? React with 👍 / 👎.
b8197c3 to
bfd9fca
Compare
|
Verification for the rebased head
Known proof note: the AWS gateway run exits 255 because I released the lease after the successful verifier run; the proof completed before cleanup and the lease was released. |
4fc74d2 to
23cb1c4
Compare
|
Verification for head Scope on this head (supersedes the original PR scope; title/body updated): dynamic node-hosted plugin tools (original #90431 substrate) + declarative node-hosted MCP servers ( Local proof (this head):
Remote proof (Blacksmith Testbox through Crabbox):
Review: fresh Known proof gaps: the remote Testbox runs validated the pre-squash commit stack; this squashed head is content-identical (same tree diff vs main modulo the two-file merge resolution in |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a6aa007d37
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| async function publishNodeSkills(client: GatewayClient, skills: unknown[]): Promise<void> { | ||
| try { | ||
| await client.request("node.skills.update", { skills }); |
There was a problem hiding this comment.
Keep node catalog publishes under the WS frame cap
When a node has valid hosted skills near the new 512 KiB total limit, this sends the entire catalog in one node.skills.update frame; the sibling node.pluginTools.update path does the same for MCP descriptor catalogs that src/node-host/mcp.ts:28-29 allows up to 10 MiB. The gateway WebSocket is still created with maxPayload: MAX_PREAUTH_PAYLOAD_BYTES (64 KiB) in src/gateway/server-runtime-state.ts:249-252 (and ws enforces that per message), so these valid catalogs close the node connection before the update handler runs and the agent never sees the tools/skills. Chunk or lower the published catalogs, or raise the authenticated frame limit before publishing them.
Useful? React with 👍 / 👎.
| const OUTPUT_CAP = 200_000; | ||
| const MCP_TEXT_CONTENT_MAX_BYTES = 1024 * 1024; | ||
| const MCP_TEXT_TRUNCATION_MARKER = "\n[truncated: MCP text content exceeded 1 MB]"; | ||
| const MCP_INVOKE_PAYLOAD_MAX_BYTES = 20 * 1024 * 1024; |
There was a problem hiding this comment.
Cap MCP invoke results to the gateway frame limit
When an MCP tool returns more than 64 KiB but less than this new 20 MiB cap, boundMcpToolResultPayload preserves it and sendMcpPayloadResult sends it through node.invoke.result on the same gateway WebSocket. Because the current gateway server max payload is 64 KiB (src/gateway/server-runtime-state.ts:249-252), the oversized result frame is rejected before the invoke-result handler runs, so the agent sees a timeout/disconnect instead of a truncated result. Bound this to the actual server frame budget or raise the authenticated frame limit.
Useful? React with 👍 / 👎.
skills.status started passing eligibility for the node-skill merge, which flipped loadWorkspaceSkillEntries into filtered mode and dropped disabled skills from status reports (QA plugin-lifecycle-hot-reload timeout). Status now merges node skills explicitly around an unfiltered load. Also: regen docs_map for new node docs sections; add the intentional node-host MCP onclose suppression to the lint-suppression allowlist.
|
Merged via squash.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cb9f109a0d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| !isProviderSafeToolName(name) || | ||
| !description || | ||
| !command || | ||
| !allowedCommands.has(command) |
There was a problem hiding this comment.
Block reserved shell commands in node tool descriptors
When a paired node publishes a descriptor whose command is system.run or system.run.prepare, this check accepts it because those commands are in the node's allowed command set. createNodePluginTools then exposes that descriptor as a model tool that forwards arbitrary model params via node.invoke (src/agents/node-plugin-tools.ts:233-247), bypassing the existing generic nodes-tool guard that reserves those commands for the exec path (src/agents/tools/nodes-tool-commands.ts:20,124-127) and its per-run command shaping. Reject these reserved commands for node-published plugin tools unless they go through the exec-specific flow.
Useful? React with 👍 / 👎.
| resolvedVerboseLevel: VerboseLevel | undefined; | ||
| resolvedReasoningLevel: ReasoningLevel; | ||
| resolvedElevatedLevel: ElevatedLevel; | ||
| execOverrides?: ExecPolicyOverrides; |
There was a problem hiding this comment.
Pass exec overrides to normal inline action handling
When a regular message combines an inline /exec host=node ... directive with a node-hosted skill slash command, resolveReplyDirectives computes execOverrides, but the ordinary get-reply.ts caller of handleInlineActions never passes this new option (the native fast path does at src/auto-reply/reply/get-reply-native-slash-fast-path.ts:348). That leaves execOverrides undefined here, so skill commands are reused or reloaded under the previous session policy and node-hosted skills made eligible by the same /exec directive are treated as missing; wire directiveResult.result.execOverrides through the normal caller too.
Useful? React with 👍 / 👎.
…penclaw#90431) * feat: node-hosted plugins — dynamic tools, MCP servers, and skills Nodes become declarative plugin hosts: - node.pluginTools.update: node hosts publish plugin-registered agent tool descriptors; gateway materializes them as agent tools executing via node.invoke under the node command allowlist, with tools.effective invalidation and node online/offline removal. - Trusted paired-node descriptors: no gateway-side plugin registration required; gateway.nodes.pluginTools.enabled off-switch (default on); description/count caps; deterministic node-prefixed collision names. - Declarative node-hosted MCP: nodeHost.mcp.servers (McpServerConfig shape) starts MCP clients on the node host, publishes tools as pluginId node-mcp, executes via built-in mcp.tools.call.v1 with per-layer timeouts, failure isolation, and orphan-safe shutdown. No re-pairing when servers change. - Node-hosted skills: node.skills.update publishes ~/.openclaw/skills content (64 skills/64KB/512KB caps both sides); gateway merges them into the skills snapshot while connected and exec host=node is available, with node:// locators, node-prefixed collisions, disabled command dispatch, and gateway.nodes.skills.enabled + nodeHost.skills.enabled switches. - Security: node-supplied pluginIds cannot satisfy pluginId-scoped tool allowlists unless gateway-registered; reserved node-mcp id requires the core MCP descriptor shape; protocol registry kept out of public plugin-sdk dts. - E2E: pond harness proves publication, MCP round-trip, skills locator, and disconnect/reconnect for all three surfaces. * style: format node-plugin-tools test * fix(skills): keep status loader unfiltered when eligibility is passed skills.status started passing eligibility for the node-skill merge, which flipped loadWorkspaceSkillEntries into filtered mode and dropped disabled skills from status reports (QA plugin-lifecycle-hot-reload timeout). Status now merges node skills explicitly around an unfiltered load. Also: regen docs_map for new node docs sections; add the intentional node-host MCP onclose suppression to the lint-suppression allowlist.
What Problem This Solves
Nodes today are peripherals: they expose a fixed RPC command surface, and every node-side integration needs either a wrapper JS plugin on the gateway (#8287's Tesla case) or nothing at all. There is no way for a node to bring its own MCP servers or skills to the agent.
This PR makes nodes first-class plugin hosts, declaratively:
agentToolmetadata; the node publishes descriptors via the newnode.pluginTools.updatemethod and the gateway materializes them as agent tools executing overnode.invoke.nodeHost.mcp.servers(standardMcpServerConfigshape) in the node machine'sopenclaw.json; the headless node host runs the MCP clients, publishes discovered tools (pluginIdnode-mcp), and calls round-trip via the built-inmcp.tools.call.v1node command.~/.openclaw/skillsare published via the newnode.skills.updatemethod and merge natively into the gateway skills snapshot while the node is connected, with node-locator notes teaching agents to run them viaexec host=node.Why This Change Was Made
Maintainer product decisions baked in:
gateway.nodes.pluginTools.enabled,gateway.nodes.skills.enabled(plus node-sidenodeHost.skills.enabled).mcp.tools.call.v1, skills publication ride the node role). Installing/removing MCP servers or skills republishes descriptors only; a node host restart applies config changes. Genuinely new command families still require pairing approval.node-mcpexcepted); denylists always win. Node skills are only eligible when the session can actuallyexec host=node(exec security, node binding, andsystem.runavailability are honored), and command dispatch is disabled for node-owned skill content.Scope/limits (v1): headless node host + request/response tools only (no MCP streaming/notifications/sampling/OAuth), 128 descriptors + 1024-char descriptions per node, 64 skills / 64KB each / 512KB total per node, enforced on both sides.
User Impact
tools.effectivecache invalidation + skills snapshot version bumps).Evidence
scripts/e2e/node-plugin-tools-pond.mjs): real gateway + two node hosts + real stdio MCP server + node skill fixture. Proves publication, MCP proof-token round-trip through the agent tool path,skills.statuslocator withnode://paths, and disappearance/return of all three surfaces across node disconnect/reconnect. Green locally and on Blacksmith Testbox (run IDs in comments).pnpm check:changedgreen on Blacksmith Testbox through Crabbox (lease + Actions run IDs in comments).pnpm buildgreen includingcheck-plugin-sdk-exports(protocol registry kept out of public plugin-sdk dts) andpnpm protocol:check(regenerated schema + Swift models).autoreview(Codex gpt-5.5, branch vs origin/main): the one accepted finding (pluginId allowlist bypass) is fixed in-branch; final run clean.