Repository navigation
fix(studio/hub): apply repo_id length limit per segment, not whole string (#6946) - #6953
Conversation
…ring is_valid_repo_id() applied the 96-char limit to the full "namespace/repo_name" string, so a repo with a valid (<=96 char) name but a long combined id was falsely rejected. Match huggingface_hub.validate_repo_id by checking the length per segment instead. Fixes unslothai#6946.
|
Warning Gemini encountered an error creating the review. You can try again by commenting |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c245dbba46
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
@codex review |
|
Codex Review: Didn't find any major issues. Keep it up! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6e12062058
ℹ️ 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".
| if _state_filename_fits(longest_variant_key): | ||
| return base | ||
| digest = hashlib.sha256(base.encode("utf-8")).hexdigest()[:32] | ||
| return f"{repo_type}s--sha256-{digest}" |
There was a problem hiding this comment.
Keep hashed state keys out of the raw repo namespace
When a newly accepted long repo ID is hashed here, the resulting key can collide with a legitimate short repo ID named sha256-<same 32 hex chars>: repo_cache_basename("model", "sha256-...") also produces models--sha256-.... In that scenario, cancelling, scanning, or deleting either repo reads or removes the other's manifest/marker through manifest_path, marker_path, and the variant iterators, which can misreport partial downloads or purge the wrong state. Use a hash prefix that raw repo IDs cannot generate, such as one containing an impossible --- separator, or escape raw keys before adding the hash namespace.
Useful? React with 👍 / 👎.
What
is_valid_repo_id()instudio/backend/hub/utils/paths.pyapplied the 96-character limit to the entirenamespace/repo_namestring:This falsely rejects repos whose name segment is within the 96-char limit but whose combined
namespace/repo_nameexceeds 96 chars. HuggingFace Hub's ownhuggingface_hub.validate_repo_id(regex^(\b[\w\-.]+\b/)?\b[\w\-.]{1,96}\b$) caps the repo-name segment, not the whole string, so such repos load fine directly viahuggingface_hubbut are blocked in Studio.Example from the issue — 100 chars total, name segment 92 chars (valid):
DavidAU/Qwen3.6-40B-Claude-4.6-Opus-Deckard-Heretic-Uncensored-Thinking-NEO-CODE-Di-IMatrix-MAX-GGUFFix
Move the length check inside the per-segment validation (alongside the existing regex and reserved-name checks), so the 96-char limit is applied to each segment rather than the full string. Minimal, behavior-preserving for every previously-valid id.
Verification
meta-llama/Llama-3-8B,gpt2),.gitsuffix, and 3-segment ids behave unchanged.Fixes #6946
🤖 Generated with Claude Code