Repository navigation
feat(http): max_backoff caps and spreads 429 retries; Retry-After as HTTP date - #146
oly-agents[bot] wants to merge 3 commits into
Conversation
…HTTP date A 429 with max_backoff set waits the longer of Retry-After and 2^attempt seconds, capped at max_backoff. Without max_backoff the wait is unchanged, except that 2^attempt no longer overflows at high attempt counts. Retry-After is read as delay-seconds or an HTTP-date (RFC 9110 10.2.3). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Snehal Ahire <snehal.ahire@pattern.com>
|
👀 Reviewing |
There was a problem hiding this comment.
Argus reviewed max_backoff, Retry-After parsing (seconds and HTTP date), the saturating exponential, how it plugs into call() (attempt starts at 1, nil response → retry_delay), and the new tests. go test ./internal/pkg/pipeline/task/http/ passes. rate-gate sends Retry-After as integer seconds, so the switch to strconv.Atoi does not break the main consumer. With max_backoff unset, behavior is unchanged apart from the documented HTTP-date and overflow fixes.
PR body links to "create PR" pages, not the related PRs
Severity: Low
Under Related PRs, the body links to .../pull/new/feat/async-fair-share and .../pull/new/feat/keepa-async-per-consumer. Those are compare pages for opening a PR. The PRs already exist, so the cross-links the task asks for point to the wrong place.
Fix: Replace them with https://github.com/patterninc/keepa-central-server/pull/172 and https://github.com/patterninc/rate-gate/pull/147.
…ntial With max_backoff set, a 429 now waits a uniform random time from Retry-After up to min(max(Retry-After, 2^attempt), max_backoff), so throttled workers stop retrying in lockstep. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Snehal Ahire <snehal.ahire@pattern.com>
|
Updated the PR description: the Related PRs links now point to keepa-central-server#172 and rate-gate#147 instead of the "create PR" compare pages. The description also covers the jittered 429 wait. |
There was a problem hiding this comment.
Argus follow-up on 83ad6ae..aa1742e: the new commit adds jitter to the 429 backoff and switches the tests to bounds checks. go test ./internal/pkg/pipeline/task/http/ passes.
Earlier comments
- ✅ addressed: 429 backoff has no jitter, so throttled workers still retry in lockstep. When
max_backoffis set, the wait is nowfloor + jitter(ceiling-floor+1), withfloor = min(Retry-After, ceiling). Becauseceiling ≥ floor, the argument torand.Nis always ≥ 1 for normal values. The pinned-draw test and the spread test cover both bounds. - ✅ addressed: PR body links to "create PR" pages, not the related PRs. The body now links keepa-central-server#172 and rate-gate#147.
New this round
- 1 inline comment: a very large
Retry-Afteroverflowstime.Duration, and the jitter path then panics inrand.N(I reproduced it).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Snehal Ahire <snehal.ahire@pattern.com>
There was a problem hiding this comment.
Argus follow-up on aa1742e..6985681: the new commit clamps delay-seconds Retry-After in parseRetryAfter and adds two TestBackoff cases. go test -race and go vet pass for ./internal/pkg/pipeline/task/http/.
Earlier comments
- ✅ addressed: Huge
Retry-Afteroverflows and makes the jitter panic. Delay-seconds now saturates atmath.MaxInt64/time.Secondseconds, sofloorandceilingstay non-negative and the argument torand.Nis always ≥ 1. The HTTP-date path was already safe, becausetime.Time.Subsaturates. The new cases cover the saturated wait with and withoutmax_backoff. The untyped constant fitsinton the amd64 and arm64 release targets. - ✅ addressed (earlier round): 429 backoff has no jitter, so throttled workers still retry in lockstep.
- ✅ addressed (earlier round): PR body links to "create PR" pages, not the related PRs.
New this round
No new findings.
|
Oly has paused automatic upkeep on this PR. No human has commented, reviewed, or pushed here in 2 workdays (Monday to Friday, UTC). Until someone does, Oly will not run merge-conflict checks or fixes, automatic Argus reviews, or PR-feedback runs on this PR. To resume, comment, leave a review, push a commit, or comment |
Requested by: snehal.ahire@pattern.com
Oly issue: https://oly.pattern.com/issue/01a23591-7ca8-7125-8890-60fedde1bcdd
Description
Adds
max_backoffto the http task and readsRetry-Afteras either seconds or an HTTP date. keepa-central's async Keepa pipelines need it to retry rate-gate 429s (ClickUp DATA-12007, https://app.clickup.com/t/1dfq9k65mjz).Why it's needed. The old 429 backoff was
2^attemptseconds with no cap, or exactlyRetry-Afterwhen sent. Rate-gate'sRetry-Afteris one token's refill time (1–4 s), so many workers behind one bucket all retry together and give up after about 30 s. And2^attemptgrows past an hour at the retry counts needed to wait out a busy bucket.What changes:
max_backoffis new and optional. When set, a 429 waits a uniform random time fromRetry-Afterup to the longer ofRetry-Afterand2^attemptseconds, capped atmax_backoff. The randomness keeps workers throttled by one bucket from retrying in lockstep. Withmax_retries: 30andmax_backoff: 60s, a throttled call keeps retrying for about 15 minutes.max_backoff, behavior is unchanged: a 429 waits exactlyRetry-After, or2^attemptseconds. The one difference is that2^attemptnow saturates instead of overflowing past attempt 30.Retry-Afternow also accepts an HTTP date (RFC 9110 10.2.3). Before, a date was silently ignored and the task retried with no wait.Retry-Aftersaturates instead of overflowingtime.Duration. An overflow used to wrap negative, so the retry ran with no wait; withmax_backoff's jitter it would panic.retry_delay.Proxy and TLS: no change needed.
scheme: httpwithinsecure_tls: truealready works withoutca_certificate;errCertPathonly applies toscheme: https. I checked this end to end: the real asins pipeline, loaded by caterpillar, ran against a local fake rate-gate. Calls carried the scope headers, got 429 withRetry-After, retried and finished.Related PRs
max_backoff)The keepa-central pipelines only set
max_backoffwhen their rate-gate flag is on. This PR must be released, and the caterpillar image Heimdall runs updated, before that flag is turned on. An older caterpillar ignores the field (no strict YAML decode) and falls back to the uncapped backoff.Types of changes
Checklist
internal/pkg/pipeline/task/http/README.md)retry_test.go: seconds and dateRetry-After, past date, missing or bad header, overflow of the attempt count and ofRetry-After, cap, jitter bounds and spread, non-429.)go test ./...passes.go vetreports only existing copy-lock findings incompress,archiveandfile; nothing inhttp.Blockers
caterpillar-task-small) is outside this repo. Someone has to cut the release and update the image before keepa-central'sKEEPA_FLAG_ASYNC_FAIR_SHAREgoes on.🤖 Generated with Claude Code