fix(plugins): preserve gateway hook runner

Co-authored-by: lanzhi-lee <36190508+lanzhi-lee@users.noreply.github.com>
This commit is contained in:
Peter Steinberger
2026-04-25 00:28:41 +01:00
parent 2b5c719a62
commit 0376987691
3 changed files with 74 additions and 3 deletions

View File

@@ -59,7 +59,7 @@ import {
type PluginActivationState,
} from "./config-state.js";
import { discoverOpenClawPlugins } from "./discovery.js";
import { initializeGlobalHookRunner } from "./hook-runner-global.js";
import { getGlobalHookRunner, initializeGlobalHookRunner } from "./hook-runner-global.js";
import {
clearPluginInteractiveHandlers,
listPluginInteractiveHandlers,
@@ -1953,8 +1953,14 @@ function activatePluginRegistry(
runtimeSubagentMode: "default" | "explicit" | "gateway-bindable",
workspaceDir?: string,
): void {
const preserveGatewayHookRunner =
runtimeSubagentMode === "default" &&
getActivePluginRuntimeSubagentMode() === "gateway-bindable" &&
getGlobalHookRunner() !== null;
setActivePluginRegistry(registry, cacheKey, runtimeSubagentMode, workspaceDir);
initializeGlobalHookRunner(registry);
if (!preserveGatewayHookRunner) {
initializeGlobalHookRunner(registry);
}
}
export function loadOpenClawPlugins(options: PluginLoadOptions = {}): PluginRegistry {