Skip to content

Retry CDN origin errors, network failures and timeouts - #1

Merged
hey-research-lab merged 1 commit into
mainfrom
fix/retry-transient-edge-errors
Oct 20, 2026
Merged

hey-research-lab merged 1 commit into
mainfrom
fix/retry-transient-edge-errors

Conversation

@hey-research-lab

Copy link
Copy Markdown
Owner

Problem

The first scheduled Snapshot run (run 39215293192, 2026-10-19) failed after 26 minutes, 500 of 4,842 detail reads in, on one answer:

hey-data: HEY answered 520. — retry after 60s
Process completed with exit code 6.

520 is what Cloudflare, in front of heyresearch.xyz, answers when the origin errs. politeFetch retried only 429, 500, 502, 503 and 504, so a single transient edge error ended a run of thousands of requests. A thrown network error or timeout was not retried either. The weekly release has never been produced.

What changed

  • src/http.ts: 520–524 join the retryable set and are retried like a 502 (the server's retry-after, else 30 s), within --max-retries. A network failure or timeout is retried the same way. An oversized body is still not retried. Every request hey-data makes is a GET, so a retry is safe.
  • .github/workflows/snapshot.yml: the run passes --max-retries 3.
  • test/http.test.ts: four new tests:
    • 520/522/524 are retried;
    • the last 520 is returned once the retries run out;
    • a network failure is retried, then thrown;
    • an oversized body is not retried.
  • test/generate.test.ts: the three resume tests stop their runs with maxRetries: 0. They inject one network failure to produce a stopped run, and with the default single retry that failure would now be absorbed instead of stopping the run.
  • README, --help text and CHANGELOG describe the new retry set.

Validation

  • pnpm scan, pnpm lint, pnpm typecheck, pnpm build, prettier --check .: pass.
  • pnpm test: 42 passed. Three of the new tests fail against main's src/http.ts and pass with this change. The fourth, the oversized-body test, guards behaviour that is already correct.
  • A live run against heyresearch.xyz with the built CLI finished with exit 0 in 21 min 50 s: generate --no-details --evidence-limit 0 --max-retries 3 wrote 4,851 projects, 4,353 ships and 26,281 changes, with totals checks passing. That run met no transient error, so it shows the change breaks nothing; the retry paths themselves are covered by the unit tests.

Limitations

  • More retries cannot outlast a longer outage. The run still stops with exit 6, and the existing resume_from_run input resumes it from the uploaded partial work.
  • The full schedule (details on, about 3 hours) was not re-run here; the next Monday schedule, or a manual dispatch after merge, is the end-to-end check.

The first scheduled Snapshot run (2026-10-19) stopped after 26 minutes,
500 of 4,842 detail reads in, on a single 520 from the CDN in front of
heyresearch.xyz: 520-524 were not in the retryable set, and a thrown
network error or timeout was never retried either.

- 520, 521, 522, 523 and 524 are retried like a 502, with the server's
  retry-after or the 30 s default, within --max-retries.
- A network failure or a timeout is retried the same way; an oversized
  body is still not. Every request is a GET.
- The Snapshot workflow passes --max-retries 3.
- The resume tests stop their runs with maxRetries 0, so one injected
  failure still stops the run they resume.
@hey-research-lab
hey-research-lab marked this pull request as ready for review October 20, 2026 08:43
@hey-research-lab
hey-research-lab merged commit 5c3f305 into main Oct 20, 2026
1 check passed
@hey-research-lab
hey-research-lab deleted the fix/retry-transient-edge-errors branch October 20, 2026 08:43
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.

1 participant