Skip to content

Studio: Hub caller boundary follow-ups deferred from #10076 #10147

Closed

Description

@danielhanchen

#10076 converted around twenty five Hub read call sites to the three-state token (str / None = ambient allowed / False = forced anonymous) and closed the cache-backed reads that let an API-key caller borrow the operator's ambient credential. Three things were deliberately left out of that PR. Recording them here so they get their own review rather than riding along at the end of a long one.

1. The sentinel authenticates the caller class, not the credential

Every guard added in #10076 keys on is_anonymous(hf_token), which is only False when the caller sent no token at all. An API key that sends any token-shaped string is no longer the sentinel, so it takes the disk fast paths: cached dataset previews, the chat template walk, the config and audio probes, the GGUF listings.

Fixing this means establishing that the supplied credential can actually reach the named repository before any cache-backed read, which is a Hub round trip in front of paths those caches exist to make fast. It is one design applied uniformly, not eight point fixes, and it deserves its own benchmark and review. Raised on #10076 as 3903238054.

2. /api/hub/cached-models and /api/hub/cached-gguf

These enumerate cached repo ids, sizes, capabilities and absolute cache paths to any authenticated caller, including an API key denied the ambient token. Unlike the routes fixed in #10076 they never claim to have authorized anything: they are a local filesystem inventory, siblings of /models-folder, /scan-folders and /hidden-models, none of which take a token. The behaviour predates #10076, which changed only the annotation.

Restricting them is a product decision about what an API key may see of the host, and it would break API and CLI consumers whose purpose is enumerating locally available models. Raised on #10076 as 3902393264.

3. Hub write paths

data_recipe/jobs.py publish and routes/export.py push were scoped out of #10076 from the start: higher blast radius than the read paths, and the same caller-boundary question applies to them.

Also worth a look

tests/test_api_key_expiry.py::test_cache_does_not_bypass_expiry mints a key expiring in 600 ms and validates it before sleeping. Under parallel CI that window elapses and the pre-sleep assertion fails; it flaked on the staging runs for #10076.

Activity

  1. Souravrajvi0 commented on Sep 3, 2026

    @Souravrajvi0
    Contributor

    Taking this in slices. First one is the flaky expiry-cache test:

    Write paths, cache credential verification, and the cached-models product question stay for later PRs.

  2. Souravrajvi0 commented on Sep 3, 2026

    @Souravrajvi0
    Contributor

    Second slice (Hub write paths):

    The flaky expiry-cache test is still #10260. Cache credential verification and the cached-models product question remain.

  3. Souravrajvi0 commented on Sep 3, 2026

    @Souravrajvi0
    Contributor

    Third slice (credential verification before cache-backed reads):

    Earlier slices: #10260 (flaky expiry test), #10263 (write paths). The cached-models / cached-gguf product question is still open.

  4. Souravrajvi0 commented on Sep 3, 2026

    @Souravrajvi0
    Contributor

    Fourth slice (cached inventory product call, implemented as: API keys do not see the host listing):

    Earlier slices: #10260 (flaky test), #10263 (writes), #10264 (cache credential verification).

  5. danielhanchen commented on Oct 10, 2026

    @danielhanchen
    MemberAuthor

    Fixed! Sorry on the delay. All four follow-ups have landed: an explicit token now has to reach the repo before it can read the host's cached copy (#10264, refined in #11026 so an offline install can still use its own cache), the cached model listings keep the inventory but swap host paths for opaque references when an API key asks (#11026), dataset publish and export push refuse an API key with no token instead of falling back to the host credential (#10142, plus the converter side in #10263), and the expiry cache test no longer races the wall clock (#10952).
    To update: Unsloth Desktop will have an update banner. For Studio, use unsloth studio update. For Docker, use docker exec <container> unsloth-studio-update. Reopen if it still happens.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions