Repository navigation
Studio: show every GGUF build when a repo publishes two at one quant - #10556
NilayYadav wants to merge 35 commits into
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
GitHub Actions reproduction + fix verificationReproduced on fresh upstream A/B run — all 6 jobs green (
Before — Same shape on After — Migration audit over a real corpusBecause this changes the identity stored pins resolve by, I keyed a corpus of 537 real GGUF repos (7 916 files) — the most-downloaded, most-liked and trending
Review rounds21 Codex rounds that reported findings, 65 findings, every one reproduced and fixed — the first sixteen by me, two more Daniel picked up with his first push, the next fifteen by @danielhanchen across three pushes (554fe6f, d583c82/f5c490f00, 1986a8c), the six from the round after that by me in 194c23c, the four from the round on 194c23c by me in 0341b34, and the two from the round on 0341b34 by me in d1de868 (the load-path default among them, found by a sweep before the round reported it), the three from the round on d1de868 by me in 97e84f7, the three from the round on 97e84f7 by me in 3408c0f, and the four from the round on 3408c0f by me in 009734e (one of them a regression my previous push introduced), the three from the round on 009734e by me in fd168b3, and the two from the round on fd168b3 by me in 35c02fe (one of them in the frontend picker), and the three from the round on 35c02fe by me in 721a1ba (two in the frontend picker: the bare label now has to equal the key's whole quant token, and an H3 denoiser partition never answers to one; and the non-llama resident check now asks the local index before calling a tagged GGUF request satisfied), and the three from the round on 721a1ba by me in 87c3b36 (the progress matcher reads the resolved key off the job's manifest when the Hub is unreachable; the auto-download treats an absent root build as a miss, never a swap, now that the listing is the evidence; and the picker's bare-label alias applies the shared resolver's root precedence), and the one from the round on 87c3b36 by me in 9d7a490 (a key-shaped build of the resident's own repo is refused by the resident whether or not it is cached yet, so the switch reaches the listing that fetches it), and the four from the round on 9d7a490 by me in b48095a (the local index decides a bare alias against every cached revision, not the selected one; a catalog-shaped GGUF repo id on a non-GGUF resident refuses a key-shaped build outright; download state a legacy bare start wrote is read from the qualified row for status, cancel, progress, the active list and the partial flag, attributed by the manifest's own file list; and the picker alias treats a downloaded and a remote copy of one key as one build). That push sits on a merge of main (78005d9) resolving the
Two of these were mine, and worth being explicit about. Sweeping for the pattern I applied So the rule the code now follows: The bare-repo default, measured. Counting only main builds, as the listers do: 15 of the 537 corpus repos have an order-dependent default on Two sites were left literal on purpose: Tests. Verified after every push, most recently on b48095a against both the merge commit 78005d9 and main 7da85a0, one interpreter per test file, run in a Modal container with both SHAs in parallel with an identical selection over the gguf/download/deletion/registry/media/picker modules: zero new failures. Every regression test in
The corpus audit was re-run after every fix: 0 of the 7 916 files change key or row as a result of any of them. The twelve fixes correct consumer sites only; the identity this PR advertises is exactly what it was when the audit above was taken. |
… at load, and gate the root-stem heuristic
Studio UI evidence — the picker rows, before and afterTwo isolated Studio installs, same harness, same viewport, same repo; they differ only in Read the sizes — they are the proof. BEFORE offers four rows, and their sizes are 92 / 102 / 136 / 185 GB. AFTER, those are exactly the sizes of the four
Scene facts, captured from the running server rather than read off the image:
The four plain checkpoints are selectable here for the first time; before this change no row in the picker could fetch them. Commits after |
…inventory not a loose compare
|
Taking the two findings from the round on fd168b3; one push for both. |
…et the picker's filename hint reach a lone tagged build
|
@codex review Both findings from the round on fd168b3 are fixed in 35c02fe; please re-review and keep iterating until you have no open findings.
Backend: 3/3 mutants caught; Modal comparison 384 = 384 failed/error ids against fd168b3, zero new (the amend after the run touched only the frontend file, backend tree hash identical). Frontend: 12/12 in |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 35c02fe319
ℹ️ 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".
| const bareLabelOf = (quant: string, label: string): boolean => | ||
| quant.toLowerCase() !== label.toLowerCase() && | ||
| new RegExp( | ||
| `(^|[-_./])${escapeRegex(label)}(?!-\\d+(?:\\.\\d+)?bpw)([-_./]|$)`, |
There was a problem hiding this comment.
Match the complete quant token before accepting an alias
When a stale hint is a prefix of the available quant, the delimiter regex treats the remainder's underscore as a token boundary. For example, wanted = "Q4_K" matches a lone qualified row model-Q4_K_M-mtp, although the backend extracts Q4_K_M and would reject Q4_K; the frontend then submits that row's filename and silently loads a different quant instead of prompting. Derive and compare the complete bare token rather than searching for the label as a delimited substring.
Useful? React with 👍 / 👎.
| const byAlias = listed.filter( | ||
| (v) => v.quant && bareLabelOf(v.quant, wanted), | ||
| ); |
There was a problem hiding this comment.
Reject bare aliases for H3 partition keys
For a listing with only one H3 partition at a quant—such as the published lone minimax_h3_fl2va_pruned-UD-Q2_K_XL row—a saved UD-Q2_K_XL hint becomes the unique byAlias match and is submitted as that FL2VA filename. The backend's accepts_bare_quant_alias deliberately excludes H3 stems because the stem encodes the task and a bare quant must not choose a partition, so this client-side shortcut bypasses that safety rule and can run the wrong video task instead of prompting.
Useful? React with 👍 / 👎.
| resident_variant = getattr(llama_backend, "hf_variant", None) or "" | ||
| if not looks_like_quant(variant, known_keys = [resident_variant]): |
There was a problem hiding this comment.
Check root-stem variants for non-GGUF residents too
The inventory-backed root-stem check is added only inside the llama.cpp branch. If the non-GGUF inference backend currently serves org/repo and the caller explicitly requests a locally indexed tagged GGUF such as org/repo:model-Q4_K_M-mtp, the later non-llama branch still calls looks_like_quant(variant) without evidence; the new default classifies the stem as a foreign tag, _loaded_satisfies returns true from the matching repo ID, and _loaded_identity_satisfies skips the GGUF auto-switch, serving the resident non-GGUF weights instead.
Useful? React with 👍 / 👎.
|
Taking the three findings from the round on 35c02fe; one push for all three. |
🛡️ Codex Security Review · Automatically triggeredSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
… resident on the index
|
@codex review |
🛡️ Codex Security Review · Automatically triggeredSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 721a1baf09
ℹ️ 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".
| try: | ||
| requirement = gguf_variants.gguf_variant_requirements(repo_id, progress_variant, hf_token) | ||
| except Exception: | ||
| requirement = None | ||
| if gguf_plan.is_main_gguf_variant_path(path, _progress_matcher_variant(requirement, progress_variant)): |
There was a problem hiding this comment.
Derive the progress matcher from the cached manifest
Fresh evidence in the current revision is that this fix resolves the matcher key only through the remote requirements lookup. After a restart while offline or during a transient Hub failure, a legacy-bare job such as Q4_K_M can still have a valid manifest for model-Q4_K_M-mtp and finalized shards, but requirement is None, so the matcher falls back to the bare key and reports every qualified main shard absent. snapshot_progress_response then produces target_present=false for an incomplete manifest-backed download, allowing hydration to retire resumable state despite its shards being present; derive the resolved key from the manifest/metadata result as well.
Useful? React with 👍 / 👎.
| const byAlias = listed.filter( | ||
| (v) => v.quant && bareLabelOf(v.quant, wanted), | ||
| ); | ||
| if (byAlias.length === 1) { | ||
| return byAlias[0].filename; |
There was a problem hiding this comment.
Preserve root precedence in filename alias selection
When a tagged root build and a subordinate checkpoint share a quant—for example model-Q4_K_M-mtp and distilled/model-Q4_K_M—both enter byAlias, so a saved Q4_K_M image/video hint returns null and prompts for a quantization. The backend's shared resolver intentionally assigns that legacy spelling to the root build, meaning this client preflight still rejects a request that chat, download, and the media index accept. Apply the same root-precedence rule before requiring a single alias.
Useful? React with 👍 / 👎.
| if exact is not None or looks_like_quant(wanted, known_keys = variants): | ||
| # A quant-shaped suffix that matches nothing is a miss, never a swap. | ||
| return exact |
There was a problem hiding this comment.
Reject missing qualified root builds before defaulting
When an explicit root-stem build is absent—for example the repo offers model-Q4_K_M-mtp but the request asks for model-Q4_K_M-fp16—exact and the bare alias are both None, while looks_like_quant(..., known_keys=variants) also returns false because known_keys only vouches for an exact key that this branch has already failed to find. Control therefore falls through to the default ranking and downloads an unrelated available build, contradicting the adjacent invariant that an explicit miss must never swap checkpoints. Recognize an absent GGUF-shaped root build from the listed quant inventory and return None instead of defaulting.
Useful? React with 👍 / 👎.
|
Taking the three findings from the round on 721a1ba; one push for all three. |
…ild in the auto-download, and give the picker alias root precedence
|
@codex review |
🛡️ Codex Security Review · Automatically triggeredSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 87c3b367b9
ℹ️ 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 not (hit and len(hit) > 1 and hit[1]): | ||
| return True |
There was a problem hiding this comment.
Resolve uncached GGUF build keys before accepting resident
When another build of a recognized Hub GGUF repo is resident but the requested root-stem build has not yet been cached, this local-only probe necessarily returns None, so the branch declares the resident sufficient. For example, org/model-GGUF:model-Q4_K_M-fp16 is treated as a foreign tag while another build of org/model-GGUF is loaded; _loaded_identity_satisfies then exits _maybe_auto_switch_model before the remote listing and auto-download can resolve the requested build, serving the wrong weights. The new index check still needs to fail the resident match for catalog-shaped GGUF repo IDs even when the specific build is not local.
Useful? React with 👍 / 👎.
|
Taking the finding from the round on 87c3b36. |
… not that build is cached
|
@codex review |
🛡️ Codex Security Review · Automatically triggeredSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9d7a4907aa
ℹ️ 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".
| owners: dict[str, list[str]] = {} | ||
| for variant in variants: |
There was a problem hiding this comment.
Resolve local aliases across all cached revisions
When an active HF cache has a newer snapshot containing only model-Q4_K_M-mtp.gguf and an older complete snapshot containing the exact plain model-Q4_K_M.gguf, variants contains only the selected newer snapshot, so this loop registers Q4_K_M as an alias for the tagged build. resolve_local_gguf("repo:Q4_K_M") then returns that snapshot and auto-switches to the tagged checkpoint, even though the union-based cached loaders added in this change correctly give the exact spelling to the older plain build. Build these alias owners from the complete cross-revision inventory before publishing the repo-level index entry.
Useful? React with 👍 / 👎.
| if variant and looks_like_quant(variant, allow_root_stem = True): | ||
| try: | ||
| from core.inference.local_model_resolver import resolve_local_gguf | ||
|
|
||
| hit = resolve_local_gguf(f"{base}:{variant}", allow_scan = False) |
There was a problem hiding this comment.
Reject uncached GGUF builds for non-GGUF residents
When the non-GGUF backend serves a catalog repo such as unsloth/model-GGUF and the caller requests an uncached root-stem build like unsloth/model-GGUF:model-Q4_K_M-mtp, the local probe necessarily returns None, after which the matching repo ID makes _loaded_satisfies return true. _loaded_identity_satisfies therefore exits the auto-switch path before the Hub listing can resolve and download the requested GGUF, serving the resident Transformers weights instead. Treat a GGUF-shaped root stem as decisive for catalog-shaped GGUF repo IDs even when that particular build is not yet in the local index.
Useful? React with 👍 / 👎.
| if not _quant_token_closes_name(path): | ||
| return _unknown_gguf_variant_key(path) |
There was a problem hiding this comment.
Reconcile legacy download state with qualified build keys
When a legacy client starts a lone tagged build using Q4_K_M, the download registry, manifest, and cancel marker remain keyed by that requested bare spelling, while this change makes subsequent catalog responses advertise only model-Q4_K_M-mtp. After a refresh, variant partial checks, selected-row progress matching, status lookup, and cancellation use the qualified key and cannot find the still-running or resumable bare-keyed job, so the card can appear idle and allow another multi-gigabyte download. Canonicalize persisted/job state to the resolved key or expose the bare alias when correlating state with the newly qualified row.
Useful? React with 👍 / 👎.
| let byAlias = listed.filter((v) => v.quant && bareLabelOf(v.quant, wanted)); | ||
| if (byAlias.length > 1) { | ||
| const roots = byAlias.filter((v) => v.quant && atRepoRoot(v.quant)); | ||
| byAlias = roots.length > 0 ? roots : byAlias; | ||
| } | ||
| return byAlias.length === 1 ? byAlias[0].filename : null; |
There was a problem hiding this comment.
Deduplicate alias candidates by variant identity
When the listing contains a downloaded and an undownloaded copy of the same qualified key—an input shape already supported by the exact-label branch—both rows enter byAlias, so this returns null even though only one build owns the legacy bare spelling. For example, two rows with quant model-Q4_K_M-mtp and a Q4_K_M hint incorrectly show “Pick a quantization” instead of preferring the downloaded filename. Group alias candidates by case-insensitive quant first, then apply the existing downloaded preference within the single resolved identity.
Useful? React with 👍 / 👎.
|
Taking the four findings from the round on 9d7a490; one push for all four, on top of the merge of main that resolves the picker/service.py conflict. |
… download state from the qualified row, and dedupe the picker alias by identity
|
@codex review |
🛡️ Codex Security Review · Automatically triggeredSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b48095aeab
ℹ️ 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".
| index = _index() if allow_scan else _scan[1] | ||
| entry = index.get(base.strip().lower()) | ||
| except Exception: | ||
| return () | ||
| return tuple(entry.variants) if entry is not None else () |
There was a problem hiding this comment.
Include all revisions in resident variant inventory
Fresh evidence in this revision is that local_variant_keys returns only entry.variants, which _local_gguf_entry populates from the selected snapshot; its cross-revision inventory is used only to compute aliases. If a tagged build was loaded through legacy Q4_K_M and an exact plain Q4_K_M sibling exists in another cached revision, resident_variant_serves resolves both spellings against this one-snapshot list and reports a match, although the union-based loaders resolve the request to the plain build. The resident shortcut can therefore continue serving the tagged weights for a request that now names the plain checkpoint.
Useful? React with 👍 / 👎.
| vouched = allow_root_stem or ( | ||
| known_keys is not None | ||
| and normalized.strip().lower() in {str(k).replace("\\", "/").strip().lower() for k in known_keys if k} | ||
| ) |
There was a problem hiding this comment.
Reject missing root-stem variants before local fallback
For a catalog-shaped repo already present in the local index, a request for an uncached root-stem build such as unsloth/model-GGUF:model-Q4_K_M-fp16 is not vouched for because _resolve_from_index calls looks_like_quant without either evidence argument. It consequently treats the suffix as a foreign tag and returns the entry's default cached build, such as model-Q4_K_M-mtp, so the request loads the wrong checkpoint without ever reaching the remote matcher that correctly rejects or downloads the requested build. Once root-stem filenames become advertised identities, this local fallback also needs to treat an absent root-stem key as an explicit miss in GGUF catalog contexts.
Useful? React with 👍 / 👎.
| if download_manifest.read_manifest( | ||
| "model", repo_id, wanted, hub_cache = hub_cache | ||
| ) is not None or download_manifest.has_cancel_marker( | ||
| "model", repo_id, wanted, hub_cache = hub_cache | ||
| ): | ||
| return wanted |
There was a problem hiding this comment.
Validate direct legacy state against the build inventory
Fresh evidence after the legacy-state reconciliation is that this direct-spelling shortcut never checks which build the manifest describes. If a download started as bare Q4_K_M while only model-Q4_K_M-mtp existed and a plain Q4_K_M sibling is later published, the plain row now owns that spelling, but this returns the tagged build's old manifest or cancel marker for the plain row; the qualified tagged row also discovers the same state through the manifest scan. The variants UI can therefore mark both checkpoints as the same partial job and route a bare cancellation to the tagged download, so direct state should be accepted only when its manifest build key agrees with the current inventory ownership.
Useful? React with 👍 / 👎.
|
For now we won't support non standard repos |

Some repos ship two files at the same quant, for example a plain build and an "-mtp" build. Both got the same key, so the picker showed one row and hid the other. Because "-" sorts before ".", the row was labelled with the plain name but downloaded the tagged file.
On AngelSlim/Hy3-GGUF the picker showed four rows and every one fetched the mtp build, so four checkpoints could not be downloaded at all. The key now includes the build tag when the filename has one, so each build gets its own row. Plain builds keep their existing key, so nothing already downloaded changes.