Skip to content

fix: retry polling on HTTP/2 GOAWAY connection errors#817

Merged
yoon-park-rl merged 1 commit into
mainfrom
yoon/goaway-connection-retry
Jul 10, 2026
Merged

fix: retry polling on HTTP/2 GOAWAY connection errors#817
yoon-park-rl merged 1 commit into
mainfrom
yoon/goaway-connection-retry

Conversation

@yoon-park-rl

Copy link
Copy Markdown
Contributor

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.

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>
@yoon-park-rl yoon-park-rl requested a review from gautam-rl July 10, 2026 19:02
@yoon-park-rl yoon-park-rl merged commit b0cc07c into main Jul 10, 2026
7 checks passed
@yoon-park-rl yoon-park-rl deleted the yoon/goaway-connection-retry branch July 10, 2026 19:18
@stainless-app stainless-app Bot mentioned this pull request Jul 10, 2026
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants