fix(telegram): stop typing indicator when LLM fails or hangs#1390
Open
kiannidev wants to merge 2 commits intosipeed:mainfrom
Open
fix(telegram): stop typing indicator when LLM fails or hangs#1390kiannidev wants to merge 2 commits intosipeed:mainfrom
kiannidev wants to merge 2 commits intosipeed:mainfrom
Conversation
010e2e5 to
dc037f0
Compare
xuwei-xy
pushed a commit
to xuwei-xy/picoclaw
that referenced
this pull request
Mar 14, 2026
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 #1323 — typing indicator kept running when the LLM failed, timed out, or hung.
Root cause
The
cancelfunction was only invoked inpreSendwhen an outbound message was sent. If the LLM failed or hung, no response was published, socancelwas never called and the typing goroutine ran indefinitely.Changes
defer InvokeTypingStop(msg.Channel, msg.ChatID)so typing stops when processing completes (success, error, or panic), regardless of publish.InvokeTypingStop(channel, chatID)to invoke the registered typing stop function.context.WithTimeoutas fallback so the goroutine exits even ifcancelis never called (e.g. LLM hangs).Testing
go test ./pkg/channels/... ./pkg/agent/...InvokeTypingStop