Skip to content

fix(telegram): stop typing indicator when LLM fails or hangs#1390

Open
kiannidev wants to merge 2 commits intosipeed:mainfrom
kiannidev:fix/1323-telegram-endless-typing
Open

fix(telegram): stop typing indicator when LLM fails or hangs#1390
kiannidev wants to merge 2 commits intosipeed:mainfrom
kiannidev:fix/1323-telegram-endless-typing

Conversation

@kiannidev
Copy link

Summary

Fixes #1323 — typing indicator kept running when the LLM failed, timed out, or hung.

Root cause

The cancel function was only invoked in preSend when an outbound message was sent. If the LLM failed or hung, no response was published, so cancel was never called and the typing goroutine ran indefinitely.

Changes

  1. Agent loop: Added defer InvokeTypingStop(msg.Channel, msg.ChatID) so typing stops when processing completes (success, error, or panic), regardless of publish.
  2. Channels manager: Added InvokeTypingStop(channel, chatID) to invoke the registered typing stop function.
  3. Telegram: Added 5-minute context.WithTimeout as fallback so the goroutine exits even if cancel is never called (e.g. LLM hangs).

Testing

  • go test ./pkg/channels/... ./pkg/agent/...
  • Added unit tests for InvokeTypingStop

@CLAassistant
Copy link

CLAassistant commented Mar 12, 2026

CLA assistant check
All committers have signed the CLA.

@kiannidev kiannidev force-pushed the fix/1323-telegram-endless-typing branch from 010e2e5 to dc037f0 Compare March 12, 2026 00:24
@sipeed-bot sipeed-bot bot added type: bug Something isn't working domain: channel domain: agent go Pull requests that update go code labels Mar 12, 2026
xuwei-xy pushed a commit to xuwei-xy/picoclaw that referenced this pull request Mar 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

domain: agent domain: channel go Pull requests that update go code type: bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Endless sending of "typing" message telegram.

2 participants