feat(connectors): generic IMAP email connector for any provider (#518)#586
Open
alarcritty wants to merge 4 commits into
Open
feat(connectors): generic IMAP email connector for any provider (#518)#586alarcritty wants to merge 4 commits into
alarcritty wants to merge 4 commits into
Conversation
alarcritty
requested review from
ANarayan,
jonsaadfalcon and
robbym-dev
as code owners
June 23, 2026 17:45
Two reliability fixes in the shared IMAP sync used by the Gmail, Outlook,
and generic IMAP connectors:
- Decode every header (From, To, Subject, In-Reply-To, Message-ID) to a
plain string. Real mail with raw 8-bit header bytes makes imaplib return
an email.header.Header object, which crashed json.dumps in the knowledge
store ("Object of type Header is not JSON serializable") and aborted the
sync. The decoder also tolerates bogus charsets like unknown-8bit.
- Reconnect and retry on a dropped TLS connection mid-backfill (for example
"[SSL: BAD_LENGTH]") instead of aborting the whole run, so a large inbox
finishes without manual retries.
…arvis#518) Add a single configuration-light IMAP connector that works with any email provider instead of a hardcoded subclass per provider. The IMAP host is resolved from the email domain (a small table of common providers, falling back to imap.<domain>), so most users only supply an email address and an app password. Registered in connectors/__init__.py so it appears in the Data Sources API and UI. Tests cover registration, host resolution, credential round-trip, document output, raw 8-bit headers, and reconnect-on-drop. Refs open-jarvis#518.
Add a catalog entry for the generic IMAP connector so the Data Sources page renders an "Email (IMAP)" card with email and app-password inputs, alongside the existing Gmail and Outlook cards. Refs open-jarvis#518.
Add knowledge_search to the default tool set and inject a KnowledgeStore when building the chat and channel agents, so non-streaming agent requests can search ingested data. The streaming web chat path bypasses the agent, so this does not yet surface in the streaming UI.
alarcritty
force-pushed
the
feat/518-dynamic-imap-connector
branch
from
July 9, 2026 10:54
3661cf6 to
96ad5fd
Compare
Contributor
Author
|
@jonsaadfalcon please review. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Closes #518.
OpenJarvis only had provider-specific email connectors (Gmail OAuth, Gmail IMAP, Outlook), each hardcoded to one
provider's IMAP host. A user without a Gmail or Outlook account had no way to index their mailbox. The issue
asks to rely on SMTP/IMAP to connect to any inbox.
Testing this end to end against a real inbox surfaced two adjacent problems that broke the flow: a
header-encoding crash during indexing, and Deep Research being pinned to a model that was not pulled.
Solution
Generic IMAP connector (the core of #518)
IMAP host is resolved from the email domain (a small table of common providers, falling back to imap.),
so a user supplies only an email address and an app password.
Gmail and Outlook.
Reliability fixes in the shared IMAP sync
header bytes made imaplib return an email.header.Header object, which crashed json.dumps in the knowledge store
("Object of type Header is not JSON serializable") and aborted the sync. The decoder also tolerates bogus
charsets such as unknown-8bit. This also benefits the Gmail and Outlook IMAP connectors.
aborting the whole run, so a large inbox finishes without manual retries.
Deep Research model resolution
pulled). It resolves from the server's running model, then the configured default, then the built-in fallback,
so research runs on a model that is actually available.
Chat tool wiring
non-streaming agent requests can search ingested data. Note: the streaming web chat path bypasses the agent, so
this does not yet surface in the streaming UI.
Verification
store; Deep Research returns answers over the indexed mail.
document output, raw 8-bit headers, and reconnect-on-drop.
Notes and limitations
port, or whose IMAP host does not follow imap., are not supported yet (there is no manual host/port
field). Outlook or Microsoft 365 accounts with app-password IMAP disabled will not connect.
Research model fix), kept as separate commits. They can be split into separate PRs if preferred.