-
-
Notifications
You must be signed in to change notification settings - Fork 52.6k
Closed
Description
Description
The Telegram sendChatAction("typing") keepalive loop occasionally fails to clean up after a reply is fully dispatched. The typing indicator continues indefinitely (observed 2+ hours) despite the built-in TTL safety net (typingTtlMs = 120000).
Steps to Reproduce
- Have a cron job or automated session that sends a reply to a Telegram chat
- Reply completes and is delivered successfully
- The typing keepalive loop (in
createTypingController) continues running indefinitely sendChatActioncalls accumulate in the logs as errors (network request failures from rate limiting or intermittent connectivity)
Expected Behavior
The typing keepalive loop should stop after:
- The reply is dispatched (
markRunComplete+markDispatchIdle→cleanup()) - At most 2 minutes via the TTL timer (
typingTtlMs)
Actual Behavior
- The keepalive loop continues firing
sendChatActionindefinitely - 183+ failed calls observed over a 2+ hour window
- The TTL timer does not appear to fire, possibly because:
refreshTypingTtl()is being called which resets the timer- Or the timer is being cleared without being re-set during cleanup
- Or
cleanup()is never reached becausemarkRunCompleteandmarkDispatchIdledon't both get called in certain code paths (e.g., cron sessions, announce flows)
Relevant Code
// reply-*.js → createTypingController()
const cleanup = () => {
if (sealed) return;
typingTtlTimer && clearTimeout(typingTtlTimer);
typingLoop.stop();
if (active) onCleanup?.();
resetCycle();
sealed = true;
};
const maybeStopOnIdle = () => {
if (!active) return;
if (runComplete && dispatchIdle) cleanup(); // Both flags needed
};
The maybeStopOnIdle() requires BOTH runComplete AND dispatchIdle to be true. If either flag isn't set (e.g., dispatch completes but markRunComplete is never called, or vice versa), cleanup never fires and the TTL is the only safety net.
Log Evidence
error telegram/api telegram sendChatAction failed: Network request for 'sendChatAction' failed!
(Repeated every 1-10 seconds for 2+ hours until gateway restart)
Environment
- OpenClaw v2026.2.24
- Telegram channel
- Config:
typingMode: "message",typingIntervalSeconds: 10 - Observed with cron job sessions that post to group topics
Workaround
Gateway restart clears all stuck loops. Setting typingMode: "never" prevents the issue entirely but loses all typing indicators.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels