fix(telegram): use concurrent runner to prevent message blocking#367
Closed
Noah-Ribaudo wants to merge 1 commit intoopenclaw:mainfrom
Closed
fix(telegram): use concurrent runner to prevent message blocking#367Noah-Ribaudo wants to merge 1 commit intoopenclaw:mainfrom
Noah-Ribaudo wants to merge 1 commit intoopenclaw:mainfrom
Conversation
## Problem When using grammy's default `bot.start()` for long polling, updates are processed sequentially. This means if one message handler takes a long time (e.g., an agent with a 10-minute timeout), ALL other incoming messages are blocked until that handler completes. From grammy's source code: ```javascript // handle updates sequentially (!) await this.handleUpdate(update); ``` This caused the entire Telegram bot to become unresponsive when a single conversation got stuck or timed out. ## Solution Replace `bot.start()` with `@grammyjs/runner`, which processes updates concurrently. This allows multiple conversations to be handled in parallel, so one slow or stuck handler doesn't block others. ## Changes - Add `@grammyjs/runner` dependency - Replace `bot.start()` with `run(bot)` in monitor.ts - Add tests verifying runner is used and responds to abort signals 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
3 tasks
Contributor
|
Thanks @Noah-Ribaudo! This change is already in main via commit 1a41fec (runner switch) plus follow-ups 068b187/322c5dd9. Closing as already implemented. Appreciate the contribution—happy to revisit if you still see blocking. |
dgarson
added a commit
to dgarson/clawdbot
that referenced
this pull request
Feb 9, 2026
* Web: wire OAuth connections flow * fix: pr feedback
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
bot.start()processes updates sequentially@grammyjs/runnerto process updates concurrentlyThe Problem
When using grammy's default long polling with
bot.start(), updates are processed one at a time:This means if one message handler hangs (e.g., waiting for an LLM response that times out after 10 minutes), every other message in every other chat waits in a queue behind it. The entire bot becomes unresponsive.
The Solution
The
@grammyjs/runnerplugin is specifically designed to solve this. It processes updates concurrently, so multiple conversations can be handled in parallel. A slow or stuck handler in one chat doesn't block handlers in other chats.Changes
@grammyjs/runnerdependencybot.start()withrun(bot)inmonitor.tsTest plan
🤖 Generated with Claude Code