Skip to content

Studio: show every GGUF build when a repo publishes two at one quant - #10556

Closed
NilayYadav wants to merge 35 commits into
unslothai:mainfrom
NilayYadav:fix-gguf-same-quant-two-rows
Closed

NilayYadav wants to merge 35 commits into
unslothai:mainfrom
NilayYadav:fix-gguf-same-quant-two-rows

Conversation

@NilayYadav

Copy link
Copy Markdown
Collaborator

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.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 8, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-10T01:16:06.706734Z b48095a Manual request
🔒 Security Review ✅ Completed 2026-09-10T01:05:26.219119Z b48095a Manual request
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Sep 8, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Sep 8, 2026
@NilayYadav

NilayYadav commented Sep 8, 2026 •

Copy link
Copy Markdown
Collaborator Author

GitHub Actions reproduction + fix verification

Reproduced on fresh upstream main (cfa31f27b89b0e6374d8d3741f802ebe9994a1d8) and verified on this PR. Both sides run the same probe, the same workflow and the same frozen inputs; only studio/backend differs. The inputs are live Hub listings for three real repos, frozen to JSON so the run is deterministic.

A/B run — all 6 jobs green (ubuntu-latest, macos-15, windows-latest × before/after). The before job is required to fail at the assertion and the after job is required to pass. Counts are selectable builds only — the imatrix, the vision mmproj and the MTP drafter are dropped first, as the listers drop them.

repo selectable builds rows before rows after
AngelSlim/Hy3-GGUF 8 4 8
ISTA-DASLab/Qwen3.8-27B-GSQ-RCO-GGUF 8 4 8
bartowski/gemma-2-9b-it-GGUF 29 23 29

Before — REPRODUCED on upstream main cfa31f27: 14 unreachable build(s). Every row on AngelSlim/Hy3-GGUF fetched the -mtp build, so all four plain checkpoints were unreachable:

row 'IQ1_M'    fetches Hy3-IQ1_M-mtp.gguf
row 'Q2_K_XL'  fetches Hy3-Q2_K_XL-mtp.gguf
row 'Q3_K_M'   fetches Hy3-Q3_K_M-mtp.gguf
row 'Q4_K_M'   fetches Hy3-Q4_K_M-mtp.gguf
FAIL AngelSlim/Hy3-GGUF: Hy3-IQ1_M.gguf is published but NO row fetches it
FAIL AngelSlim/Hy3-GGUF: Hy3-Q2_K_XL.gguf is published but NO row fetches it
FAIL AngelSlim/Hy3-GGUF: Hy3-Q3_K_M.gguf is published but NO row fetches it
FAIL AngelSlim/Hy3-GGUF: Hy3-Q4_K_M.gguf is published but NO row fetches it

Same shape on bartowski/gemma-2-9b-it-GGUF, where the row a user reads as Q4_K_M fetched the embedding-precision build: row 'Q4_K_M' fetches gemma-2-9b-it-Q4_K_M-fp16.gguf.

After — FIXED on PR 10556: 0 unreachable build(s). Each build gets its own row and every row fetches its own file; the plain builds keep their historical bare key (Q4_K_M → Hy3-Q4_K_M.gguf) and only the tagged sibling is qualified (Hy3-Q4_K_M-mtp).

Migration audit over a real corpus

Because 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 filter=gguf repos — under merge base and under this head:

  • 431 files re-keyed across 46 repos, and no repo offers fewer rows than before (5 978 → 6 214 rows across the corpus).
  • Every re-keyed file's old pin was run through the real plan_for_variant. Every one that no longer resolves is explained: 3 are companions (mmproj/imatrix, never selectable rows) and 32 are repos where 2–3 real builds already shared the bare key, so the pin was already ambiguous and main was silently serving an arbitrary one of them. Refusing is the behaviour test_a_bare_pin_refuses_to_pick_between_two_builds pins. 0 unexplained.

Review rounds

21 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 picker/service.py conflict with #10264's authorize-after-walk shape. Almost all share one shape: a call site deciding root precedence, ambiguity, or spelling equivalence on its own instead of through the shared resolver. The table below is the first sixteen; Daniel's commit messages carry the next seventeen, and the comment above 194c23c the last six.

