Retry transient network errors (RemoteDisconnected) in github_utils (#48124)
* Retry transient network errors (RemoteDisconnected) in github_utils
`http.client.RemoteDisconnected` is a `ConnectionError` subclass, not a
`urllib.error.URLError`, so it was escaping both except clauses and
producing an unhandled traceback in CI (seen in run 31988833378).
Two changes:
- `_request`: catch `ConnectionError` and re-raise wrapped in `URLError`
so all network failures surface as a single consistent type.
- `github_request`: retry `URLError` with exponential backoff (1 s,
2 s, … capped at 60 s) instead of failing hard immediately, since
RemoteDisconnected / connection resets are almost always transient.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* Retry transient network errors (RemoteDisconnected) in github_utils
`http.client.RemoteDisconnected` is a `ConnectionError` subclass, not a
`urllib.error.URLError`, so it was escaping both except clauses and
producing an unhandled traceback in CI (seen in run 31988833378).
Two changes:
- `_request`: catch `ConnectionError` and re-raise wrapped in `URLError`
so all network failures surface as a single consistent type.
- `github_request`: retry `URLError` with exponential backoff (1 s,
2 s, … capped at 60 s) instead of failing hard immediately, since
RemoteDisconnected / connection resets are almost always transient.
Add tests covering the new retry behaviour and the ConnectionError
normalization in `_request`.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* Clarify connection error test names and explain URLError vs ConnectionError
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* Rename test and simplify comments per review
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* Fix line length formatting
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* Drop RequestTest class, fold tests into GithubRequestTest
Per review feedback: no need for a separate test class — the two new
tests for connection error retry behaviour sit naturally alongside the
existing GithubRequestTest cases.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* Move _request normalization tests into GithubRequestTest
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
---------
Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>