Files
hermes-agent/gateway/platforms
kshitijk4poor 78b98032c5 fix(telegram): key the deaf-ingress report on dispatcher progress, not update age
Follow-up to the cherry-picked #102383 commit. The check as written was neither
sensitive nor specific:

- It aged the newest received update, so a wedged PTB dispatcher was never
  reported while new updates kept arriving more often than every 300s (probe:
  1 update/250s for an hour -> 0 reports).
- `delivered` counted only MessageEvents reaching the gateway handler, while
  `received`/`dispatched` counted every Update; a single handled callback_query,
  reaction, unauthorized user or unmentioned group message produced a false
  ERROR after 300s of quiet.
- `_record_updates_received` skipped the generation/teardown guard
  `_record_polling_progress` applies, and the counters never reset across
  polling generations, so a late response from a fenced poll or a reconnect
  inflated the backlog.

Now `received` and `dispatched` count the same population (every fetched
update reaches the group-99 catch-all) and the report fires when a backlog
persists with no dispatch progress across two 90s heartbeats, once per stall,
re-armed on progress, reset per generation, at WARNING (diagnostic only;
#71240 owns recovery). The delivered counter and the `note_inbound_delivered`
facade method are dropped; the once-per-adapter "no message handler" error on
BasePlatformAdapter.handle_message stays. `_record_polling_progress` returns
whether the round-trip was accepted so the received stamp reuses its gate.
Tests trimmed to two invariants; every guard proven red by mutation.

Refs #102260
2026-09-13 18:55:15 +05:30
..