Skip to content

fix(imap): skip a sender-less message when defaulting a draft's recipient - #1977

Merged
potiuk merged 1 commit into
apache:mainfrom
sharpca:fix/imap-default-recipient-review-fixes
Nov 4, 2026
Merged

potiuk merged 1 commit into
apache:mainfrom
sharpca:fix/imap-default-recipient-review-fixes

Conversation

@sharpca

@sharpca sharpca commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Follow-up to #1965, which merged before these review points were folded in.

The shared thread_start_message helper stays. What changes:

  • _first_foreign_sender skips a message with no parseable From, so a
    sender-less reply no longer wins as the default recipient and the draft
    reaches a later, addressable sender. A regression test pins that window.
  • The shared contract scopes the default-recipient rule to the missing-root
    case and to backends that default a recipient at all; maildir takes an
    explicit to.
  • start comes straight from thread_start_message, and the unreachable
    addressee is not None guard is gone.

This is the same change as the maintainer's fixup branch
(potiuk/magpie:imap-1965-review-fixups, opened as sharpca#1), applied on top
of current main.

…ient

Addresses the review points on apache#1965:

- `_first_foreign_sender` skips a message with no parseable `From`, so the default
  recipient is a message the draft can actually be addressed to.
- The shared contract scopes the default-recipient rule to the missing-root case and
  to backends that default a recipient at all; `maildir` takes an explicit `to`.
- `start` comes straight from `thread_start_message`, and the unreachable
  `addressee is not None` guard is gone.
@github-actions github-actions Bot added family:tools tools/* contract:mail-source Tool capability: inbound-mail ingestion (mbox / IMAP / ...) labels Nov 3, 2026

@Kaap10 Kaap10 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks @sharpca for following up with the review fixups from #1965; verified locally and all 43 tests pass.

@potiuk potiuk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, LGTM: _first_foreign_sender now skips a message with no parseable From, the new test pins that window, and start stays the same message because thread_start_message returns the root whenever the window holds it. CI is green.


This review was drafted by an AI-assisted tool and
confirmed by an Apache Magpie maintainer. The maintainer
approving this PR has read the findings and signed off. If
something feels off, please reply on the PR and a maintainer
will follow up.

More on how Apache Magpie handles maintainer review:
Contributing guide.

@potiuk
potiuk merged commit 7b6e5bb into apache:main Nov 4, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contract:mail-source Tool capability: inbound-mail ingestion (mbox / IMAP / ...) family:tools tools/*

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants