From cd813ddded972e3ef8c257c82be104f39e911596 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Facu=5FVi=C3=B1as?= Date: Wed, 11 Mar 2026 18:02:20 -0300 Subject: [PATCH] fix(reliability): distinguish Discord 404 from auth errors in reactions The catch-all in checkReactions() silently swallowed auth failures (401/403), making them indistinguishable from "no reaction yet". Now: - 404: expected (no reactions for this emoji), continue - 401/403: re-thrown so the poll loop surfaces the auth failure - Other errors: best-effort skip (rate limits, network) Co-Authored-By: Claude Opus 4.6 --- .../extensions/remote-questions/discord-adapter.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/resources/extensions/remote-questions/discord-adapter.ts b/src/resources/extensions/remote-questions/discord-adapter.ts index a3f84e0f0..4c9a4960e 100644 --- a/src/resources/extensions/remote-questions/discord-adapter.ts +++ b/src/resources/extensions/remote-questions/discord-adapter.ts @@ -76,8 +76,13 @@ export class DiscordAdapter implements ChannelAdapter { const humanUsers = users.filter((u: { id: string }) => u.id !== this.botUserId); if (humanUsers.length > 0) reactions.push({ emoji, count: humanUsers.length }); } - } catch { - // ignore missing reaction + } catch (err) { + const msg = String((err as Error).message ?? ""); + // 404 = no reactions for this emoji — expected, continue + if (msg.includes("HTTP 404")) continue; + // 401/403 = auth failure — surface to caller so it can fail the poll + if (msg.includes("HTTP 401") || msg.includes("HTTP 403")) throw err; + // Other errors (rate limit, network) — skip this emoji, best-effort } }