You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(telegram): typing-indicator heartbeat while a turn is in flight (#294)
* feat(telegram): typing-indicator heartbeat while a turn is in flight
A chat turn can run up to ~10 min, during which the athlete previously
got zero feedback and would assume the bot was dead. Pulse Telegram's
native "typing" chat action every 4s for the generation phase of the
shared turn skeleton, stopping it in a finally around generation (never
delivery). Each pulse is best-effort — a rejected or throwing pulse is
logged at debug and never affects the turn or its reply — and the
interval is unref'd so a pending pulse can't hold the process open
during shutdown or an /update drain.
Closes#167
* fix(telegram): guard heartbeat pulses and export the interval constant
- add an in-flight guard so a beat is skipped while the previous pulse is
still unsettled, preventing pulse pile-up when a pulse is parked in the API
retry layer; the flag is released in a finally so a rejected pulse can't
wedge it
- export TYPING_HEARTBEAT_MS and assert the <=5s auto-clear invariant against
the production constant instead of a test-local mirror
User-facing: The bot now shows a typing indicator while it works on your message, so a long reply no longer looks like it went silent.
6
+
7
+
Starts a best-effort heartbeat that re-emits Telegram's native "typing" chat action every 4s for the duration of the generation phase in the shared turn skeleton, then stops it in a `finally` around generation (never around delivery). Each pulse is isolated: a rejected or throwing pulse is logged at debug and can never affect the turn or its reply, and the interval is unref'd so a pending pulse cannot hold the process open during shutdown or an `/update` drain.
0 commit comments