← Back to Pull requests

fix: make update_pythons.py survive GitHub API rate limits #2997

Closed
unknown closed this pull request without merging on Sep 27, 2026 09:35 UTC
View on GitHub
unknown unknown commented on Sep 23, 2026 16:10 UTC
Author

The weekly Update dependencies job fails whenever the hosted runner's unauthenticated GitHub API budget (60 requests/hour per IP) is used up: bin/update_pythons.py fetches the GraalPy and Python-Apple-support release lists with bare requests.get() and raises on the first 403. Scheduled runs 35567370482 (2026-09-21) and 33363160761 (2026-08-31) both died this way in "Run update: python configs", so the 09-21 run produced no update and the 08-31 miss needed manual dispatches on 09-01/09-02.

The sibling scripts in the same nox session (update_virtualenv.py, update_python_build_standalone.py) already use cibuildwheel.extra.github_api_request, which is meant to sleep until x-ratelimit-reset and retry. That branch has never worked: it computes the wait as reset_time - int(e.headers.get("date", 0)), and Date is an RFC 2822 string, so it raises ValueError on every rate-limited response (extra.py:78, since 1638641 / #2002).

This PR routes both calls in update_pythons.py (:123, :380) through github_api_request, computes the wait from time.time() instead of the Date header, and adds a unit test for the retry path (it fails on main with the ValueError above).

Reproduction: exhaust the unauthenticated budget from your IP, then run the script.

for i in $(seq 60); do curl -s -o /dev/null "https://api.github.com/repos/oracle/graalpython/releases?per_page=1"; done
uv run bin/update_pythons.py --force

  • main: requests.exceptions.HTTPError: 403 Client Error: rate limit exceeded for url: https://api.github.com/repos/beeware/Python-Apple-support/releases

  • main + only the update_pythons.py change: ValueError: invalid literal for int() with base 10: 'Wed, 23 Sep 2026 16:01:43 GMT' at cibuildwheel/extra.py:78

  • this branch: Github rate limit exceeded. Waiting for 3209 seconds. and the script continues after the reset.
  • nox -s update_pins on this branch via workflow_dispatch on my fork: 35886486982, all steps green. prek -a passes.

    The release checklist depends on this job (docs/contributing.md: "Autoupdates are run weekly, with a PR being raised with any changes as required, so just make sure the latest one is merged before continuing").

    Written with Claude Code; the reproduction, the test and the fork run were executed as described.

    🤖 Generated with Claude Code

    Diff: 365 lines (+273 / -92) across 4 files Reviewer: glaziermag Review duration: 5364m
    All Vouch review confidence checks passed
    Residual risk 0.17 = Change Risk (0.43) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.43 · 365 lines diff across 4 files
    0.43
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.353
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #2997"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 42.7% (MEDIUM) · Higher = larger blast radius
    42.7%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 16.9% · Safe to merge
    16.9%