#6902

[imessage] reply `files` attachments are never delivered on macOS 26 – SEND_FILE_SCRIPT needs `as alias`; tool still reports success

OpenKubyx-businessopened 4d ago

Plugin: imessage 0.2.0 (external_plugins/imessage/server.ts, line 424; still unchanged on main as of 2026-10-23) macOS: 26.7.1 (Tahoe), Mac mini M4, Messages signed in to iMessage Use case: Claude Code agent running unattended with --channels plugin:imessage@claude-plugins-official

What happens reply with files: ["/abs/path/file.png"] returns success (osascript exits 0) and the agent tells the user the file was sent, but the file never arrives on the recipient's devices (iPhone, another Mac). On the sending Mac, Messages shows an empty outgoing bubble. In ~/Library/Messages/chat.db the outgoing message has no row in attachment / message_attachment_join, i.e. Messages accepted the command but attached nothing. Same result for PNG, JPEG and PDF, for files in ~/Pictures, ~/Downloads and ~/Documents, with and without extended attributes (quarantine/provenance).

Root cause SEND_FILE_SCRIPT passes a POSIX file (file URL) to send:

tell application "Messages" to send (POSIX file (item 1 of argv)) to chat id (item 2 of argv)

On macOS 26, Messages only attaches the file when it receives an alias:

tell application "Messages" to send ((POSIX file (item 1 of argv)) as alias) to chat id (item 2 of argv)

A/B test (same source PNG, same 1:1 iMessage chat, 2026-10-26; checked in chat.db 60 s after sending and on the recipient's iPhone and Mac)

TestFileAppleScriptosascriptAttachment row in chat.dbArrived
T1copy with xattrs, ~/Picturessend (POSIX file …) (plugin)exit 0noneno
T2fresh file, ~/Picturessend (POSIX file …)exit 0noneno
T3fresh file, ~/Picturessend ((POSIX file …) as alias)exit 0transfer_state 5, deliveredyes
T4file written via Messages' do shell scriptas aliasexit 0transfer_state 5, deliveredyes
T5fresh file, ~/Downloadssend (POSIX file …)exit 0noneno
T6fresh file, ~/Picturesas alias to buddy instead of chat idexit 0transfer_state 5, deliveredyes

The only variable that matters is as alias. File location and extended attributes make no difference.

Suggested fix

  1. Change SEND_FILE_SCRIPT to send ((POSIX file (item 1 of argv)) as alias) to chat id (item 2 of argv).
  2. Because osascript exits 0 even when nothing is attached, consider verifying the send: after a few seconds, check chat.db for an outgoing attachment row with the file's transfer_name and return an error to the model if none exists. Otherwise the agent confidently reports "sent" while the user receives nothing.

Workaround we use now: a small MCP tool that copies the file to ~/Pictures/<subfolder>/, sends it with as alias and polls chat.db (attachment.transfer_state = 5, message.is_delivered = 1) before reporting success.

Thanks :).

Activity

0

No activity yet.