From afec11e21b846b1e5b7b5fb0eb637224173c0093 Mon Sep 17 00:00:00 2001 From: Tom Alison <6170+talison@users.noreply.github.com> Date: Sat, 14 Mar 2026 14:24:45 -0700 Subject: [PATCH] fix: off-by-one in stall restart escalation Change >= to > so the process exit fires after MAX_CONSECUTIVE_POLL_RESTARTS actual restart attempts rather than exiting on the Nth detection before the Nth restart has a chance to recover. A transient outage that would recover on the 5th retry no longer gets killed early. --- extensions/telegram/src/polling-session.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/telegram/src/polling-session.ts b/extensions/telegram/src/polling-session.ts index e8b059bbee5..c8ebca6e4bc 100644 --- a/extensions/telegram/src/polling-session.ts +++ b/extensions/telegram/src/polling-session.ts @@ -234,7 +234,7 @@ export class TelegramPollingSession { if (elapsed > POLL_STALL_THRESHOLD_MS && runner.isRunning()) { this.#consecutiveStallRestarts += 1; stalledRestart = true; - if (this.#consecutiveStallRestarts >= MAX_CONSECUTIVE_POLL_RESTARTS) { + if (this.#consecutiveStallRestarts > MAX_CONSECUTIVE_POLL_RESTARTS) { this.opts.log( `[telegram] Polling recovery exhausted after ${this.#consecutiveStallRestarts} consecutive stall restarts without successful getUpdates; escalating to process exit.`, );