openclaw - 💡(How to fix) Fix iMessage: reply tag stripping leaves garbage bytes + sent message echo loop [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#61705Fetched 2026-04-08 02:55:40
View on GitHub
Comments
0
Participants
1
Timeline
0
Reactions
0
Participants

Fix Action

Workaround

Agent can avoid using reply tags entirely, which fixes Bug 1. Bug 2 has no agent-side workaround.

RAW_BUFFERClick to expand / collapse

Environment

  • OpenClaw 2026.4.5 (3e72c03)
  • imsg 0.4.0
  • macOS (arm64)
  • Channel: iMessage DM

Bug 1: Reply tag stripping leaves residual bytes

When the agent uses [[reply_to_current]] tags (as instructed by the system prompt), the tag stripping code leaves 1-2 garbage bytes at the start of the delivered iMessage. These appear as mojibake characters like ��, �=, �C, �7, etc.

Messages that don't use reply tags arrive clean. The corruption is visible in imsg history output on the [sent] entries, confirming it happens before iMessage delivery, not after.

Likely cause: off-by-one or encoding-aware slice issue in the tag stripping regex/logic.

Bug 2: Sent messages echoed back as inbound

After sending a reply via iMessage, the same message is picked up by the inbound poller as a new message from the user. This creates a feedback loop where the agent receives its own replies as queued user messages.

The [sent] messages show up moments later as [recv] from the same number, with the garbage bytes included, making it look like the user is quoting the agent.

Steps to Reproduce

  1. Configure iMessage channel with a DM peer
  2. Send any message that triggers a [[reply_to_current]] prefixed reply
  3. Observe garbage bytes at start of delivered message
  4. Observe the sent message appearing as a new inbound message in the next poll cycle

Expected Behavior

  • Reply tags should be fully stripped with no residual bytes
  • Outbound messages should not be picked up as inbound by the poller

Workaround

Agent can avoid using reply tags entirely, which fixes Bug 1. Bug 2 has no agent-side workaround.

extent analysis

TL;DR

The issue can be mitigated by avoiding the use of [[reply_to_current]] tags in the agent's replies, which fixes Bug 1, but a more comprehensive solution is needed to address Bug 2.

Guidance

  • Review the tag stripping logic in the OpenClaw codebase to identify potential off-by-one or encoding-aware slice issues that could be causing the residual bytes.
  • Investigate the inbound poller's message filtering to determine why it is picking up sent messages as new inbound messages, potentially due to insufficient filtering or message identification.
  • Consider implementing a more robust message identification mechanism to prevent the feedback loop in Bug 2.
  • Verify the issue by checking the imsg history output for [sent] and [recv] entries to confirm the presence of garbage bytes and the feedback loop.

Example

No code snippet is provided as the issue does not contain sufficient information about the specific code implementation.

Notes

The provided workaround only addresses Bug 1, and a more comprehensive solution is needed to fix Bug 2. The root cause of the issue is likely related to the tag stripping logic and the inbound poller's message filtering.

Recommendation

Apply workaround: Avoid using [[reply_to_current]] tags in the agent's replies, as this fixes Bug 1, and investigate the inbound poller's message filtering to address Bug 2. This is a temporary solution until a more comprehensive fix can be implemented.

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: reply tag stripping leaves garbage bytes + sent message echo loop [1 participants]