fix(install): resolve version via redirect to avoid GitHub API rate limits#1414
Merged
pszymkowiak merged 1 commit intortk-ai:developfrom Apr 23, 2026
Merged
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
The installer failed with "Failed to get latest version" when the GitHub REST API returned 403 due to the anonymous rate limit (60 req/hour, shared across NAT/CI). Switch the primary lookup to the `/releases/latest` 302 redirect, which doesn't count against the API quota. Keep the API call as a fallback, and add a RTK_VERSION escape hatch for pinning. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2ac884c to
f67ae3b
Compare
pszymkowiak
approved these changes
Apr 23, 2026
Collaborator
pszymkowiak
left a comment
There was a problem hiding this comment.
Tested the redirect approach live — curl -sI https://github.com/rtk-ai/rtk/releases/latest | grep location: returns the tag cleanly, full parsing pipeline extracts v0.37.2 correctly with no trailing chars.
The fallback to REST API and the RTK_VERSION escape hatch are both well-placed. Fixes a real blocker for CI environments and shared NATs hitting the 60 req/hr anonymous limit.
LGTM
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
install.shfails withFailed to get latest versionwhen the GitHub REST API returns 403 (anonymous rate limit of 60 req/hour, easily hit from shared NATs, CI, or corporate networks).https://github.com/<repo>/releases/latest302 redirect, whoseLocationheader contains the tag — no API quota consumed.RTK_VERSIONenv var as an escape hatch to pin a specific version (the error message now points users to it).Problem
When unauthenticated requests exceed 60/hour (GitHub's documented rate limit for anonymous API access), the API returns HTTP 403. With
curl -f, that produces an empty pipeline result, and the installer bails withFailed to get latest version. Users sharing an outbound IP (CI, NAT, coworking spaces) can trivially exhaust the quota for everyone behind that IP.Fix
Primary: parse the 302 redirect from
github.com/<repo>/releases/latest. This doesn't hit the API at all and has no documented rate limit.Fallback: if the redirect parsing yields nothing (unexpected GitHub change, network oddity), fall back to the original API call with a warning.
Escape hatch:
RTK_VERSION=v0.37.1 curl -fsSL ... | shlets users pin a version and skip both lookups entirely.Verification
sh -n install.sh✅rtk-ai/rtk:v0.37.1✅RTK_VERSIONoverride path tested by setting the env var and short-circuitingget_latest_version.Test plan
curl -fsSL https://raw.githubusercontent.com/rtk-ai/rtk/master/install.sh | shinstalls successfully on macOS/bin/sh= dash)RTK_VERSION=v0.37.0 curl -fsSL ... | shinstalls v0.37.0 specificallyRelated
latesttag, fixed in v0.28.0).