Skip to content

Conversation

@williamjameshandley
Copy link
Contributor

Summary

  • Replace N+1 subprocess calls with single efficient notmuch show --body=false call
  • Headers mode now fetches only headers without body content
  • Fixes failures when raw email content couldn't be fetched

Problem

Previously _search_emails() made N+1 subprocess calls:

  1. notmuch search --output=messages to get message IDs
  2. For each ID: notmuch show --format=raw to fetch full raw email

This was slow (multiple processes) and could fail if raw email parsing failed.

Solution

Use single notmuch show --format=json --body=false call which returns headers directly. The --body=false flag is documented as "much faster and substantially smaller".

Test plan

  • All 29 email extraction tests pass
  • Manual testing confirms headers mode works efficiently
  • ID queries work correctly with full message IDs

🤖 Generated with Claude Code

Previously _search_emails() made N+1 subprocess calls:
1. notmuch search --output=messages (get IDs)
2. For each ID: notmuch show --format=raw (full email content)

This was slow and could fail if raw email couldn't be fetched.

Now uses single call: notmuch show --format=json --body=false
which returns headers directly without body content. This is
documented as "much faster and substantially smaller".

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@chatgpt-codex-connector
Copy link

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

Update MCP schema descriptions to emphasize that id: queries must use
the ENTIRE message ID string including the @Domain part, not just the
local part before the @.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@williamjameshandley williamjameshandley merged commit d4cc971 into master Jan 5, 2026
3 checks passed
@williamjameshandley williamjameshandley deleted the fix/email-headers-mode branch January 5, 2026 07:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants