[object Object]

← back to Claude Mail

poller: guard against invoking claude on an empty prompt (empty body + subject)

1a8facd9fb0d5b373be9d57b9567ab0f3b79064b · 2026-06-25 10:17:50 -0700 · Steve

Files touched

Diff

commit 1a8facd9fb0d5b373be9d57b9567ab0f3b79064b
Author: Steve <steve@designerwallcoverings.com>
Date:   Thu Jun 25 10:17:50 2026 -0700

    poller: guard against invoking claude on an empty prompt (empty body + subject)
---
 poller.js | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/poller.js b/poller.js
index d75b1c6..fb124f4 100644
--- a/poller.js
+++ b/poller.js
@@ -41,12 +41,19 @@ async function main() {
 
       log(`ACCEPT uid ${uid} from=${from} subj="${subject}" -> running claude`);
       const body = stripQuote(parsed.text || parsed.html?.replace(/<[^>]+>/g, ' ') || '');
-      const prompt = body || subject;
+      const prompt = (body || subject || '').trim();
 
       let reply;
-      const res = await runClaude(prompt);
-      reply = res.ok ? res.text
-        : `I hit a problem running that locally:\n\n${res.text}\n\n— Claude (agentabrams)`;
+      if (!prompt) {
+        // Nothing to act on (empty body + empty subject) — don't invoke claude
+        // on an empty prompt; reply asking for content.
+        reply = 'I got your message but it had no readable body or subject to act on. '
+          + 'Reply with what you\'d like me to do (keep the phrase in the subject).\n\n— Claude (agentabrams)';
+      } else {
+        const res = await runClaude(prompt);
+        reply = res.ok ? res.text
+          : `I hit a problem running that locally:\n\n${res.text}\n\n— Claude (agentabrams)`;
+      }
 
       const replySubject = /^re:/i.test(subject) ? subject : `Re: ${subject}`;
       const msgId = parsed.messageId;

← f2f1dc0 gate: add RFC 3834 mail-loop breakers (auto-submitted/bulk/l  ·  back to Claude Mail  ·  gate: drop bare spf=pass from anti-spoof set (keep DKIM/DMAR 15ecdd0 →