fix(plugins): preserve live hook registry during gateway runs

This commit is contained in:
Vincent Koc
2026-03-23 01:00:08 -07:00
parent 9105b3723d
commit d22279d2e8
9 changed files with 198 additions and 63 deletions

View File

@@ -4,6 +4,7 @@ import { createSubsystemLogger } from "../logging/subsystem.js";
import { applyTestPluginDefaults, normalizePluginsConfig } from "./config-state.js";
import { loadOpenClawPlugins } from "./loader.js";
import { createPluginLoaderLogger } from "./logger.js";
import { getActivePluginRegistry, getActivePluginRegistryKey } from "./runtime.js";
import type { OpenClawPluginToolContext } from "./types.js";
const log = createSubsystemLogger("plugins");
@@ -59,17 +60,21 @@ export function resolvePluginTools(params: {
return [];
}
const registry = loadOpenClawPlugins({
config: effectiveConfig,
workspaceDir: params.context.workspaceDir,
runtimeOptions: params.allowGatewaySubagentBinding
? {
allowGatewaySubagentBinding: true,
}
: undefined,
env,
logger: createPluginLoaderLogger(log),
});
const activeRegistry = getActivePluginRegistry();
const registry =
getActivePluginRegistryKey() && activeRegistry
? activeRegistry
: loadOpenClawPlugins({
config: effectiveConfig,
workspaceDir: params.context.workspaceDir,
runtimeOptions: params.allowGatewaySubagentBinding
? {
allowGatewaySubagentBinding: true,
}
: undefined,
env,
logger: createPluginLoaderLogger(log),
});
const tools: AnyAgentTool[] = [];
const existing = params.existingToolNames ?? new Set<string>();