-
-
Notifications
You must be signed in to change notification settings - Fork 69.5k
[Bug]: Multi-channel response routing leaks to wrong channel when messages arrive simultaneously #4530
Description
Summary
When multiple channels are active (e.g., WhatsApp + iMessage), a response intended for one channel can leak to another channel if a message arrives on the second channel while the agent is processing a request from the first.
Steps to reproduce
- Configure both WhatsApp and iMessage channels
- Start a conversation on WhatsApp
- While WhatsApp conversation is ongoing, receive an unrelated iMessage from a different contact
- The agent's response (meant for WhatsApp) gets sent to the iMessage contact instead
Expected behavior
Responses should be pinned to the channel/session that initiated the request. The "current channel" context should not be overwritten by incoming messages from other channels.
Actual behavior
The response is routed to the most recently received message's channel, not the channel that initiated the request. This causes:
- Privacy leaks (sensitive content sent to wrong recipients)
- Context confusion (audit results from one conversation appearing in another)
Environment
- OpenClaw version: 2026.1.29
- OS: macOS
- Install method: npm
- Channels configured: WhatsApp (selfChatMode), iMessage
Root cause hypothesis
The gateway's "current channel" state appears to get clobbered when a new message arrives from a different channel during processing. The response routing should be bound to the originating session/channel at request time, not at response time.
Possible fix directions
- Pin response routing to the session that initiated the request
- Add channel isolation to prevent cross-channel context switching during processing
- Queue incoming messages from other channels until the current request completes