openclaw - 💡(How to fix) Fix iMessage: is_from_me:true messages mis-attributed + attributedBody garbage prefixes + echo into inbound queue [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#60525Fetched 2026-04-08 02:50:02
View on GitHub
Comments
0
Participants
1
Timeline
0
Reactions
0
Participants

Code Example

imsg history --chat-id <direct-chat-id> --limit 8 --json

---

{
  "text": "��\u0002<actual message content>",
  "is_from_me": true,
  "sender": "<recipient-handle-not-self>",
  "chat_id": 7
}
RAW_BUFFERClick to expand / collapse

Symptoms

  1. Leading garbage bytes on some messages: Text starts with + control bytes (e.g., ��\u0002, �k\u0003). These correlate with chat.db rows where text is NULL but attributedBody blob is present — the CLI is decoding attributedBody and prepending replacement characters + control bytes.

  2. Wrong sender attribution on outbound messages: Messages with is_from_me: true show sender as the recipient handle instead of self. For example, in a DM between Eva (Mac mini) and Wally (iMac), Eva's outbound messages show sender: [email protected] (Wally's handle) instead of Eva's own identity.

  3. Echo loop — outbound messages ingested as inbound: is_from_me: true messages are surfacing as inbound/queued messages in the OpenClaw pipeline, causing the sender to see their own outgoing messages echoed back as if they were received from the other party.

Reproduction

On two machines (Mac mini + iMac) running OpenClaw with iMessage plugin:

imsg history --chat-id <direct-chat-id> --limit 8 --json

Affected messages show:

{
  "text": "��\u0002<actual message content>",
  "is_from_me": true,
  "sender": "<recipient-handle-not-self>",
  "chat_id": 7
}

Specific message IDs from our chat: 5148, 5149, 5151 — all is_from_me: true, all with garbage prefix, all attributed to recipient handle.

In chat.db, these rows have text = NULL and a non-empty attributedBody blob.

Expected Behavior

  • Outgoing (is_from_me: true) messages should never be ingested as inbound events
  • Sender attribution for is_from_me: true should be self (or omitted), not the recipient handle
  • Rendered text derived from attributedBody should be normalized — strip leading \uFFFD (U+FFFD replacement character) and ASCII control characters \x00-\x1F

Proposed Fixes (in priority order)

B) Tighten echo/drop rules (highest impact):

  • Never allow is_from_me: true into the inbound queue
  • If normalized text matches recent outbound echo-cache, drop as reflected content

A) Normalize text at ingest/render:

  • Strip leading \uFFFD and \x00-\x1F control characters before echo-cache / queue rendering
  • This handles the attributedBody decode artifacts

C) Fix display attribution:

  • For is_from_me: true, render sender as self — never the recipient handle

Environment

  • macOS 15.x (Sequoia), ARM64
  • OpenClaw latest (installed via Homebrew)
  • iMessage plugin, two machines (Mac mini + iMac) on separate iMessage accounts
  • Confirmed on both machines independently

extent analysis

TL;DR

Implementing the proposed fixes, specifically tightening echo/drop rules and normalizing text at ingest/render, should resolve the issues with leading garbage bytes, wrong sender attribution, and echo loops.

Guidance

  • Tighten echo/drop rules: Modify the inbound queue logic to never allow is_from_me: true messages and drop messages that match recent outbound echo-cache content to prevent echo loops.
  • Normalize text at ingest/render: Strip leading \uFFFD and \x00-\x1F control characters from attributedBody before rendering to fix leading garbage bytes.
  • Fix display attribution: Update the rendering logic to display the sender as self for is_from_me: true messages, rather than the recipient handle.
  • Verify fixes: Test the changes using the imsg history command with the --json flag to ensure the issues are resolved.

Example

// Expected output after fixes
{
  "text": "<actual message content>",
  "is_from_me": true,
  "sender": "<self-handle>",
  "chat_id": 7
}

Notes

The proposed fixes should be implemented in priority order, with tightening echo/drop rules having the highest impact. The environment and setup may affect the implementation details, but the general approach should remain the same.

Recommendation

Apply the proposed fixes, starting with tightening echo/drop rules, to resolve the issues with leading garbage bytes, wrong sender attribution, and echo loops. This approach addresses the root causes of the problems and provides a comprehensive solution.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix iMessage: is_from_me:true messages mis-attributed + attributedBody garbage prefixes + echo into inbound queue [1 participants]