Skip to content

bug(gmail): draft replies via --reply-to-message-id don't set a recipient (no --to inference, no --reply-all) #804

Description

@privatenumber

Summary

gog gmail drafts create / drafts update with --reply-to-message-id (or --thread-id)
auto-populate the subject (Re: …), threading headers (In-Reply-To/References), and the
quoted body, but do not set the recipient. The draft's To is taken only from --to, and
drafts allow an empty recipient, so a reply draft created without --to is silently saved with no
recipient. It looks like a proper reply (correct subject/thread/quote) but can't be sent as-is.

This is the natural follow-up to the reply-parity fixes in #488 (subject), #512 (threading headers),
and #673 (--thread-id) — recipient is the one reply attribute still not derived.

Repro

gog gmail drafts create --reply-to-message-id <msgId> --quote --subject "Re: Hello" --body "Thanks!"
# -> draft created; subject, thread, and quote correct; To is EMPTY (no error, no warning)

Expected

Either the recipient auto-populated from the reply target (matching the Gmail UI and
gog gmail send --reply-all), or at least a warning when a reply draft is created with an empty recipient.

Actual

Draft saved with an empty To. No error or warning.

Root cause (v0.22.0, 197992a)

  • internal/cmd/gmail_drafts.go:324To is built only from splitCSV(input.To); the reply lookup
    (prepareComposeReply) supplies subject/threading/quote but the sender is never used for To.
  • internal/cmd/gmail_drafts.go:327 — drafts build with rfc822Config{allowMissingTo: true}, so the
    missing-recipient guard at internal/cmd/gmail_mime.go:52 is skipped (intentional, per feat(gmail): allow drafts without a recipient #57
    "allow drafts without a recipient").
  • By contrast gog gmail send is protected: --to is required unless --reply-all
    (internal/cmd/gmail_send.go:93-95), and --reply-all auto-populates recipients from the reply
    target (internal/cmd/gmail_send.go:25). Drafts have neither.

Impact

Especially bites scripted/agent workflows: the draft looks complete, so the empty recipient goes
unnoticed until a human opens or tries to send it.

Suggested fix

  1. Add --reply-all to drafts create/update for parity with send.
  2. Optionally, when a reply target is set and --to is empty, default To to the original sender
    (Gmail-UI behavior), keeping the empty-draft use case from feat(gmail): allow drafts without a recipient #57 when no reply target is given.
  3. At minimum, warn when a reply draft is created/updated with an empty recipient.

Environment

gog v0.22.0 (confirmed by reading source at 197992a; behavior is longstanding).

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Normal priority bug or improvement with limited blast radius.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.impact:message-lossThis issue is about lost, duplicated, misrouted, or suppressed channel messages.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions