been building agent infrastructure for a while and this is one of the messiest edge cases i keep seeing.
most agent setups use a shared mailbox. works fine for one agent. breaks badly at scale.
what goes wrong:
- two agents poll the same inbox simultaneously
- both read the same OTP email
- one executes, one silently fails or retries on a expired code
- no error surfaced to the orchestrator
the fix isn't complicated but it's not obvious either.
each agent needs its own dedicated inbox with isolated read locks. when agent A claims an email, agent B can't see it. this also means your deliverability reputation stays clean — you're not blasting from one shared identity.
the other pattern that helps: long-poll on inbound instead of polling on a schedule. you fire GET /inbox/wait and it blocks until the email arrives (or times out). no cron, no missed messages between poll windows.
curious how others are handling multi-agent email scenarios — shared inbox with locking, or fully isolated per-agent inboxes?
[link] [comments]