Skip to content

Gateway injects duplicate Telegram messages into sessions (same message_id) #25835

@jadeathena84-arch

Description

@jadeathena84-arch

Bug

The gateway injects the same Telegram DM into a session JSONL file twice, approximately 20 seconds apart. The duplicate has the identical Telegram message_id. This causes the LLM to process and respond to the same user message twice, resulting in duplicate outbound Telegram messages.

Reproduction

  1. User sends a single Telegram DM to the bot
  2. Gateway injects the message into the session at T+0
  3. Gateway injects the same message (same message_id) again at ~T+20s
  4. LLM responds to both injections, sending two identical replies

Evidence

From a session JSONL file, Telegram message_id: 4017 appears twice:

Timestamp: 2026-02-24T17:43:13.016Z  message_id: "4017"
Timestamp: 2026-02-24T17:43:35.457Z  message_id: "4017"

Content is identical. The 22-second gap suggests a retry/redelivery rather than a race condition.

This affects every DM in the session - 18 out of 179 log entries were sequential duplicates with identical content.

Expected Behavior

The gateway should deduplicate incoming Telegram messages by message_id before injecting them into the session. If a message with the same message_id already exists in the current session context, skip the duplicate.

Workaround

Added deduplication in a downstream log processor (extracts message_id and skips dupes), but this only fixes log output. The LLM still sees and responds to both copies.

Environment

  • OpenClaw version: 2026.2.23
  • Channel: Telegram (private DM)
  • Platform: macOS (Darwin 25.3.0)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions