Skip to content

fix: restore the clipboard after reply_to_email (#106) - #111

Merged
patrickfreyer merged 6 commits into
mainfrom
fix/106-restore-clipboard
Oct 15, 2026
Merged

patrickfreyer merged 6 commits into
mainfrom
fix/106-restore-clipboard

Conversation

@patrickfreyer

Copy link
Copy Markdown
Owner

Opened by Claude (AI assistant) on Patrick's behalf.

Fixes #106

What

reply_to_email's AppleScript put the "Restore clipboard" block after return outputText, and its on error branch returned early too, so the restore never ran. Every reply (send, draft or open) left the reply body on the user's clipboard.

  • reply_to_email: the error path now sets outputText instead of returning. The tell block falls through to the restore, which is followed by a single return outputText.
  • forward_email (with message): the success path already restored the clipboard. The error path now restores it too, inside try because oldClip is undefined if the failure happens before the paste.
  • _send_html_email restores before its return already. It has no AppleScript on error, so a mid-script failure still skips the restore. That isn't touched here.

Tests

ClipboardRestoreTests in tests/test_compose_tools.py, mock-level like the existing ones:

  • for each of send, draft and open, the reply script has no return before the restore, and only return outputText after it;
  • forward's error block restores before returning;
  • forward without a message has no clipboard code at all.

Full suite: 123 passed (venv, mcp<2 pinned until #104 lands). Nothing was run against the real Mail.app.

🤖 Generated with Claude Code

patrickfreyer and others added 6 commits October 14, 2026 23:14
…first

The reply script's "Restore clipboard" block sat after `return outputText`
(and the error path returned early too), so it never ran and every reply
left the body on the user's clipboard. All paths now fall through to the
restore before returning. forward_email's error path also restores the
clipboard when a message note was pasted.

Fixes #106

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…pboard

In open mode nothing follows the paste, so the restored clipboard was
written back only 0.5s after Cmd+V. If Mail handles the keystroke late,
the paste could pick up the restored clipboard instead of the reply
body. Open mode now waits another 0.5s, matching send and draft, which
both spend that delay before send/close.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@patrickfreyer
patrickfreyer merged commit d5a2f81 into main Oct 15, 2026
5 checks passed
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.

bug: reply_to_email never restores the user's clipboard (restore code is after return)

1 participant