picoclaw/pkg/channels
Jex 213274002a
fix: keep Discord typing indicator alive during agent processing (#391)
* fix: keep Discord typing indicator alive during agent processing

Discord's ChannelTyping() expires after ~10s, but agent processing
(LLM + tool execution) typically takes 30-60s+. Replace single-fire
ChannelTyping() with a self-managed typing loop inside DiscordChannel.

- startTyping(chatID): goroutine refreshes ChannelTyping every 8s
- stopTyping(chatID): called in Send() when response is dispatched
- Stop() cleans up all typing goroutines on shutdown
- startTyping placed after all early returns to prevent goroutine leaks

Typing lifecycle fully contained in channel layer, no interface changes.

Fixes #390

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: add goroutine safety to Discord typing indicator

- Add 5-minute timeout as safety net to prevent indefinite goroutine leaks
  when agent produces no outbound message (empty response, panic, etc.)
- Listen on c.ctx.Done() so goroutine exits when channel context is cancelled
- Log ChannelTyping() errors at debug level for diagnostics (rate limits, session closed)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 13:28:58 +01:00
..
base.go merge: sync upstream/main into feat/multi-agent-routing 2026-02-14 10:38:04 -03:00
base_test.go style: fix gofmt formatting (CRLF -> LF) 2026-02-14 11:21:47 +09:00
dingtalk.go misc: fmt code 2026-02-13 17:51:47 +08:00
discord.go fix: keep Discord typing indicator alive during agent processing (#391) 2026-02-19 13:28:58 +01:00
feishu_32.go add build constraints for feishu to support 32-bit builds 2026-02-11 20:59:25 +01:00
feishu_64.go Merge branch 'main' into architecture-32-bit 2026-02-13 21:18:34 +01:00
line.go style: fix gofmt formatting (CRLF -> LF) 2026-02-14 11:21:47 +09:00
maixcam.go Fix shadowing field runnnig 2026-02-16 00:47:17 +09:00
manager.go feat: implement structured Telegram command handling with a dedicated command service and telegohandler integration. (#164) 2026-02-16 14:20:16 +08:00
onebot.go feat(onebot): enhance OneBot channel (#192) 2026-02-19 14:39:35 +08:00
qq.go add QQ channel support 2026-02-11 00:00:53 +08:00
slack.go merge: sync upstream/main into feat/multi-agent-routing 2026-02-16 10:34:55 -03:00
slack_test.go refactor(channels): consolidate media handling and improve resource cleanup 2026-02-12 12:46:28 +08:00
telegram.go merge: sync upstream/main into feat/multi-agent-routing 2026-02-16 10:34:55 -03:00
telegram_commands.go feat: implement structured Telegram command handling with a dedicated command service and telegohandler integration. (#164) 2026-02-16 14:20:16 +08:00
whatsapp.go Remove duplicate truncate functions, reuse utils.Truncate 2026-02-12 00:46:48 +08:00