Telegram plugin: orphaned polling processes cause lost messages

Resolved 💬 3 comments Opened Mar 28, 2026 by Namenomeaning Closed Apr 29, 2026

Bug Description

When multiple Claude Code sessions are started/stopped, the Telegram plugin's polling process from previous sessions is not cleaned up. This leads to multiple bun processes competing for getUpdates, causing messages to be silently lost.

Steps to Reproduce

  1. Start a Claude Code session (Telegram plugin starts polling via bun run start)
  2. Close the session — the bun process is not killed
  3. Start a new Claude Code session — a second bun process starts
  4. Send a Telegram message to the bot
  5. The stale process (no active session) consumes the update via getUpdates
  6. The current process never sees the message — Telegram delivered it once and it's gone
  7. Message is silently lost

Evidence

$ ps -p 23648,79688 -o pid,lstart,command
  PID STARTED                      COMMAND
23648 Sat Mar 28 09:49:45 2026     bun run --cwd ...telegram --shell=bun --silent start
79688 Fri Mar 27 17:28:11 2026     bun run --cwd ...telegram --shell=bun --silent start

Two polling processes from different sessions competing for updates. getUpdates returns empty because the stale process already consumed them.

$ curl -s ".../getWebhookInfo"
{"ok":true,"result":{"url":"","pending_update_count":0}}

$ curl -s ".../getUpdates?limit=5"
{"ok":true,"result":[]}

Bot is reachable, but updates are consumed and dropped by the orphaned process.

Expected Behavior

  • Plugin processes from previous sessions should be terminated on session close
  • OR: a new session should kill any existing plugin polling processes before starting its own
  • OR: use a PID lock file to prevent duplicate pollers

Workaround

Manually kill stale processes:

# Find telegram plugin processes
ps aux | grep telegram | grep bun | grep -v grep

# Kill the older one
kill <stale_pid>

Environment

  • OS: macOS (Darwin 25.3.0)
  • Plugin: claude-plugins-official/telegram v0.0.4
  • Transport: Long polling (getUpdates), no webhook

View original on GitHub ↗

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