From 8c64b726fd26cf1963bda539bc33bafa54848de0 Mon Sep 17 00:00:00 2001 From: Echo Date: Sun, 15 Feb 2026 11:05:48 -0500 Subject: [PATCH] fix(mattermost): fail closed if listing slash commands fails --- extensions/mattermost/src/mattermost/slash-commands.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/extensions/mattermost/src/mattermost/slash-commands.ts b/extensions/mattermost/src/mattermost/slash-commands.ts index 08ba8651098..252169e844b 100644 --- a/extensions/mattermost/src/mattermost/slash-commands.ts +++ b/extensions/mattermost/src/mattermost/slash-commands.ts @@ -251,6 +251,10 @@ export async function registerSlashCommands(params: { existing = await listMattermostCommands(client, teamId); } catch (err) { log?.(`mattermost: failed to list existing commands: ${String(err)}`); + // Fail closed: if we can't list existing commands, we should not attempt to + // create/update anything because we may create duplicates and end up with an + // empty/partial token set (causing callbacks to be rejected until restart). + throw err; } const existingByTrigger = new Map(existing.map((cmd) => [cmd.trigger, cmd]));