# Site Consequence
P1 delete guard, both directions unlinks a loaded model
P1 _find_local_gguf_by_variant / _gguf_files_for_variant an ambiguous pin loads a different checkpoint
P1 looks_like_quant root-stem admission a foreign provider's 404 became a refusal instead of falling through
P1 default selection for a bare org/repo remote and cached could pick different weights, and the choice could change after a download
P1 _already_serving, _ensure_selected_local_model_loaded answered from the wrong checkpoint — defects introduced by an earlier round of these fixes, see below
P2 the trailing-suffix regex model-Q4_K_M.fp16.gguf re-keyed to bare Q4_K_M — this PR's own bug through the dot separator
P2 resolve_local_gguf_path a cached model reported not_downloaded
P2 manifest reconstruction, and a companion shadowing it resume aborted on blobs it had already fetched
P2 _resolve_quant_gguf / _resolve_cached_model_path priced and revealed the wrong checkpoint
P2 iter_snapshots_preferring_whole metadata read from a torn revision instead of the complete one
P2 _legacy_variant_aliases, _loaded_satisfies, remote size lookup a persisted repo:q4_0 stopped resolving

Two of these were mine, and worth being explicit about. Sweeping for the pattern I applied variant_spellings_may_name_one_build at _already_serving and in the recipe check. That helper is deliberately loose and is only sound where a false match fails closed, as in the delete guard; at those two sites a false match runs the wrong checkpoint. _already_serving is back to an exact comparison — variant there is already the resolver's selected identity, not the request's spelling — and the other two sites resolve against the repo's inventory instead.

So the rule the code now follows: resolve_variant_alias (inventory-aware) wherever a wrong answer serves the wrong weights; variant_spellings_may_name_one_build (loose, symmetric) only in fail-closed guards. Plus is_main_gguf_candidate, so a resolver sees exactly the files the main-file filter will accept, and collapse_same_quant_root_builds, so a bare org/repo means one thing.

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 main; this PR took that to 26; the collapse brings it back to exactly 15, with none still new. Every build stays individually advertised.

