{{ message }}
Repository navigation
Commit 2173763
Bound and classify GitHub API retries (#207)
* Bound and classify GitHub API retries
The retry transport is now the only retry layer, with a bounded cost:
- Real timeouts: 10s dial, 10s TLS handshake, 30s response headers,
60s per request. A stalled connection no longer hangs the run.
- At most 3 attempts per request, full-jitter backoff (1s base, 8s cap),
and a 60s retry-wait budget shared by the whole run.
- Retry-After (seconds or HTTP date) and X-RateLimit-Reset are honored
only when the wait fits the remaining budget; otherwise the caller gets
the rate-limit answer at once.
- A per-host circuit breaker: after 3 requests in a row exhaust their
retries, later requests to that host fail at once.
- Untrusted TLS certificates and 401/403/404/409/422 are answers, not
outages, and are never retried.
- Batches are split only on query-level GraphQL errors. An outage or rate
limit rejected every half alike, so a 50-pin batch used to fan out into
99 retried requests.
- The anonymous SSO-fallback client shares the same transport and budget.
Requests that end without an answer return UnknownOutcomeError, and
IsTransient follows the transport's rules.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
* Retry GitHub API failures patiently, as a CLI can
A CLI run can wait out a short outage or rate limit, so retry like one:
- Up to 8 attempts per request, with exponential full-jitter backoff
capped at 30s per wait.
- Keep retrying until GitHub has given no answer for 5 minutes; any
answer resets that window. Retry-After and rate-limit resets are waited
out when they fall inside it, with a "waiting until HH:MM UTC" line.
- Drop the per-host circuit breaker and the 60s run budget.
- Show each wait on stderr, throttled to one line per cause, e.g.
"GitHub API unavailable (503 Service Unavailable); retrying in 20s,
attempt 3/8", so a long wait doesn't look hung.
Timeouts, the single retry layer, no batch splitting on outages, and the
answer/outage taxonomy are unchanged.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
* Retry patiently in CI, fail fast in a terminal
In CI (CI=true or GITHUB_ACTIONS=true) keep the patient policy: 8
attempts, backoff up to 30s, a 5-minute no-answer window, and rate-limit
waits inside it. Elsewhere, retry a blip for a few seconds (3 attempts,
backoff up to 2s, a 10s window) and report a longer rate limit's reset
time instead of waiting for it. runPolicy is the one place that decides.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
* Honor Retry-After on server errors
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
* Retry GraphQL rate-limit rejections
GitHub rejects a GraphQL query over its rate limit with HTTP 200 and a
RATE_LIMITED error. Treat that as a rate limit in the transport, under the
same CI and terminal policies, rather than as an answer.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>1 parent 1370c18 commit 2173763
14 files changed
Lines changed: 981 additions & 342 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| 15 | + | |
14 | 16 | | |
15 | 17 | | |
16 | 18 | | |
| |||
818 | 820 | | |
819 | 821 | | |
820 | 822 | | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
| 857 | + | |
| 858 | + | |
821 | 859 | | |
822 | 860 | | |
823 | 861 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
| |||
125 | 126 | | |
126 | 127 | | |
127 | 128 | | |
| 129 | + | |
| 130 | + | |
128 | 131 | | |
129 | 132 | | |
130 | 133 | | |
| |||

0 commit comments