Skip to content

imessage: strip NUL bytes from echo-cache text normalization#2201

Open
BingqingLyu wants to merge 18 commits into
mainfrom
fork-pr-63581-fix-imessage-echo-nul-prefix
Open

imessage: strip NUL bytes from echo-cache text normalization#2201
BingqingLyu wants to merge 18 commits into
mainfrom
fork-pr-63581-fix-imessage-echo-nul-prefix

Conversation

@BingqingLyu

@BingqingLyu BingqingLyu commented Apr 28, 2026

Copy link
Copy Markdown
Owner

Summary

normalizeEchoTextKey() uses .trim() to normalize outbound messages before caching. JavaScript's .trim() does not strip NUL bytes, so when iMessage echoes back a sent message with a leading NUL prefix (as seen in chat.db), the key does not match the cached entry and the echo is forwarded as a new inbound message.

Fixed by stripping NUL bytes before trimming during text-key normalization. The implementation uses String.fromCharCode(0) based normalization so the cache key matches echoed messages without tripping the repo's no-control-regex lint rule.

Testing

  • Added two test cases covering single and multiple leading NUL bytes
  • pnpm test extensions/imessage/src/monitor/monitor-provider.echo-cache.test.ts -- 4 tests pass

Closes openclaw#63544


Made with Copilot | fully reviewed by human

BsnizND and others added 18 commits April 27, 2026 07:49
Fixes openclaw#72523.

Remote proof:
- CI run 24980529154 passed on 29f825b.
- Blacksmith Testbox tbx_01kq6tsgbaxgstxmtearwy9n4w passed focused formatting, Google Meet tests, Google realtime provider tests, and extension test typecheck.

Thanks @BsnizND.

Co-authored-by: BSnizND <[email protected]>
- pi.md: 9 H2 + 14 H3 (Package Dependencies, File Structure, Tool Pipeline, etc.)
- cli/hooks.md: 6 H2 (List All Hooks, Get Hook Information, etc.)
- plugins/message-presentation.md: 8 H2 (Producer Examples, Renderer Contract, etc.)
- plan/ui-channels.md: 7 H2 (Non Goals, Target Model, Refactor Steps, etc.)
- install/ansible.md: 6 H2 + 1 H3 (What You Get, Quick Start, etc.)

Mintlify anchor generation prefers sentence case for predictable URLs.
- automation/standing-orders: sentence-case all H2/H3 headings (Why Standing Orders, Anatomy, Execute-Verify-Report Pattern, Multi-Program Architecture, Best Practices, etc.) and clean up Related link styling
- platforms/raspberry-pi: sentence-case 10 headings (Hardware Requirements, Performance Optimizations, Cost Comparison, etc.)
- install/fly: sentence-case troubleshooting and Private Deployment headings
- pi-dev: drop 'this guide summarizes' filler, sentence-case 4 H2 headings, restore brand-cased Pi
- concepts/model-providers: sentence-case Kimi Coding (other brand-named providers preserved as-is: Google Gemini, Google Vertex, Kilo Gateway, Volcano Engine)
- channels/msteams: 8 H2/H3 (Federated Authentication, Local Development, Known Limitations, Reply Style, Presentation Cards, Private Channels, etc.)
- auth-credential-semantics: 4 H2 (Stable Probe Reason Codes, Token Credentials, Explicit Auth Order Filtering, Probe Target Resolution)
- tools/browser: preserve brand-named headings (Browserless, WebSocket CDP, Chrome MCP, Control API, Brave); minor cleanup
- security/CONTRIBUTING-THREAT-MODEL: 4 H2/H3 (What We Use, Risk Levels, Review Process; Threat IDs preserved as branded label)
- gateway/multiple-gateways: 4 H2 (Best Recommended Setup, Why This Works, General Multi-Gateway Setup, Isolation Checklist)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

iMessage echo detection fails when echoed message has NUL (\0) prefix

5 participants