fix(plugins): keep disabled plugin runtime deps off

Co-authored-by: openclaw-clawsweeper[bot] <280122609+openclaw-clawsweeper[bot]@users.noreply.github.com>
This commit is contained in:
clawsweeper[bot]
2026-04-29 23:15:47 -07:00
committed by GitHub
parent fbc145440f
commit 6dbaa0a278
2 changed files with 72 additions and 1 deletions

View File

@@ -657,6 +657,34 @@ describe("resolvePluginCapabilityProviders", () => {
});
});
it("keeps bundled runtime dependency repair disabled when plugins are globally disabled", () => {
const cfg = { plugins: { enabled: false, allow: ["custom-plugin"] } } as OpenClawConfig;
const enablementCompat = {
plugins: {
enabled: true,
allow: ["custom-plugin", "openai"],
entries: { openai: { enabled: true } },
},
};
setBundledCapabilityFixture("mediaUnderstandingProviders");
mocks.withBundledPluginEnablementCompat.mockReturnValue(enablementCompat);
mocks.withBundledPluginVitestCompat.mockReturnValue(enablementCompat);
expectNoResolvedCapabilityProviders(
resolvePluginCapabilityProviders({
key: "mediaUnderstandingProviders",
cfg,
}),
);
expect(mocks.resolveRuntimePluginRegistry).toHaveBeenCalledWith({
config: enablementCompat,
onlyPluginIds: ["openai"],
activate: false,
installBundledRuntimeDeps: false,
});
});
it.each([
"imageGenerationProviders",
"videoGenerationProviders",
@@ -816,4 +844,41 @@ describe("resolvePluginCapabilityProviders", () => {
activate: false,
});
});
it("keeps targeted provider fallback dependency repair disabled when plugins are globally disabled", () => {
const cfg = { plugins: { enabled: false, allow: ["custom-plugin"] } } as OpenClawConfig;
const enablementCompat = {
plugins: {
enabled: true,
allow: ["custom-plugin", "google"],
entries: { google: { enabled: true } },
},
};
mocks.loadPluginManifestRegistry.mockReturnValue({
plugins: [
{
id: "google",
origin: "bundled",
contracts: { memoryEmbeddingProviders: ["gemini"] },
},
] as never,
diagnostics: [],
});
mocks.withBundledPluginEnablementCompat.mockReturnValue(enablementCompat);
mocks.withBundledPluginVitestCompat.mockReturnValue(enablementCompat);
const provider = resolvePluginCapabilityProvider({
key: "memoryEmbeddingProviders",
providerId: "gemini",
cfg,
});
expect(provider).toBeUndefined();
expect(mocks.resolveRuntimePluginRegistry).toHaveBeenCalledWith({
config: enablementCompat,
onlyPluginIds: ["google"],
activate: false,
installBundledRuntimeDeps: false,
});
});
});

View File

@@ -87,6 +87,7 @@ function resolveCapabilityProviderConfig(params: {
function createCapabilityProviderFallbackLoadOptions(params: {
compatConfig?: OpenClawConfig;
sourceConfig?: OpenClawConfig;
pluginIds: string[];
installBundledRuntimeDeps?: boolean;
}): PluginLoadOptions {
@@ -95,7 +96,10 @@ function createCapabilityProviderFallbackLoadOptions(params: {
onlyPluginIds: params.pluginIds,
activate: false,
};
if (params.installBundledRuntimeDeps === false) {
if (
params.installBundledRuntimeDeps === false ||
params.sourceConfig?.plugins?.enabled === false
) {
loadOptions.installBundledRuntimeDeps = false;
}
return loadOptions;
@@ -243,6 +247,7 @@ export function resolvePluginCapabilityProvider<K extends CapabilityProviderRegi
});
const loadOptions = createCapabilityProviderFallbackLoadOptions({
compatConfig,
sourceConfig: params.cfg,
pluginIds,
installBundledRuntimeDeps: params.installBundledRuntimeDeps,
});
@@ -288,6 +293,7 @@ export function resolvePluginCapabilityProviders<K extends CapabilityProviderReg
});
const loadOptions = createCapabilityProviderFallbackLoadOptions({
compatConfig,
sourceConfig: params.cfg,
pluginIds,
installBundledRuntimeDeps: params.installBundledRuntimeDeps,
});