mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 12:40:43 +00:00
fix(doctor): preserve built-in channel plugin allow entries
This commit is contained in:
@@ -114,6 +114,39 @@ describe("doctor stale plugin config helpers", () => {
|
||||
]);
|
||||
});
|
||||
|
||||
it("keeps built-in channel ids in restrictive plugin config", () => {
|
||||
const result = maybeRepairStalePluginConfig({
|
||||
plugins: {
|
||||
allow: ["telegram", "whatsapp", "acpx"],
|
||||
entries: {
|
||||
telegram: { enabled: true },
|
||||
whatsapp: { enabled: true },
|
||||
acpx: { enabled: true },
|
||||
},
|
||||
},
|
||||
channels: {
|
||||
whatsapp: {
|
||||
enabled: true,
|
||||
allowFrom: ["+15555550123"],
|
||||
},
|
||||
},
|
||||
} as OpenClawConfig);
|
||||
|
||||
expect(result.changes).toEqual([
|
||||
"- plugins.allow: removed 1 stale plugin id (acpx)",
|
||||
"- plugins.entries: removed 1 stale plugin entry (acpx)",
|
||||
]);
|
||||
expect(result.config.plugins?.allow).toEqual(["telegram", "whatsapp"]);
|
||||
expect(result.config.plugins?.entries).toEqual({
|
||||
telegram: { enabled: true },
|
||||
whatsapp: { enabled: true },
|
||||
});
|
||||
expect(result.config.channels?.whatsapp).toEqual({
|
||||
enabled: true,
|
||||
allowFrom: ["+15555550123"],
|
||||
});
|
||||
});
|
||||
|
||||
it("removes stale third-party channel config and dependent channel refs", () => {
|
||||
const result = maybeRepairStalePluginConfig({
|
||||
plugins: {
|
||||
|
||||
@@ -104,7 +104,7 @@ function scanStalePluginConfigWithState(
|
||||
continue;
|
||||
}
|
||||
const pluginId = normalizePluginId(rawPluginId);
|
||||
if (!pluginId || knownIds.has(pluginId)) {
|
||||
if (!pluginId || knownIds.has(pluginId) || registryState.knownChannelIds.has(pluginId)) {
|
||||
continue;
|
||||
}
|
||||
hits.push({
|
||||
@@ -119,7 +119,7 @@ function scanStalePluginConfigWithState(
|
||||
if (entries) {
|
||||
for (const rawPluginId of Object.keys(entries)) {
|
||||
const pluginId = normalizePluginId(rawPluginId);
|
||||
if (!pluginId || knownIds.has(pluginId)) {
|
||||
if (!pluginId || knownIds.has(pluginId) || registryState.knownChannelIds.has(pluginId)) {
|
||||
continue;
|
||||
}
|
||||
hits.push({
|
||||
|
||||
Reference in New Issue
Block a user