-
-
Notifications
You must be signed in to change notification settings - Fork 69.7k
Discord inbound debouncer key does not include message.id — duplicate processing on gateway resume #29868
Description
Bug Report
Summary: The inbound message debouncer uses key {channel}:{accountId}:{channelId}:{authorId} (without message.id). When Discord retransmits a message on gateway resume failure (e.g., after container restart or WebSocket reconnect), OpenClaw processes it again as a new message, potentially sending duplicate responses.
Root cause: message-handler.ts (or equivalent) uses a debouncer keyed on channel + author, not on the unique message ID. Discord may retransmit the same MESSAGE_CREATE event on RESUME if acknowledgment failed.
Impact:
- Duplicate agent responses to the same user message after container restart
- Potential message flooding if multiple retransmit events occur in quick succession
Workaround (applied locally): Track processed message.id in SQLite at the application layer before enqueuing inference. SQLite store with 24h TTL inserted at the message handler entry point.
Suggested fix: Include message.id in the debouncer key, or add an idempotency check on message.id before dispatch.
Environment:
- OpenClaw version: latest (as of 2026-02-28)
- Node.js: v22.22.0
- Platform: Docker container (Linux)
- Discord gateway: @buape/carbon