Repository navigation
Fix on-device GGUF image/video picks asking for a quantization - #8149
Conversation
An on-device GGUF pick could reach the diffusion load carrying only a repo id and never a concrete .gguf filename, so it dead-ended even though the row had just shown itself as one-click loadable. Three paths fed this: - The pinned quant row sent its quant label with no ggufFilename and no isGguf, so the pages read it as a curated repo and asked for a pipeline load, which a single-file GGUF repo rejects. - A curated GGUF artifact resolves to kind "gguf" with no filename, since the catalog lists repos and not their files. - A GGUF directory failed the .gguf extension check and hit the "Pick a quantization for this model to load it" toast. Add a resolver that turns a repo-level pick into a real filename using the repo's own listing, through the cache the picker rows already use. It prefers an exact filename, then a quant label (favouring the copy on disk), then a sole downloaded file, then a sole file. An ambiguous repo still returns null and keeps the prompt, and a stale label that matches nothing does not fall back to the sole file, so a pin left from a deleted quant prompts instead of loading a different quant. Wire it into handleModelSelect and the route arrival effect on both the Images and Video pages, and mark the pinned row as a GGUF pick.
Two gaps in the repo-level GGUF resolution. A pinned row carries a quant label and no filename, and the chat picker forwards only the filename, so the label was dropped at the URL boundary and the target page saw a bare repo id. A curated repo still resolved through the catalog; every other task-tagged on-device GGUF repo read as a pipeline, which the backend rejects. The label now rides its own `ggufQuant` param, since `quant` is consumed verbatim as a filename, and both pages resolve it against the listing whatever the catalog says. Resolving is a listing request and staging is a plan request, and neither sets `busy`, so the user can pick again or switch pages while one is in flight. The late continuation loaded anyway: `handleLoad` clears the newer load's poll and overwrites `lastLoad`, and `quantRevert` is one slot, so a stale rollback restored the superseded label over the current one. A pick now claims the page and does nothing at all once something else holds it, including the "pick a quantization" prompt, which would otherwise blame a model the user had moved on from. A page switch, an unload and an adapter deploy release the page too. The pick itself moves into lib/diffusion-gguf-pick.ts so both pages share one copy and the ordering is testable; the two page-specific halves (images keys defaults on the repo, video on repo/filename) stay in the pages. Local directory picks now pass their path to the listing instead of asking it to resolve a filesystem path as a hub repo. 13 new tests: routed filename vs label vs neither, and superseded, released, out-of-order and stale-rollback picks. Suite is 959 passing, tsc -b and the test project clean, vite build clean, catalog:check and i18n:check:strict pass, and eslint on the touched files stays at the 49 pre-existing problems.
|
Reviewed and pushed a follow-up commit on top. Two P1s from the review reproduce on read, and one more gap alongside them: Routed pinned pick outside the catalog. Stale resolution. Nothing sets Local directory picks now pass their path as The resolve-then-load ordering moved into Verification, in Not covered here: the manual pass on a live Studio, in particular a pinned non-catalog diffusion GGUF picked from Chat, and a throttled listing with a second pick or a page switch on top of it. |
|
Ran the PR through a simulation harness before and after, on three trees side by side: Is the issue realYes, and on How the harness worksThe page decision code is not re-implemented, it is executed. What was run
What the simulation foundAn arrival with a quant label in Two other reported failures were artifacts of my own scenarios, not the code: Merging itNothing else moves. No Python, kernel, CUDA or ROCm path is touched, so there is no hardware matrix to run; Browsers: Vite builds to the Repo gateStill worth a manual pass on a live Studio before merge, in particular a pinned non-catalog diffusion GGUF |
|
Codex Review: Didn't find any major issues. More of your lovely PRs please. 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". |
|
@codex review |
|
Codex Review: Didn't find any major issues. You're on a roll. 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". |
|
Converged. Final head RoundsRound 2 raised two P1s, both correct, both consequences of the ownership model I added in round 1. I reproduced each against the shipped code before touching anything, then fixed and re-ran. Routed loads carried no token: the route effect's plain Eject did not end the pick: I had Fixed in Round 3 was a clean approval on Round 4 re-confirmed after the final comment pass ( Cross-platform and browserReplicated onto a staging repo rather than the org queue. All four disposable workflows green: One job stayed red: Final stateAlongside the repo suite, a harness that executes the real page code (the decision functions are extracted from the .tsx and run against fake state) covers 30 ownership scenarios, 19 URL cases, 66 cross-platform path cases, 9 for this round's two items, 3423 exhaustive event interleavings and 25000 fuzzed listings. Everything green on the final head. Thread pruned twice: 10 comments and 1 trigger removed, 3 review husks minimized. Rejected and untriaged items would have been kept; there were none. |
) * Repin six UI contracts on what they guard, not how it was spelled Repo tests (CPU) is red on main with six failures. All six are source-shape contracts whose subject was rewritten by #8082 and #8149; in every case the behaviour they exist to protect is intact, and in two cases it is better than what the assertion described. Three in test_update_release_notes.py asserted the literal Tailwind class max-h-[calc(100dvh_-_2rem)]. #8082 replaced that fixed cap with stackGeometry, which subtracts the same 2rem when nothing is in the way and subtracts more when the Live monitor is, so the stack dodges it instead of sitting under it. The arithmetic is checked numerically in monitor-stack-inset.test.ts, which pins stackGeometry(null, W, H).maxHeight to H - 32 among thirteen other cases. What these tests can still add is that every stack element reads it, so they now count stack containers and require a cap on each. Counting matters: there are two such elements, browser and desktop, and capping one and not the other is the mistake worth catching. A fourth test names the node test, so deleting the numeric check does not quietly leave the cap unguarded. Three in test_model_picker_contracts.py: - The routed pick test pinned diffusionRoutePick's second argument, which was respelled from routeSearch.quant to routedFilename. The catalog spec is the third argument and is the thing the test is named for, so the second is no longer matched. - The GGUF guard test required a toast.error in a branch that used to reject a repo-id pick. #8149 made that branch resolve the repo's own .gguf instead, which is the better answer. The invariant that survives is that the branch does something: a bare return there drops the pick with no request and no message. - The deferred-load test required the flush effect to end with }, [active]); and to call handleLoadRef directly. The load body moved into runStagedLoad, shared with the visible path, so the dependency array grew. It now accepts either spelling and, when the helper is used, follows through into it. Mutation-tested, all eight caught: cap dropped from the browser stack; from the desktop stack alone; desktop stack stops measuring itself; node test stops pinning H - 32; repo-id GGUF pick returns bare; routed pick drops its catalog spec; deferred flush clears the flag and stops; runStagedLoad loads nothing. The first two survived an earlier draft that used a plain substring check, which is why the counting form is there. tests/studio: 3 failed, 2795 passed. The three are test_studio_gguf_export_script_pin.py, which fails identically on main and is outside this job's scope. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Bound the deferred-flush match to its own effect Keying the closing boundary on `[active` let a validly reordered dependency array run the match past the effect and on to the next hook, where loadOrStage's own handleLoadRef call satisfied the loader assertion for a flush that loads nothing. Stop at the first boundary and check the deps separately. * Check the catalog spec by position, not by presence The capture is every argument after `wanted`, so a substring check did not prove the spec reached the third parameter. `diffusionRoutePick(wanted, routedFilename ?? loadSpecFor(wanted, IMAGE_CATALOG)?.filename)` type-checks, passes the catalog filename as the quant and drops the spec, which sends curated single-file artifacts down the GGUF branch, and it satisfied the old assertion. Split the argument list on its own commas and pin the third. * Tighten the repinned contract comments --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: danielhanchen <[email protected]>
A GGUF pick can still reach the diffusion load carrying only a repo id and never a concrete
.gguffilename. The backend requires one, so the pick dead-ends on a model the picker just advertised as one click loadable.Scope
This is a follow up to #8053, which fixed the collapsed On Device row by making it forward
ggufFilename. Two sibling paths still send a repo id with no filename, and one of them produces the same error message that #8053 removed.What is still broken on main
1. A pinned diffusion quant, clicked in the Images or Video picker.
renderPinnedQuantRowsendsggufVariant(a label likeQ4_K_S) with noggufFilenameand noisGguf. The pages read the label only meta as a curated repo and ask for a pipeline load:Reachable from a normal flow: the collapsed On Device row has a pin control, so pinning a diffusion quant and then clicking it is enough.
2. The same pinned quant, clicked in the chat picker. The diffusion routing forwards
quant: meta.ggufFilename ?? undefined, which is undefined here, so the Images page falls to the catalog spec.loadSpecFor()returns{kind: "gguf"}with no filename, because the catalog lists repos and not their files:Fix
A resolver that turns a repo level pick into a real filename using the repo's own listing, read through the cache the picker rows already use, so the row just clicked usually costs no extra request.
Resolution order: exact filename, then quant label (favouring the copy on disk), then a sole downloaded file, then a sole file.
Two deliberate non-behaviours:
Wired into
handleModelSelectand the route arrival effect on bothimages-page.tsxandvideo-page.tsx, plusisGguf: trueon the pinned row.The existing
meta.isGgufbranch now resolves instead of showing the toast. That branch is not reachable from a local GGUF directory today (those expand rather than select), so this part is defensive: it is the exact shape that regressed before #8053, and it now resolves rather than dead ends.Split into two modules so the selection logic is testable on its own:
gguf-filename-pick.tsis the pure pick with no app deps,diffusion-gguf-filename.tsis the request.Compatibility
Frontend TypeScript only. No backend, Python, kernel or hardware paths touched, and no API or payload shape changed.
The
isGguf: trueadded to the pinned row is a no op for chat, which already derived the same value:The pinned row always sets
ggufVariant, so that expression was already true. Passing it explicitly produces the identical result.The new branch in
handleModelSelectsits after the existing curated, expander, direct.ggufand.safetensorsbranches, so every pick that worked before still takes its original branch. It only catches picks that previously fell through to the pipeline load, which the backend rejected.Testing
Verified against a live Studio on macOS/MPS using
unsloth/Z-Image-Turbo-GGUF, a repo holding one quant (z-image-turbo-Q4_K_S.gguf).z-image-turbo-Q4_K_S.gguf, and the load the fixed code posts is accepted and the model actually loads:loaded: true, model_kind: gguf, family: z-image. Unloaded afterwards.tsc -band the test project both clean,catalog:checkpasses,vite buildsucceeds.Verified through the API and unit tests rather than a browser click through, so a manual pass on the pinned row in the Images picker is worth doing before merge.