fix: preserve bundled channel plugin compat (#58873)

* fix: preserve bundled channel plugin compat

* fix: preserve bundled channel plugin compat (#58873)

* fix: scope channel plugin compat to bundled plugins (#58873)
This commit is contained in:
Ayaan Zaidi
2026-04-01 14:42:36 +05:30
committed by GitHub
parent 2d53ffdec1
commit fb28b02540
8 changed files with 273 additions and 2 deletions

View File

@@ -158,8 +158,25 @@ describe("resolveEffectiveEnableState", () => {
});
}
function resolveConfigOriginTelegramState(config: Parameters<typeof normalizePluginsConfig>[0]) {
const normalized = normalizePluginsConfig(config);
return resolveEffectiveEnableState({
id: "telegram",
origin: "config",
config: normalized,
rootConfig: {
channels: {
telegram: {
enabled: true,
},
},
},
});
}
it.each([
[{ enabled: true }, { enabled: true }],
[{ enabled: true, allow: ["browser"] as string[] }, { enabled: true }],
[
{
enabled: true,
@@ -174,6 +191,15 @@ describe("resolveEffectiveEnableState", () => {
] as const)("resolves bundled telegram state for %o", (config, expected) => {
expect(resolveBundledTelegramState(config)).toEqual(expected);
});
it("does not bypass allowlists for non-bundled plugins that reuse a channel id", () => {
expect(
resolveConfigOriginTelegramState({
enabled: true,
allow: ["browser"] as string[],
}),
).toEqual({ enabled: false, reason: "not in allowlist" });
});
});
describe("resolveEnableState", () => {

View File

@@ -302,8 +302,9 @@ export function resolveEffectiveEnableState(params: {
}): { enabled: boolean; reason?: string } {
const base = resolveEnableState(params.id, params.origin, params.config, params.enabledByDefault);
if (
params.origin === "bundled" &&
!base.enabled &&
base.reason === "bundled (disabled by default)" &&
(base.reason === "bundled (disabled by default)" || base.reason === "not in allowlist") &&
isBundledChannelEnabledByChannelConfig(params.rootConfig, params.id)
) {
return { enabled: true };

View File

@@ -1014,6 +1014,22 @@ describe("loadOpenClawPlugins", () => {
expectTelegramLoaded(registry);
},
},
{
name: "loads bundled channel plugins when channels.<id>.enabled=true even under restrictive plugins.allow",
config: {
channels: {
telegram: {
enabled: true,
},
},
plugins: {
allow: ["browser"],
},
} satisfies PluginLoadConfig,
assert: (registry: ReturnType<typeof loadOpenClawPlugins>) => {
expectTelegramLoaded(registry);
},
},
{
name: "still respects explicit disable via plugins.entries for bundled channels",
config: {