mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-04 22:01:15 +00:00
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:
@@ -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", () => {
|
||||
|
||||
@@ -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 };
|
||||
|
||||
@@ -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: {
|
||||
|
||||
Reference in New Issue
Block a user