Skip to content

fix(telegram): add message deduplication to prevent duplicate processing - #598

Closed
youbiak wants to merge 1 commit into
openclaw:mainfrom
youbiak:fix/telegram-message-deduplication
Closed

youbiak wants to merge 1 commit into
openclaw:mainfrom
youbiak:fix/telegram-message-deduplication

Conversation

@youbiak

@youbiak youbiak commented Jan 9, 2026 •

Copy link
Copy Markdown

Problem

Telegram messages can be redelivered after gateway restarts, getUpdates conflicts, or network reconnects. This causes the same message to be processed multiple times, spamming sessions with duplicates.

Evidence: A single "Hello" message (ID 1687) was delivered 10+ times to a session over 25 minutes.

Solution

Add seenMessages map (matching the pattern already used in Slack adapter - see src/slack/monitor.ts:501-512) to track chatId:messageId pairs and skip already-processed messages.

Changes:

  • Track up to 500 recent messages
  • Auto-cleanup entries older than 60 seconds
  • Log skipped duplicates in verbose mode

Testing

  • Linter passes (npm run lint)
  • Tested on live instance - duplicates no longer processed after restart

AI Disclosure

  • 🤖 AI-assisted (Claude/Haki)
  • Fully tested on live Clawdbot instance
  • I understand what the code does

Closes #597

Telegram messages can be redelivered after gateway restarts, getUpdates
conflicts, or network reconnects. This causes the same message to be
processed multiple times, spamming sessions with duplicates.

Add seenMessages map (matching the pattern used in Slack adapter) to
track chatId:messageId pairs and skip already-processed messages.

- Track up to 500 recent messages
- Auto-cleanup entries older than 60 seconds
- Log skipped duplicates in verbose mode
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.

fix(telegram): add message deduplication to prevent duplicate processing

1 participant