AIdeazz Blog About Portfolio

Multi-Inbox IMAP Triage: Diagnosing the Sent-to-Received Ratio Imbalance

· by

A production worker running mail polling does not fail when it loses connection; it fails when it silently reads hundreds of inbound messages while having sent almost nothing. When our outbound follow-up radar checked its heterogeneous mail providers, it surfaced raw numbers that immediately flagged a operational failure: one inbox held 729 incoming messages against 2 sent over a 45-day window, another logged 667 inbox messages against 3 sent, and a third recorded 196 inbox messages against 12 sent.

If you automate outbound outreach or candidate pipelines across disparate mail servers, monitoring your multi-inbox imap triage sent-to-received ratio is the only early warning against pipeline drift. A polling worker that digests hundreds of headers without generating corresponding dispatch signals creates an illusion of system health while operational throughput halts.

Here is what running IMAP triage across heterogeneous mail infrastructure looks like under actual load, how we trace inbox asymmetry, and how our background processes handle the backlog.

Dissecting the Inbox Asymmetry Across Heterogeneous Mailboxes

When you poll multiple servers simultaneously, each endpoint exhibits distinct rate characteristics and volume patterns. In our stack, followup-radar.log records mailbox volume across independent providers over a 45-day monitoring horizon. The log captured the following breakdown:

- imap.gmail.com: 729 inbox / 2 sent (last 45d)
- imap.zoho.com: 196 inbox / 12 sent (last 45d)
- imap.gmail.com: 667 inbox / 3 sent (last 45d)

Across these three mail accounts, the inbound volume totaled hundreds of unhandled messages while outbound dispatches remained in single or low double digits. An automated process scanning these folders can parse headers all day without throwing an unhandled exception. The loop returns an exit code of zero, the process stays green in the process supervisor, yet the actual business feedback loop is dead.

When reply-radar.log executed its checks on inbound items, the outcome showed:

APPLY — scanned 160 · automated/own skipped 0 · no CRM match 1 · REPLIES MATCHED 0 · errors 0
APPLY — scanned 160 · automated/own skipped 0 · no CRM match 0 · REPLIES MATCHED 0 · errors 0
APPLY — scanned 162 · automated/own skipped 2 · no CRM match 0 · REPLIES MATCHED 0 · errors 0

The radar scanned 160 messages in consecutive sweeps, followed by 162 messages where 2 automated or self-sent items were skipped, yielding exactly 0 matched replies. An inbox-to-sent disparity of this magnitude indicates that non-actionable traffic (marketing newsletters, transactional notices, and unclassified auto-responders) is saturating the IMAP triage parser, masking whether outbound leads ever responded.

How Polling Loops Mask Upstream Process Failures

A mailbox that accumulates 729 or 667 incoming messages against 2 or 3 sent items typically points to an upstream bottleneck in the staging pipeline. If leads are not entering the CRM or passing qualification stages, no outbound emails get drafted, leaving the sent folders starved while public-facing addresses continue to receive noise.

Looking at atlas-lead-machine.log, we can see the triage rules actively rejecting or filtering prospective contacts before they ever reach the dispatch layer:

[lead-machine] done · staged 8 · looked at 42 · no-email 12 · already-in-CRM 22 · outside-band 0 · audit-failed 2 · crawler-blocked rescued 0

Out of 42 candidates inspected, 22 were already present in HubSpot, 12 had no email address, and 2 failed audit checks, leaving only 8 staged contacts. In an earlier log run, out of 10 items seen, 5 were eligible and only 2 were staged. When upstream stages filter out 34 contacts across these criteria, outbound activity drops to near zero.

Simultaneously, atlas-outcomes.log showed:

{
  "staged": 0,
  "sent": 0,
  "pushed to Atlas": {"ok": true, "lanes": 8}
}

