mirror of
https://github.com/openai/codex.git
synced 2026-10-19 17:28:46 +00:00
## Why Closed WebSocket connections previously triggered immediate reconnects, and successful handshakes reset backoff even when connections were short-lived. ## What changed - Delay automatic reconnects before token refresh or enrollment, and report `Connecting` while waiting. - Use exponential backoff with jitter between half and all of the delay, starting at 5 seconds and capped at 30 seconds. - Retain backoff across short-lived connections and reset it after a connection lasts at least 60 seconds. - Interrupt the reconnect delay on shutdown, auth owner invalidation, or enable/disable changes, including an immediate disable/enable pair. ## Testing Add connection tests for delayed token refresh, backoff retention and reset, explicit re-enabling, and prompt shutdown. Update retry tests to check jitter bounds, saturation during sustained failures, and backoff retention after a successful handshake. GitOrigin-RevId: 0b9055ff64ff7d96f2d974b73ced8d4ffd02ac9e