Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.
Python agentaichatgptdeepseekfine-tuninggemmaimage-generationllamallmllmsopenaipythonqwenreinforcement-learningself-hostedstable-diffusiontext-to-speechttsuiunsloth
Studio: answer a collapsed On Device row from disk, not the Hub (#16271)
Yannick Loth6c95897aac28
diff --git a/studio/backend/hub/services/models/cache_inventory.py b/studio/backend/hub/services/models/cache_inventory.pyindex f4481c3b8ba..4ac68e44099 100644--- a/studio/backend/hub/services/models/cache_inventory.py+++ b/studio/backend/hub/services/models/cache_inventory.py@@ -8,8 +8,11 @@ from __future__ import annotationsimport jsonimport asyncio+import contextvars+import functoolsimport threadingimport time+from concurrent.futures import ThreadPoolExecutorfrom collections import OrderedDictfrom pathlib import Pathfrom typing import NamedTuple, Optional@@ -79,6 +82,19 @@ _cached_inventory_flights: dict[tuple[asyncio.AbstractEventLoop, tuple[str, int]], asyncio.Task[list[dict]]] = {}+# Own pool: on the default executor a cold walk queued every asyncio.to_thread caller (#14038).+_CACHED_INVENTORY_POOL = ThreadPoolExecutor(+ max_workers = 2, thread_name_prefix = "cached-inventory-scan"+)+++async def _inventory_scan_thread(fn, /, *args):+ """``asyncio.to_thread`` on the inventory pool, context variables carried along."""+ loop = asyncio.get_running_loop()+ call = functools.partial(contextvars.copy_context().run, fn, *args)+ return await loop.run_in_executor(_CACHED_INVENTORY_POOL, call)++# Retrying a superseded scan is only worth it while invalidations are occasional; past this the endpoint has to answer instead of restarting the walk forever._INVENTORY_SCAN_MAX_ATTEMPTS = 8# Last scan per inventory name that confirmed its epoch, served when the cap is hit.@@ -856,7 +872,7 @@ async def _shared_cached_inventory_scan(name: str, scanner) -> _CachedInventorySrows = await hf_cache_scan.shared_scan(_cached_inventory_flights,(name, epoch),- lambda expected_epoch = epoch: asyncio.to_thread(+ lambda expected_epoch = epoch: _inventory_scan_thread(_scan_cached_inventory_snapshot, scanner, expected_epoch),)diff --git a/studio/backend/hub/tests/test_model_services.py b/studio/backend/hub/tests/test_model_services.pyindex c3e701cfe6b..8f27e152741 100644--- a/studio/backend/hub/tests/test_model_services.py+++ b/studio/backend/hub/tests/test_model_services.py@@ -1429,7 +1429,7 @@ def test_cached_inventory_requests_share_scan(monkeypatch, inventory_request, scscans += 1return cached- monkeypatch.setattr(cache_inventory.asyncio, "to_thread", fake_to_thread)+ monkeypatch.setattr(cache_inventory, "_inventory_scan_thread", fake_to_thread)monkeypatch.setattr(cache_inventory, scanner_name, scan)_shared_setup_11(epoch, monkeypatch)@@ -1455,6 +1455,23 @@ def test_cached_inventory_requests_share_scan(monkeypatch, inventory_request, scassert scans == 1 and cache_inventory._cached_inventory_flights == {}+def test_cached_inventory_scan_keeps_off_the_default_executor(monkeypatch):+ """The cache walk must not run on the loop's default executor (#14038)."""+ threads = []++ def scan(**_kwargs):+ threads.append(threading.current_thread().name)+ return [{"repo_id": "Org/Model"}]++ _shared_setup_11([0], monkeypatch)+ result = asyncio.run(cache_inventory._shared_cached_inventory_scan("gguf", scan))+ assert result.rows == [{"repo_id": "Org/Model"}]+ assert result.confirmed is True+ assert threads and threads[0].startswith(+ "cached-inventory-scan"+ ), f"the cache walk ran on {threads}, the default executor"++@pytest.mark.parametrize("scanner_name, inventory_call",[diff --git a/studio/frontend/src/features/model-picker/components/model-selector/gguf-discovery.ts b/studio/frontend/src/features/model-picker/components/model-selector/gguf-discovery.tsindex 3512e40379c..105e4d220f2 100644--- a/studio/frontend/src/features/model-picker/components/model-selector/gguf-discovery.ts+++ b/studio/frontend/src/features/model-picker/components/model-selector/gguf-discovery.ts@@ -74,47 +74,3 @@ export async function loadPickerGgufVariants<T extends GgufVariantsResponse>(return cached;}}--/** Whether the Hub reports an update or missing companion for a cached quant; only the- * expander carries those actions. */-export async function hubWithdrawsSoleQuant<T extends GgufVariantsResponse>(- listRemote: () => Promise<T>,- quant: string,-): Promise<boolean> {- let remote: T;- try {- remote = await listRemote();- } catch {- return false;- }- const published = remote.variants.find(- (v) => v.quant.toLowerCase() === quant.toLowerCase(),- );- return Boolean(- published?.update_available || published?.pending_drafter_filename,- );-}--export function createTaskLimiter(limit: number) {- let active = 0;- const queue: (() => void)[] = [];- const next = () => {- if (active >= limit) return;- const start = queue.shift();- if (start) start();- };- return function run<R>(task: () => Promise<R>): Promise<R> {- return new Promise<R>((resolve, reject) => {- queue.push(() => {- active += 1;- task()- .then(resolve, reject)- .finally(() => {- active -= 1;- next();- });- });- next();- });- };-}diff --git a/studio/frontend/src/features/model-picker/components/model-selector/pickers.tsx b/studio/frontend/src/features/model-picker/components/model-selector/pickers.tsxindex 30a86c84c1d..e2c4708b131 100644--- a/studio/frontend/src/features/model-picker/components/model-selector/pickers.tsx+++ b/studio/frontend/src/features/model-picker/components/model-selector/pickers.tsx@@ -6,11 +6,7 @@ import {isChatGgufTask,reconcileGgufPinsAfterDelete,} from "./reconcile-gguf-pins";-import {- createTaskLimiter,- hubWithdrawsSoleQuant,- loadPickerGgufVariants,-} from "./gguf-discovery";+import { loadPickerGgufVariants } from "./gguf-discovery";import { firstIndexByKey } from "./option-index";import { ModelMemoryBar } from "@/components/model-memory-bar";@@ -1877,6 +1873,69 @@ const DownloadedModelDeviceRow = memo(function DownloadedModelDeviceRow({);});+function renderDeviceGgufExpander({+ repo: c,+ optionKey,+ loadedQuants,+ updateDisabled,+ expander,+ actions,+ callbacks,+ canConfigure,+}: {+ repo: CachedGgufRepo;+ optionKey: string;+ loadedQuants: readonly string[];+ updateDisabled: boolean;+ expander: DeviceRowExpanderProps;+ actions: DeviceRowActionsBox;+ callbacks: ReturnType<typeof useDeviceExpanderCallbacks>;+ canConfigure: boolean;+}) {+ return (+ <GgufVariantExpander+ diffusionLoad={expander.diffusionLoad}+ hostPooledMemory={expander.hostPooledMemory}+ gpuCount={expander.gpuCount}+ repoId={c.repo_id}+ loadedQuants={loadedQuants}+ pipelineTag={c.task ?? null}+ loadId={c.load_id}+ cachePath={c.cache_path}+ onDevice={true}+ allowPin={true}+ onHasVision={(v) => actions.get().reportVision(c.repo_id, v)}+ onSelect={callbacks.onSelect}+ resolveDownloadFootprint={expander.resolveDownloadFootprint}+ onConfigure={canConfigure ? callbacks.onConfigure : undefined}+ hfToken={expander.hfToken}+ parentOptionKey={optionKey}+ onNavigatePastStart={callbacks.onNavigatePastStart}+ onNavigatePastEnd={callbacks.onNavigatePastEnd}+ gpuGb={expander.gpuGb}+ systemRamGb={expander.systemRamGb}+ budgetKnown={expander.budgetKnown}+ variantActions={{+ onUpdate: (quant, expectedBytes) =>+ actions.get().updateGgufVariant(c.repo_id, quant, expectedBytes),+ updateDisabled,+ onDelete: async (quant, cachePath) => {+ const a = actions.get();+ await deleteCachedModel(+ c.repo_id,+ quant,+ a.hfToken || undefined,+ cachePath ??+ (mediaPageForTask(c.task) ? c.cache_path || undefined : undefined),+ );+ actions.get().prunePinnedQuantValidation(c.repo_id, quant);+ actions.get().refreshCachedLists();+ },+ }}+ />+ );+}+// One quant on disk with "All quantizations" off: the row carries it as a chip.const SoleQuantGgufDeviceRow = memo(function SoleQuantGgufDeviceRow({repo: c,@@ -1887,6 +1946,10 @@ const SoleQuantGgufDeviceRow = memo(function SoleQuantGgufDeviceRow({pinned: isPinned,ejectable,gpuGb,+ loadedQuants,+ expanderOpen,+ updateDisabled,+ expander,actions,optionEvents,optionId,@@ -1902,7 +1965,12 @@ const SoleQuantGgufDeviceRow = memo(function SoleQuantGgufDeviceRow({pinned: boolean;ejectable: boolean;gpuGb: number | undefined;+ loadedQuants: readonly string[];+ expanderOpen: boolean;+ updateDisabled: boolean;+ expander: DeviceRowExpanderProps;}) {+ const callbacks = useDeviceExpanderCallbacks(actions, optionKey);const variant = sole.variant;const expectedBytes = ggufVariantExpectedBytes(variant);// Should never be partial, but if it is, state what is on disk rather than load a torn file.@@ -1923,107 +1991,143 @@ const SoleQuantGgufDeviceRow = memo(function SoleQuantGgufDeviceRow({pipelineTag: c.task ?? null,};return (- <div className={downloadedRowShellClassName(isSelected, true)}>- <div className="min-w-0 flex-1">- <ModelRow- label={onDeviceRepoLabel(c.repo_id)}- tooltipText={localPathTooltip(- c.repo_id,- c.cache_path,- ggufQuantDetailLabel(variant.quant),+ <div>+ <div className={downloadedRowShellClassName(isSelected, true)}>+ <div className="min-w-0 flex-1">+ <ModelRow+ label={onDeviceRepoLabel(c.repo_id)}+ tooltipText={localPathTooltip(+ c.repo_id,+ c.cache_path,+ ggufQuantDetailLabel(variant.quant),+ )}+ meta={`GGUF · ${formatBytes(variant.size_bytes)}`}+ quantChip={ggufQuantChipLabel(variant.quant)}+ partial={isPartial}+ // Only for llama.cpp loads: diffusion GGUFs run on a different planner and the estimate would be wrong.+ memory={+ mediaPageForTask(c.task)+ ? undefined+ : {+ repoId: c.repo_id,+ quant: variant.quant,+ sizeBytes: variant.size_bytes,+ lookupTableBytes: ggufVariantLookupTableBytes(variant),+ loadId: c.load_id,+ }+ }+ gpuGb={gpuGb}+ showVision={c.has_vision || sole.hasVision}+ selected={isSelected}+ loaded={loaded}+ alignMeta="device"+ optionProps={rovingOptionProps(+ optionEvents,+ optionKey,+ optionId,+ optionActive,+ isSelected,+ )}+ onClick={() => actions.get().select(c.repo_id, selectMeta)}+ onArrowDownIntoChildren={+ expanderOpen ? () => focusFirstChildOption(optionKey) : undefined+ }+ vramStatus={null}+ className={downloadedRowButtonClassName}+ />+ </div>+ <span className={ROW_ACTIONS_CLASS}>+ {canConfigure && (+ <ModelLoadSettingsAction+ ariaLabel={`Inference settings for ${onDeviceRepoLabel(c.repo_id)} ${variant.quant}`}+ onConfigure={() => actions.get().configure(c.repo_id, selectMeta)}+ />)}- meta={`GGUF · ${formatBytes(variant.size_bytes)}`}- quantChip={ggufQuantChipLabel(variant.quant)}- partial={isPartial}- // Only for llama.cpp loads: diffusion GGUFs run on a different planner and the estimate would be wrong.- memory={- mediaPageForTask(c.task)- ? undefined- : {- repoId: c.repo_id,- quant: variant.quant,- sizeBytes: variant.size_bytes,- lookupTableBytes: ggufVariantLookupTableBytes(variant),- loadId: c.load_id,+ <ModelRowMenu+ ariaLabel={`More options for ${onDeviceRepoLabel(c.repo_id)} ${variant.quant}`}+ cachePath={{ repoId: c.repo_id, variant: variant.quant }}+ // The expander reads Hub-only state (updates, companions); a collapsed row never asks.+ items={[+ ...(ejectMenuItemsFor(actions, c.repo_id, ejectable) ?? []),+ {+ key: "quantizations",+ label: expanderOpen ? "Hide quantizations" : "Show quantizations",+ icon: (+ <HugeiconsIcon+ icon={+ expanderOpen+ ? ChevronDownStandardIcon+ : ChevronRightStandardIcon+ }+ strokeWidth={1.75}+ className="size-icon"+ />+ ),+ onSelect: () =>+ actions.get().toggleGgufExpanded(c.repo_id, expanderOpen),+ },+ ]}+ pin={{+ pinned: isPinned,+ pinLabel: "Pin",+ unpinLabel: "Unpin",+ onToggle: () => actions.get().togglePinned(c.repo_id, variant.quant),+ }}+ del={{+ title: "Delete cached model?",+ impact: {+ repoId: c.repo_id,+ variant: variant.quant,+ cachePath:+ variant.cache_ref ??+ variant.cache_path ??+ (mediaPageForTask(c.task) ? c.cache_path : null),+ },+ description: (+ <>+ This will remove{" "}+ <span className="font-medium text-foreground">+ {onDeviceRepoLabel(c.repo_id)} ({variant.quant})+ </span>{" "}+ from disk. You can re-download it later.+ </>+ ),+ successMessage: `Deleted ${onDeviceRepoLabel(c.repo_id)} ${variant.quant}`,+ disabled: deleteDisabled,+ onConfirm: async () => {+ const hfToken = actions.get().hfToken;+ await deleteCachedModel(+ c.repo_id,+ variant.quant,+ hfToken || undefined,+ variant.cache_ref ??+ variant.cache_path ??+ (mediaPageForTask(c.task) ? c.cache_path : undefined) ??+ undefined,+ );+ if (isChatGgufTask(c.task)) {+ await reconcileGgufPinsAfterDelete(c.repo_id, hfToken || undefined);+ } else if (isPinned) {+ actions.get().togglePinned(c.repo_id, variant.quant);}- }- gpuGb={gpuGb}- showVision={c.has_vision || sole.hasVision}- selected={isSelected}- loaded={loaded}- alignMeta="device"- optionProps={rovingOptionProps(- optionEvents,- optionKey,- optionId,- optionActive,- isSelected,- )}- onClick={() => actions.get().select(c.repo_id, selectMeta)}- vramStatus={null}- className={downloadedRowButtonClassName}- />- </div>- <span className={ROW_ACTIONS_CLASS}>- {canConfigure && (- <ModelLoadSettingsAction- ariaLabel={`Inference settings for ${onDeviceRepoLabel(c.repo_id)} ${variant.quant}`}- onConfigure={() => actions.get().configure(c.repo_id, selectMeta)}+ actions.get().prunePinnedQuantValidation(c.repo_id, variant.quant);+ actions.get().refreshCachedLists();+ },+ }}/>- )}- <ModelRowMenu- ariaLabel={`More options for ${onDeviceRepoLabel(c.repo_id)} ${variant.quant}`}- cachePath={{ repoId: c.repo_id, variant: variant.quant }}- items={ejectMenuItemsFor(actions, c.repo_id, ejectable)}- pin={{- pinned: isPinned,- pinLabel: "Pin",- unpinLabel: "Unpin",- onToggle: () => actions.get().togglePinned(c.repo_id, variant.quant),- }}- del={{- title: "Delete cached model?",- impact: {- repoId: c.repo_id,- variant: variant.quant,- cachePath:- variant.cache_ref ??- variant.cache_path ??- (mediaPageForTask(c.task) ? c.cache_path : null),- },- description: (- <>- This will remove{" "}- <span className="font-medium text-foreground">- {onDeviceRepoLabel(c.repo_id)} ({variant.quant})- </span>{" "}- from disk. You can re-download it later.- </>- ),- successMessage: `Deleted ${onDeviceRepoLabel(c.repo_id)} ${variant.quant}`,- disabled: deleteDisabled,- onConfirm: async () => {- const hfToken = actions.get().hfToken;- await deleteCachedModel(- c.repo_id,- variant.quant,- hfToken || undefined,- variant.cache_ref ??- variant.cache_path ??- (mediaPageForTask(c.task) ? c.cache_path : undefined) ??- undefined,- );- if (isChatGgufTask(c.task)) {- await reconcileGgufPinsAfterDelete(c.repo_id, hfToken || undefined);- } else if (isPinned) {- actions.get().togglePinned(c.repo_id, variant.quant);- }- actions.get().prunePinnedQuantValidation(c.repo_id, variant.quant);- actions.get().refreshCachedLists();- },- }}- />- </span>+ </span>+ </div>+ {expanderOpen &&+ renderDeviceGgufExpander({+ repo: c,+ optionKey,+ loadedQuants,+ updateDisabled,+ expander,+ actions,+ callbacks,+ canConfigure,+ })}</div>);});@@ -2157,48 +2261,17 @@ const DownloadedGgufDeviceRow = memo(function DownloadedGgufDeviceRow({</span>)}</div>- {expanderOpen && (- <GgufVariantExpander- diffusionLoad={expander.diffusionLoad}- hostPooledMemory={expander.hostPooledMemory}- gpuCount={expander.gpuCount}- repoId={c.repo_id}- loadedQuants={loadedQuants}- pipelineTag={c.task ?? null}- loadId={c.load_id}- cachePath={c.cache_path}- onDevice={true}- allowPin={true}- onHasVision={(v) => actions.get().reportVision(c.repo_id, v)}- onSelect={callbacks.onSelect}- resolveDownloadFootprint={expander.resolveDownloadFootprint}- onConfigure={canConfigure ? callbacks.onConfigure : undefined}- hfToken={expander.hfToken}- parentOptionKey={optionKey}- onNavigatePastStart={callbacks.onNavigatePastStart}- onNavigatePastEnd={callbacks.onNavigatePastEnd}- gpuGb={expander.gpuGb}- systemRamGb={expander.systemRamGb}- budgetKnown={expander.budgetKnown}- variantActions={{- onUpdate: (quant, expectedBytes) =>- actions.get().updateGgufVariant(c.repo_id, quant, expectedBytes),- updateDisabled,- onDelete: async (quant, cachePath) => {- const a = actions.get();- await deleteCachedModel(- c.repo_id,- quant,- a.hfToken || undefined,- cachePath ??- (mediaPageForTask(c.task) ? c.cache_path || undefined : undefined),- );- actions.get().prunePinnedQuantValidation(c.repo_id, quant);- actions.get().refreshCachedLists();- },- }}- />- )}+ {expanderOpen &&+ renderDeviceGgufExpander({+ repo: c,+ optionKey,+ loadedQuants,+ updateDisabled,+ expander,+ actions,+ callbacks,+ canConfigure,+ })}</div>);});@@ -2450,22 +2523,6 @@ async function readSoleQuant(}}-function soleQuantNeedsExpander(- target: SoleQuantTarget,- quant: string,- hfToken?: string,-): Promise<boolean> {- if (isHuggingFaceOffline()) return Promise.resolve(false);- return hubWithdrawsSoleQuant(- () =>- listGgufVariantsCached(target.repoId, hfToken, {- localPath: target.localSource,- includeCacheLocations: target.includeCacheLocations,- }),- quant,- );-}-const EMPTY_SOLE_QUANT_ENTRIES: ReadonlyMap<string,SoleQuantEntry<SoleDownloadedQuant>@@ -2527,13 +2584,13 @@ function useSoleDownloadedQuants(};}, []);- const hubProbeLimitRef = useRef(createTaskLimiter(SOLE_QUANT_WORKERS));const readerRef = useRef<ReturnType<typeof createSoleQuantReader<SoleDownloadedQuant>> | null>(null);if (readerRef.current === null) {readerRef.current = createSoleQuantReader<SoleDownloadedQuant>({workers: SOLE_QUANT_WORKERS,+ // Disk only: the Hub is asked when the row is expanded.read: (target) => readSoleQuant(target, hfTokenRef.current),commit: (target, quant) => {if (!mountedRef.current) return;@@ -2542,23 +2599,6 @@ function useSoleDownloadedQuants(next.set(target.repoId, { key: target.key, quant });return next;});- if (!quant) return;- // A later Hub answer may still send the row back to its expander.- void hubProbeLimitRef.current(() =>- soleQuantNeedsExpander(- target,- quant.variant.quant,- hfTokenRef.current,- ),- ).then((withdraw) => {- if (!withdraw || !mountedRef.current) return;- setEntries((prev) => {- if (prev.get(target.repoId)?.key !== target.key) return prev;- const next = new Map(prev);- next.set(target.repoId, { key: target.key, quant: null });- return next;- });- });},});}@@ -7354,6 +7394,10 @@ export function HubModelPicker({pinned={pinnedSet.has(pinKey(c.repo_id, sole.variant.quant))}ejectable={ejectsKept && isKeptLoaded(c.repo_id)}gpuGb={expanderGpuGb}+ loadedQuants={loadedQuantsFor(c.repo_id)}+ expanderOpen={isGgufExpanded(c.repo_id)}+ updateDisabled={loadedModelId === c.repo_id}+ expander={deviceExpanderProps}{...deviceRowListProps(optionKey)}/>);diff --git a/studio/frontend/tests/loaded-gguf-quant-marker.test.ts b/studio/frontend/tests/loaded-gguf-quant-marker.test.tsindex 76f668aba0d..00f3f418c68 100644--- a/studio/frontend/tests/loaded-gguf-quant-marker.test.ts+++ b/studio/frontend/tests/loaded-gguf-quant-marker.test.ts@@ -12,9 +12,10 @@ const picker = readSrc(test("every quant list and cached GGUF row marks the quant each loaded model runs", () => {const expanders = picker.match(/<GgufVariantExpander\b/g)?.length ?? 0;- // Plus the two memoized On Device rows, which take the list for their expander.- assert.equal(picker.match(/loadedQuants=\{/g)?.length ?? 0, expanders + 2);+ // Plus the three memoized On Device rows, which take the list for their expander.+ assert.equal(picker.match(/loadedQuants=\{/g)?.length ?? 0, expanders + 3);assert.match(picker, /<DownloadedGgufDeviceRow[\s\S]*?loadedQuants=\{loadedQuantsFor\(c\.repo_id\)\}/);+ assert.match(picker, /<SoleQuantGgufDeviceRow[\s\S]*?loadedQuants=\{loadedQuantsFor\(c\.repo_id\)\}/);assert.match(picker, /<LocalModelDeviceRow[\s\S]*?loadedQuants=\{\s*isGguf && !directGguf \? loadedQuantsFor\(m\.id\) : EMPTY_LOADED_QUANTS\s*\}/);assert.match(picker,diff --git a/studio/frontend/tests/picker-gguf-discovery.test.ts b/studio/frontend/tests/picker-gguf-discovery.test.tsindex f522beed83c..493a1780bd6 100644--- a/studio/frontend/tests/picker-gguf-discovery.test.ts+++ b/studio/frontend/tests/picker-gguf-discovery.test.ts@@ -4,11 +4,7 @@import assert from "node:assert/strict";import test from "node:test";import type { GgufVariantsResponse } from "../src/features/chat/types/api.ts";-import {- loadPickerGgufVariants,- createTaskLimiter,- hubWithdrawsSoleQuant,-} from "../src/features/model-picker/components/model-selector/gguf-discovery.ts";+import { loadPickerGgufVariants } from "../src/features/model-picker/components/model-selector/gguf-discovery.ts";const local: GgufVariantsResponse = {repo_id: "Org/Cached",@@ -232,46 +228,6 @@ test("an update downloads the published revision's size and the Hub default winsassert.equal(current.variants[0].size_bytes, 256);});-test("a Hub update or missing drafter withdraws a collapsed sole quant", async () => {- for (const extra of [- { update_available: true },- { pending_drafter_filename: "mtp-drafter.gguf" },- ]) {- const remote = { ...local, variants: [{ ...local.variants[0], ...extra }] };- assert.equal(- await hubWithdrawsSoleQuant(async () => remote, "q4_k_m"),- true,- );- }- assert.equal(await hubWithdrawsSoleQuant(async () => local, "Q4_K_M"), false);- assert.equal(- await hubWithdrawsSoleQuant(async () => {- throw new Error("Hugging Face unreachable");- }, "Q4_K_M"),- false,- );-});--test("follow-up Hub probes never exceed the limiter's concurrency", async () => {- const run = createTaskLimiter(2);- let active = 0;- let peak = 0;- const done = await Promise.all(- Array.from({ length: 7 }, (_, i) =>- run(async () => {- active += 1;- peak = Math.max(peak, active);- await new Promise((resolve) => setTimeout(resolve, 5));- active -= 1;- if (i === 3) throw new Error("probe failed");- return i;- }).catch(() => -1),- ),- );- assert.equal(peak, 2);- assert.deepEqual(done, [0, 1, 2, -1, 4, 5, 6]);-});-test("a failed disk phase falls back to the Hub only when it is reachable", async () => {const calls: boolean[] = [];const list = async (localOnly: boolean) => {diff --git a/tests/studio/test_model_picker_contracts.py b/tests/studio/test_model_picker_contracts.pyindex 1239ef4a6e6..112c2c3594b 100644--- a/tests/studio/test_model_picker_contracts.py+++ b/tests/studio/test_model_picker_contracts.py@@ -692,7 +692,15 @@ def test_a_pinned_cached_row_loads_from_the_id_the_backend_pinned():assert "loadPickerGgufVariants(" in pickersole = re.search(r"async function readSoleQuant\(.*?\n}", picker, re.S)assert sole and "localOnly: true," in sole.group(0)- assert "soleQuantNeedsExpander(" in picker and "hubWithdrawsSoleQuant(" in picker+ # Collapsed rows read disk only; the expander asks the Hub.+ assert "hubWithdrawsSoleQuant(" not in picker+ assert "soleQuantNeedsExpander(" not in picker+ sole_reader = re.search(r"function useSoleDownloadedQuants\(.*?\n}\n", picker, re.S)+ assert sole_reader, "the sole-quant reader was renamed"+ assert "listGgufVariantsCached(" not in sole_reader.group(0), (+ "the collapsed rows list variants directly instead of through readSoleQuant, "+ "which is the only caller that pins offline=true"+ )assert "cachePath={c.cache_path}" in pickerpage = _read("features/chat/chat-page.tsx")@@ -3182,7 +3190,7 @@ def test_a_multi_quant_parent_row_still_has_no_gear():# The parent row is the memoized DownloadedGgufDeviceRow that renderDownloadedGgufRow mounts.start = pickers.index("const DownloadedGgufDeviceRow = memo(")parent = pickers[start : pickers.index("\n});", start)]- parent_row = parent[: parent.index("{expanderOpen && (")]+ parent_row = parent[: parent.index("{expanderOpen &&")]# A partial repo puts a row menu in the gutter instead; the gear invariant is about the# branch that expands, so read that one when the row splits on it.split = parent_row.find("isPartialRepo ?")@@ -3205,6 +3213,18 @@ def test_a_multi_quant_parent_row_still_has_no_gear():)+def test_a_sole_quant_row_keeps_its_gear_and_reaches_the_expander_from_its_menu():+ """Playwright drivers open run settings from a sole-quant row's gear, and Enter on the row+ loads, so the expander (Hub-only state: updates, pending companions) opens from the menu."""+ pickers = _read("features/model-picker/components/model-selector/pickers.tsx")+ start = pickers.index("const SoleQuantGgufDeviceRow = memo(")+ sole = pickers[start : pickers.index("\n});", start)]+ assert "<ModelLoadSettingsAction" in sole and "Inference settings for" in sole+ assert 'key: "quantizations"' in sole+ assert "actions.get().toggleGgufExpanded(c.repo_id, expanderOpen)" in sole+ assert "{expanderOpen &&\n renderDeviceGgufExpander({" in sole++def test_run_settings_page_keeps_its_identifying_controls():page = _read("features/model-picker/components/model-config-page.tsx")assert 'aria-label="Back to model list"' in page