Skip to content

Telegram update offset should be scoped to bot token #11337

@anooprdawar

Description

@anooprdawar

Problem

The update offset file (~/.openclaw/telegram/update-offset-default.json) is keyed to the account name (e.g. "default"), not the bot token. If the bot token changes (common during initial setup/debugging), the persisted lastUpdateId from the old token becomes invalid for the new token's update_id sequence.

This causes shouldSkipUpdate() to silently reject ALL inbound messages because updateId <= lastUpdateId is always true — the old offset is millions ahead of the new bot's actual update IDs.

Impact

  • All inbound Telegram messages silently dropped
  • No error logged — just a dedupe skip
  • Very hard to diagnose (raw-update logs show messages arriving, but nothing happens)

Suggested Fix

Include the bot user ID (or a hash of the token) in the offset file:

{
  "version": 2,
  "botId": "8125167982",
  "lastUpdateId": 363897059
}

On startup, if botId doesn't match the current bot, reset lastUpdateId to null.

Related

Root cause of #11011

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingstaleMarked as stale due to inactivity

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions