Record @mention wake failures instead of silently swallowing them

The catch block in wakeAgentMentions now records wake_state on each
mention (woken/failed) instead of silently discarding the error. Failed
mentions render with a strikethrough and muted color so the user sees
which agents could not be reached, with a tooltip on hover. Migration
044 adds the wake_state column to chat_mentions.
This commit is contained in:
ZacharyZhang-NY committed 2026-06-30 21:38:19 -04:00
1 parent f6a2659761
commit 77644121db
5 files changed
+23 -5

No files matched your search

@@ -145,10 +145,19 @@ function renderBody(body: string, mentions: ChatMentionRecord[], context: Messag
if (!token.startsWith("@")) throw new Error("Message mention token is invalid.");
if (mention.offsetStart > lastIndex) parts.push(...formatInline(body.slice(lastIndex, mention.offsetStart), `s${lastIndex}`));
const label = mentionLabel(mention, context);
const failed = mention.wakeState === "failed";
parts.push(
<span
key={`m-${mention.messageId}-${mention.offsetStart}`}
style={{ background: "var(--accent-soft)", color: "var(--accent)", padding: "1px 5px", borderRadius: 4, fontWeight: 500 }}
title={failed ? "Agent could not be reached" : undefined}
style={{
background: failed ? "rgba(255,100,80,0.1)" : "var(--accent-soft)",
color: failed ? "var(--text-3)" : "var(--accent)",
padding: "1px 5px",
borderRadius: 4,
fontWeight: 500,
textDecoration: failed ? "line-through" : undefined,
}}
>
@{label}
</span>,