When staging generates 0 leads and dispatches 0 messages, the sent folder across all IMAP accounts remains static. Yet incoming newsletters and system notifications keep incrementing the inbox counts toward 729 and 667. Without an automated metric alerting on the sent-to-received ratio, an operator checking only process uptime will assume the automation pipeline is running normally.

Supervisor Stability vs. Process Health

In our runtime environment managed by PM2, 8 of 9 processes are online:

While algom-stream entered a restart loop hitting 10070 restarts, the primary worker cto-aipa remained stable with only 2 restarts over a 1d uptime window. Sibling workers like algom-poll ran for 3d without a single restart.

Process supervision tells you whether Node.js or Python processes are crashing; it cannot evaluate whether the message ratio inside your mail store represents an operational stall. An IMAP reader process can run cleanly for 3d, consume 79 MB of memory, handle zero errors, and still fail to surface a single business-critical reply because the inbound stream is choked with unmatched items.

Connecting IMAP Triage Directly to CRM Pipeline Stages

The remedy to inbox bloat is anchoring IMAP polling directly to CRM deal states. In our setup, deals are queried directly against the HubSpot deals search API:

When deal-digest.log records 129 contracts sent and 1530 appointments scheduled across aggregate pipeline history, but the live 45-day active IMAP monitor reports only 2 sent emails on imap.gmail.com and 12 on imap.zoho.com, it exposes an immediate divergence between CRM tracking records and active mailbox usage.

To keep the pipeline moving without manual intervention:
1. Match incoming headers exclusively against known CRM contact IDs before performing body retrieval. In reply-radar.log, matching 0 replies across 162 scanned records allows the worker to discard non-CRM mail without reading bodies, saving CPU cycles and network overhead.
2. Track mailbox outbound activity as a health check. If an automated box has sent fewer than 10 messages over a multi-week span while receiving hundreds, trigger an alert to verify whether upstream stages—such as apply-queue.log (where 12 candidates were sunk by kit verdict)—are dropping all candidate records before output.
3. Validate lead qualification thresholds. In job-board-watch.log, a source was rejected when only 25.4% of postings remained live after pruning expired listings, missing the required 40.0% threshold.

Balancing inbound triage against outbound velocity ensures your automated systems do not run blind behind clean process logs.

Frequently Asked Questions

Q: Why does the ratio between inbox and sent items matter if IMAP polling logs zero errors?
A: A polling loop can log zero errors while scanning hundreds of messages if it simply finds no matching records in the CRM. In our logs, followup-radar.log revealed mailboxes with 729 and 667 incoming messages against only 2 and 3 sent messages, while reply-radar.log processed 162 emails with 0 CRM matches. The worker was completely healthy from an infrastructure standpoint, but entirely stalled from an operational perspective.

Q: How does upstream lead qualification affect IMAP inbox skew?
A: If upstream scrapers or filters drop records, outbound dispatch stops while inbound noise continues to accumulate. In atlas-lead-machine.log, out of 42 contacts examined, 22 were already in the CRM, 12 had no email, and 2 failed audits, leaving only 8 staged. When outbound volume falls to single digits, the sent folder stagnates while automated newsletters and system alerts steadily drive up the inbox total.

Q: Can PM2 process metrics detect an IMAP triage breakdown?
A: No. PM2 tracks memory usage, uptime, and restart counts. For example, cto-aipa showed 2 restarts and 232 MB memory over 1d of uptime, while algom-poll maintained 0 restarts and 79 MB across 3d. The supervisor cannot detect semantic issues such as an inbox accumulating 729 items with only 2 sent messages.

Q: What is the risk of scanning high-volume inboxes without CRM filtering?
A: Without early CRM matching, triage scripts waste execution time parsing MIME bodies of unindexed marketing mail. In our system, reply-radar.log discarded 160 scanned items immediately when no CRM match was found, preventing expensive downstream operations on irrelevant inbound traffic.

— Elena Revicheva · AIdeazz AI Lab · Portfolio · Professional Outlook (PDF)