Skip to content

[codex] fix(telegram): avoid duplicate pollers#1343

Closed
cola-runner wants to merge 1 commit intoanthropics:mainfrom
cola-runner:codex/telegram-polling-lock
Closed

[codex] fix(telegram): avoid duplicate pollers#1343
cola-runner wants to merge 1 commit intoanthropics:mainfrom
cola-runner:codex/telegram-polling-lock

Conversation

@cola-runner
Copy link
Copy Markdown

What changed

  • add a per-state-dir polling lock so only one Telegram plugin instance owns getUpdates
  • downgrade duplicate instances to tools-only mode instead of starting a competing poller
  • replace the fixed 5-second approval directory poll with fs.watch, with interval fallback if file watching is unavailable
  • document the new tools-only behavior in the Telegram README

Why

Telegram only allows one long-poll consumer per bot token. Today, duplicate Telegram plugin instances can be spawned by parallel Claude sessions or by loading both the installed cache copy and the marketplace source copy. Those extra pollers compete for getUpdates, trigger 409 Conflict, steal inbound messages from each other, and keep extra Bun processes alive in the background.

This change keeps one active poller per state directory and makes every other instance outbound-only. That preserves reply/react/edit tools without letting multiple processes fight over inbound delivery.

Validation

  • git diff --check
  • started the plugin with a simulated live polling.lock owner and confirmed it logs running tools-only mode
  • started the plugin with a simulated stale polling.lock owner and confirmed it reclaims the lock and exits cleanly on shutdown
  • verified the approval watcher falls back cleanly to polling only if file watching fails

Related

@github-actions
Copy link
Copy Markdown

Thanks for your interest! This repo only accepts contributions from Anthropic team members. If you'd like to submit a plugin to the marketplace, please submit your plugin here.

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.

1 participant