Repository navigation
fix(gmail): leave the user's own addresses out of gmail autoreply - #1325
saariuslystoned wants to merge 4 commits into
Conversation
gmail autoreply excluded only the account and the sending address, so a message sent from another of the user's send-as aliases was auto-replied to that alias even without --allow-self. Build the self list with selfEmailsForReply, as gmail reply-all and gmail send --reply-all do. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nnot be read A message sent from one of the user's addresses with an external Reply-To was still auto-replied to without --allow-self, whose help says it allows replying to messages sent by your own account or alias. Skip those. Also stop before searching or sending if the send-as list cannot be read, instead of silently treating only the account and sending address as self. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Codex review: ready, awaiting a maintainer decision. What this changesThis PR excludes send-as aliases from default autoreplies and stops when alias discovery fails, while preserving the --allow-self fallback. Example: An account receives mail from alias@example.com with Reply-To victim@external.com.
Review scores
ProductKind: Bug fix · Worth it: Needs a maintainer decision · Fix scope: Complete Merge readiness⏳ Ready, awaiting maintainer decision Keep open: main still needs the alias-exclusion fix, and no introduced correctness bug was found; changing the discovery-error fallback needs an owner decision. Priority: P2 Decision needed
Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe Gmail autoreply CLI loads account identities and matching messages, filters eligible recipients, sends threaded replies, and labels successfully handled threads for deduplication. flowchart TD
A[Autoreply CLI] --> B[Load send-as identities]
B --> C[Search Gmail messages]
C --> D[Check labels and sender identities]
D --> E[Skip excluded messages]
D --> F[Send threaded replies]
F --> G[Apply dedupe label]
Technical reviewBest possible solution: Retain the shared alias-exclusion fix and have the feature owner explicitly settle whether discovery failure must stop default autoreplies. Do we have a high-confidence way to reproduce the issue? Main's recipient-selection path establishes the alias and external Reply-To failures, and the contributor supplies matching before-and-after CLI observations; this review did not execute target code. Is this the best way to solve the issue? Reusing the existing identity helper and checking From before Reply-To is a focused repair; making identity discovery mandatory is a separate compatibility choice. 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:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
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 (3 earlier review cycles)
Reviewed November 10, 2026, 6:44 PM ET / 23:44 UTC (Revision 4). |
--allow-self already permits replies to the user's own addresses, so a failed send-as lookup there falls back as before instead of stopping the run. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Real-behavior proof for head
Hashes: SHA256SUMS |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Upgrade proof: v0.48.0 to head Loopback Gmail stand-in at Built from this checkout:
Stand-in send-as list: 1. v0.48.0 writes the account settings and the dedupe label
{
"keyring_backend": "file",
"default_timezone": "America/Chicago",
"account_aliases": {
"inbox": "probe@example.com"
}
}v0.48.0 autoreply, exit 0. 2. Head, same config, no new mailExit 0. 3. Alias exclusion on mail v0.48.0 had not labeledAdded Head, exit 0.
Label creates stayed 1 ( 4. Send-as lookup failsAdded Head, exit 6. stdout: {"error":{"class":"permission_denied","code":6,"message":"Google API error (403 forbidden): Forbidden"}}stderr: Stand-in saw only that one 5. Lookup recoversStand-in Final sends: ☁️ |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Thank you for the fix. I reproduced the claim and consolidated excluding send-as aliases from default Gmail auto-replies into #1336, with regression coverage and your coauthor credit retained. The full |
Problem
gmail autoreplytreated only the account and the sending address as "self". Without--allow-self, which is documented as "Allow replying to messages sent by your own account/alias", it still auto-replied in three cases:Reply-To;Fix
selfEmailsForReply(account, from.sendingEmail, sendAs), asgmail reply-allandgmail send --reply-alldo.--allow-self, skip a message whose From is any self address (no_reply_recipient), whatever itsReply-To.--allow-selfbehaves as before.--allow-self, if the send-as list can't be read, stop before searching or sending instead of guessing. The API error is wrapped, so exit codes are unchanged. With--allow-self, a failed lookup keeps the previous sender fallback, since replies to your own addresses are allowed anyway.Tests
internal/cmd/gmail_autoreply_sendas_test.gorunsgmail autoreplythrough the CLI against anhttptestGmail server with send-asme@example.comandalias@example.com. It covers:main(e8428c3) one reply is sent; with this change it's skipped."Alias" <ALIAS@EXAMPLE.COM>: skipped.Reply-Toan external address: skipped, and sent with--allow-self.--allow-self: sent.settings/sendAsreturning 403: the command fails with no send, and with--allow-selfit still replies.settings/sendAsis fetched exactly once.Built
gogbinaries frommainand from this branch were run against a local Gmail stand-in throughGOG_GOOGLE_API_BASE_URL. The stand-in is not Google: its send-as list isprobe@example.com(primary) andalias@example.com. The result for each case is whatmessages/sendreceived:Every
make cistep passed on36cacee(go1.27.3). The Go test suite ran on a second macOS arm64 machine, and the fmt, lint, deadcode, docs, agent-skills and node checks ran locally.@saariuslystoned
☁️
🤖 Generated with Claude Code