Skip to content

Fix Hub download token boundary (clean replacement) - #7413

Closed
Imagineer99 wants to merge 2 commits into
unslothai:mainfrom
Imagineer99:fix/pr7177-clean-history
Closed

Imagineer99 wants to merge 2 commits into
unslothai:mainfrom
Imagineer99:fix/pr7177-clean-history

Conversation

@Imagineer99

Copy link
Copy Markdown
Member

Summary

Supersedes #7177 with the same request-scoped authentication fix on a clean, current-main history.

  • enforce request-scoped Hugging Face authentication for Hub download and metadata paths
  • scrub ambient worker credentials when a request omits X-Unsloth-HF-Token
  • pass token=False for anonymous model, GGUF, dataset, formatting, seed, and dataset-card advisory calls
  • preserve explicitly supplied request tokens through every covered path

Why this replacement exists

The original branch still contains the reconcile-history merge. This replacement is the exact final #7177 patch transplanted onto current main, without the unrelated ancestry.

Validation

  • stable patch ID exactly matches the final Fix Hub download token boundary #7177 patch
  • 164 targeted Hub, seed, dataset, model-metadata, and picker token-boundary tests passed
  • git diff --check
  • one commit, zero merge commits

@Imagineer99

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 👍

Reviewed commit: afa2cbc501

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@Imagineer99
Imagineer99 marked this pull request as ready for review July 29, 2026 11:03

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cd61f0f195

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +686 to +690
const preparedToken = await prepareHfTokenForUse(hfToken);
if (!preparedToken.proceed) {
throw new Error("Model load cancelled.");
}
hfToken = preparedToken.token;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Reuse the prepared token for GGUF metadata

When loading a GGUF whose diffusion status is not already known, this unconditional preparation validates the saved token, and performLoad immediately calls prepareHfTokenForUse again before fetchGgufStagedMetadata. For a valid token, every such load therefore makes two sequential /api/hub/token/validate requests, adding avoidable load latency and consuming validation rate limits; pass the already prepared hfToken into the metadata request instead of preparing it again.

Useful? React with 👍 / 👎.

@Imagineer99

Copy link
Copy Markdown
Member Author

Superseded by #10076, which extracts the remaining Hub metadata and progress token-boundary behavior onto current main. The worker and download boundary is already covered by #8433. Closing this stale, conflict-heavy branch in favor of the focused replacement.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants