Skip to content

fix(email): harden adapter against malformed IMAP responses (#2794 salvage) - #774

Merged
hashbender merged 1 commit into
mainfrom
mirror/pr-56956
Jul 2, 2026
Merged

fix(email): harden adapter against malformed IMAP responses (#2794 salvage)#774
hashbender merged 1 commit into
mainfrom
mirror/pr-56956

Conversation

@hashbender

Copy link
Copy Markdown
Owner

Summary

One malformed IMAP fetch response can no longer silently lose messages — the email adapter marks UIDs seen before fetching, so an unguarded msg_data[0][1] crash mid-batch permanently skipped every remaining message in that batch.

Salvage of NousResearch#2794 by @CharmingGroot, ported to the relocated plugins/platforms/email/adapter.py (PR targeted the old gateway/platforms/email.py) and widened: the Message-ID split('@')[1] fix now covers all 3 send paths via a shared helper (the PR fixed 2 of 3), plus a non-bytes payload guard.

Changes

  • plugins/platforms/email/adapter.py: try/except around msg_data[0][1] (IndexError/TypeError → warn + skip), isinstance(bytes) payload check, _message_id_domain() helper with localhost fallback replacing 3 crash-prone split('@')[1] sites
  • tests/gateway/test_email_robustness.py: 9 tests incl. the batch-continues-after-malformed-response contract
  • scripts/release.py: AUTHOR_MAP entry for @CharmingGroot

Validation

Result
tests/gateway/test_email_robustness.py + test_email.py 97/97 pass
batch behavior malformed UID skipped, subsequent messages still fetched

Infographic

infographic

Nous Research


Mirror-of: NousResearch#56956
NousResearch#56956

@hashbender
hashbender merged commit ce1061d into main Jul 2, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant