Telegram plugin: multiple polling instances silently steal messages

Resolved 💬 3 comments Opened Mar 26, 2026 by TiM1113 Closed Mar 29, 2026

Problem

When running multiple Claude Code sessions simultaneously (e.g., terminal + IDE extension), each session spawns its own Telegram MCP server process that polls the same bot token via getUpdates.

Telegram's getUpdates is first-come-first-served — whichever process polls first consumes the message. The other session(s) never see it.

This failure is completely silent. There is no warning, no log, no error — the user just sees the bot not responding, with no way to diagnose the cause.

Steps to reproduce

  1. Open Claude Code in terminal — Telegram plugin starts (process A)
  2. Open Claude Code in IDE (e.g., VS Code with Antigravity) — Telegram plugin starts (process B)
  3. Send a message to the bot on Telegram
  4. Message is consumed by whichever process polls first (e.g., process A)
  5. The other session (process B) never receives it — no error, no indication

Expected behavior

  • Only one Telegram polling process should be active per bot token at any time
  • If a second instance attempts to start, it should either:
  • Refuse to start with a clear warning: _"Another Telegram polling process is already active for this bot"_
  • Delegate to the existing instance via IPC or shared queue

Suggested fix

  • Lock file mechanism: write a PID lock (e.g., ~/.claude/channels/telegram/.poll.lock) on startup; check before polling
  • Singleton polling: use a shared long-polling process that dispatches messages to the active session
  • At minimum: log a visible warning when getUpdates returns a conflict or when another process is detected

Environment

  • macOS (Darwin 25.4.0)
  • Telegram plugin version: 0.0.4
  • Claude Code: terminal + VS Code extension running simultaneously

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