Retry budget for transient arXiv failures may be shorter than the failure window

Author: AfonsoZhangCreated Sep 26, 2026Updated Sep 26, 2026

Splitting this out of #447, which fixes the classification of arXiv 406 (transient, not permanent). This issue is about the retry budget for that class of response — a judgement call I do not think a drive-by PR should make.

Current behaviour

tools/verify_papers.py:

python
def backoff(attempt: int) -> float:
    return min(2 ** attempt + random.uniform(0, 1), 30)

_verify_arxiv_batch_with_retry() runs 3 attempts, so the worst case before a batch is split is roughly 1 + 2 + 4 seconds plus jitter — under 10 seconds of waiting. tools/arxiv_fetch.py::_fetch_atom() is separate and coarser: 5 * attempt over 3 attempts, so about 15 seconds.

Why it may be too short

While debugging #447 I saw export.arxiv.org return 406 to urllib consistently over several minutes — repeated single-ID and search calls all failed in that window, while curl on the same URL succeeded. A ~10 second budget does not outlast a window like that, so the batch still ends up split and re-attempted, and arxiv_fetch.py still raises.

I have no evidence about what sets the window length, and no reproducer on demand (later the same day, 30 rapid calls all returned 200), so I cannot say what budget would be enough. That is exactly why this is a question rather than a patch.

Options, roughly in order of cost

  1. Leave it. verify_pending is an honest answer, and callers can re-run.
  2. Honour Retry-After when present — I never captured 406 response headers, so whether arXiv sends one is unknown and worth a look by someone who can reproduce it.
  3. Raise the attempt count or the cap for this specific class (e.g. transient-but-not-429), keeping the current budget for ordinary network errors.
  4. Treat a persistent transient failure as a cached negative for a short TTL, so a batch does not re-pay the full budget on every call in a run.

Happy to implement whichever direction you prefer; I did not want to pick one on a guess about the cause.

Source: wanshuiyin/Auto-claude-code-research-in-sleep