[PR #6141] [MERGED] Launcher: release lists past GitHub's rate limit (disk cache, Kira mirror) #6674

Closed
opened 2026-11-03 06:24:45 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/6141
Author: @ludovic111
Created: 11/1/2026
Status: ✅ Merged
Merged: 11/1/2026
Merged by: @ludovic111

Base: main ← Head: fix/launcher-github-rate-limit


📝 Commits (1)

  • 6a6e34e Launcher: release lists past GitHub's rate limit (disk cache, Kira mirror)

📊 Changes

6 files changed (+535 additions, -10 deletions)

View changed files

📝 launcher/README.md (+9 -0)
📝 launcher/src/backend.rs (+11 -8)
➕ launcher/src/github.rs (+234 -0)
➕ launcher/src/github/tests.rs (+278 -0)
📝 launcher/src/lib.rs (+1 -0)
📝 launcher/src/native_mods.rs (+2 -2)

📄 Description

🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself.

Players behind a shared address (school, dorm, carrier NAT) spend GitHub's 60 anonymous API calls an hour together, and then the launcher says "GitHub's rate limit was reached" and can't install or update.

The launcher's GitHub API reads (release list, launcher tags/releases by tag, commits for native mods) now go through launcher/src/github.rs:

  • Disk cache. Each answer is saved in <data>/cache/github/ and reused for 5 minutes without asking, then revalidated with its ETag. Measured: an anonymous 304 still counts against the hour (curl, 2026-11-01), so the fresh window is what saves calls; three horizon-launcher versions in a row spent 1 call (55 → 54). The ETag saves the download, and is free for CI's HORIZON_GITHUB_TOKEN.
  • Mirror. On a 429, a 403 with GitHub's rate-limit headers (x-ratelimit-remaining: 0 or retry-after), or no connection, Horizon's own repository is read through Kira's read-only mirror https://mcp.playhorizon.dev/github/public (horizon-rust/kira#109, which must deploy first for the fallback to answer; until then the launcher behaves as before plus the cache). HORIZON_GITHUB_MIRROR overrides it; empty disables it. Other repositories (GitHub mods) have no mirror.
  • Both failing. The last saved answer is used; with none, the error names both: "GitHub's rate limit was reached for your network, and Horizon's mirror of GitHub couldn't help either (…). Try again in a few minutes."
  • A plain 403 is no longer reported as a rate limit in backend::get.
  • Asset downloads unchanged and verified: browser_download_url is github.com/…/releases/download/… → 302 to release-assets.githubusercontent.com, no API rate-limit headers.
  • README (Updates) describes it.

Tested

  • src/github/tests.rs (8 tests): ETag kept and sent, 304 → saved copy, fresh window (and a clock set back), rate-limit detection (429 / 403 + headers / plain 403), mirror on rate limit and on no connection, mirror's answer kept, 404 not retried on the mirror, both failing → saved copy else a clear error, no mirror for other repos, corrupt or foreign cache files ignored.
  • Live, isolated dirs (HORIZON_LAUNCHER_HOME etc. in mktemp -d, HORIZON_LAUNCHER_NO_SELF_UPDATE=1): versions ×3 = 1 API call; GitHub broken (HTTPS_PROXY to a dead port) + mirror pointed at kira#109's route running locally against real GitHub → the list loads through it; both dead with a saved copy → the copy; both dead without → the message above.
  • Launcher: cargo fmt --check, cargo clippy --all-targets -D warnings, cargo test (402 + 68 pass).

pr_ready (tools/pr_ready.py --quick on ludovics-mac-mini, against origin/main at e076162fb, 9 min 34 s)

Check Result
Scope ⚠️ 6 files, +535 −10 (about half is the tests file)
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 584 passed
launcher rustfmt ✅
launcher clippy ✅
launcher tests ✅ 402 passed
Parity ➖ 10 affected, to run in CI (--quick)

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/6141 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 11/1/2026 **Status:** ✅ Merged **Merged:** 11/1/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/launcher-github-rate-limit` --- ### 📝 Commits (1) - [`6a6e34e`](https://github.com/horizon-rust/horizon/commit/6a6e34e1ecdd76aeaf4cf2a7e45e10d0815b01c8) Launcher: release lists past GitHub's rate limit (disk cache, Kira mirror) ### 📊 Changes **6 files changed** (+535 additions, -10 deletions) <details> <summary>View changed files</summary> 📝 `launcher/README.md` (+9 -0) 📝 `launcher/src/backend.rs` (+11 -8) ➕ `launcher/src/github.rs` (+234 -0) ➕ `launcher/src/github/tests.rs` (+278 -0) 📝 `launcher/src/lib.rs` (+1 -0) 📝 `launcher/src/native_mods.rs` (+2 -2) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. Players behind a shared address (school, dorm, carrier NAT) spend GitHub's 60 anonymous API calls an hour together, and then the launcher says "GitHub's rate limit was reached" and can't install or update. The launcher's GitHub API reads (release list, launcher tags/releases by tag, commits for native mods) now go through `launcher/src/github.rs`: - **Disk cache.** Each answer is saved in `<data>/cache/github/` and reused for 5 minutes without asking, then revalidated with its ETag. Measured: an **anonymous 304 still counts** against the hour (curl, 2026-11-01), so the fresh window is what saves calls; three `horizon-launcher versions` in a row spent 1 call (55 → 54). The ETag saves the download, and is free for CI's `HORIZON_GITHUB_TOKEN`. - **Mirror.** On a 429, a 403 with GitHub's rate-limit headers (`x-ratelimit-remaining: 0` or `retry-after`), or no connection, Horizon's own repository is read through Kira's read-only mirror `https://mcp.playhorizon.dev/github/public` (horizon-rust/kira#109, which must deploy first for the fallback to answer; until then the launcher behaves as before plus the cache). `HORIZON_GITHUB_MIRROR` overrides it; empty disables it. Other repositories (GitHub mods) have no mirror. - **Both failing.** The last saved answer is used; with none, the error names both: "GitHub's rate limit was reached for your network, and Horizon's mirror of GitHub couldn't help either (…). Try again in a few minutes." - A plain 403 is no longer reported as a rate limit in `backend::get`. - **Asset downloads unchanged and verified:** `browser_download_url` is `github.com/…/releases/download/…` → 302 to `release-assets.githubusercontent.com`, no API rate-limit headers. - README (Updates) describes it. ### Tested - `src/github/tests.rs` (8 tests): ETag kept and sent, 304 → saved copy, fresh window (and a clock set back), rate-limit detection (429 / 403 + headers / plain 403), mirror on rate limit and on no connection, mirror's answer kept, 404 not retried on the mirror, both failing → saved copy else a clear error, no mirror for other repos, corrupt or foreign cache files ignored. - Live, isolated dirs (`HORIZON_LAUNCHER_HOME` etc. in `mktemp -d`, `HORIZON_LAUNCHER_NO_SELF_UPDATE=1`): `versions` ×3 = 1 API call; GitHub broken (`HTTPS_PROXY` to a dead port) + mirror pointed at kira#109's route running locally against real GitHub → the list loads through it; both dead with a saved copy → the copy; both dead without → the message above. - Launcher: `cargo fmt --check`, `cargo clippy --all-targets -D warnings`, `cargo test` (402 + 68 pass). **pr_ready** (`tools/pr_ready.py --quick` on ludovics-mac-mini, against origin/main at e076162fb, 9 min 34 s) | Check | Result | | --- | --- | | Scope | ⚠️ 6 files, +535 −10 (about half is the tests file) | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 584 passed | | launcher rustfmt | ✅ | | launcher clippy | ✅ | | launcher tests | ✅ 402 passed | | Parity | ➖ 10 affected, to run in CI (--quick) | 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 06:24:45 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#6674
No description provided.