Skip to content

Studio: don't let a malformed HF token empty the model picker's Recommended list - #7266

Merged
Imagineer99 merged 1 commit into
unslothai:mainfrom
oobabooga:worktree-picker-hf-token-sanitize
Jul 20, 2026
Merged

Imagineer99 merged 1 commit into
unslothai:mainfrom
oobabooga:worktree-picker-hf-token-sanitize

Conversation

@oobabooga

Copy link
Copy Markdown
Member

The "Select model" picker's Recommended list calls Hugging Face's listModels from the browser with the saved token. A malformed token (anything not starting with hf_) makes @huggingface/hub throw before it even sends a request, and the picker renders that failure as "No models found". The Hub page already runs the token through hfApiToken() first, so it stays populated; the picker passed the raw token, so only the picker broke.

Fix

Route the picker's accessToken through hfApiToken() too, matching the Hub page. A malformed token now falls back to anonymous browsing, so the public Unsloth listing still shows.

The gap dates to #6364/#6605, when the picker adopted the shared search stack but the hfApiToken() sanitizer was wired only into the Hub page. Not a regression from #7261.

Verification

tsc -b and eslint on the changed file pass. A valid or even expired hf_ token was never affected, since HF serves the public listing anonymously either way; only a non-hf_ token hit this.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the HubModelPicker component to import and use the hfApiToken helper function for sanitizing the Hugging Face access token, aligning its behavior with the Hub page. There are no review comments, so no feedback is provided.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@Imagineer99

Copy link
Copy Markdown
Member

Tested manual repro of the issue and found that this commit successfully fixes the issue.

image image

@Imagineer99
Imagineer99 merged commit c9d479f into unslothai:main Jul 20, 2026
33 of 36 checks passed
danielhanchen added a commit to Sneakr/unsloth that referenced this pull request Jul 21, 2026
Resolves the pickers.tsx import conflict from unslothai#7266 (malformed HF token must
not empty the Recommended list). The PR consolidated the picker imports onto
the @/features/hub barrel, so the resolution keeps that structure and adds
main's new hfApiToken there (also re-exported from the hub barrel) rather than
reintroducing the deep per-module import paths. The accessToken = hfApiToken(
hfToken) fix from unslothai#7266 merges in unchanged.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants