mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-30 03:11:10 +00:00
fix(regression): widen preseeded cli plugin registry loads
This commit is contained in:
@@ -145,4 +145,32 @@ describe("ensurePluginRegistryLoaded", () => {
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
it("does not treat a pre-seeded partial registry as all scope", async () => {
|
||||
const config = {
|
||||
plugins: { enabled: true },
|
||||
channels: { "demo-channel-a": { enabled: true } },
|
||||
};
|
||||
|
||||
mocks.loadConfig.mockReturnValue(config);
|
||||
mocks.applyPluginAutoEnable.mockReturnValue({ config, changes: [] });
|
||||
mocks.getActivePluginRegistry.mockReturnValue({
|
||||
plugins: [],
|
||||
channels: [{ plugin: { id: "demo-channel-a" } }],
|
||||
tools: [],
|
||||
});
|
||||
|
||||
const { ensurePluginRegistryLoaded } = await import("./plugin-registry.js");
|
||||
|
||||
ensurePluginRegistryLoaded({ scope: "all" });
|
||||
|
||||
expect(mocks.loadOpenClawPlugins).toHaveBeenCalledTimes(1);
|
||||
expect(mocks.loadOpenClawPlugins).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
config,
|
||||
throwOnLoadError: true,
|
||||
workspaceDir: "/tmp/workspace",
|
||||
}),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -37,11 +37,12 @@ export function ensurePluginRegistryLoaded(options?: { scope?: PluginRegistrySco
|
||||
// Tests (and callers) can pre-seed a registry (e.g. `test/setup.ts`); avoid
|
||||
// doing an expensive load when we already have plugins/channels/tools.
|
||||
if (
|
||||
scope !== "all" &&
|
||||
pluginRegistryLoaded === "none" &&
|
||||
active &&
|
||||
(active.plugins.length > 0 || active.channels.length > 0 || active.tools.length > 0)
|
||||
) {
|
||||
pluginRegistryLoaded = "all";
|
||||
pluginRegistryLoaded = scope;
|
||||
return;
|
||||
}
|
||||
const config = loadConfig();
|
||||
|
||||
Reference in New Issue
Block a user