From b0cf76165c9d2fe8948b76e527b8de08fe9778ec Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Fri, 1 May 2026 20:26:30 +0100 Subject: [PATCH] fix(release): clean up one-shot gateway MCP runtimes --- scripts/e2e/lib/kitchen-sink-plugin/sweep.sh | 1 + src/gateway/server-methods/agent.test.ts | 15 +++++++++++++++ src/gateway/server-methods/agent.ts | 1 + test/scripts/plugin-prerelease-test-plan.test.ts | 1 + 4 files changed, 18 insertions(+) diff --git a/scripts/e2e/lib/kitchen-sink-plugin/sweep.sh b/scripts/e2e/lib/kitchen-sink-plugin/sweep.sh index 855b89360a0..c686d788aae 100644 --- a/scripts/e2e/lib/kitchen-sink-plugin/sweep.sh +++ b/scripts/e2e/lib/kitchen-sink-plugin/sweep.sh @@ -121,6 +121,7 @@ while IFS='|' read -r label spec plugin_id source expectation surface_mode perso export KITCHEN_SINK_SOURCE="$source" export KITCHEN_SINK_SURFACE_MODE="$surface_mode" export KITCHEN_SINK_PERSONALITY="${personality:-}" + export OPENCLAW_KITCHEN_SINK_PERSONALITY="${personality:-}" case "$expectation" in success) run_success_scenario diff --git a/src/gateway/server-methods/agent.test.ts b/src/gateway/server-methods/agent.test.ts index 45cb711f6e4..5ba31732b26 100644 --- a/src/gateway/server-methods/agent.test.ts +++ b/src/gateway/server-methods/agent.test.ts @@ -1212,6 +1212,21 @@ describe("gateway agent handler", () => { ); }); + it("forwards one-shot bundle MCP cleanup from agent RPC into the runner", async () => { + primeMainAgentRun(); + mocks.agentCommand.mockClear(); + + await invokeAgent({ + message: "cleanup probe", + sessionKey: "agent:main:subagent:cleanup-probe", + idempotencyKey: "test-idem-agent-cleanup-bundle-mcp", + cleanupBundleMcpOnRunEnd: true, + }); + + const call = await waitForAgentCommandCall(); + expect(call.cleanupBundleMcpOnRunEnd).toBe(true); + }); + it.each( (["channel", "replyChannel"] as const).flatMap((field) => (["heartbeat", "cron", "webhook"] as const).map((channel) => [field, channel] as const), diff --git a/src/gateway/server-methods/agent.ts b/src/gateway/server-methods/agent.ts index 044ef0b6045..911924d9196 100644 --- a/src/gateway/server-methods/agent.ts +++ b/src/gateway/server-methods/agent.ts @@ -1373,6 +1373,7 @@ export const agentHandlers: GatewayRequestHandlers = { acpTurnSource: request.acpTurnSource, internalEvents: request.internalEvents, inputProvenance, + cleanupBundleMcpOnRunEnd: request.cleanupBundleMcpOnRunEnd, abortSignal: activeRunAbort.controller.signal, // Internal-only: allow workspace override for spawned subagent runs. workspaceDir: resolveIngressWorkspaceOverrideForSpawnedRun({ diff --git a/test/scripts/plugin-prerelease-test-plan.test.ts b/test/scripts/plugin-prerelease-test-plan.test.ts index 2b88e1817fd..be916937c7b 100644 --- a/test/scripts/plugin-prerelease-test-plan.test.ts +++ b/test/scripts/plugin-prerelease-test-plan.test.ts @@ -108,6 +108,7 @@ describe("scripts/lib/plugin-prerelease-test-plan.mjs", () => { expect(script).toContain("scripts/e2e/lib/kitchen-sink-plugin/sweep.sh"); expect(sweepScript).toContain('plugins install "$KITCHEN_SINK_SPEC"'); expect(sweepScript).toContain("KITCHEN_SINK_PERSONALITY"); + expect(sweepScript).toContain("OPENCLAW_KITCHEN_SINK_PERSONALITY"); expect(sweepScript).toContain('plugins uninstall "$KITCHEN_SINK_SPEC" --force'); const successScenario = sweepScript.slice( sweepScript.indexOf("run_success_scenario()"),