fix(bot): liveness watchdog — silent getUpdates stall now self-heals in seconds - #97
Merged
Merged
Conversation
…on silent stall The bot hung mid-update-handling (a decayed Redis channel-layer await): process alive, nothing logged, long-poll dead, inbound messages silently lost (gotcha #26, live 2026-07-02 — diagnosed via a no-offset getUpdates probe returning 200 instead of 409). Same failure class the daemon fixed with its heartbeat watchdog in PR #56; the bot never got one. A completed getUpdates cycle (even empty) now stamps a heartbeat; a watchdog task hard-exits (os._exit 70) when no cycle completes within 300s so launchd KeepAlive restarts the bot with fresh connections. backend: 542 passed. Ruff clean.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Goal
Tonight's lost Telegram test: the bot consumed the update, then hung forever on an internal await (Redis channel-layer stall — same class the daemon fixed via heartbeat watchdog in PR #56). Process alive, zero log output, long-poll dead — every subsequent message silently lost until a manual restart. Documented as gotcha #26 with the non-destructive diagnosis (a no-offset
getUpdatesprobe: healthy bot → 409 Conflict; hung bot → 200).Change
getUpdatescycle (even empty) stamps a monotonic heartbeat.os._exit(70)s — launchdKeepAliverestarts the bot within seconds. A stalled event loop can't be trusted to unwind cleanly, hence the hard exit.watchdog_is_stalled()+ 4 tests (fresh/stale decision, stall → exit(70), healthy loop never exits).Test Summary
backend 542 passed, ruff clean.
After merge
Kickstart the bot once (
launchctl kickstart -k gui/$(id -u)/com.openremote.bot) to pick up the code; from then on this failure mode self-heals.