You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Stop gateway typing refresh loops before final response delivery, so a late platform typing tick cannot outlive the completed reply.
Let GatewayStreamConsumer request typing stop as soon as the model stream finishes.
Keep a configurable HERMES_TYPING_MAX_SECONDS stale-loop guard as a final fallback.
Why
This salvages the core approach from #29172 onto current main and adds the max-lifetime guard we validated locally. It addresses the Telegram stuck typing family tracked in #28004 / #29175, where the agent has already finished and the reply is delivered but the platform still shows typing.
Local reproduction on current main before this patch:
2026-05-28 10:05:53 agent turn ended with finish_reason=stop
2026-05-28 10:05:54 gateway logged response ready for Telegram
user still saw Telegram typing much later, after the turn was no longer active
Changes
Add per-chat typing stop events in BasePlatformAdapter.
Use the per-chat stop event for _keep_typing instead of the session interrupt event.
Stop typing refresh before final text, TTS, images, media, and file delivery.
Signal typing stop from GatewayStreamConsumer when the stream receives DONE.
Add regression coverage for request_typing_stop and stream-finish typing stop handoff.
Thanks for this. A fix for the post-delivery typing-stop boundary in base.py has landed on main via #37556 (merged as 6a30cfca8): it moves _stop_typing_task() ahead of the post-delivery callback and bounds the callback with a timeout, which also closes the root-cause issue #24971.
This PR overlaps that area but also touches paths #37556 didn't (e.g. the stream-consumer / final-delivery path), so I'm not closing it — could you rebase on current main and let me know if there's still a residual gap your change covers after #37556? Happy to take the remaining delta as a focused follow-up if so.
Thanks for the focused typing-lifecycle work. This is now implemented on current main; this is an automated hermes-sweeper review.
09a96ba0f6ee68d701bd7c4fc2b2518a83b37c62 wires a one-shot Telegram pause_typing_for_chat() callback into both GatewayStreamConsumer construction paths (gateway/run.py:16745, gateway/run.py:18068) and runs it before finalization (gateway/stream_consumer.py:270). tests/gateway/test_stream_consumer.py:368 verifies the pause precedes the final edit.
565b7c8d9d879c6423c55e9be84596936bc489ba prevents the final Telegram reply from re-arming its typing timer (plugins/platforms/telegram/adapter.py:3839), with regression coverage at tests/gateway/test_telegram_format.py:217.
The earlier post-delivery callback boundary noted in the discussion was also fixed by 6a30cfca82409cbf20b915c832a9acfb46551fe5 (gateway/platforms/base.py:5255).
The stream-finalize fix is contained in v2026.7.1.
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
comp/gatewayGateway runner, session dispatch, deliveryP2Medium — degraded but workaround existssweeper:implemented-on-mainSweeper: behavior already present on current maintype/bugSomething isn't working
4 participants
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
GatewayStreamConsumerrequest typing stop as soon as the model stream finishes.HERMES_TYPING_MAX_SECONDSstale-loop guard as a final fallback.Why
This salvages the core approach from #29172 onto current
mainand adds the max-lifetime guard we validated locally. It addresses the Telegram stuck typing family tracked in #28004 / #29175, where the agent has already finished and the reply is delivered but the platform still shows typing.Local reproduction on current main before this patch:
2026-05-28 10:05:53agent turn ended withfinish_reason=stop2026-05-28 10:05:54gateway loggedresponse readyfor TelegramChanges
BasePlatformAdapter._keep_typinginstead of the session interrupt event.GatewayStreamConsumerwhen the stream receives DONE.request_typing_stopand stream-finish typing stop handoff.Validation
./venv/bin/python -m pytest tests/gateway/test_keep_typing_timeout.py tests/gateway/test_stream_consumer.py -q96 passed in 11.74sRelated
Fixes #28004.
Addresses #29175.
Supersedes / salvages #29172.
Related: #21688.