mirror of
https://github.com/nesquena/hermes-webui.git
synced 2026-07-16 12:40:18 +00:00
78dab75fc3
Greptile review caught that /api/session handler calls _diag.maybe_start() at entry and _diag.finish() only on the success path. Three exit paths leaked the watchdog entry: 1. early-return when sid is missing (400) 2. early-return when session is not visible to active profile (409) 3. early-return when session not found (404) 4. the existing 'except KeyError:' branch at the bottom of the handler Without _diag.finish() the watchdog's _watchdog_pending dict held the request until the 5s slow-request timeout fired _on_timeout and emitted a spurious 'Slow WebUI request still running' log. The pending dict also stayed unbounded by in-flight count. Fix: every early-return path now calls _diag.finish() before returning; the except KeyError branch calls it once at entry so all paths through it are covered. finish() is idempotent (no-ops if already called).