Skip to content

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

Merged
afjcjsbx merged 4 commits intosipeed:mainfrom
kiannidev:fix/1323-telegram-endless-typing
Mar 19, 2026
Merged

fix(telegram): stop typing indicator when LLM fails or hangs#1390
afjcjsbx merged 4 commits intosipeed:mainfrom
kiannidev:fix/1323-telegram-endless-typing

Conversation

@kiannidev
Copy link
Copy Markdown
Contributor

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
Copy Markdown

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
@kiannidev
Copy link
Copy Markdown
Contributor Author

Hi, maintainers.
Please review this PR.

Thanks

@kiannidev
Copy link
Copy Markdown
Contributor Author

I fixed lint error. There was some mistakes during the commit.
Sorry for that.
Please review again.

Thanks

@afjcjsbx afjcjsbx merged commit bd4317f into sipeed:main Mar 19, 2026
4 checks passed
j0904 pushed a commit to j0904/picoclaw that referenced this pull request Mar 22, 2026
…ss-typing

fix(telegram): stop typing indicator when LLM fails or hangs
@sipeed-bot
Copy link
Copy Markdown

sipeed-bot Bot commented Mar 25, 2026

@kiannidev Good fix for the typing indicator leak! Having it spin forever when the LLM fails was definitely confusing for users. Clean root cause analysis too.

We are building a PicoClaw Dev Group on Discord for contributors. If you would like to join, send an email to support@sipeed.com with the subject [Join PicoClaw Dev Group] + Your GitHub account and we will send you the invite link!

andressg79 pushed a commit to andressg79/picoclaw that referenced this pull request Mar 30, 2026
…ss-typing

fix(telegram): stop typing indicator when LLM fails or hangs
ra1phdd pushed a commit to ra1phdd/picoclaw-pkg that referenced this pull request Apr 12, 2026
…ss-typing

fix(telegram): stop typing indicator when LLM fails or hangs
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.

3 participants