Skip to content

Draft reply via --reply-to-message-id doesn't auto-populate Subject from original message #488

@jbowerbir

Description

@jbowerbir

Summary

When creating a reply draft with gog gmail drafts create --reply-to-message-id <id>, the draft appears in the Gmail web UI thread (red "Draft" label visible) but cannot be opened or expanded. Clicking it does nothing.

Root Cause

fetchReplyInfo() correctly fetches the original message to extract the RFC 2822 Message-ID for In-Reply-To and References headers, and correctly sets threadId on the Draft resource. However, Subject is not fetched from the original message or auto-populated as Re: <original subject>.

Gmail's web UI requires subject matching (in addition to threadId and MIME headers) to render a draft as a proper reply in conversation view. When the subject doesn't match, the draft is filed into the thread (because threadId is set) but the UI can't expand it.

Expected Behavior

When --reply-to-message-id is provided and --subject is not provided, gog should:

  1. Fetch the original message's Subject header (the message is already fetched in fetchReplyInfo)
  2. Auto-populate the draft subject as Re: <original subject>, stripping any existing Re: prefix to avoid Re: Re: Re: chains

When --subject is provided with --reply-to-message-id, the current behavior (pass through verbatim) is fine, though a warning when it doesn't match the thread subject could help.

Reproduction

# Create a draft reply - draft appears in thread but can't be opened in Gmail web UI
gog gmail drafts create \
  --account user@example.com \
  --to "recipient@example.com" \
  --subject "Re: Some Subject" \
  --body "reply body" \
  --reply-to-message-id <message-id>

Suggested Fix

In gmail_send.go, add "Subject" to replyInfoMetadataHeaders (around line 615). Then in gmail_drafts.go, when --reply-to-message-id is set and --subject is empty, populate it from the fetched metadata with Re: prefix.

Environment

  • gog v0.11.0
  • Gmail web UI (new interface)
  • Tested on Linux (WSL2)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions