fix: retry polling on HTTP/2 GOAWAY connection errors#817
Merged
Conversation
APITimeoutError is a subclass of APIConnectionError, so the previous except clauses caught timeouts but not bare APIConnectionError, which is what httpx raises when an HTTP/2 GOAWAY frame drops the connection mid-poll. Catch APIConnectionError instead so GOAWAY-interrupted polls continue retrying rather than surfacing as APIConnectionError to callers. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
gautam-rl
approved these changes
Jul 10, 2026
Merged
gautam-rl
added a commit
that referenced
this pull request
Jul 10, 2026
…rgin Long-poll helpers forwarded timeout_seconds=remaining (often well above what the server honors) and left the client read timeout at the global 30s default. Cap the forwarded timeout_seconds at the server clamp (30s status, 25s exec) and set a per-request read timeout of server_hold + 5s so the client is never the party that aborts a long-poll. Defensive hygiene: this does not by itself eliminate held-stream cancels. Those are server-initiated (the h2 stream idle timeout racing the long-poll clamp) and are fixed server-side. Pairs with #817. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
APITimeoutError is a subclass of APIConnectionError, so the previous except clauses caught timeouts but not bare APIConnectionError, which is what httpx raises when an HTTP/2 GOAWAY frame drops the connection mid-poll. Catch APIConnectionError instead so GOAWAY-interrupted polls continue retrying rather than surfacing as APIConnectionError to callers.