From 50c8e7423091da68ab619f64cdec06bf51dc14ab Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Sat, 17 Jan 2026 18:07:06 +0000 Subject: [PATCH] fix(doctor): avoid ack reaction migration without config (#1087) Thanks @YuriNachos. Co-authored-by: Yuri Chukhlib --- CHANGELOG.md | 3 +++ src/commands/doctor-legacy-config.test.ts | 27 ++++++++--------------- src/commands/doctor-legacy-config.ts | 5 +---- 3 files changed, 13 insertions(+), 22 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f1a711e60..3fc1610d7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,9 @@ Docs: https://docs.clawd.bot - macOS: strip prerelease/build suffixes when parsing gateway semver patches. (#1110) — thanks @zerone0x. - macOS: keep CLI install pinned to the full build suffix. (#1111) — thanks @artuskg. +### Fixes +- Doctor: avoid re-adding WhatsApp ack reaction config when only legacy auth files exist. (#1087) — thanks @YuriNachos. + ## 2026.1.16-2 ### Changes diff --git a/src/commands/doctor-legacy-config.test.ts b/src/commands/doctor-legacy-config.test.ts index 8cb19b5d5..52a05ace9 100644 --- a/src/commands/doctor-legacy-config.test.ts +++ b/src/commands/doctor-legacy-config.test.ts @@ -57,7 +57,7 @@ describe("normalizeLegacyConfigValues", () => { ]); }); - it("copies legacy ack reaction when whatsapp auth exists", () => { + it("does not add whatsapp config when only auth exists (issue #900)", () => { const credsDir = path.join(tempOauthDir ?? "", "whatsapp", "default"); writeCreds(credsDir); @@ -65,14 +65,11 @@ describe("normalizeLegacyConfigValues", () => { messages: { ackReaction: "👀", ackReactionScope: "group-mentions" }, }); - expect(res.config.channels?.whatsapp?.ackReaction).toEqual({ - emoji: "👀", - direct: false, - group: "mentions", - }); + expect(res.config.channels?.whatsapp).toBeUndefined(); + expect(res.changes).toEqual([]); }); - it("copies legacy ack reaction when legacy auth exists", () => { + it("does not add whatsapp config when only legacy auth exists (issue #900)", () => { const credsPath = path.join(tempOauthDir ?? "", "creds.json"); fs.writeFileSync(credsPath, JSON.stringify({ me: {} })); @@ -80,14 +77,11 @@ describe("normalizeLegacyConfigValues", () => { messages: { ackReaction: "👀", ackReactionScope: "group-mentions" }, }); - expect(res.config.channels?.whatsapp?.ackReaction).toEqual({ - emoji: "👀", - direct: false, - group: "mentions", - }); + expect(res.config.channels?.whatsapp).toBeUndefined(); + expect(res.changes).toEqual([]); }); - it("copies legacy ack reaction when non-default auth exists", () => { + it("does not add whatsapp config when only non-default auth exists (issue #900)", () => { const credsDir = path.join(tempOauthDir ?? "", "whatsapp", "work"); writeCreds(credsDir); @@ -95,11 +89,8 @@ describe("normalizeLegacyConfigValues", () => { messages: { ackReaction: "👀", ackReactionScope: "group-mentions" }, }); - expect(res.config.channels?.whatsapp?.ackReaction).toEqual({ - emoji: "👀", - direct: false, - group: "mentions", - }); + expect(res.config.channels?.whatsapp).toBeUndefined(); + expect(res.changes).toEqual([]); }); it("copies legacy ack reaction when authDir override exists", () => { diff --git a/src/commands/doctor-legacy-config.ts b/src/commands/doctor-legacy-config.ts index 402a52441..8dced8895 100644 --- a/src/commands/doctor-legacy-config.ts +++ b/src/commands/doctor-legacy-config.ts @@ -1,6 +1,4 @@ import type { ClawdbotConfig } from "../config/config.js"; -import { hasAnyWhatsAppAuth } from "../web/accounts.js"; - export function normalizeLegacyConfigValues(cfg: ClawdbotConfig): { config: ClawdbotConfig; changes: string[]; @@ -10,8 +8,7 @@ export function normalizeLegacyConfigValues(cfg: ClawdbotConfig): { const legacyAckReaction = cfg.messages?.ackReaction?.trim(); const hasWhatsAppConfig = cfg.channels?.whatsapp !== undefined; - const hasWhatsAppAuth = hasAnyWhatsAppAuth(cfg); - if (legacyAckReaction && (hasWhatsAppConfig || hasWhatsAppAuth)) { + if (legacyAckReaction && hasWhatsAppConfig) { const hasWhatsAppAck = cfg.channels?.whatsapp?.ackReaction !== undefined; if (!hasWhatsAppAck) { const legacyScope = cfg.messages?.ackReactionScope ?? "group-mentions";