1cc592bef6
Review finding (low, real): the comment claimed /ping degenerates to a pure connectivity check when TG_WATCHDOG_ENABLED=false, but _wd_last_ok_monotonic is also stamped by _restart_client (on the disconnect-flap path, which runs before the watchdog-enabled gate), so with the watchdog off one flap sets age and nothing ever refreshes it — age grows unbounded past the threshold and /ping returns 503 on a live connection, spuriously failing the container healthcheck and triggering an autoheal restart after every flap. Fix: gate the staleness branch on the watchdog being enabled — healthy = connected and (not Config["tg_watchdog_enabled"] or age is None or age < threshold) so with the watchdog disabled /ping is a pure connectivity check (matching the intent), and correct the comment to note a flap-restart can stamp age even when the watchdog is off. New test test_ping_watchdog_disabled_stale_age_still_healthy: watchdog off + connected + stale age => 200 ok. Adversarially validated — reverting the gate reds the new test (503) while the watchdog-ON stale-probe test stays green. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>