Skip to content

Fix iMessage group media delivery#86720

Merged
omarshahine merged 2 commits into
openclaw:mainfrom
omarshahine:codex/imessage-group-media-send-attachment
May 26, 2026
Merged

Fix iMessage group media delivery#86720
omarshahine merged 2 commits into
openclaw:mainfrom
omarshahine:codex/imessage-group-media-send-attachment

Conversation

@omarshahine

@omarshahine omarshahine commented May 26, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes iMessage media-only sends to explicit chat targets by routing them through imsg send-attachment --transport auto instead of the generic RPC send payload with a file path.

Why

While testing issue #83365, normal iMessage group image replies generated the PNG but did not deliver a media attachment. Direct imsg send-rich --file also failed on the same group with an IMCore attachment staging error, while imsg send-attachment --transport auto succeeded and produced a real attachment row. DM media sends by handle already worked, so this keeps handle/DM sends on the existing path and only changes explicit chat media-only sends (chat_id / chat_guid).

Changes

  • Add a CLI JSON helper for the iMessage send runtime.
  • For media-only explicit chat sends, resolve chat_id to a chat GUID when needed and call send-attachment --transport auto.
  • Preserve existing RPC send behavior for DM handle media sends and text/caption sends.
  • Add unit coverage for chat GUID, chat ID, and DM handle media behavior.

Validation

  • pnpm format:check -- extensions/imessage/src/send.ts extensions/imessage/src/send.test.ts
  • pnpm vitest run extensions/imessage/src/send.test.ts extensions/imessage/src/actions.runtime.test.ts
  • pnpm tsgo:extensions

Live Evidence

On the Lobster Mac, the same generated PNG failed via imsg send-rich --file for the group, but succeeded via imsg send-attachment --transport auto and produced an image attachment in the group chat.

Fixes #83365

@openclaw-barnacle openclaw-barnacle Bot added channel: imessage Channel integration: imessage size: M maintainer Maintainer-authored PR labels May 26, 2026
@omarshahine omarshahine changed the title [codex] Fix iMessage group media delivery Fix iMessage group media delivery May 26, 2026
@omarshahine

Copy link
Copy Markdown
Contributor Author

Testing note for #83365:

On this Lobster machine, the reproduced failure was specific to group media delivery through the existing rich/file path:

  • OpenClaw generated a valid PNG for the group request.
  • The normal final media reply did not appear as media in the group.
  • A direct imsg send-rich --chat <redacted-group> --file <generated-png> attempt failed locally with an attachment-directory permission error.
  • A direct imsg send-attachment --chat <redacted-group> --file <generated-png> --transport auto attempt succeeded and produced an outbound attachment in the group.

This PR therefore changes OpenClaw's explicit-chat, media-only iMessage send path to use send-attachment --transport auto, matching the command path that succeeded during the live repro. This does not claim that every send-rich --file scenario is broken; it documents that send-rich --file failed for the tested iMessage group on this machine while send-attachment --transport auto worked.

@clawsweeper

clawsweeper Bot commented May 26, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper status: review started.

I am starting a fresh review of this pull request: Fix iMessage group media delivery This is item 1/1 in the current shard. Shard 0/1.

This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking.

Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted.

@omarshahine

Copy link
Copy Markdown
Contributor Author

Live validation after this PR was built locally from commit 6e10d32 and the gateway was restarted from /Users/lobster/GitHub/openclaw/dist/index.js:

  • Controlled media-only OpenClaw send to the new redacted iMessage test group used the existing generated PNG at ~/.openclaw/media/tool-image-generation/red-coffee-mug-blue-table---a46a540c-2275-4db2-bdd2-e6bccd361739.png.
  • Messages DB evidence: a new outbound row was created in the group chat with attachment_count=1.
  • Controlled media-only OpenClaw send to the redacted 1:1 DM using the same PNG also created a new outbound row in the DM chat with attachment_count=1.
  • The generated file was optimized for delivery during both sends (Optimized media from 1.14MB to 0.05MB).

This validates the PR's media-only iMessage delivery path for both an explicit group chat_id target and an explicit DM chat_id target on this machine. Identifiers, handles, phone numbers, and private chat names are intentionally omitted.

@omarshahine omarshahine marked this pull request as ready for review May 26, 2026 02:14
@omarshahine

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Fresh proof is now on the PR: Lobster built commit 6e10d32, restarted the gateway from the built dist, and validated media-only iMessage sends for both an explicit group chat_id target and an explicit DM chat_id target with outbound DB rows showing attachment_count=1. Please review against the updated proof and non-draft state.

@clawsweeper

clawsweeper Bot commented May 26, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

@omarshahine

Copy link
Copy Markdown
Contributor Author

Maintainer verification before merge:

  • Local cleanup check on follow-up commit c92d111543: pnpm run lint:extensions:bundled in the Fix iMessage group media delivery #86720 worktree, passed.
  • GitHub checks on c92d111543: gh pr checks 86720 --json name,state,link --jq '[.[] | select(.state != "SUCCESS" and .state != "SKIPPED" and .state != "NEUTRAL") | {name,state,link}]' returned [].
  • Relevant CI/proof runs observed green include CI run 26428503154, Real behavior proof run 26428501870, OpenGrep PR Diff run 26428503150, and CodeQL Critical Quality run 26428503100.
  • Live behavior proof: Lobster built the PR, restarted the gateway from built dist, and verified media-only iMessage sends to an explicit group chat_id and explicit DM chat_id, both producing outbound DB rows with attachment_count=1.
  • Known proof gap: the live behavior proof was on original behavior commit 6e10d32; the follow-up c92d111543 only adds braces around existing timer cleanup to satisfy lint and does not change send behavior.

No changelog entry added per maintainer direction.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: imessage Channel integration: imessage maintainer Maintainer-authored PR size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: iMessage group media final replies can silently fail even though direct imsg send-rich succeeds

1 participant