From 5e4a91f996ef0a956af964a3d3e77c864d3c8e30 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Wed, 10 Dec 2025 13:51:06 +0000 Subject: [PATCH] Auto-reply: reject empty inbound messages --- src/auto-reply/reply.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/auto-reply/reply.ts b/src/auto-reply/reply.ts index 405be01a2..4851fd603 100644 --- a/src/auto-reply/reply.ts +++ b/src/auto-reply/reply.ts @@ -582,6 +582,17 @@ export async function getReplyFromConfig( ? applyTemplate(reply.bodyPrefix ?? "", sessionCtx) : ""; const baseBody = sessionCtx.BodyStripped ?? sessionCtx.Body ?? ""; + // Bail early if the cleaned body is empty to avoid sending blank prompts to the agent. + // This can happen if an inbound platform delivers an empty text message or we strip everything out. + if (!baseBody.trim()) { + await onReplyStart(); + logVerbose("Inbound body empty after normalization; skipping agent run"); + cleanupTyping(); + return { + text: + "I didn't receive any text in your message. Please resend or add a caption.", + }; + } const abortedHint = reply?.mode === "command" && abortedLastRun ? "Note: The previous agent run was aborted by the user. Resume carefully or ask for clarification."