Auto-reply: reject empty inbound messages

This commit is contained in:
Peter Steinberger
2025-12-10 13:51:06 +00:00
parent df4331da04
commit 5e4a91f996

View File

@@ -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."