Skip to content

MS Graph: createReplyDraftDirect uses broken $filter=conversationId pattern #18

Description

@edwinhu

Bug

createReplyDraftDirect() in src/token-api.ts uses $filter=conversationId eq '...' at /me/messages, which returns InefficientFilter / 400 errors on MS Graph. This breaks:

  • superhuman reply --attach <file> for Outlook accounts
  • superhuman reply-all --attach <file> for Outlook accounts
  • Any code path that calls createReplyDraftDirect() or sendReplyDirect() with an MS Graph token

Root Cause

The broken pattern at line 2785:

/me/messages?$filter=conversationId eq '${threadId}'&$select=id&$orderby=receivedDateTime desc&$top=1

This is a known MS Graph limitation (documented in memory). The same bug was previously fixed in getThreadInfoDirect() by switching to client-side filtering.

Fix

Replace server-side $filter with the client-side filtering pattern already used by getThreadInfoDirect():

  1. Fetch recent 50 messages
  2. Filter by conversationId client-side
  3. Fallback: try treating threadId as a direct message ID

Impact

  • Outlook/MS Graph accounts cannot reply with attachments
  • Gmail accounts are unaffected (different code path)

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