[object Object]

← back to George Gmail

Fleet auto-responder: fix scan query (bare deliveredto:steve+ never matches in Gmail) + probe-subject safety guard (RETEST/FLEETMAILTEST/DTEST/PMRCV)

2f343b590bd9587a641a5c7503c8a777e9a4d7a9 · 2026-05-19 10:31:20 -0700 · Steve Abrams

Files touched

Diff

commit 2f343b590bd9587a641a5c7503c8a777e9a4d7a9
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Tue May 19 10:31:20 2026 -0700

    Fleet auto-responder: fix scan query (bare deliveredto:steve+ never matches in Gmail) + probe-subject safety guard (RETEST/FLEETMAILTEST/DTEST/PMRCV)
---
 fleet-autoresponder.js | 28 +++++++++++++++++++++++-----
 1 file changed, 23 insertions(+), 5 deletions(-)

diff --git a/fleet-autoresponder.js b/fleet-autoresponder.js
index bee0f74..0efafe4 100644
--- a/fleet-autoresponder.js
+++ b/fleet-autoresponder.js
@@ -184,12 +184,25 @@ function parseDisplayName(raw) {
 // ─────────────────────────────────────────────────────────────────────────────
 // Spam / loop safety gate. Returns { ok:true } or { ok:false, reason }
 // ─────────────────────────────────────────────────────────────────────────────
+// Infrastructure-probe subject patterns. The fleet is exercised by automated
+// delivery/forwarding probes (RETEST-, FLEETMAILTEST-, DTEST-, PMRCV- tokens,
+// and "diagnostic"/"receive probe" subjects). They look like real inquiries
+// but must never be auto-acknowledged. This is defense-in-depth on top of the
+// fleet-autoreplied labelling of any known backlog.
+const PROBE_SUBJECT = /\b(RETEST|FLEETMAILTEST|DTEST|PMRCV)[-\s]|\b(forwarding|delivery|receive)\s+(diagnostic|probe|re-?test)\b|\bautomated\s+(inbound\s+)?email\s+(delivery\s+)?(re-?test|diagnostic)\b/i;
+
 function safetyGate(msg, headers, senderEmail) {
   const labelIds = msg.labelIds || [];
 
   // 1. Spam folder — never reply.
   if (labelIds.includes('SPAM')) return { ok: false, reason: 'message in SPAM' };
 
+  // 1b. Infrastructure probe — subject matches a known probe token/phrase.
+  const subj = headerVal(headers, 'Subject') || '';
+  if (PROBE_SUBJECT.test(subj)) {
+    return { ok: false, reason: `infrastructure probe subject: "${subj}"` };
+  }
+
   // 2. no-reply / system senders.
   const NO_REPLY = /(^|[._-])(no-?reply|donotreply|do-not-reply|mailer-daemon|postmaster|bounce|bounces)([._-]|@)/i;
   if (senderEmail && NO_REPLY.test(senderEmail)) {
@@ -417,11 +430,16 @@ async function main() {
 
   const ledger = loadLedger();
 
-  // Candidate inquiries: unprocessed inbox mail delivered to a steve+ plus-tag.
-  // Gmail matches the plus-tag against the Delivered-To header via deliveredto:,
-  // NOT the visible To: header (which is the customer-facing info@<domain>).
-  // We deliberately scope to INBOX (excludes SPAM) and exclude already-labelled mail.
-  const q = `in:inbox -label:${PROCESSED_LABEL} deliveredto:steve+ newer_than:${SCAN_WINDOW}`;
+  // Candidate inquiries: unprocessed recent inbox mail.
+  //
+  // NOTE: a bare `deliveredto:steve+` does NOT work as a Gmail search prefix —
+  // Gmail will not prefix-match a partial plus-address, so that query returns
+  // zero. Instead we scan all recent unprocessed INBOX mail and let
+  // recoverFleetDomain() — which reads the real Delivered-To header — decide
+  // which messages actually came in on a fleet plus-tag. Non-fleet mail is
+  // skipped immediately ("no recognised fleet plus-tag"). INBOX scope excludes
+  // SPAM; the safety gate handles the rest.
+  const q = `in:inbox -label:${PROCESSED_LABEL} newer_than:${SCAN_WINDOW}`;
   let ids;
   if (ONLY_IDS) {
     ids = [...ONLY_IDS];

← e9fdf0f Fleet auto-responder: --daemon self-scheduling mode (pm2-man  ·  back to George Gmail  ·  Fleet auto-responder: update usage docstring (daemon/force f 8f310af →