Two sites were left literal on purpose: download_manifest.py (loosening it could match another variant's manifest, worse than the current fail-soft miss) and the empty-folder sweep in deletion.py (guarded by any(sub.iterdir()), so it only removes empty directories).

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 test_gguf_same_quant_sibling_rows.py (105 in that file at this head) is mutation-checked — a one-line revert of the fix it names makes it fail — including a battery run against Daniel's five fixes in 1986a8c, 5/5 caught.

test_gguf_same_quant_sibling_rows.py holds 53 tests, 26 added here, and they are mutation-checked rather than merely passing: fifteen mutants, each reverting exactly one fix, applied one at a time. Every mutant is caught by a test whose stated reason matches it. That check earned its keep — one assertion initially passed with the rule it named deleted, because the pair it used was masked by ASCII case ordering, so it now asserts on the live Hy3-Q4_K_M-mtp shape.

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.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

@NilayYadav

Copy link
Copy Markdown
Collaborator Author

Studio UI evidence — the picker rows, before and after

Two isolated Studio installs, same harness, same viewport, same repo; they differ only in studio/backend. Merge base 580cffab vs head c37a3f901. Scene drives the real Model Hub picker against the live listing for AngelSlim/Hy3-GGUF (8 published builds: 4 quants × {plain, -mtp}).

PR 10556 GGUF picker before/after

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 -mtp rows. So every bare row in BEFORE was fetching the tagged build:

row BEFORE AFTER (plain) AFTER (tagged)
IQ1_M 92 GB → Hy3-IQ1_M-mtp.gguf 89 GB → Hy3-IQ1_M.gguf 92 GB → IQ1_M · Hy3-IQ1_M-mtp
Q2_K_XL 102 GB 100 GB 102 GB
Q3_K_M 136 GB 135 GB 136 GB
Q4_K_M 185 GB → Hy3-Q4_K_M-mtp.gguf 182 GB → Hy3-Q4_K_M.gguf 185 GB → Q4_K_M · Hy3-Q4_K_M-mtp

Scene facts, captured from the running server rather than read off the image:

  • row_count 4 → 8
  • the Q4_K_M row's file: Hy3-Q4_K_M-mtp.gguf → Hy3-Q4_K_M.gguf (171.98 GiB → 169.81 GiB)
  • the collapsed selector: IQ1_M GGUF 92 GB → IQ1_M GGUF 89 GB — the default row stops pointing at the speculative-decoding copy
  • the tagged rows arrive with a distinguishing label (Q4_K_M · Hy3-Q4_K_M-mtp) while the plain rows keep display_label: null, so nothing that already read as Q4_K_M changes its wording

The four plain checkpoints are selectable here for the first time; before this change no row in the picker could fetch them.

Commits after c37a3f901 on this branch do not touch this surface — one is a formatting autofix, and the others change the auto-download admission flag, the cached-path snapshot ordering and the route-side quant resolution. The corpus audit in the comment above confirms they re-key nothing: 0 of 7 916 files change key or row across all of them.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Sep 9, 2026
@NilayYadav

Copy link
Copy Markdown
Collaborator Author

Taking the two findings from the round on fd168b3; one push for both.

…et the picker's filename hint reach a lone tagged build
@NilayYadav

Copy link
Copy Markdown
Collaborator Author

@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.

  • One resident rule, shared. The inventory-growth check now lives in local_model_resolver.resident_variant_serves, and both the resident short circuit and the recipe gate delegate to it, so they cannot disagree: a resident loaded through the legacy bare Q4_K_M beside a later-cached plain sibling is trusted by neither. The recipe test covers that growth case alongside the empty-active-variant case.
  • The picker's filename hint reaches a lone tagged build. pickGgufFilename (frontend) accepts a saved bare label for exactly ONE qualified row whose bare token it is — the same unique-alias rule the backend's download and load paths apply — so a Q4_K_M hint on a repo advertised as model-Q4_K_M-mtp submits instead of prompting. Two rows carrying the label still prompt, and a trailing bit-width modifier is treated as part of the token. It does not attempt the backend's root-over-subordinate precedence; a tagged root beside a distilled/ sibling prompts here where the backend resolves, which is the conservative side. Say if you would rather it mirror that too.

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 gguf-filename-pick.test.ts including four new cases, the alias branch mutation-checked, tsc clean, Biome clean on the touched files.

@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: 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)([-_./]|$)`,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge 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 👍 / 👎.

Comment on lines +74 to +76
const byAlias = listed.filter(
(v) => v.quant && bareLabelOf(v.quant, wanted),
);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge 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 👍 / 👎.

Comment on lines +8063 to +8064
resident_variant = getattr(llama_backend, "hf_variant", None) or ""
if not looks_like_quant(variant, known_keys = [resident_variant]):

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge 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 👍 / 👎.

@NilayYadav

Copy link
Copy Markdown
Collaborator Author

Taking the three findings from the round on 35c02fe; one push for all three.

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

Security review completed. No security issues were found in this pull request.

Reviewed commit: 35c02fe319

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@NilayYadav

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

Security review completed. No security issues were found in this pull request.

Reviewed commit: 721a1baf09

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@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: 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".

Comment on lines +702 to +706
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)):

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge 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 👍 / 👎.

Comment on lines +121 to +125
const byAlias = listed.filter(
(v) => v.quant && bareLabelOf(v.quant, wanted),
);
if (byAlias.length === 1) {
return byAlias[0].filename;

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 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 👍 / 👎.

Comment on lines 934 to 936
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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge 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 👍 / 👎.

@NilayYadav

Copy link
Copy Markdown
Collaborator Author

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
@NilayYadav

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

Security review completed. No security issues were found in this pull request.

Reviewed commit: 87c3b367b9

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@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: 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".

Comment thread studio/backend/routes/inference.py Outdated
Comment on lines +8080 to +8081
if not (hit and len(hit) > 1 and hit[1]):
return True

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge 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 👍 / 👎.

@NilayYadav

Copy link
Copy Markdown
Collaborator Author

Taking the finding from the round on 87c3b36.

@NilayYadav

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

Security review completed. No security issues were found in this pull request.

Reviewed commit: 9d7a4907aa

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@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: 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".

Comment on lines +245 to +246
owners: dict[str, list[str]] = {}
for variant in variants:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge 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 👍 / 👎.

Comment on lines +8084 to +8088
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)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge 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 👍 / 👎.

Comment on lines +1063 to +1064
if not _quant_token_closes_name(path):
return _unknown_gguf_variant_key(path)

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 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 👍 / 👎.

Comment on lines +99 to +104
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;

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 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 👍 / 👎.

@NilayYadav

Copy link
Copy Markdown
Collaborator Author

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
@NilayYadav

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

Security review completed. No security issues were found in this pull request.

Reviewed commit: b48095aeab

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@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: 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".

Comment on lines +1071 to +1075
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 ()

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge 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 👍 / 👎.

Comment on lines +201 to +204
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}
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge 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 👍 / 👎.

Comment on lines +907 to +912
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

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 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 👍 / 👎.

@danielhanchen

Copy link
Copy Markdown
Member

For now we won't support non standard repos

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