mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 11:50:43 +00:00
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:
@@ -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,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -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,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user