diff --git a/src/discord/monitor/allow-list.ts b/src/discord/monitor/allow-list.ts index 12c2d1d39..645847889 100644 --- a/src/discord/monitor/allow-list.ts +++ b/src/discord/monitor/allow-list.ts @@ -258,7 +258,8 @@ export function resolveDiscordChannelConfigWithFallback(params: { scope, } = params; const channels = guildInfo?.channels; - if (!channels) return null; + // Return null if channels is undefined, null, or empty object - allows all channels when no allowlist is configured + if (!channels || Object.keys(channels).length === 0) return null; const resolvedParentSlug = parentSlug ?? (parentName ? normalizeDiscordSlug(parentName) : ""); const match = resolveDiscordChannelEntryMatch( channels, diff --git a/src/discord/monitor/native-command.ts b/src/discord/monitor/native-command.ts index e53ff328a..ff4fd6b4f 100644 --- a/src/discord/monitor/native-command.ts +++ b/src/discord/monitor/native-command.ts @@ -38,6 +38,7 @@ import { readChannelAllowFromStore, upsertChannelPairingRequest, } from "../../pairing/pairing-store.js"; +import { logVerbose } from "../../globals.js"; import { resolveAgentRoute } from "../../routing/resolve-route.js"; import { loadWebMedia } from "../../web/media.js"; import { chunkDiscordTextWithMode } from "../chunk.js"; @@ -656,6 +657,14 @@ async function dispatchDiscordCommandInteraction(params: { modeWhenAccessGroupsOff: "configured", }); if (!commandAuthorized) { + // Log warning when no allowlist is configured to help users debug + const anyAuthorizerConfigured = authorizers.some((entry) => entry.configured); + if (!anyAuthorizerConfigured) { + logVerbose( + `discord: slash command rejected for user ${user.id} - no allowlist configured. ` + + `Configure channels.discord.guilds..users or channels.discord.dm.allowFrom to allow users.`, + ); + } await respond("You are not authorized to use this command.", { ephemeral: true }); return; }