openclaw - 💡(How to fix) Fix iMessage (imsg): sent messages with is_from_me=true echoed back as inbound to session [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#60940Fetched 2026-04-08 02:45:24
View on GitHub
Comments
0
Participants
1
Timeline
0
Reactions
0
Participants

Outbound messages sent by the gateway (my replies) are being fed back into the session as inbound messages, causing an infinite echo loop.

Root Cause

The imsg JSON-RPC watch stream includes all messages — including sent ones — with is_from_me: true in the payload. The gateway is not filtering these out before routing them as inbound messages to the agent session.

Example from imsg history --json:

{"is_from_me":true,"created_at":"2026-04-04T16:12:55.735Z","chat_id":1,"sender":"+12107402623","text":"my reply text..."}

These is_from_me: true messages should be silently ignored on the inbound path.

Fix Action

Workaround

Build a wrapper script that filters is_from_me: true from the imsg JSON-RPC stream before it reaches the gateway, and set channels.imessage.cliPath to point to the wrapper.

Code Example

{"is_from_me":true,"created_at":"2026-04-04T16:12:55.735Z","chat_id":1,"sender":"+12107402623","text":"my reply text..."}
RAW_BUFFERClick to expand / collapse

Bug Report

Version: OpenClaw 2026.4.1 (da64a97), imsg 0.5.0

Channel: iMessage (legacy imsg integration)

Description

Outbound messages sent by the gateway (my replies) are being fed back into the session as inbound messages, causing an infinite echo loop.

Root Cause

The imsg JSON-RPC watch stream includes all messages — including sent ones — with is_from_me: true in the payload. The gateway is not filtering these out before routing them as inbound messages to the agent session.

Example from imsg history --json:

{"is_from_me":true,"created_at":"2026-04-04T16:12:55.735Z","chat_id":1,"sender":"+12107402623","text":"my reply text..."}

These is_from_me: true messages should be silently ignored on the inbound path.

Reproduction

  1. Configure OpenClaw with iMessage via imsg
  2. Send a message to the agent and receive a reply
  3. The agent's reply is fed back into the session as if it came from the user
  4. The agent responds again, creating an echo loop

Expected Behavior

Messages where is_from_me: true should be filtered out and never routed as inbound messages to the agent session.

Workaround

Build a wrapper script that filters is_from_me: true from the imsg JSON-RPC stream before it reaches the gateway, and set channels.imessage.cliPath to point to the wrapper.

extent analysis

TL;DR

Filtering out messages with is_from_me: true from the imsg JSON-RPC stream is likely to resolve the infinite echo loop issue.

Guidance

  • Identify the source of the imsg JSON-RPC stream and determine how to modify or wrap it to filter out messages with is_from_me: true.
  • Implement a wrapper script as described in the workaround section of the issue to filter out these messages before they reach the gateway.
  • Update the channels.imessage.cliPath configuration to point to the new wrapper script.
  • Verify that the echo loop is resolved by testing the message flow after implementing the wrapper script.

Example

// Example of a filtered message
{
  "is_from_me": false,
  "created_at": "2026-04-04T16:12:55.735Z",
  "chat_id": 1,
  "sender": "+12107402623",
  "text": "user's message text..."
}

Note that this example is not a code snippet, but rather an illustration of what a filtered message might look like.

Notes

The provided workaround suggests building a wrapper script to filter out is_from_me: true messages, which implies that modifying the existing imsg integration directly may not be feasible or desirable.

Recommendation

Apply the workaround by building a wrapper script to filter out is_from_me: true messages, as this approach is explicitly described in the issue and targets the identified root cause.

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