Skip to content

Commit 6aed7bf

Browse files
committed
perf(agents): lazy-load MCP retirement manager
1 parent 5f5a840 commit 6aed7bf

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/agents/agent-bundle-mcp-materialize.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import type { OpenClawConfig } from "../config/types.openclaw.js";
77
import { logWarn } from "../logger.js";
88
import { getPluginToolMeta, setPluginToolMeta, type PluginToolMcpMeta } from "../plugins/tools.js";
99
import { matchesMcpToolFilterPattern } from "./agent-bundle-mcp-filter.js";
10-
import { completeDeferredSessionMcpRuntimeRetirement } from "./agent-bundle-mcp-manager-api.js";
1110
import {
1211
buildSafeToolName,
1312
normalizeReservedToolNames,
@@ -32,6 +31,10 @@ async function releaseRuntimeLease(params: {
3231
releaseLease?: () => void;
3332
}): Promise<void> {
3433
params.releaseLease?.();
34+
// Lease retirement is a lifecycle-only edge. Keep the manager graph out of
35+
// read-only CLI startup paths that load tool materialization metadata.
36+
const { completeDeferredSessionMcpRuntimeRetirement } =
37+
await import("./agent-bundle-mcp-manager-api.js");
3538
await completeDeferredSessionMcpRuntimeRetirement(params.runtime).catch((error: unknown) => {
3639
logWarn(`bundle-mcp: deferred runtime cleanup failed: ${String(error)}`);
3740
});

0 commit comments

Comments
 (0)