ChatbotX
ChatbotX copied to clipboard
Webchat: typing indicator never clears after the bot reply (no typing:false is ever sent)
Environment
Self-hosted, images ghcr.io/chatbotxio/chatbotx-{builder,worker,realtime}:latest built 2026-09-08. The same code is on main @ 2c59740 (2026-09-11).
Steps to reproduce
- Set an AI agent as the default reply (any automated response that calls
sendTypingToChannelworks too). - Open the webchat widget on a page and send "hi".
- The typing dots appear while the reply is generated; the reply arrives; the dots stay on screen until the iframe is reloaded.
Root cause
- Worker automated-response (
ar-index.ts):sendTyping()posts{ typing: true, seconds: 5 }immediately and every 4 s withsetInterval; thefinallyblock only doesclearInterval. Nothing ever posts{ typing: false }. - Widget
apps/builder/src/features/integration-webchat/webchat-realtime.tsx:case RealtimeEventType.typing: setIsTyping(data.typing), whilecase messageCreated: handleNewMessage(data)does not touchisTyping. apps/realtime/src/parties/guests.tsonly broadcasts the payload; nothing honorsseconds.
Net effect: isTyping becomes true on the first bot reply and never goes back to false.
Realtime log for one exchange (room = the guest conversation):
12:48:54 POST /parties/guests/<room> (typing: true)
12:48:58 POST /parties/guests/<room> (typing: true, 4 s interval)
12:48:59 POST /parties/guests/<room> (messageCreated, outgoing)
(nothing afterwards)
Expected
Dots visible only while the bot is generating; cleared when the outgoing message arrives (or after seconds).
Suggested fix
Either side is enough:
- Widget: clear
isTypingwhen an outgoingmessageCreatedarrives (PR incoming). - Worker: send
{ typing: false }afterclearIntervalin thefinallyblock.