Commit graph

3 commits

Author SHA1 Message Date
pre-commit-ci[bot]
522b156a34 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2026-05-31 07:05:31 +00:00
Daniel Han
d8c3784aff Studio: fail closed on bad redirect tag and report both failures (PR #5886)
Harden the tokenless llama.cpp release-redirect fallback:

- Guard the redirect-resolved tag with is_release_tag_like so an unexpected
  redirect target fails closed to the REST/source path instead of building a
  404-bound download URL.
- When the REST listing and the redirect both fail, raise a chained error that
  names both causes instead of only the REST 403.
- Drop a no-op except branch in the specific-tag path and clarify the
  synthetic-release comment.

Add negative tests: both paths failing, a pinned tag never using the redirect,
a malformed redirect target being rejected, and a real REST asset URL taking
precedence over the synthetic one.
2026-05-31 07:05:01 +00:00
Daniel Han
7e6e2fff09 Studio: fall back to a tokenless release redirect when the llama.cpp REST API is rate limited
unsloth studio update discovers the llama.cpp prebuilt through the GitHub REST
API, which is rate limited to 60 requests per hour per IP for anonymous callers.
Without GH_TOKEN or GITHUB_TOKEN, users on shared, NAT, or cloud IPs hit HTTP 403
and the installer falls back to a slow source build.

Keep the REST API as the primary path. When it is unavailable (for example a
tokenless 403), fall back to resolving the latest upstream release from the
unauthenticated github.com/<repo>/releases/latest redirect and build
deterministic asset download URLs, so the prebuilt path still works with no
token. The redirect is only a fallback and is always unauthenticated.

Scope is narrow: the fallback only applies to the upstream repo plus latest plus
the simple policy path, on platforms whose asset choice is a single deterministic
file. Pinned tags, the Linux CUDA manifest path, the token path, and Windows x64
NVIDIA or AMD asset selection are unchanged.

Add tests covering redirect parsing, REST first resolution, the redirect fallback
on a 403 and on a missing tag, the Windows CUDA opt out, and end to end macOS and
Linux latest resolution when the REST API 403s.
2026-05-31 05:45:26 +00:00