fix(gateway): stop typing indicator on Telegram after session completion - #20959
Closed
vincent-wen789 wants to merge 2 commits into
Closed
fix(gateway): stop typing indicator on Telegram after session completion#20959vincent-wen789 wants to merge 2 commits into
vincent-wen789 wants to merge 2 commits into
Conversation
added 2 commits
May 7, 2026 10:07
…ives up When a background task is stuck in blocking I/O (e.g. a hung tool call), cancel_session_processing waits 5s then unblocks dispatch — but the _keep_typing refresh loop kept running, leaving an infinite 'typing…' bubble on Telegram and other platforms. Now, when the task refuses to unwind within the 5s window, proactively call interrupt_session_activity — which sets the interrupt_event (so _keep_typing exits on its next tick) and invokes stop_typing on the adapter. Also: pass chat_id through the existing call site in _handle_slash_command to enable this cleanup on command-initiated session cancels.
- Implement stop_typing() in TelegramAdapter using choose_sticker chat action to supersede the persistent typing indicator - Without this, normal session completion leaves typing visible even after _keep_typing is cancelled (Telegram client caching) - Complements the dead-session typing cleanup in cancel_session_processing (chat_id parameter + interrupt_session_activity on timeout)
Collaborator
This was referenced May 14, 2026
Contributor
|
Thanks for tracing the dead-session typing path. The timeout case still needs a fix, but this patch cannot land unchanged. Problems
Suggested changes
Automated hermes-sweeper review. |
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
Fixes stuck typing indicator on Telegram that persists after normal session completion.
Problem
Two independent issues caused Telegram typing to stay visible indefinitely:
Normal completion:
_keep_typingis cancelled, but Telegram adapter had nostop_typing()implementation — the base class no-op left the typing bubble to expire on its own (~5s). Some Telegram clients cache the indicator state and never clear it.Dead-session timeout:
cancel_session_processinggives up after 5s if the task is stuck in blocking I/O. Without thechat_idparameter, the interrupt event was never signaled, so_keep_typingkept refreshing the typing bubble every 2 seconds indefinitely.Changes
gateway/platforms/telegram.pystop_typing()implementation that sendschoose_stickerchat action to supersede thetypingaction (Telegram has no explicit "cancel typing" API)_keep_typingstops refreshinggateway/platforms/base.pychat_idparameter tocancel_session_processing_gave_up), callinterrupt_session_activityto signal the interrupt event and invokestop_typingon the adapter_handle_slash_commandto passchat_idTest Plan
Related
/newresponse dropped during active agent)