Skip to content

feat: reply to the Reply-To address when the sender set one#79

Merged
bhekanik merged 1 commit into
mainfrom
feat/reply-to-capture
Jun 11, 2026
Merged

feat: reply to the Reply-To address when the sender set one#79
bhekanik merged 1 commit into
mainfrom
feat/reply-to-capture

Conversation

@bhekanik

@bhekanik bhekanik commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

What

Replies now target the original message's Reply-To: header when the sender set one, instead of always using From:. Final audit backlog item P1 #16. Off main; no migration.

Why

A reply to a mailing-list digest or a no-reply@ sender went to the wrong place — those are exactly the senders that set Reply-To to redirect responses. The reply builder even carried a comment: "Envelope does not yet capture the Reply-To: header — using From: as the reply target."

How

  • Capture: mail-parse already has the fully parsed message, so extract_metadata now pulls Reply-To addresses into MessageMetadata.reply_to. Every provider (Gmail/IMAP/fake) routes through this, so all benefit.
  • No migration / no envelope change: MessageMetadata is stored as a JSON blob in the body row and derives Default; the new field is #[serde(default)], so old rows deserialize fine and every existing ..Default::default() literal keeps compiling (verified: the whole workspace test suite compiles unchanged).
  • Prefer it: the reply builder reads body.metadata.reply_to.first() and uses it as the target, falling back to From: when absent. reply-all adds the other original recipients as Cc on top.

Gmail thread-id (the other half of this item) — already done

Verified the Gmail parser already uses the API's threadId directly as the envelope thread id (provider-gmail/src/parse.rs), so Gmail replies already rethread correctly. No change needed.

Verification

  • mail-parse: new tests — Reply-To captured into metadata (name + email), and absent Reply-To leaves it empty. 15 pass.
  • mxr daemon: new dispatch_prepare_reply_prefers_reply_to_header — a message whose Reply-To differs from From produces a reply targeting Reply-To. 476 pass (the lone failure is the pre-existing dispatch_sync_now_acknowledges flake that fix: detach sync on timeout instead of cancelling mid-flight #62 fixes).
  • mxr-core 42 pass; clippy + fmt clean across all three crates.
  • Docs: guides/compose.md documents the reply-recipient rule.

Generated with Claude Code


Summary by cubic

Replies now use the original message’s Reply-To when present, fixing replies to mailing lists and no-reply senders. Changes are backward compatible and complete Linear P1 #16.

  • New Features
    • mail-parse: capture and store Reply-To as MessageMetadata.reply_to (serde default; no migration).
    • Reply builder prefers Reply-To (first address) and falls back to From; reply-all keeps other original recipients as Cc.
    • Added tests in mail-parse and daemon; updated the compose guide.

Written for commit af02b7c. Summary will update on new commits.

Review in cubic

Replies always targeted the From: address, so a reply to a mailing-list
digest or a no-reply@ sender went to the wrong place — exactly the
addresses that set Reply-To to redirect responses.

Capture the Reply-To header into the message body metadata at parse time
(mail-parse already has the parsed message, so every provider benefits),
and have the reply builder prefer those addresses over From:, falling
back to From: when absent. The metadata is a JSON blob with a
serde-default field, so no migration or envelope-schema change is needed.

Gmail thread-id propagation — the other half of this backlog item — is
already in place: the Gmail parser uses the API's threadId directly as
the envelope thread id.
@vercel

vercel Bot commented Jun 10, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
mxr-mail Ready Ready Preview, Comment Jun 10, 2026 8:42pm

@coderabbitai

coderabbitai Bot commented Jun 10, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@bhekanik, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 34 minutes and 47 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 0312a9db-c5cc-480c-8e93-5307b5ff3f53

📥 Commits

Reviewing files that changed from the base of the PR and between 7bb7a09 and af02b7c.

📒 Files selected for processing (5)
  • crates/core/src/types.rs
  • crates/daemon/src/handler/mutations.rs
  • crates/daemon/src/handler/tests/mutations_and_delivery.rs
  • crates/mail-parse/src/lib.rs
  • site/src/content/docs/guides/compose.md
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/reply-to-capture

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

No issues found across 5 files

Re-trigger cubic

@bhekanik bhekanik merged commit b866c09 into main Jun 11, 2026
27 of 29 checks passed
@bhekanik bhekanik deleted the feat/reply-to-capture branch June 11, 2026 00:34
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