From 8e2e4b2ed58cd7128f770fcf7fb4ffcf874af715 Mon Sep 17 00:00:00 2001 From: Shadow Date: Tue, 3 Mar 2026 09:28:30 -0600 Subject: [PATCH] fix: ignore discord wildcard audit keys (#33125) (thanks @thewilloftheshadow) (#33125) --- CHANGELOG.md | 1 + src/discord/audit.test.ts | 51 +++++++++++++++++++++++++++++++++++++++ src/discord/audit.ts | 5 ++++ 3 files changed, 57 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0c67c75d6..caf869d7a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ Docs: https://docs.openclaw.ai ### Fixes - Telegram/DM draft finalization reliability: require verified final-text draft emission before treating preview finalization as delivered, and fall back to normal payload send when final draft delivery is not confirmed (preventing missing final responses and preserving media/button delivery). (#32118) Thanks @OpenCils. +- Discord/audit wildcard warnings: ignore "\*" wildcard keys when counting unresolved guild channels so doctor/status no longer warns on allow-all configs. (#33125) Thanks @thewilloftheshadow. - Exec heartbeat routing: scope exec-triggered heartbeat wakes to agent session keys so unrelated agents are no longer awakened by exec events, while preserving legacy unscoped behavior for non-canonical session keys. (#32724) thanks @altaywtf - macOS/Tailscale remote gateway discovery: add a Tailscale Serve fallback peer probe path (`wss://.ts.net`) when Bonjour and wide-area DNS-SD discovery return no gateways, and refresh both discovery paths from macOS onboarding. (#32860) Thanks @ngutman. - Telegram/multi-account default routing clarity: warn only for ambiguous (2+) account setups without an explicit default, add `openclaw doctor` warnings for missing/invalid multi-account defaults across channels, and document explicit-default guidance for channel routing and Telegram config. (#32544) thanks @Sid-Qin. diff --git a/src/discord/audit.test.ts b/src/discord/audit.test.ts index f5e7e6828..4474f70bd 100644 --- a/src/discord/audit.test.ts +++ b/src/discord/audit.test.ts @@ -53,4 +53,55 @@ describe("discord audit", () => { expect(audit.channels[0]?.channelId).toBe("111"); expect(audit.channels[0]?.missing).toContain("SendMessages"); }); + + it("does not count '*' wildcard key as unresolved channel", async () => { + const { collectDiscordAuditChannelIds } = await import("./audit.js"); + + const cfg = { + channels: { + discord: { + enabled: true, + token: "t", + groupPolicy: "allowlist", + guilds: { + "123": { + channels: { + "111": { allow: true }, + "*": { allow: true }, + }, + }, + }, + }, + }, + } as unknown as import("../config/config.js").OpenClawConfig; + + const collected = collectDiscordAuditChannelIds({ cfg, accountId: "default" }); + expect(collected.channelIds).toEqual(["111"]); + expect(collected.unresolvedChannels).toBe(0); + }); + + it("handles guild with only '*' wildcard and no numeric channel ids", async () => { + const { collectDiscordAuditChannelIds } = await import("./audit.js"); + + const cfg = { + channels: { + discord: { + enabled: true, + token: "t", + groupPolicy: "allowlist", + guilds: { + "123": { + channels: { + "*": { allow: true }, + }, + }, + }, + }, + }, + } as unknown as import("../config/config.js").OpenClawConfig; + + const collected = collectDiscordAuditChannelIds({ cfg, accountId: "default" }); + expect(collected.channelIds).toEqual([]); + expect(collected.unresolvedChannels).toBe(0); + }); }); diff --git a/src/discord/audit.ts b/src/discord/audit.ts index 58b3142c6..8350d67e3 100644 --- a/src/discord/audit.ts +++ b/src/discord/audit.ts @@ -56,6 +56,11 @@ function listConfiguredGuildChannelKeys( if (!channelId) { continue; } + // Skip wildcard keys (e.g. "*" meaning "all channels") — they are valid + // config but are not real channel IDs and should not be audited. + if (channelId === "*") { + continue; + } if (!shouldAuditChannelConfig(value as DiscordGuildChannelConfig | undefined)) { continue; }