Surface channel delivery failures on agent replies instead of swallowing them

The previous fix made a broken SMTP/Telegram account non-fatal — the
reply gets recorded either way now — but that also made delivery
failures completely invisible: an agent sees their reply "sent"
successfully with no indication the customer never actually received it.
Added messages.deliveryFailed, set whenever the outbound send throws, and
a warning badge on the message bubble so this is now visible instead of
silent.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Gh2UXUQUVBWroWEnn1FLFG
This commit is contained in:
ogrechkoandClaude Sonnet 5 committed 2026-10-07 08:26:54 +00:00
1 parent 8d1f91187a
commit b92d9801ff
8 files changed
+1258 -14

No files matched your search

+5
View File
@@ -75,6 +75,7 @@ function toMessageDTO(message: typeof messages.$inferSelect, attachments: Attach
visibility: message.visibility,
attachments,
createdAt: message.createdAt.getTime(),
deliveryFailed: message.deliveryFailed,
};
}
@@ -142,6 +143,7 @@ async function appendMessage(params: {
direction: "in" | "out";
visibility?: "public" | "internal";
emailMessageId?: string;
deliveryFailed?: boolean;
attachments?: AttachmentInput[];
}) {
const [message] = await db
@@ -155,6 +157,7 @@ async function appendMessage(params: {
bodyHtml: params.bodyHtml ?? null,
direction: params.direction,
visibility: params.visibility ?? "public",
deliveryFailed: params.deliveryFailed ?? false,
emailMessageId: params.emailMessageId,
})
.returning();
@@ -398,6 +401,7 @@ export async function recordAgentReply(params: {
agentName: string;
body: string;
emailMessageId?: string;
deliveryFailed?: boolean;
attachments?: AttachmentInput[];
}) {
const existing = await db.query.tickets.findFirst({ where: eq(tickets.id, params.ticketId) });
@@ -415,6 +419,7 @@ export async function recordAgentReply(params: {
body: params.body,
direction: "out",
emailMessageId: params.emailMessageId,
deliveryFailed: params.deliveryFailed,
attachments: params.attachments,
});
}