From 9769b96fb1e587311f5104ffbb8f9343f72c9b5b Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Sat, 14 Feb 2026 01:56:00 +0000 Subject: [PATCH] fix(config): auto-enable configured plugins --- src/config/plugin-auto-enable.test.ts | 38 ++++++++++++++------------- src/config/plugin-auto-enable.ts | 4 +-- 2 files changed, 22 insertions(+), 20 deletions(-) diff --git a/src/config/plugin-auto-enable.test.ts b/src/config/plugin-auto-enable.test.ts index 72f4d2dd4d8..92227d14279 100644 --- a/src/config/plugin-auto-enable.test.ts +++ b/src/config/plugin-auto-enable.test.ts @@ -2,7 +2,7 @@ import { describe, expect, it } from "vitest"; import { applyPluginAutoEnable } from "./plugin-auto-enable.js"; describe("applyPluginAutoEnable", () => { - it("configures channel plugins with disabled state and updates allowlist", () => { + it("auto-enables channel plugins and updates allowlist", () => { const result = applyPluginAutoEnable({ config: { channels: { slack: { botToken: "x" } }, @@ -11,9 +11,9 @@ describe("applyPluginAutoEnable", () => { env: {}, }); - expect(result.config.plugins?.entries?.slack?.enabled).toBe(false); + expect(result.config.plugins?.entries?.slack?.enabled).toBe(true); expect(result.config.plugins?.allow).toEqual(["telegram", "slack"]); - expect(result.changes.join("\n")).toContain("Slack configured, not enabled yet."); + expect(result.changes.join("\n")).toContain("Slack configured, enabled automatically."); }); it("respects explicit disable", () => { @@ -29,7 +29,7 @@ describe("applyPluginAutoEnable", () => { expect(result.changes).toEqual([]); }); - it("configures irc as disabled when configured via env", () => { + it("auto-enables irc when configured via env", () => { const result = applyPluginAutoEnable({ config: {}, env: { @@ -38,11 +38,11 @@ describe("applyPluginAutoEnable", () => { }, }); - expect(result.config.plugins?.entries?.irc?.enabled).toBe(false); - expect(result.changes.join("\n")).toContain("IRC configured, not enabled yet."); + expect(result.config.plugins?.entries?.irc?.enabled).toBe(true); + expect(result.changes.join("\n")).toContain("IRC configured, enabled automatically."); }); - it("configures provider auth plugins as disabled when profiles exist", () => { + it("auto-enables provider auth plugins when profiles exist", () => { const result = applyPluginAutoEnable({ config: { auth: { @@ -57,7 +57,7 @@ describe("applyPluginAutoEnable", () => { env: {}, }); - expect(result.config.plugins?.entries?.["google-antigravity-auth"]?.enabled).toBe(false); + expect(result.config.plugins?.entries?.["google-antigravity-auth"]?.enabled).toBe(true); }); it("skips when plugins are globally disabled", () => { @@ -85,10 +85,12 @@ describe("applyPluginAutoEnable", () => { env: {}, }); - expect(result.config.plugins?.entries?.bluebubbles?.enabled).toBe(false); + expect(result.config.plugins?.entries?.bluebubbles?.enabled).toBe(true); expect(result.config.plugins?.entries?.imessage?.enabled).toBeUndefined(); - expect(result.changes.join("\n")).toContain("bluebubbles configured, not enabled yet."); - expect(result.changes.join("\n")).not.toContain("iMessage configured, not enabled yet."); + expect(result.changes.join("\n")).toContain("bluebubbles configured, enabled automatically."); + expect(result.changes.join("\n")).not.toContain( + "iMessage configured, enabled automatically.", + ); }); it("keeps imessage enabled if already explicitly enabled (non-destructive)", () => { @@ -103,7 +105,7 @@ describe("applyPluginAutoEnable", () => { env: {}, }); - expect(result.config.plugins?.entries?.bluebubbles?.enabled).toBe(false); + expect(result.config.plugins?.entries?.bluebubbles?.enabled).toBe(true); expect(result.config.plugins?.entries?.imessage?.enabled).toBe(true); }); @@ -120,8 +122,8 @@ describe("applyPluginAutoEnable", () => { }); expect(result.config.plugins?.entries?.bluebubbles?.enabled).toBe(false); - expect(result.config.plugins?.entries?.imessage?.enabled).toBe(false); - expect(result.changes.join("\n")).toContain("iMessage configured, not enabled yet."); + expect(result.config.plugins?.entries?.imessage?.enabled).toBe(true); + expect(result.changes.join("\n")).toContain("iMessage configured, enabled automatically."); }); it("allows imessage auto-configure when bluebubbles is in deny list", () => { @@ -137,10 +139,10 @@ describe("applyPluginAutoEnable", () => { }); expect(result.config.plugins?.entries?.bluebubbles?.enabled).toBeUndefined(); - expect(result.config.plugins?.entries?.imessage?.enabled).toBe(false); + expect(result.config.plugins?.entries?.imessage?.enabled).toBe(true); }); - it("configures imessage as disabled when only imessage is configured", () => { + it("auto-enables imessage when only imessage is configured", () => { const result = applyPluginAutoEnable({ config: { channels: { imessage: { cliPath: "/usr/local/bin/imsg" } }, @@ -148,8 +150,8 @@ describe("applyPluginAutoEnable", () => { env: {}, }); - expect(result.config.plugins?.entries?.imessage?.enabled).toBe(false); - expect(result.changes.join("\n")).toContain("iMessage configured, not enabled yet."); + expect(result.config.plugins?.entries?.imessage?.enabled).toBe(true); + expect(result.changes.join("\n")).toContain("iMessage configured, enabled automatically."); }); }); }); diff --git a/src/config/plugin-auto-enable.ts b/src/config/plugin-auto-enable.ts index eb56c3402d6..5e02d2c8f95 100644 --- a/src/config/plugin-auto-enable.ts +++ b/src/config/plugin-auto-enable.ts @@ -407,7 +407,7 @@ function registerPluginEntry(cfg: OpenClawConfig, pluginId: string): OpenClawCon ...cfg.plugins?.entries, [pluginId]: { ...(cfg.plugins?.entries?.[pluginId] as Record | undefined), - enabled: false, + enabled: true, }, }; return { @@ -426,7 +426,7 @@ function formatAutoEnableChange(entry: PluginEnableChange): string { const label = getChatChannelMeta(channelId).label; reason = reason.replace(new RegExp(`^${channelId}\\b`, "i"), label); } - return `${reason}, not enabled yet.`; + return `${reason}, enabled automatically.`; } export function applyPluginAutoEnable(params: {