You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(stream): honor server retry: hint, fall back to exp backoff
Reconnect previously used pure exponential backoff (2/4/8/16/30s)
and ignored the server's `retry: 3000` SSE field. Brief network
hiccups got 30s of needless downtime before the 5th reconnect.
Hybrid policy:
- Honor the server's retry: hint for the first 3 reconnect attempts
(default 3 s, updated whenever the server emits a new value
mid-stream).
- After 3 sustained failures the issue is probably structural
(server down, auth changed, etc.), so switch to exponential
backoff anchored on the hint, capped at 30 s.
Also reset reconnect_attempts to 0 after a successful stream so a
graceful server close doesn't carry forward stale failure counts.
_parse_sse now surfaces `retry:` lines as a synthetic
("__retry__", int_ms) tuple — _stream_loop intercepts them, updates
self._retry_ms, and continues without dispatching to handlers.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
0 commit comments