Repository navigation
fix(studio): preserve chat GGUF variants across cache-folder changes - #10438
Imagineer99 wants to merge 37 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. |
|
Live Studio A/B — the missing-quant bug reproduces on main, head fixes it Head
Confirmed; no blockers seen on this head in the live run. |
|
Screenshots for the live A/B above — on-device listing after switching the models dir away and back, head main — the repo collapses to a single variant and only The seeded cache held two quants ( head — both quants present, each with its own Both Confirmed; no blockers seen on this head. Caveat as before: the cache files were seeded as sparse placeholders at the true Hub sizes, since Studio decides "downloaded" from on-disk bytes. |
The variant listing resolved a repo against one cache folder at a time, so moving the download folder (or switching back to the default) dropped quants that were still on disk in another remembered folder, and the surviving rows lost the cache_path of the copy they describe. List logical quants across the active cache and every remembered folder, keeping each quant's own cache_path, and reconcile them with the download-state rows so the picker shows one row per quant no matter which folder holds it. Deletes and loads then resolve the same copy the listing named. Closes unslothai#10437 Adapted from unslothai#10438 onto current main.
The variant listing resolved a repo against one cache folder at a time, so moving the download folder (or switching back to the default) dropped quants that were still on disk in another remembered folder, and the surviving rows lost the cache_path of the copy they describe. List logical quants across the active cache and every remembered folder, keeping each quant's own cache_path, and reconcile them with the download-state rows so the picker shows one row per quant no matter which folder holds it. Deletes and loads then resolve the same copy the listing named. Closes unslothai#10437 Adapted from unslothai#10438 onto current main.
Resolve conflicts with main: keep host-path redaction and cache authorization on the variants routes alongside include_cache_locations, drop shard_count removed upstream, restore the is_anonymous import, and adapt the cache-switch tests to the API-key dependency and the Hub access probe.
Windows identifies cache blobs by size when the hash is unreadable, so the update-available precondition is POSIX only; the merged-vs-direct parity stays on every platform. macOS tmp_path lives under /private/var, which the download folder guard denies, so exempt the test's own tmp_path.
The variant listing resolved a repo against one cache folder at a time, so moving the download folder (or switching back to the default) dropped quants that were still on disk in another remembered folder, and the surviving rows lost the cache_path of the copy they describe. List logical quants across the active cache and every remembered folder, keeping each quant's own cache_path, and reconcile them with the download-state rows so the picker shows one row per quant no matter which folder holds it. Deletes and loads then resolve the same copy the listing named. Closes unslothai#10437 Adapted from unslothai#10438 onto current main.
* fix(studio): keep every chat GGUF quant listed across cache folders The variant listing resolved a repo against one cache folder at a time, so moving the download folder (or switching back to the default) dropped quants that were still on disk in another remembered folder, and the surviving rows lost the cache_path of the copy they describe. List logical quants across the active cache and every remembered folder, keeping each quant's own cache_path, and reconcile them with the download-state rows so the picker shows one row per quant no matter which folder holds it. Deletes and loads then resolve the same copy the listing named. Closes #10437 Adapted from #10438 onto current main. * fix(studio): judge merged offline GGUF sources by their own state A remembered cache's quants are merged into the listing when the request is local-only or offline, and there the Hub readiness pass cannot run. Every merged source was therefore reported as downloaded, so a copy whose main shards are complete but whose projector or drafter never finished was advertised as a model the picker could load, while the same snapshot requested directly reported it partial and offered the resume. Judge each source against its own snapshot instead, with the same local manifest, marker and blob check the direct listing uses, and fall back to a partial row when it does not pass. Reported-by: Codex review (P2) on #204. * test(studio): accept the cache-location flag in the boundary stub The route now forwards `include_cache_locations` to the variants service, so the inventory boundary test's stub of that service has to accept it; otherwise the call raises inside the endpoint and the route answers 500. * fix(studio): rank duplicate GGUF sources by their own partial state A remembered copy of a quant could shadow a healthy duplicate when the shadowed copy was verified complete by its manifest but still marked partial by its own snapshot state, such as a cancellation marker: the merge then reported the quant as unusable and offered a retry while the loadable duplicate was omitted from the listing. Rank duplicates on the full per-snapshot partial verdict in addition to the completed-vs-incomplete manifest rule. Reported-by: Codex review (P2) on #204. * fix(studio): rank loader candidates by snapshot state, not manifest alone `_cached_variant_candidates` ordered cached copies by manifest completeness only, so an active snapshot a cancellation marker had already invalidated was yielded before a healthy duplicate in a remembered folder; the merged listing picked the healthy copy but `cached_gguf_for_load` could still open the cancelled one and fail offline on the interrupted companion. Rank on the same full per-snapshot verdict the listing uses. The delete preview also named the folder it would delete, so an API-key authenticated request read the host's absolute cache directory out of `/api/hub/delete-impact`. It now passes through the host-path boundary and answers with the opaque `cache_ref` the delete call already accepts; a browser session still reads the path. Reported-by: Codex review (P1/P2) on #204. * fix(studio): keep remembered-cache quants reachable and referenced Four follow-ups from the same review area: - The merged-listing pass had a second anonymous test after `hub_cached_read_refused` had already authorized this caller, so a public repo's authorized anonymous read lost quants that exist only in a remembered folder. The authorization verdict decides; trust it. - A quant the snapshot lists but does not complete -- an interrupted split download -- was dropped from the merge entirely, so it could neither be marked partial nor keep its folder. It is now a fallback source that the merge reports as a resume, not as a loadable copy. - Merging can change which rows are root-level, and the default is chosen among root rows; keep the merged set's own answer instead of the one the active cache picked alone. - Both variant response models now declare the opaque `cache_ref` sibling the host-path boundary adds, so FastAPI serialization keeps the only handle an API-key caller has for pinning a later delete to a listed copy. Reported-by: Codex review on #204. * fix(studio): judge merged cached sources by their own state and reference Addresses the review findings on the remembered-cache merge: - Rank duplicate sources on the current revision's companion readiness, which only that copy's own Hub answer knows, so a usable duplicate is not discarded for one the snapshot judges partial. - Apply that same local partial verdict to a quant the current revision no longer lists, instead of keeping the synthesized loadable row. - Prefer downloaded non-partial rows when recomputing the merged default. - Carry partial transport, resumability and remaining bytes from the copy's own folder so a remembered partial keeps its resume affordance. - Forward the redacted cache reference as the delete target, and declare it on the variant model so it survives response serialization. Focused regressions cover each; reverting the fixes fails them. * fix(studio): delete the cached GGUF copy the row names A logical quant delete carries no folder, so the server re-resolved its target with the local-only duplicate ranking while the listing had ranked those duplicates by their own scoped companion readiness. The two can disagree, and the delete then removed a copy the row never showed. Carry the listed copy's own cache path through the expander row, the pinned-quant row (from the validation listing) and the delete preview, so preview and delete act on the copy the user sees. * fix(studio): keep redacted GGUF deletes on the listed copy Host-path redaction nulls cache_path and answers with the opaque cache_ref, so a picker row that forwards only the cleared path sends nothing and the server re-ranks duplicates by local-only state. The chat variant model now declares cache_ref, the expander, sole-quant, and pinned-copy rows prefer it for both the delete and its preview, and the disk card previews the same identity its delete sends. * fix(studio): settle the GGUF replacement's review findings at the current baseline Restore the deleted useDeleteConfirmAction invocation that left the download card's confirm dialog unparsable, judge a remembered partial's resume affordance against the cache root a resume really continues in, keep the bare repo pin while a runnable non-GGUF copy survives, and type the pinned-variant map so the frontend projects compile. * fix(studio): resolve GGUF quants across remembered cache folders * test(studio): keep cache-aware picker contracts current * fix(studio): retain single-cache GGUF snapshot pins and normalize formatting * fix(studio): reject invalid targeted GGUF delete previews * test(studio): group GGUF cache-switch regressions by scenario
…ai#11938) * fix(studio): keep every chat GGUF quant listed across cache folders The variant listing resolved a repo against one cache folder at a time, so moving the download folder (or switching back to the default) dropped quants that were still on disk in another remembered folder, and the surviving rows lost the cache_path of the copy they describe. List logical quants across the active cache and every remembered folder, keeping each quant's own cache_path, and reconcile them with the download-state rows so the picker shows one row per quant no matter which folder holds it. Deletes and loads then resolve the same copy the listing named. Closes unslothai#10437 Adapted from unslothai#10438 onto current main. * fix(studio): judge merged offline GGUF sources by their own state A remembered cache's quants are merged into the listing when the request is local-only or offline, and there the Hub readiness pass cannot run. Every merged source was therefore reported as downloaded, so a copy whose main shards are complete but whose projector or drafter never finished was advertised as a model the picker could load, while the same snapshot requested directly reported it partial and offered the resume. Judge each source against its own snapshot instead, with the same local manifest, marker and blob check the direct listing uses, and fall back to a partial row when it does not pass. Reported-by: Codex review (P2) on unslothai#204. * test(studio): accept the cache-location flag in the boundary stub The route now forwards `include_cache_locations` to the variants service, so the inventory boundary test's stub of that service has to accept it; otherwise the call raises inside the endpoint and the route answers 500. * fix(studio): rank duplicate GGUF sources by their own partial state A remembered copy of a quant could shadow a healthy duplicate when the shadowed copy was verified complete by its manifest but still marked partial by its own snapshot state, such as a cancellation marker: the merge then reported the quant as unusable and offered a retry while the loadable duplicate was omitted from the listing. Rank duplicates on the full per-snapshot partial verdict in addition to the completed-vs-incomplete manifest rule. Reported-by: Codex review (P2) on unslothai#204. * fix(studio): rank loader candidates by snapshot state, not manifest alone `_cached_variant_candidates` ordered cached copies by manifest completeness only, so an active snapshot a cancellation marker had already invalidated was yielded before a healthy duplicate in a remembered folder; the merged listing picked the healthy copy but `cached_gguf_for_load` could still open the cancelled one and fail offline on the interrupted companion. Rank on the same full per-snapshot verdict the listing uses. The delete preview also named the folder it would delete, so an API-key authenticated request read the host's absolute cache directory out of `/api/hub/delete-impact`. It now passes through the host-path boundary and answers with the opaque `cache_ref` the delete call already accepts; a browser session still reads the path. Reported-by: Codex review (P1/P2) on unslothai#204. * fix(studio): keep remembered-cache quants reachable and referenced Four follow-ups from the same review area: - The merged-listing pass had a second anonymous test after `hub_cached_read_refused` had already authorized this caller, so a public repo's authorized anonymous read lost quants that exist only in a remembered folder. The authorization verdict decides; trust it. - A quant the snapshot lists but does not complete -- an interrupted split download -- was dropped from the merge entirely, so it could neither be marked partial nor keep its folder. It is now a fallback source that the merge reports as a resume, not as a loadable copy. - Merging can change which rows are root-level, and the default is chosen among root rows; keep the merged set's own answer instead of the one the active cache picked alone. - Both variant response models now declare the opaque `cache_ref` sibling the host-path boundary adds, so FastAPI serialization keeps the only handle an API-key caller has for pinning a later delete to a listed copy. Reported-by: Codex review on unslothai#204. * fix(studio): judge merged cached sources by their own state and reference Addresses the review findings on the remembered-cache merge: - Rank duplicate sources on the current revision's companion readiness, which only that copy's own Hub answer knows, so a usable duplicate is not discarded for one the snapshot judges partial. - Apply that same local partial verdict to a quant the current revision no longer lists, instead of keeping the synthesized loadable row. - Prefer downloaded non-partial rows when recomputing the merged default. - Carry partial transport, resumability and remaining bytes from the copy's own folder so a remembered partial keeps its resume affordance. - Forward the redacted cache reference as the delete target, and declare it on the variant model so it survives response serialization. Focused regressions cover each; reverting the fixes fails them. * fix(studio): delete the cached GGUF copy the row names A logical quant delete carries no folder, so the server re-resolved its target with the local-only duplicate ranking while the listing had ranked those duplicates by their own scoped companion readiness. The two can disagree, and the delete then removed a copy the row never showed. Carry the listed copy's own cache path through the expander row, the pinned-quant row (from the validation listing) and the delete preview, so preview and delete act on the copy the user sees. * fix(studio): keep redacted GGUF deletes on the listed copy Host-path redaction nulls cache_path and answers with the opaque cache_ref, so a picker row that forwards only the cleared path sends nothing and the server re-ranks duplicates by local-only state. The chat variant model now declares cache_ref, the expander, sole-quant, and pinned-copy rows prefer it for both the delete and its preview, and the disk card previews the same identity its delete sends. * fix(studio): settle the GGUF replacement's review findings at the current baseline Restore the deleted useDeleteConfirmAction invocation that left the download card's confirm dialog unparsable, judge a remembered partial's resume affordance against the cache root a resume really continues in, keep the bare repo pin while a runnable non-GGUF copy survives, and type the pinned-variant map so the frontend projects compile. * fix(studio): resolve GGUF quants across remembered cache folders * test(studio): keep cache-aware picker contracts current * fix(studio): retain single-cache GGUF snapshot pins and normalize formatting * fix(studio): reject invalid targeted GGUF delete previews * test(studio): group GGUF cache-switch regressions by scenario


A user reported on Discord that chat GGUF quantizations downloaded into different folders stop appearing together after switching the download folder back to default. Their Q6 variant was in the default cache and Q8 in a custom cache.
Keep one repository row and discover complete chat variants across remembered caches, preferring the active cache for duplicates. A completed recorded download takes precedence over an interrupted duplicate. Loading, copying, quant deletion, memory estimates, and per-quant context metadata resolve the selected source. Startup uses the logical repository identity. The shared Hub configuration flow receives the selected quant directly.
Pins survive while another complete downloaded copy remains, including cache folders with different repository-ID casing. Pin cleanup retains request credentials and avoids removing pins on unconfirmed scans. Explicit filesystem listings retain their scope. Image/video GGUF loading is outside this change; shared media lookup and pin callbacks retain their prior cache scope.
Online listings reuse successful Hub metadata within the request and apply the existing snapshot readiness/update checks. Complete remembered chat sources can answer transient Hub failures, while HTTP 401/403/404/429 errors still surface.
Closes #10437.
Validation on preceding commit
bb8abccb9(integrated main4953744e4):47ba1bca1had 49 successful and 10 skipped CI checks; Upstream CI on this head was cancelled by a maintainer. Fork validation on the exact head finished with 17 successful workflows, one skipped workflow, and one failed workflow. Frontend CI passed 7,116 tests on both Linux and Windows; both backend Python jobs passed. The CPU suite had 17,985 passes and two failures reproduced identically on base4953744e4: missingruffin the test environment, and two unencodedread_text()calls intests/test_wheel_smoke_publish_guard.py. The Rust lock test and browser-dependency installation passed targeted retries. These results do not replace upstream required checks or approval. The anonymous pin-reconciliation finding is fixed inc411b2dd6: a public variant listing cannot invalidate a complete copy confirmed by disk inventory. The download-card observation was verified as pre-existing.Validation on current commit
c411b2dd6:999dd8500and the pre-push gate passed. The full backend suite and fork CI above belong to the preceding commit; current-head upstream CI and review remain pending.Original cache-switch A/B evidence on narrowed candidate
76821802750a65abf3b46b11229702867509133a:UI evidence uses isolated 256-byte cache fixtures, not full model inference. Validation ran locally on Linux under WSL. Existing PR history is preserved.