fix(telegram): keep typing indicator alive while Claude is processing#979
Open
snemesh wants to merge 1 commit intoanthropics:mainfrom
Open
fix(telegram): keep typing indicator alive while Claude is processing#979snemesh wants to merge 1 commit intoanthropics:mainfrom
snemesh wants to merge 1 commit intoanthropics:mainfrom
Conversation
Telegram's typing indicator expires after ~5 seconds. For queries that take 30s-2min (tool use, file reads, complex reasoning), the indicator disappears and the user can't tell if the bot is still working or silently failed. Added startTyping/stopTyping helpers that re-send sendChatAction every 4 seconds. startTyping is called when an inbound message is received; stopTyping is called when reply or edit_message sends a response. Multiple chats are tracked independently via a Map. Fixes anthropics#932
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.
Problem
Telegram's typing indicator expires after ~5 seconds. For queries that take 30s–2min (tool use, file reads, complex reasoning), the indicator disappears and the user can't tell if the bot is still working or has silently failed. This is especially problematic because
--channelsis experimental and sessions can genuinely stop responding (#777, #963).Fix
Added
startTyping(chat_id)/stopTyping(chat_id)helpers:startTypingsendssendChatAction("typing")immediately, then repeats every 4 seconds viasetIntervalstopTypingclears the interval — called whenreplyoredit_messagesends a responseMap<string, interval>startTypingon the same chat replaces the previous interval (no leak)stopTypingon unknown chat is a safe no-opChanges
external_plugins/telegram/server.ts— 27 insertions, 2 deletionsTest plan
bun buildpassesTest output (12/12 passed)
Fixes #932