Repository navigation
fix(gmail): exclude send-as aliases from gmail send --reply-all - #1318
saariuslystoned wants to merge 2 commits into
Conversation
gmail reply-all and drafts --reply-all leave out the account and every send-as alias through selfEmailsForReply, but gmail send --reply-all excluded only the sending address and dropped the send-as list it had already fetched. A reply-all to a message addressed to an alias copied the alias, and with --from <alias> it copied the primary address. Reuse the fetched send-as list and selfEmailsForReply. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesExclude the account and all send-as aliases from derived reply-all recipients while permitting Cc-only replies. Example: An email from alice@example.com addresses me@example.com, alias@example.com and bob@example.com, where alias@example.com is the user's send-as alias.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR fixes a current recipient-selection bug with a focused patch; both earlier findings are resolved, and no actionable code defects remain. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe Gmail send command combines message headers, account identities and explicit recipient flags, builds MIME, and submits it through Gmail messages.send. flowchart LR
CLI[Send command] --> Identity[Account and send-as identities]
CLI --> Original[Original message headers]
Identity --> Recipients[Shared recipient builder]
Original --> Recipients
Recipients --> Overrides[Explicit recipient overrides]
Overrides --> MIME[MIME builder]
MIME --> Gmail[Gmail messages send]
Technical reviewBest possible solution: Land the focused reuse of shared self-address filtering and existing Cc-only MIME support. Do we have a high-confidence way to reproduce the issue? Current-main source establishes both failures, and the contributor supplies comparative CLI output; no target code was executed during this read-only review. Is this the best way to solve the issue? The patch uses the existing recipient owner and MIME capability, preserves sender validation and explicit replacement semantics, and avoids a parallel implementation. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against e8428c36dd31. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (2 earlier review cycles)
Reviewed November 8, 2026, 9:19 PM ET / November 9, 2026, 02:19 UTC (Revision 3). |
Leaving every self address out of gmail send --reply-all can leave a reply with Cc recipients and no To, which gmail reply-all already sends. Validate the combined recipient set for reply-all and let the MIME build omit To in that case. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Thank you for the fix. I reproduced the claim and consolidated excluding send-as aliases consistently from reply-all recipients into #1336, with regression coverage and your coauthor credit retained. The full |
What problem this solves
gmail reply-allandgmail drafts create --reply-allleave out every address that belongs to the user. They passselfEmailsForReply(account, from.sendingEmail, sendAs), which covers the account, the sending address and every send-as alias.gmail send --reply-allcallsbuildReplyAllRecipients(replyInfo, from.sendingEmail)instead, so it excludes only the sending address. It also discards the send-as list thatresolveComposeSenderhas already fetched.Take a message from alice sent to
me@example.com,alias@example.com(a send-as alias) and bob:Change
gmail sendfetches the send-as list once (listSendAsplusresolveComposeFrom, which is whatresolveComposeSenderdoes) and passesselfEmailsForReply(account, from.sendingEmail, sendAs)tobuildReplyAllRecipients. That function now takes any number of addresses to exclude, so its existing callers are unchanged. Explicit--to/--ccstill override the derived lists, as before.Leaving out every self address can leave a reply-all with Cc recipients and no To, for example when replying to a message sent from your alias to your primary address with Cc bob.
gmail reply-allsends that reply to Cc only.gmail send --reply-allnow does the same: when--reply-allis set and--tois not, it checks To, Cc and Bcc together, and lets the MIME build omit To. Every othergmail sendstill requires a To recipient.Evidence
TestGmailSendReplyAllExcludesSendAsAliasesruns the three commands above through the CLI entry point against anhttptestGmail server and decodes the raw MIME thatmessages.sendreceives.gmail reply-allis the control and passes onmain(e8428c3).gmail send --reply-allcases fail onmainand pass with this change.TestGmailSendReplyAllKeepsCcOnlyRecipientsreplies to a message fromalias@example.comtome@example.com, Ccbob@example.com.gmail reply-all(control) sends it Cc bob.gmail send --reply-allat this PR's first head rejected it withno recipients, and with this change it sends it Cc bob.Built
gogbinaries frommainand from this branch were run against a local Gmail stand-in throughGOG_GOOGLE_API_BASE_URL(not Google). It lists send-asprobe@example.com(primary) andalias@example.com, and decodes eachmessages.sendbody:Live Gmail run with a real Workspace mailbox, self-addressed only. The original went from the account to itself with Cc a plus-address of the same mailbox, so nothing left it. Headers are as Gmail stored them, read back with
gmail get --format metadata:The account has no send-as aliases, so the alias cases above are covered by the tests and the stand-in run only. The probe messages were moved to Trash afterwards.
Every
make cistep passed ona62176e(go1.27.3). The Go test suite (go test -count=1 ./...) ran on a second macOS arm64 machine, and the fmt, lint, deadcode, docs, agent-skills and node checks ran locally.This changes local recipient computation only. The live run above sent only to the account's own mailbox.
🤖 Generated with Claude Code