Repository navigation
feat: message_ids on manage_trash for exact-id move to trash - #150
Merged
patrickfreyer merged 1 commit intoNov 18, 2026
Merged
Conversation
Callers that already know which messages to trash can pass their ids instead of narrowing subject/sender filters. Each id is resolved with a direct lookup (no whose scan) and re-read right before the move; a real run then re-checks every id and reports any still in the source mailbox. The id count must not exceed max_deletes. Mirrors the message_ids path on move_email. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
patrickfreyer
added a commit
that referenced
this pull request
Nov 18, 2026
carry #150: message_ids on manage_trash for exact-id move to trash
Owner
|
Posted by Claude (AI maintainer agent) on Patrick's behalf. Thank you @PodioSpaz! This is merged via #151, which carries your commit unchanged plus a merge of current Generated by Claude Code |
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds an optional
message_idsargument tomanage_trash(action="move_to_trash"), matching the onemove_emailgot in #50.Why
Today the only way to trash specific messages is to filter by
sender/subject_keywordsand hope the preview catches only the ones you mean. With recurring subjects (statements, digests, "Your order has shipped") the filter also catches older mail. A triage workflow then has to narrow the filters until the dry-run count matches, or give up on that group. In one real inbox triage run, 99 of 364 queued messages couldn't be trashed or archived safely for this reason. The caller already had the exact ids fromsearch_emails.What changed
manage_trash(..., message_ids=[...]), foraction="move_to_trash"only. When set, subject, sender, age filters andapply_to_allare ignored, as inmove_email.whose. Each id is looked up with«class mssg» id N of mailboxinside the loop, following the guidance in enhancement: id-based read_email and attachment tools, and a size guard for search output #128 and search_emails on large INBOX causes Mac Mail UI to hang and returns empty results #41. The lookup is never awhosescan over the mailbox or a reference list captured up front.idis read again right before the move and must equal the requested id. I added this because I have seen a loop that looked messages up by id while removing them from the same mailbox trash the wrong messages. That loop usedfirst message whose id is Nplusdelete, not this tool. The re-read check makes that kind of mistake fail safely.STILL PRESENT: N, plus aStill in mailbox: <id>line for each one, so callers can confirm the result.max_deletes.normalize_message_idshelper.Not found: <id>.REQUESTED: n id(s), MATCHED: k, likemove_email.dry_run=Truestays the default and previews without moving anything.The change only adds an argument with a default. No existing tool names or required arguments change.
Testing
PYTHONPATH=plugin python -m pytest tests/ -q: 315 passed, 1 failed. The failure istest_compose_tools.py::test_create_rich_email_draft_writes_multipart_eml, which also fails onmainon macOS: the temp directory resolves to/private/var/...while the test expects/var/.... It's unrelated to this change.tests/test_manage_trash.pycover:whosein the generated scriptmax_deletesand wrong-action errorsscripts/check_versions.pypasses. The generated AppleScript compiles withosacompilefor both dry and real runs.Not found, andSTILL PRESENT: 0.Related
message_idsonmove_email, which this mirrors.whose.move_to_trash. This change returns before that code, so the two shouldn't conflict beyond a rebase.🤖 Generated with Claude Code