fix: sync built-in channel enablement across config paths

This commit is contained in:
Peter Steinberger
2026-02-23 19:40:32 +00:00
parent 69b17a37e8
commit 87603b5c45
10 changed files with 213 additions and 86 deletions

View File

@@ -32,12 +32,12 @@ describe("enablePluginInConfig", () => {
expect(result.reason).toBe("blocked by denylist");
});
it("writes built-in channels to channels.<id>.enabled instead of plugins.entries", () => {
it("writes built-in channels to channels.<id>.enabled and plugins.entries", () => {
const cfg: OpenClawConfig = {};
const result = enablePluginInConfig(cfg, "telegram");
expect(result.enabled).toBe(true);
expect(result.config.channels?.telegram?.enabled).toBe(true);
expect(result.config.plugins?.entries?.telegram).toBeUndefined();
expect(result.config.plugins?.entries?.telegram?.enabled).toBe(true);
});
it("adds built-in channel id to allowlist when allowlist is configured", () => {
@@ -51,4 +51,25 @@ describe("enablePluginInConfig", () => {
expect(result.config.channels?.telegram?.enabled).toBe(true);
expect(result.config.plugins?.allow).toEqual(["memory-core", "telegram"]);
});
it("re-enables built-in channels after explicit plugin-level disable", () => {
const cfg: OpenClawConfig = {
channels: {
telegram: {
enabled: true,
},
},
plugins: {
entries: {
telegram: {
enabled: false,
},
},
},
};
const result = enablePluginInConfig(cfg, "telegram");
expect(result.enabled).toBe(true);
expect(result.config.channels?.telegram?.enabled).toBe(true);
expect(result.config.plugins?.entries?.telegram?.enabled).toBe(true);
});
});