diff --git a/scripts/e2e/lib/bundled-plugin-install-uninstall/runtime-smoke.mjs b/scripts/e2e/lib/bundled-plugin-install-uninstall/runtime-smoke.mjs index 0567c091013a..c4ca27ad0fd4 100644 --- a/scripts/e2e/lib/bundled-plugin-install-uninstall/runtime-smoke.mjs +++ b/scripts/e2e/lib/bundled-plugin-install-uninstall/runtime-smoke.mjs @@ -237,12 +237,22 @@ function ensureGatewayConfig(config, port) { }; } -function activateSmokePlugin(config, pluginId) { +export function activateSmokePlugin(config, pluginId, channels = []) { const allow = Array.isArray(config.plugins?.allow) ? Array.from(new Set([...config.plugins.allow, pluginId].filter(isNonEmptyString))) : undefined; + const channelConfig = { ...(config.channels ?? {}) }; + for (const channel of channels) { + channelConfig[channel] = { + ...(typeof channelConfig[channel] === "object" && channelConfig[channel] !== null + ? channelConfig[channel] + : {}), + enabled: true, + }; + } return { ...config, + ...(channels.length > 0 ? { channels: channelConfig } : {}), plugins: { ...config.plugins, enabled: true, @@ -645,7 +655,10 @@ async function smokePlugin(pluginId, pluginDir, requiresConfig, pluginIndex, plu const plan = buildPluginPlan(manifest); const port = readPositiveInt(process.env.OPENCLAW_BUNDLED_PLUGIN_RUNTIME_PORT_BASE, 19000) + pluginIndex * 3; - const config = ensureGatewayConfig(activateSmokePlugin(readConfig(), pluginId), port); + const config = ensureGatewayConfig( + activateSmokePlugin(readConfig(), pluginId, plan.channels), + port, + ); if (plan.speechProviders[0]) { const provider = plan.speechProviders[0]; config.messages = { diff --git a/test/scripts/bundled-plugin-install-uninstall-probe.test.ts b/test/scripts/bundled-plugin-install-uninstall-probe.test.ts index 93a311fae9d9..3af05a16efed 100644 --- a/test/scripts/bundled-plugin-install-uninstall-probe.test.ts +++ b/test/scripts/bundled-plugin-install-uninstall-probe.test.ts @@ -205,6 +205,25 @@ describe("bundled plugin install/uninstall probe", () => { ); }); + it("activates channel config for channel plugin runtime smoke", async () => { + const runtimeSmoke = await import(pathToFileURL(runtimeSmokePath).href); + + expect( + runtimeSmoke.activateSmokePlugin( + { plugins: { allow: ["browser"] }, channels: { telegram: { dmPolicy: "open" } } }, + "telegram", + ["telegram"], + ), + ).toMatchObject({ + channels: { telegram: { dmPolicy: "open", enabled: true } }, + plugins: { + allow: ["browser", "telegram"], + enabled: true, + entries: { telegram: { enabled: true } }, + }, + }); + }); + it("rejects loose runtime output limit env values instead of parsing prefixes", async () => { const runtimeSmoke = await importRuntimeSmokeWithEnv({ OPENCLAW_BUNDLED_PLUGIN_RUNTIME_OUTPUT_CHARS: "5chars",