- active_ws_connections was incremented on entry to _ws_proxy_handler
but only decremented in the finally around the relay loop, so every
early return (instance resolve failure, connect-retry exhaustion)
leaked a permanent +1 and the stats counter grew monotonically under
connect failures. Maintain the counter with a try/finally around the
entire proxy body so every exit path decrements it.
- The instance re-resolution added to the HTTP and WebSocket retry
loops was unguarded: if provisioning fails mid-retry, the exception
escaped as an unhandled 500 / raw ASGI error. Return the existing
502 responses (HTTP) or close 4003 (WebSocket) instead.
- Document the recently added TERMINALS_STATUS_CACHE_TTL,
TERMINALS_TOKEN_CACHE_TTL, TERMINALS_WS_COMPRESSION, and
TERMINALS_ACCESS_LOG settings in the README configuration table.
Claude-Session: https://claude.ai/code/session_01XvuMBS4XMccRrCwNxfoPsu
Co-authored-by: Claude <noreply@anthropic.com>