Bug Report: iMessage (imsg) Channel - Binary Length Prefix Leaking into Message Content
Description
When receiving messages via the iMessage channel (using the imsg provider), every incoming message has binary junk prepended to the text content. This appears to be a length-prefix from the underlying protobuf/gRPC communication that is not being properly stripped.
Symptom
Every received message starts with binary characters (hex: variable varint-encoded length prefix) followed by the actual message text.
Example of raw message content:
��Mrrrrow! 🐱 Ich bin wach und bereit!
Expected:
Mrrrrow! 🐱 Ich bin wach und bereit!
Environment
- OpenClaw version: 2026.4.9 (npm latest)
- OS: macOS 26.3.1 (arm64)
- Node: v22.22.1
- Channel: iMessage (
channel: imessage, provider: imsg)
- imsg CLI: Installed via Homebrew at
/opt/homebrew/bin/imsg
- Gateway: local mode, running via LaunchAgent
Root Cause Hypothesis
The imsg bridge communicates with OpenClaw using protobuf/gRPC. The message payload includes a length-prefix (varint) that should be consumed during deserialization, but it's being passed through to the content instead. The binary bytes appear to be a protobuf varint length prefix that isn't being stripped by the channel handler.
Reproduction Steps
- Configure iMessage channel with imsg provider
- Send any message to the agent via iMessage
- Observe that the
message field in context contains binary prefix characters
- The prefix is consistent across all messages (typically 2-4 bytes)
Impact
- Functional: Low - text is still readable
- UX: High annoyance factor
- Compatibility: May break tools expecting clean text input
- Token usage: Wastes tokens on binary data
Related Issues
May be related to other binary injection issues:
Suggested Fix
The iMessage channel handler should properly strip the protobuf length prefix before passing message content to the agent context.
To submit this bug report:
- Go to https://github.com/openclaw/openclaw/issues/new?template=bug_report.yml
- Copy the content above into the form
- Submit the issue
Bug Report: iMessage (imsg) Channel - Binary Length Prefix Leaking into Message Content
Description
When receiving messages via the iMessage channel (using the
imsgprovider), every incoming message has binary junk prepended to the text content. This appears to be a length-prefix from the underlying protobuf/gRPC communication that is not being properly stripped.Symptom
Every received message starts with binary characters (hex: variable varint-encoded length prefix) followed by the actual message text.
Example of raw message content:
Expected:
Environment
channel: imessage,provider: imsg)/opt/homebrew/bin/imsgRoot Cause Hypothesis
The imsg bridge communicates with OpenClaw using protobuf/gRPC. The message payload includes a length-prefix (varint) that should be consumed during deserialization, but it's being passed through to the content instead. The binary bytes appear to be a protobuf varint length prefix that isn't being stripped by the channel handler.
Reproduction Steps
messagefield in context contains binary prefix charactersImpact
Related Issues
May be related to other binary injection issues:
Suggested Fix
The iMessage channel handler should properly strip the protobuf length prefix before passing message content to the agent context.
To submit this bug report: