fix(plugins): allow configured bundled channels past allowlists

This commit is contained in:
Doruk Ardahan
2026-04-03 13:43:21 +03:00
committed by Peter Steinberger
parent 2ad69083d2
commit f7d24c1ed5
5 changed files with 15 additions and 16 deletions

View File

@@ -177,10 +177,7 @@ describe("resolveEffectiveEnableState", () => {
it.each([
[{ enabled: true }, { enabled: true }],
[
{ enabled: true, allow: ["browser"] as string[] },
{ enabled: false, reason: "not in allowlist" },
],
[{ enabled: true, allow: ["browser"] as string[] }, { enabled: true }],
[
{
enabled: true,
@@ -324,7 +321,7 @@ describe("resolveEffectivePluginActivationState", () => {
});
});
it("keeps allowlists authoritative over bundled channel activation", () => {
it("lets explicit bundled channel activation bypass the allowlist", () => {
const rawConfig = {
channels: {
telegram: {
@@ -346,11 +343,11 @@ describe("resolveEffectivePluginActivationState", () => {
sourceRootConfig: rawConfig,
}),
).toEqual({
enabled: false,
activated: false,
enabled: true,
activated: true,
explicitlyEnabled: true,
source: "disabled",
reason: "not in allowlist",
source: "explicit",
reason: "channel enabled in config",
});
});

View File

@@ -285,6 +285,10 @@ export function resolvePluginActivationState(params: {
config: params.sourceConfig ?? params.config,
rootConfig: params.sourceRootConfig ?? params.rootConfig,
});
const explicitlyConfiguredBundledChannel =
params.origin === "bundled" &&
explicitSelection.reason === "channel enabled in config" &&
explicitSelection.explicitlyEnabled;
if (!params.config.enabled) {
return {
@@ -333,7 +337,7 @@ export function resolvePluginActivationState(params: {
reason: "selected memory slot",
};
}
if (params.config.allow.length > 0 && !explicitlyAllowed) {
if (params.config.allow.length > 0 && !explicitlyAllowed && !explicitlyConfiguredBundledChannel) {
return {
enabled: false,
activated: false,

View File

@@ -1017,7 +1017,7 @@ describe("loadOpenClawPlugins", () => {
},
},
{
name: "blocks bundled channel plugins when channels.<id>.enabled=true but plugins.allow excludes them",
name: "loads bundled channel plugins when channels.<id>.enabled=true even if plugins.allow excludes them",
config: {
channels: {
telegram: {
@@ -1029,9 +1029,7 @@ describe("loadOpenClawPlugins", () => {
},
} satisfies PluginLoadConfig,
assert: (registry: ReturnType<typeof loadOpenClawPlugins>) => {
const telegram = registry.plugins.find((entry) => entry.id === "telegram");
expect(telegram?.status).toBe("disabled");
expect(telegram?.error).toBe("not in allowlist");
expectTelegramLoaded(registry);
},
},
{