mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-05 05:03:31 +00:00
fix: preserve built-in channel auto-enable fallback
This commit is contained in:
@@ -273,6 +273,37 @@ describe("applyPluginAutoEnable channels", () => {
|
||||
);
|
||||
});
|
||||
|
||||
it("keeps built-in channel enablement when a same-id plugin does not claim the channel", () => {
|
||||
const result = materializePluginAutoEnableCandidates({
|
||||
config: {
|
||||
channels: {
|
||||
telegram: {
|
||||
botToken: "token",
|
||||
},
|
||||
},
|
||||
},
|
||||
candidates: [
|
||||
{
|
||||
pluginId: "telegram",
|
||||
kind: "channel-configured",
|
||||
channelId: "telegram",
|
||||
},
|
||||
],
|
||||
env: makeIsolatedEnv(),
|
||||
manifestRegistry: makeRegistry([
|
||||
{
|
||||
id: "telegram",
|
||||
channels: ["unrelated-channel"],
|
||||
origin: "global",
|
||||
},
|
||||
]),
|
||||
});
|
||||
|
||||
expect(result.config.channels?.telegram?.enabled).toBe(true);
|
||||
expect(result.config.plugins?.entries?.telegram).toBeUndefined();
|
||||
expect(result.changes).toContain("Telegram configured, enabled automatically.");
|
||||
});
|
||||
|
||||
it("uses the plugin manifest id, not the channel id, for plugins.entries", () => {
|
||||
const result = applyWithApnChannelConfig();
|
||||
|
||||
|
||||
@@ -868,7 +868,13 @@ function resolveAutoEnableChannelId(params: {
|
||||
(record) => record.id === params.entry.pluginId,
|
||||
);
|
||||
if (plugin && plugin.origin !== "bundled") {
|
||||
return null;
|
||||
if (params.entry.kind !== "channel-configured") {
|
||||
return null;
|
||||
}
|
||||
const channelId = normalizeManifestChannelId(params.entry.channelId);
|
||||
if ((plugin.channels ?? []).some((id) => normalizeManifestChannelId(id) === channelId)) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
const builtInChannelId = normalizeChatChannelId(params.entry.pluginId);
|
||||
if (builtInChannelId) {
|
||||
|
||||
Reference in New Issue
Block a user