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

fix(telegram): add message deduplication to prevent duplicate processing#598
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
@youbiak youbiak closed this Jan 9, 2026
heatherstew44-maker pushed a commit to heatherstew44-maker/openclaw that referenced this pull request Mar 8, 2026
guillaumemaka pushed a commit to guillaumemaka/openclaw that referenced this pull request May 28, 2026
…ams (openclaw#598)

`rawSearch` is already the output of `parseDiffRouteSearch` via the
`useSearch` select transform. The `useMemo` at line 760 re-parsed it
through the same function with an unsafe `as Record<string, unknown>`
cast, producing an identical result. Use `rawSearch` directly instead.
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