diff --git a/CHANGELOG.md b/CHANGELOG.md index 706b787b5ac..3a86abcc99b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ Docs: https://docs.openclaw.ai - Telegram/webhook: acknowledge validated webhook updates before running bot middleware, keeping slow agent turns from tripping Telegram delivery retries while preserving per-chat processing lanes. Fixes #71392. - MCP: retire one-shot embedded bundled MCP runtimes at run end, skip bundle-MCP startup when a runtime tool allowlist cannot reach bundle-MCP tools, and add `mcp.sessionIdleTtlMs` idle eviction for leaked session runtimes. Fixes #71106, #71110, #70389, and #70808. - MCP/config reload: hot-apply `mcp.*` changes by disposing cached session MCP runtimes, and dispose bundled MCP runtimes during gateway shutdown so removed `mcp.servers` entries reap child processes promptly. Fixes #60656. +- Infer/MCP: treat `openclaw infer model run` as a one-shot agent turn for bundled MCP lifecycle cleanup, so local and gateway infer runs do not keep MCP stdio children alive after the result is returned. Fixes #71457. - Gateway/restart continuation: durably hand restart continuations to a session-delivery queue before deleting the restart sentinel, recover queued continuation work after crashy restarts, and fall back to a session-only wake when no channel route survives reboot. (#70780) Thanks @fuller-stack-dev. - Agents/tool-result pruning: harden the tool-result character estimator and context-pruning loops against malformed `{ type: "text" }` blocks created by void or undefined tool handler results, serializing non-string text payloads for size accounting so they cannot bypass trimming as zero-sized. Fixes #34979. (#51267) Thanks @cgdusek. - Daemon/service-env: add Nix Home Manager profile bin directories to generated gateway service PATHs on macOS and Linux, honoring `NIX_PROFILES` right-to-left precedence and falling back to `~/.nix-profile/bin` when unset. Fixes #44402. (#59935) Thanks @jerome-benoit. diff --git a/src/cli/capability-cli.test.ts b/src/cli/capability-cli.test.ts index 5018bba941f..a712748ef62 100644 --- a/src/cli/capability-cli.test.ts +++ b/src/cli/capability-cli.test.ts @@ -360,6 +360,37 @@ describe("capability cli", () => { ); }); + it("cleans up bundled MCP runtimes for local model runs", async () => { + await runRegisteredCli({ + register: registerCapabilityCli as (program: Command) => void, + argv: ["capability", "model", "run", "--prompt", "hello", "--json"], + }); + + expect(mocks.agentCommand).toHaveBeenCalledWith( + expect.objectContaining({ + cleanupBundleMcpOnRunEnd: true, + }), + expect.anything(), + expect.anything(), + ); + }); + + it("requests bundled MCP runtime cleanup for gateway model runs", async () => { + await runRegisteredCli({ + register: registerCapabilityCli as (program: Command) => void, + argv: ["capability", "model", "run", "--prompt", "hello", "--gateway", "--json"], + }); + + expect(mocks.callGateway).toHaveBeenCalledWith( + expect.objectContaining({ + method: "agent", + params: expect.objectContaining({ + cleanupBundleMcpOnRunEnd: true, + }), + }), + ); + }); + it("defaults tts status to gateway transport", async () => { await runRegisteredCli({ register: registerCapabilityCli as (program: Command) => void, diff --git a/src/cli/capability-cli.ts b/src/cli/capability-cli.ts index 6b4c3dd850f..e253fa7f7e4 100644 --- a/src/cli/capability-cli.ts +++ b/src/cli/capability-cli.ts @@ -530,6 +530,7 @@ async function runModelRun(params: { agentId, model: params.model, json: false, + cleanupBundleMcpOnRunEnd: true, }, { ...defaultRuntime, @@ -565,6 +566,7 @@ async function runModelRun(params: { message: params.prompt, provider, model, + cleanupBundleMcpOnRunEnd: true, idempotencyKey: randomIdempotencyKey(), }, expectFinal: true,