fix(slack): fail closed on slash command channel type lookup

This commit is contained in:
Peter Steinberger
2026-02-02 16:53:02 -08:00
parent 9e3ea2687c
commit fff59da962
3 changed files with 117 additions and 4 deletions

View File

@@ -34,6 +34,7 @@ import {
} from "./allow-list.js";
import { resolveSlackChannelConfig, type SlackChannelConfigResolved } from "./channel-config.js";
import { buildSlackSlashCommandMatcher, resolveSlackSlashCommandConfig } from "./commands.js";
import { normalizeSlackChannelType } from "./context.js";
import { isSlackChannelAllowedByPolicy } from "./policy.js";
import { deliverSlackSlashReplies } from "./replies.js";
@@ -176,8 +177,9 @@ export function registerSlackMonitorSlashCommands(params: {
}
const channelInfo = await ctx.resolveChannelName(command.channel_id);
const channelType =
const rawChannelType =
channelInfo?.type ?? (command.channel_name === "directmessage" ? "im" : undefined);
const channelType = normalizeSlackChannelType(rawChannelType, command.channel_id);
const isDirectMessage = channelType === "im";
const isGroupDm = channelType === "mpim";
const isRoom = channelType === "channel" || channelType === "group";