mirror of https://github.com/openclaw/openclaw.git
fix(config): keep built-in auto-enable idempotent
This commit is contained in:
parent
2615402a2b
commit
7299b42e2a
|
|
@ -200,6 +200,31 @@ describe("applyPluginAutoEnable", () => {
|
|||
expect(validated.ok).toBe(true);
|
||||
});
|
||||
|
||||
it("does not re-emit built-in auto-enable changes when rerun with plugins.allow set", () => {
|
||||
const first = applyPluginAutoEnable({
|
||||
config: {
|
||||
channels: {
|
||||
whatsapp: {
|
||||
allowFrom: ["+15555550123"],
|
||||
},
|
||||
},
|
||||
plugins: {
|
||||
allow: ["telegram"],
|
||||
},
|
||||
},
|
||||
env: {},
|
||||
});
|
||||
|
||||
const second = applyPluginAutoEnable({
|
||||
config: first.config,
|
||||
env: {},
|
||||
});
|
||||
|
||||
expect(first.changes).toHaveLength(1);
|
||||
expect(second.changes).toEqual([]);
|
||||
expect(second.config).toEqual(first.config);
|
||||
});
|
||||
|
||||
it("respects explicit disable", () => {
|
||||
const result = applyPluginAutoEnable({
|
||||
config: {
|
||||
|
|
|
|||
|
|
@ -458,7 +458,8 @@ export function applyPluginAutoEnable(params: {
|
|||
continue;
|
||||
}
|
||||
const allow = next.plugins?.allow;
|
||||
const allowMissing = Array.isArray(allow) && !allow.includes(entry.pluginId);
|
||||
const allowMissing =
|
||||
builtInChannelId == null && Array.isArray(allow) && !allow.includes(entry.pluginId);
|
||||
const alreadyEnabled =
|
||||
builtInChannelId != null
|
||||
? (() => {
|
||||
|
|
|
|||
Loading…
Reference in New Issue