fix(email): preserve thread recipients and cursor state - #90482
aviyashchin wants to merge 1 commit into
Conversation
Reviewed the diff. Solid upgrade on both axes. The durable UID cursor fixes a real restart-safety hole (another client marking mail SEEN while Hermes is down silently swallowed those messages under the UNSEEN search), with write-after-dispatch ordering proven by the failure test, atomic tmp+replace persistence, and an `int(uid) <= cursor` guard covering the `X:*` inclusive-range quirk. Recipient preservation is similarly complete: getaddresses-based extraction with dedup, thread-context carrying To/Cc into replies (self dropped, extras de-duped into Cc), always-cc/reply-all-senders config plus per-send cc/subject plumbed through both the adapter path and the standalone sender, with tests pinning each combination. Four things worth attention:
No blocking issues found — the cursor work in particular is the right fix. |
What
In-Reply-To/Referencesand reply-all recipient sets while removing the bot itself.Why
Advancing the cursor before processing can lose a message across restart, and reducing a reply to only the sender drops legitimate thread participants. The send path also could not express an explicit subject/CC even though the adapter supports email delivery.
Validation
scripts/run_tests.sh tests/gateway/test_email.py tests/gateway/test_email_robustness.py tests/gateway/test_email_charset_fallback.py tests/gateway/test_email_secret_scope.py tests/tools/test_send_message_tool.py tests/tools/test_send_message_target_parse.pyIn-Reply-To, preserved the original To and Cc recipients, and returned the exact requested token.