Skip to content

Model picker: default Show all quantizations off, collapse single-quant rows, say Reveal in Folder outside macOS - #7736

Merged
shimmyshimmer merged 16 commits into
mainfrom
studio-single-quant-row
Aug 2, 2026
Merged

shimmyshimmer merged 16 commits into
mainfrom
studio-single-quant-row

Conversation

@shimmyshimmer

@shimmyshimmer shimmyshimmer commented Aug 2, 2026 •

Copy link
Copy Markdown
Member

Three model picker changes: "Show all quantizations" now defaults to off, single-quant rows collapse in the On Device list, and the reveal label off macOS.

1. Default "Show all quantizations" to off

On Device now lists what is actually on disk, rather than every quant the repo publishes. A stored choice still wins, so only fresh installs and users who never touched the toggle move.

That list now keeps torn quants. They were filtered out with the undownloaded ones, which left a folder holding only a torn quant reading "No GGUF variants found" and stranded the resume. Covered by tests/variant-visibility.test.ts.

2. Collapse single-quant On Device rows

In the model picker's On Device list, a GGUF repo always renders as a row you have to click to reveal its quantizations. With "Show all quantizations" off, that expander often holds a single downloaded quant, so the click reveals one row and nothing else.

This collapses that case. A repo holding exactly one complete quant on disk now renders as a single row carrying the quant as a chip, and one click loads it directly, the same way a pinned quant row behaves.

Changes

  • useSoleDownloadedQuants resolves, per On Device GGUF repo, what is on disk. It only runs while "Show all quantizations" is off, uses the cached Hub resolver with preferLocalCache so it never triggers a remote listing, and resolves 6 repos at a time.
  • A repo collapses only when its disk-only listing holds one variant and that variant is complete. A torn quant beside a complete one keeps the expander, where it can be resumed.
  • Backend: every response built from local state now also lists quants known only from download state, the disk-only branches and the remote-failure fallback alike. A sibling cancelled before any file landed leaves no snapshot entry, so it was missing from those listings, which made the repo read as holding a single quant and took its resume with it. Only quants the listing does not already carry are added, and the success path already handled this through is_variant_partial.
  • Those rows render through a new row renderer: repo name, quant chip, GGUF tag and size, and the vision flag read with the variant. The Loaded badge matches the collapsed quant rather than any active variant from the repo. Hovering keeps inference settings, pin/unpin and delete. There is no update entry, since update_available is derived from remote blob hashes and a disk-only response cannot carry it; the Hub page's on-device card still surfaces updates, and turning the setting on restores the expander with its indicator.
  • ModelRow gained an optional quantChip prop for the chip beside the name.
  • Selected and Loaded state for those rows comes from soleQuantRowState in the new row-identity.ts, which also holds the picker's id and quant matchers. A repo running a different quant no longer marks the row selected or loaded, while a compare pane's staged pick keeps its highlight.
  • Auto-expansion waits for that repo's probe to settle. Without the wait, a user with "Expand quantizations" on would mount an expander, and its remote listing, for every row in the window before single-quant repos collapse. A row the user clicks open skips the wait, including a row still waiting, whose click now opens it rather than collapsing what is already hidden.
  • Probe results are kept per repo in sole-quant-cache.ts, each tagged with that repo's cache version, location, and the bytes the inventory reports. A download or delete re-reads only the repo it touched, leaving every other row and expander alone. A quant added or replaced outside this tab moves the row's bytes, and a sibling cancelled there moves the row's new has_variant_state, which is the only signal that changes when a cancel leaves no bytes behind. Either drops that repo's cached listing and re-reads it.
  • Reads run as a worker pool, so a slow repo does not hold up the ones behind it, a repo is read once per key, and a read whose repo has since moved on is dropped rather than committed over the newer result.
  • New useGgufVariantsCacheVersions(repoIds) reads every listed repo's cache version into one snapshot. Watching the global version alone does not work: a per-repo invalidation never moves it. Covered by tests/gguf-variants-cache-version.test.ts and tests/sole-quant-cache.test.ts.

Behaviour left alone

  • Turning "Show all quantizations" back on restores the previous rows exactly.
  • Repos with two or more quants downloaded keep their expander.
  • A repo whose variants cannot be resolved keeps its expandable row rather than guessing.
  • Recommended and other browse lists are untouched, they still list every quant.

3. Say "Reveal in Folder" outside macOS

The reveal action used three labels: "Reveal in Finder" on macOS, "Reveal in File Explorer" on Windows, "Reveal in File Manager" everywhere else. Windows and Linux now both say "Reveal in Folder", macOS keeps "Reveal in Finder".

Applied at all three sites that render it, so the row menu, the path info button and the GGUF download card stay consistent:

  • model-picker/components/model-selector/model-row-menu.tsx
  • hub/catalog/path-info-button.tsx
  • hub/catalog/gguf-download-card.tsx

Label only, the underlying reveal call and its platform dispatch are unchanged.

Testing

  • Backend pytest tests/test_cached_gguf_routes.py tests/test_hf_cache_dangling_refs.py: 307 passing, including three new regression tests for the cancelled sibling, one per code path plus the inventory signal. The wider -k "gguf or variant or inventory or partial or cache" selection has an identical failure set with and without this branch.
  • npm test: 251 passing, including 6 new cases for per-repo cache invalidation, 16 for the sole-quant cache, its read scheduling and its disk-drift rule, 7 for the collapsed row's selected/loaded state, and 13 for what an expander lists, when it opens, and what a click does to it.
  • npm run typecheck and npm run build clean.
  • biome check reports no new diagnostics against each file's baseline.
  • Backend probe against a real cache confirming the resolver is disk-only: prefer_local_cache=True issues zero remote listings and returns exactly the on-disk quants, False issues one remote listing per repo.

With Show all quantizations off, an On Device GGUF repo holding one quant
on disk now renders as a single row with that quant as a chip, loading it
in one click instead of requiring an expand. Repos with two or more quants
downloaded, and every row while the setting is on, are unchanged.

@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: 27c292dfa2

ℹ️ 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".

await Promise.all(
targets.slice(i, i + SOLE_QUANT_BATCH).map(async (target) => {
try {
const res = await listGgufVariants(

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 Use the cached local variant resolver

When the On Device section opens with “Show all quantizations” disabled, this calls the uncached chat listGgufVariants client once for every downloaded GGUF repo. Supplying localPath without preferLocalCache does not make the backend disk-only: get_gguf_variants_response still performs the remote Hugging Face listing first, so a large local catalog generates many unnecessary remote requests on every mount, causing slow offline fallback and potential rate limiting despite the six-request batching. Use the cached Hub resolver with local-cache preference, or otherwise cache these automatic probes.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Confirmed, and it was worse than described. listGgufVariants from the chat client has no client side cache at all, and local_only = prefer_local_cache or offline in get_gguf_variants_response, so passing localPath alone never took the disk-only branch. On top of the remote listing, /api/models/gguf-variants also runs _read_native_context_length, a GGUF header walk, per call.

Verified against a real cache by spying on the remote lister:

unsloth/SmolLM2-135M-Instruct-GGUF prefer_local_cache=True:  remote=0  rows=[('Q8_0', True, False)]
unsloth/SmolLM2-135M-Instruct-GGUF prefer_local_cache=False: remote=1  rows=[('Q8_0', True, False)]
unsloth/Qwen3.5-4B-GGUF            prefer_local_cache=True:  remote=0  rows=[('UD-Q4_K_XL', True, False), ('UD-IQ2_XXS', True, False)]
unsloth/Qwen3.5-4B-GGUF            prefer_local_cache=False: remote=1  rows=[('UD-Q4_K_XL', True, False), ('UD-IQ2_XXS', True, False)]

Fixed in 141b6b8: the probe now uses the cached Hub resolver with preferLocalCache: true plus localPath, so it is disk-only and shares the TTL cache. Two follow-ons from that, both intended:

  • The response only ever lists files on disk, so the rule is now "one listed variant and it is downloaded". A repo with a torn quant beside a complete one keeps its expander, where the partial row can be resumed or deleted.
  • A disk-only response never carries update_available, so the update entry is gone from the collapsed row rather than sitting there permanently dead. The Hub page's on-device card still surfaces updates.

): ReadonlyMap<string, GgufVariantDetail> {
// A download or delete bumps this, so a repo that gained or lost a sibling
// quant switches row style.
const variantsVersion = useGgufVariantsCacheVersion();

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 Observe per-repository cache invalidations

Calling useGgufVariantsCacheVersion() without a repo ID observes only the global version, while download completion and deleteCachedModel invalidate a specific repo and therefore update only that repo's version. React receives the invalidation event but sees the same snapshot, so fetchKey remains unchanged and the stale sole-quant map stays active; after downloading a sibling quant, the row can continue direct-loading the old quant instead of becoming expandable until inventory refresh and the entire batch resolution finish. Aggregate the relevant per-repo versions or clear the resolved map directly on repository invalidation.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Confirmed. getGgufVariantsCacheVersion() with no repo id returns ${globalVersion}:0, and bumpGgufVariantsCacheVersion(repoId) only writes into repoVersions, so a per-repo invalidation fires the listener but hands back an identical snapshot. fetchKey never moved and the resolved map stayed put until an inventory refresh happened to change the repo list.

Fixed in 141b6b8 with useGgufVariantsCacheVersions(repoIds), which reads every listed repo's version into one snapshot. Added tests/gguf-variants-cache-version.test.ts to pin the behaviour, including the case that made this a bug:

✔ a per-repo invalidation does not move the global version
✔ a per-repo invalidation moves that repo's version
✔ the aggregated snapshot moves when any listed repo is invalidated
✔ an unrelated repo's invalidation leaves the snapshot alone
✔ a global invalidation moves the snapshot too

res,
).variants.filter((variant) => variant.downloaded === true);
if (downloaded.length === 1) {
found.set(target.repoId, downloaded[0]);

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 native context metadata for the collapsed row

The normalized variants response includes the native contextLength, but this map retains only the variant and the collapsed row consequently omits contextLength from selectMeta. Opening inference settings for a sole quant then falls back to fetchGgufStagedMetadata using the repo ID rather than c.load_id; for a pinned snapshot in a non-active cache, or when offline resolution by repo ID fails, this can inspect a different revision or return null, making the context slider use the wrong native limit or its 32K fallback. Carry the response's context length through the map as the existing expander does.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Half right, but the suggested fix is not available on the resolver this now uses.

context_length is not part of GgufVariantsResponse in the Hub schema. Only /api/models/gguf-variants attaches one, and it does so by calling _read_native_context_length, a GGUF header walk done per request. The disk-only responses confirm it:

unsloth/SmolLM2-135M-Instruct-GGUF prefer_local_cache=True: context_length=NO FIELD
unsloth/Qwen3.5-4B-GGUF            prefer_local_cache=True: context_length=NO FIELD

So carrying the value through the map would mean keeping the chat endpoint, which is exactly the remote listing plus header walk per repo flagged in the other comment. Not worth it to seed a slider.

You are right that fetchGgufStagedMetadata is called with model_path: target.id rather than the load id, so a pinned snapshot in a non-active cache can be probed by repo id. That is pre-existing and not introduced here: pinned quant rows have always omitted contextLength and take the same path. Worth its own fix in the staged metadata call rather than paying for a header walk across every On Device repo. Leaving as is.

Windows said Reveal in File Explorer and Linux said Reveal in File
Manager. Both now say Reveal in Folder; macOS keeps Reveal in Finder.
@shimmyshimmer shimmyshimmer changed the title Collapse single-quant On Device rows in the model picker Model picker: collapse single-quant On Device rows, say Reveal in Folder outside macOS Aug 2, 2026

@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: dca14f8670

ℹ️ 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".

tooltipText={localPathTooltip(c.repo_id, c.cache_path)}
meta={`GGUF · ${formatBytes(variant.size_bytes)}`}
quantChip={variant.quant}
showVision={c.has_vision ?? visionByRepo[c.repo_id]}

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 Retain vision metadata when collapsing the row

When an older backend omits the optional has_vision field from cached inventory, a sole-quant repository can no longer populate this fallback: useSoleDownloadedQuants discards the variants response's normalized hasVision, and the collapsed row never mounts the expander that calls reportVision. Consequently, Vision-capable models permanently lose their Vision badge while “Show all quantizations” is disabled; retain and report the response metadata alongside the sole variant.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Confirmed and fixed in 4075d43.

visionByRepo is only ever written by the expander's reportVision, and a collapsed row never mounts the expander, so that fallback could never fill for these repos. The resolver was already reading has_vision in the same response and throwing it away.

It now keeps the flag beside the variant and the row reads c.has_vision || sole.hasVision. The disk-only response carries it correctly, checked across the whole local cache:

COLLAPSE  unsloth/gemma-4-E4B-it-GGUF        vision=True   [('UD-Q4_K_XL', True)]
COLLAPSE  unsloth/Qwen3.6-27B-MTP-GGUF       vision=True   [('UD-Q4_K_XL', True)]
COLLAPSE  unsloth/SmolLM2-135M-Instruct-GGUF vision=False  [('Q8_0', True)]
expander  unsloth/Qwen3.5-4B-GGUF            vision=True   [('UD-Q4_K_XL', True), ('UD-IQ2_XXS', True)]

Two of the repos that collapse here are vision models, so this was not hypothetical.

Comment on lines +3029 to +3034
loaded={isRuntimeLoadedModel(
loadedModelId,
activeGgufVariant,
c.repo_id,
"required",
)}

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 Match the loaded badge to the collapsed quant

When the active Hugging Face cache changes while another quant from the same repository remains loaded—for example, Q8 from the previous cache is running while the newly active cache exposes sole quant Q4—this marks the Q4-specific row as Loaded because the required policy only verifies that some active GGUF variant exists. The collapsed row now represents an exact quant, so compare activeGgufVariant with variant.quant, as the pinned-quant renderer does, rather than showing the badge for any loaded quant from the repository.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Correct, fixed in 4075d43.

isRuntimeLoadedModel(..., "required") only asks whether some GGUF variant is active: it computes hasActiveGgufVariant from ggufVariantsMatchForPicker(activeGgufVariant, null) and never compares the quant. That is right for a repo row standing in for every quant, wrong for a row that names one.

The row now matches on the quant, like renderPinnedQuantRow:

loaded={
  modelIdsMatchForPicker(loadedModelId, c.repo_id) &&
  ggufVariantsMatchForPicker(activeGgufVariant, variant.quant)
}

The pinned renderer's extra !ggufVariantsMatchForPicker(activeGgufVariant, null) clause is redundant here: variant.quant is non-empty (isValidGgufVariant requires it), and the matcher normalizes a null active variant to "", so a null can never match.

Probing with localPath alone still ran a remote listing per repo, since
the backend only goes disk-only on prefer_local_cache. Switch to the
cached Hub resolver with local preference, so the On Device list stays
offline and client cached.

Watch every listed repo's cache version instead of the global one, which
a per-repo invalidation never moves. Collapse only when the repo holds a
single complete file, so torn quants keep their expander, and drop the
update entry that a disk-only response can never populate.

@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: 141b6b866d

ℹ️ 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 +3048 to +3051
<ModelRowMenu
ariaLabel={`More options for ${c.repo_id} ${variant.quant}`}
iconClassName="size-3"
cachePath={{ repoId: c.repo_id, variant: variant.quant }}

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 Restore the update action on collapsed rows

When “Show all quantizations” is disabled and the sole cached quant has a newer Hub version, this collapsed path replaces GgufVariantExpander, but its ModelRowMenu receives only the cache path, pin, and delete actions. The expandable path wires variantActions.onUpdate, whereas the local-only sole-quant resolver also cannot surface remote update state, so these users lose both the update indicator and the Update command. Preserve the update metadata and wire the managed update action into this menu.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Not doing this one, and the comment states the reason itself: a local-only resolver cannot surface remote update state.

update_available is not something the collapsed row is dropping on the floor, it is not derivable on disk. _variant_update_available_from_requirement compares local blob hashes against requirement.expected_files sha256 values, which come from the remote Hugging Face listing, and the cache inventory carries no equivalent flag. Wiring the action back would mean going back to the remote listing per repo on every mount, which is the P2 raised on this same PR and the more serious of the two, especially now that the setting defaults to off and this is the common path.

Verified across the full local cache that the current resolver is disk-only: 8 cached GGUF repos probed, 0 remote listings attempted.

So the trade is deliberate: a single-quant repo shows no update hint in the picker. Updates remain available from the Hub page's on-device card, which does the remote comparison on a page the user chose to open, and turning "Show all quantizations" on restores the expander with its update indicator. If the update hint should be present without a remote call, the fix belongs in the inventory, exposing a cached update flag per repo, and then both the collapsed row and the Hub rows can read it.

On Device now lists what is on disk unless the setting is turned on.
A stored choice still wins, so only fresh installs move.
@shimmyshimmer shimmyshimmer changed the title Model picker: collapse single-quant On Device rows, say Reveal in Folder outside macOS Model picker: default Show all quantizations off, collapse single-quant rows, say Reveal in Folder outside macOS Aug 2, 2026
The collapsed row never mounts the expander, so it never received a
reported vision flag. Keep the flag the resolver already read.

The row is one quant, so match the loaded badge to that quant instead of
accepting any active variant from the repo.
@shimmyshimmer

Copy link
Copy Markdown
Member Author

@codex review

@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: 4075d432c2

ℹ️ 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 variant = sole.variant;
const optionKey = makeModelOptionKey("downloaded-gguf", c.repo_id);
const isSelected = value === c.repo_id;

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 Match selected state to the collapsed quant

When the selected model ID matches this repository but activeGgufVariant is a different quant—for example, Q8 remains loaded after switching to a cache whose sole on-disk quant is Q4—this marks the Q4 row selected and passes that state into its option props even though the row now represents one exact quant. This produces a misleading selected background/ARIA state while the correctly updated Loaded badge remains absent; include the same normalized variant comparison used by the pinned-quant renderer.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Right that the row was claiming a selection that pointed at another quant, fixed in 335e1fe, though not with a straight copy of the pinned renderer's comparison.

Copying it outright would break compare panes. HubModelPicker never receives selectedGgufVariant, so the only quant signal it has is the resident activeGgufVariant from the runtime store, while value is per pane (value={model1.id} / model2.id in GeneralCompareHeader). Gating purely on the resident quant would drop the highlight from a staged pane whenever the other pane's model is the resident one.

So the rule is: the picker's value selects the row, unless this repo is resident on a different quant.

selected: pickerValue === repoId && (!repoIsLoaded || quantIsLoaded)

In the main selector value is inferenceParams.checkpoint, so repoIsLoaded is true whenever the value matches and this reduces to the exact quant comparison you asked for. Extracted into row-identity.ts with the matchers, and pinned by tests/sole-quant-row-state.test.ts:

✔ this quant running: selected and loaded
✔ quant casing and padding still count as running
✔ repo running a different quant: neither selected nor loaded
✔ repo resident with no quant reported: not this row
✔ another model resident: the picker's value still selects the row
✔ nothing resident: the picker's value still selects the row
✔ the picker points elsewhere: not selected, even while running

One correction on the detail: the pinned renderer uses strict === for its selected check, not the normalized comparison. The normalized matcher is what it uses for Loaded. The row state helper now normalizes both, so a padded or differently cased quant no longer misses.

The row names one quant, so a repo running a different one is no longer
marked selected. Value alone still selects when the repo is not the
resident model, so a compare pane's staged pick keeps its highlight.

Moves the picker's id and quant matchers into row-identity.ts so the
row state has a test.

@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: 335e1fe034

ℹ️ 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 +762 to +764
// One file on disk and nothing torn beside it. A partial quant
// keeps the expander, where it can be resumed or deleted.
if (local.length === 1 && local[0].downloaded === 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.

P2 Badge Keep partial variants visible in the fallback expander

When a repo contains a torn quant, either alone or beside a complete one, this deliberately keeps the expander so the partial download can be resumed or deleted. However, with the newly default-disabled “Show all quantizations” setting, GgufVariantExpander builds displayVariants using sortedVariants.filter((v) => v.downloaded), which removes partial variants because they are reported with downloaded: false. A partial-only repo therefore displays “No GGUF variants found,” while a mixed repo hides the torn quant, leaving neither resume nor delete available unless the user discovers and enables the setting.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Right about the mechanism, fixed in ae66aea. Two corrections to where it bites and what was lost.

The filter is the bug: downloaded is false for a torn quant (_local_response sets downloaded = quant in complete, partial = not downloaded), so filtering on downloaded alone dropped exactly the rows that need attention. That is now:

variants.filter((v) => v.downloaded === true || v.partial === true)

Off means what the repo holds on disk, and a torn download holds space. Quants that were never downloaded stay hidden, which still works because partial is only set for torn or in-progress quants: the remote branch computes is_partial = v.quant in partial_quants, the set built from .incomplete blobs, never for plain undownloaded rows.

Corrections:

  • A partial-only cached repo cannot reach this state. isCompleteCachedRow (!row.partial && !row.liveDownload) keeps it out of the On Device list entirely, so no row and no expander. The empty "No GGUF variants found" case is real for the local-path expanders instead, custom folders, LM Studio and scanned dirs, which are not filtered that way. Same fix covers it.
  • The expander never offered delete for a torn quant, with the setting on or off: the row menu is gated on v.downloaded at pickers.tsx:1170. So what the filter took away was visibility and resume, not delete. Widening the menu to partial rows is a separate change and I have left it alone.

Pinned by tests/variant-visibility.test.ts:

✔ On Device with the setting off lists what is on disk
✔ On Device with the setting on lists every quant
✔ browse lists are never filtered
✔ a torn-only repo does not empty its list
✔ a repo with nothing on disk lists nothing
✔ variants missing the flags count as not on disk

Off means what the repo holds on disk, and a torn download holds space
and needs a resume. Filtering on downloaded alone dropped those rows, so
a folder holding only a torn quant read as No GGUF variants 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: ae66aeadd0

ℹ️ 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 3081 to 3083
const soleQuant = soleDownloadedQuants.get(c.repo_id);
if (soleQuant) return renderSoleQuantGgufRow(c, soleQuant);
return (

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 Wait before mounting fallback expanders

When a user has persisted “Expand quantizations” enabled and the new default leaves “Show all quantizations” off, soleDownloadedQuants is initially empty while its batched disk probes run, so every row falls through here and isGgufExpanded mounts GgufVariantExpander. That expander still calls the uncached chat listGgufVariants without preferLocalCache, causing a remote-first Hugging Face listing per downloaded repo before sole rows eventually collapse; large catalogs can therefore still be slow offline or hit rate limits. Fresh evidence in the final code is the asynchronous empty state combined with this immediate fallback mount; represent resolution as pending or make the fallback expander use the cached local resolver while this setting is off.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Correct, and it is the earlier remote-listing P2 coming back through a different door. Fixed in 5c4508b.

The window is real: useSoleDownloadedQuants starts empty, isGgufExpanded returns true for every row while expandQuantizations is on, so each row mounted GgufVariantExpander, whose effect fires the chat listGgufVariants without preferLocalCache. Those requests still complete after the rows collapse and the expanders unmount.

Auto-expansion now waits for the probe:

shouldMountVariantExpander({ expanded, autoExpand, soleQuantsPending })
// expanded && !(autoExpand && soleQuantsPending)

A row the user opened is never held back, since that is one repo the user asked for.

I did not take the other suggestion, switching the fallback expander to the cached local resolver while the setting is off. That resolver returns no update_available, so multi-quant repos would lose their update indicator in the default configuration, and the Hub route is also where context_length is attached, which the expander threads into the pick. Holding the mount costs nothing and keeps both.

Worth being explicit about what remains: with expandQuantizations on, multi-quant repos still auto-expand and still fetch remotely once the probe settles. That predates this PR, and it is one request per repo the user has asked to see expanded.

Added to tests/variant-visibility.test.ts:

✔ auto-expansion waits for the sole-quant probe
✔ auto-expansion resumes once the probe settles
✔ a row the user opened is not held back
✔ a collapsed row never mounts an expander

@shimmyshimmer

Copy link
Copy Markdown
Member Author

@codex review

With Expand quantizations on, every On Device row mounted an expander,
and its remote listing, in the window before single-quant repos collapse.
Auto-expansion now waits for the probe; a row the user opened does not.

@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: 5c4508b539

ℹ️ 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 +792 to +793
quants: settled ? resolved.quants : EMPTY_SOLE_QUANTS,
pending: enabled && !settled,

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 Retain unaffected sole-quant resolutions during invalidation

When a download or deletion invalidates one repository, its version changes the aggregate fetchKey, and this drops the entire resolved map while every repository is probed again. Consequently, unrelated sole-quant rows temporarily revert to expandable rows, and with auto-expansion enabled the shared pending flag also unmounts every repository's expander. Because the resolver processes sequential batches of six and each request can take up to 30 seconds, one slow repository can change or disable interactions across the whole catalog for an extended period; preserve settled results and pending state per repository so only the invalidated row is withheld.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Correct on all three points, fixed in f07ac9d.

The aggregate fetchKey did move on any single repo's invalidation, the returned map was dropped wholesale, and the pending flag was one boolean for the whole list, so with auto-expansion on every expander unmounted while the catalog was re-read. GGUF_VARIANTS_TIMEOUT_MS is 30s and the batches were sequential, so a slow repo did hold up everything behind it.

Reworked to per repo state in sole-quant-cache.ts:

  • Each repo carries its own key, ${itsCacheVersion}::${localSource}, and its own entry. partitionSoleQuants returns resolved rows, the pending set, and only the repos needing a read, so a repo keeps its row until its own key moves.
  • pending is a set, and the expander gate now asks about that row's repo rather than the whole list.
  • Reads run as a worker pool instead of fixed batches of six, so a slow repo no longer blocks the ones behind it. In-flight keys are tracked, so a repo already being read is not read again when the list re-renders.
  • A read that finds no single quant, or fails, is stored as a settled null rather than left absent, so it is not retried until something actually changes.

tests/sole-quant-cache.test.ts pins the property this comment is about:

✔ resolved repos are rows, unread repos are pending
✔ one repo's invalidation leaves the other repo's row alone
✔ a repo pointed at another directory is re-read
✔ a repo with no single quant is settled, not pending
✔ disabled reports nothing and asks for nothing
✔ a global invalidation moves every repo's key

Also pinned the assumption the per-repo keys rest on, that a version string carries no comma so the joined snapshot splits back per repo, in tests/gguf-variants-cache-version.test.ts.

One repo's download or delete moved the shared key, which dropped every
resolved row and, with auto-expansion on, unmounted every expander while
the whole catalog was re-read. Results and pending state are now per
repo, so only the invalidated row is withheld.

Reads run as a worker pool rather than fixed batches, so a slow repo no
longer holds up the ones behind it, and a repo already read is not read
again.
@shimmyshimmer

Copy link
Copy Markdown
Member Author

@codex review

@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: f07ac9de8a

ℹ️ 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 +783 to +785
useEffect(
() => () => {
mountedRef.current = 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.

P2 Badge Reset the mounted ref during effect setup

Because main.tsx renders the app under StrictMode, React's development effect replay runs this cleanup and then invokes the setup again; the setup never restores mountedRef.current to true. Every sole-quant read subsequently reaches the false check and discards its result, leaving all repositories permanently pending and preventing single-quant rows from collapsing in development. Set the ref to true in the effect setup before returning the cleanup.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Correct, and worse than a stale result: fixed in a1dd070.

main.tsx:47 does render under StrictMode, and the effect only cleared the ref. The replay ran teardown then setup, setup restored nothing, so mountedRef.current stayed false for the life of the picker. Every read then hit the guard and dropped its entry, leaving every repo pending forever. With "Expand quantizations" on that is worse than rows failing to collapse: the pending gate would have held every expander shut, so no quant list at all in development.

Now set on setup as well as cleared on teardown:

useEffect(() => {
  mountedRef.current = true;
  return () => {
    mountedRef.current = false;
  };
}, []);

Comment on lines +3121 to +3124
const expanderOpen = shouldMountVariantExpander({
expanded: isGgufExpanded(c.repo_id),
autoExpand: expandQuantizations,
soleQuantsPending: soleQuants.pending.has(c.repo_id),

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 Let manual reopening bypass the probe wait

When the persisted “Expand quantizations” setting is enabled, autoExpand is always passed as true regardless of whether the user has explicitly toggled this particular row. While its sole-quant probe is pending, clicking once collapses the row and clicking again makes isGgufExpanded true but still suppresses the expander, so a slow probe can leave the quant choices inaccessible despite the intended manual-open exception. Track whether the row was explicitly reopened rather than using the global preference as the auto-expansion signal.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Correct, fixed in a1dd070. The exception I described was not implemented: autoExpand was the global preference, so a manual reopen was suppressed along with the automatic ones.

There was a second half to it. A row held back by its probe renders nothing, but the click handler still read the collapse set, so the first click "collapsed" an already-hidden row and only the second reopened it, which the gate then ignored anyway. Two clicks to reach a row that stayed shut.

Both are handled by telling the toggle what the row actually shows:

onClick={() => toggleGgufExpanded(c.repo_id, expanderOpen)}

A click on a row that shows nothing opens it and records an explicit reopen; a click on a showing row collapses it and clears that mark, so the preference governs again. autoExpand is now expandQuantizations && !reopenedGguf.has(repoId), so a reopened row skips the wait. Other callers keep the one-argument form and default to isGgufExpanded(id).

Added to tests/variant-visibility.test.ts:

✔ clicking a row held back by its probe opens it
✔ clicking a showing row collapses it and clears the reopen mark
✔ reopening a collapsed row leaves other rows alone

The first also asserts the end state you asked about: once reopened, shouldMountVariantExpander mounts the expander even while that repo's probe is still pending.

StrictMode replays effects, so clearing the ref on teardown without
setting it on setup left it false for good: in development every read
was discarded and no row ever collapsed.

A row held back by its probe rendered nothing, but a click still read as
collapse, so opening it took two clicks and the second was ignored while
auto-expand was on. Explicit reopens are tracked and skip the wait.
@shimmyshimmer

Copy link
Copy Markdown
Member Author

@codex review

@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: a1dd070bda

ℹ️ 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 +811 to +814
setEntries((prev) => {
const next = new Map(prev);
next.set(target.repoId, { key: target.key, quant });
return next;

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 Prevent superseded probes from overwriting fresh results

When a repository is invalidated while its previous sole-quant probe is still running, the changed key starts a second probe, but the first probe still writes its result unconditionally here. If the newer probe finishes first, the older completion overwrites its fresh entry with the obsolete key; partitionSoleQuants then marks the row pending again and launches a third request, temporarily removing the collapsed row and potentially suppressing its auto-expanded controls for another 30-second timeout. Only commit the result when inFlightRef.current.get(target.repoId) === target.key.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Correct, fixed in 0b66c56. The commit was unconditional, so the interleaving you describe lands exactly as written: the newer read settles the row, the older one overwrites it with its obsolete key, partitionSoleQuants sees the mismatch and marks the repo pending again.

Reads now belong to a key. The ownership check runs both before the read starts, so a target superseded while queued is never read, and after it returns, so a superseded result is dropped rather than committed.

The scheduling moved out of the component into createSoleQuantReader in sole-quant-cache.ts, which made this testable with controlled completions:

✔ a superseded read never overwrites the fresher result
✔ a repo already being read at the same key is not read again
✔ reads are capped at the worker count
✔ a failed read commits as no sole quant

The first test is a real regression test, not a passing formality: removing the post-read ownership guard fails it.

Comment on lines +762 to +766
const localSource = repo.load_id || repo.cache_path || null;
return {
repoId: repo.repo_id,
localSource,
key: soleQuantKey(versions[index], localSource),

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 Reprobe when refreshed inventory changes on disk

When a repository's cache changes outside this frontend instance—for example, another tab or an external Hugging Face process adds or replaces a quant—an inventory refresh can return updated size or modification metadata without bumping this module-local variants version. Because the probe key contains only that version and the unchanged load path, the previous sole-quant entry remains settled indefinitely: a repo that gained a sibling can stay collapsed to the old quant, and a replaced quant can leave a direct-load row pointing at a missing file. Include a disk-content fingerprint in the invalidation identity and invalidate/re-read the underlying variants resolver when it changes.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Correct, and the window is wider than 30 seconds. ggufVariantsTtlMs gives a local response holding a downloaded variant GGUF_VARIANTS_LOCAL_TTL_MS, which is 10 minutes, so even a re-read would have been answered from the client cache.

Fixed in 0b66c56, in the two parts you describe:

  • The probe key now carries soleQuantFingerprint(repo), the repo's size_bytes and last_modified from the inventory. A quant added or replaced elsewhere moves the row's bytes, which moves the key.
  • A changed fingerprint also calls invalidateGgufVariantsCache(repoId), so the cached listing is dropped and the re-read actually reaches disk. Every other reader of that repo's variants benefits, not just this probe.

No loop: the fingerprint is recorded before the invalidation, so the version bump that invalidation causes does not trigger another one.

✔ bytes changing on disk moves the key, so the repo is read again
✔ unchanged bytes keep the repo settled

A read whose repo was invalidated mid-flight still committed, so a stale
result could land on top of a fresh one and send the row back to pending.
Reads now belong to a key and a result is dropped once a newer read owns
the repo.

The probe key also carries the repo's size and mtime, and a change there
drops that repo's cached listing, so a quant added or replaced outside
this tab is picked up instead of staying settled behind a ten minute
cache entry.

Scheduling moved to sole-quant-cache.ts, where the ordering rules have
tests.

@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: 0b66c5649f

ℹ️ 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 +793 to +797
const seen = fingerprintsRef.current.get(target.repoId);
fingerprintsRef.current.set(target.repoId, target.key);
if (seen !== undefined && seen !== target.key) {
invalidateGgufVariantsCache(target.repoId);
}

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 Compare only the disk fingerprint before invalidating

When a download, deletion, or external disk change updates this repository, target.key changes because it contains the variants cache version as well as the fingerprint. This effect then calls invalidateGgufVariantsCache, which bumps that same version, producing another key change and another invalidation indefinitely; the affected row remains pending while the picker repeatedly rerenders and reprobes. Track and compare only the disk fingerprint here, rather than the complete probe key.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Correct, and it was mine from the previous commit. Fixed in 3eee667.

I recorded target.key while reasoning about it as though it were the fingerprint. The key carries the variants cache version, invalidateGgufVariantsCache bumps that version, the bump moves the key, and the next pass reads that as another change. One delete or download would have spun the picker: invalidate, re-render, invalidate.

Drift is now the repo's bytes alone. SoleQuantTarget carries fingerprint beside key, and the decision moved into takeDriftedRepos, so the rule is stated once and tested:

✔ first sight records without asking for an invalidation
✔ a version bump alone does not count as drift
✔ changed bytes drift once, not on every pass
✔ only the repo whose bytes moved drifts

Restoring the key comparison fails three of those four, so they hold the actual regression rather than restating the fix.

Separately, while running the full typecheck for this change I found a type error I had reported as clean two commits ago: a test fixture with none of the optional flags does not infer against that constraint. My verification command was truncating tsc's output past the banner lines. Fixed in the same commit, and the checks now read: npm run typecheck clean, npm test 249 passing, npm run build clean.

Recording the whole probe key meant the version bump that invalidation
itself causes read as a fresh change, so one delete or download would
invalidate and re-render without end. Drift is now the repo's bytes
alone.

Also fixes a type error in a test fixture: an object with none of the
optional flags does not infer against that constraint.
@shimmyshimmer

Copy link
Copy Markdown
Member Author

@codex review

@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: 3eee667f02

ℹ️ 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 +732 to +735
// One file on disk and nothing torn beside it. A partial quant keeps the
// expander, where it can be resumed.
if (local.length !== 1 || local[0].downloaded !== true) return null;
return { variant: local[0], hasVision: normalized.hasVision };

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 Keep manifest-only partial quants from collapsing

When a repo has one complete quant plus a canceled sibling represented only by its manifest/marker or incomplete blob, this local-only response can contain just the complete snapshot quant: the Hub backend returns a cached response before consulting list_partial_gguf_variants_from_state (studio/backend/hub/services/models/gguf_variants.py:658-675). This check therefore collapses the repo, and the resulting row exposes actions only for the complete quant, hiding the sibling's resume/delete controls under the newly default-disabled “Show all quantizations” setting. The earlier visibility filter was fixed, but fresh evidence is that the sole-quant probe itself still omits this class of partial before deciding to collapse.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Correct, and reachable. Fixed in 4dc13c7, in the backend rather than the probe.

Reproduced it against a constructed cache: a repo with a complete Q4_K_M snapshot plus a Q8_0 sibling that exists only in download state.

cancelled sibling on disk: ['Q8_0']
prefer_local_cache response: [('Q4_K_M', True, False)]
probe collapses the repo: True

Two things worth adding to your description.

First, the repo genuinely reaches the picker in this state, so the case is not theoretical. is_gguf_repo_partial documents it as a tripwire and deliberately keeps partial false: "user downloads Q8_0 fully, then starts Q4_K_M and cancels ... partial=True only when at least one variant is broken AND no other variant is clean". The row is listed, and the probe then collapsed it.

Second, the scoped branch has the same hole, not just the cached one. _scoped_local_response returns before the state lister as well, and a pinned row is the common case for this probe, since it passes the row's load_id.

Fixed at the response rather than in the probe, since a listing that claims to describe disk should not omit part of it. Both local branches now merge state-only quants in as partial, and only quants the listing does not already carry are added, so a complete quant keeps its status and the pinned-snapshot attribution is untouched.

test_a_cancelled_siblings_resume_survives_the_local_listing covers it, including a control that nothing is invented when no download was cancelled, and an assertion that the route still issues no remote listing. It fails without the change.

Regression check on the surrounding behaviour: test_cached_gguf_routes.py and test_hf_cache_dangling_refs.py are 305 passing, including the pinned-snapshot and cancel-marker tests. Across the wider -k "gguf or variant or inventory or partial or cache" selection the failure set is byte-identical with and without this change: 9 pre-existing failures in test_cache_case_resolution.py and test_hf_cache_settings.py, 1725 passing either way. Re-probing the real local cache also gives the same collapse decisions and still zero remote listings.

@shimmyshimmer

Copy link
Copy Markdown
Member Author

@codex review

A sibling cancelled before any file landed exists only in download
state, which the cache listing cannot see, so the response named one
quant and the picker collapsed the repo and hid the resume.

The local branches now merge those state-only quants in as partial. Only
quants the listing does not already carry are added, so a complete quant
keeps its status and the pinned-snapshot attribution is untouched.
@shimmyshimmer

Copy link
Copy Markdown
Member Author

@codex review

@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: a1ca91dc8f

ℹ️ 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 +639 to +641
state = list_partial_gguf_variants_from_state(repo_id, hub_cache = hub_cache)
if state is None:
return response

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 Apply state-partial enrichment to failure fallbacks

When an expanded On Device row is opened while Hugging Face is unavailable or a private repo cannot be queried, the chat client calls the remote-first route, whose exception fallback at lines 729–733 returns _local_response directly instead of passing it through this helper. A repo containing complete Q4 plus a marker-only canceled Q8 is therefore correctly kept expandable by the sole-quant probe, but the subsequent expander response omits Q8 and the new default visibility filter hides its resume control. Fresh evidence after the prior fix is this still-unenriched remote-failure cache branch; apply _with_state_partials there as well.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Correct, fixed in 7a9db28. Same one-line omission as the branches above it: the except path's cache read returned _local_response directly.

Checked the neighbouring paths while I was there, so the scope is clear:

  • The except path's _scoped_local_response() was already covered, since the merge went inside that helper rather than at its call sites.
  • The success path is fine and needs nothing. It walks the remote listing through is_variant_partial, which reads manifests and markers, so a marker-only cancelled quant is listed and flagged partial there.

So the failure fallback was the one remaining hole, and it is the worst place to have it: an unreachable Hub is exactly when a resume has nowhere else to surface.

test_a_cancelled_sibling_survives_a_failed_remote_listing covers it through the route the expander actually uses, with no prefer_local_cache and the remote lister raising. It fails without the change.

test_cached_gguf_routes.py and test_hf_cache_dangling_refs.py are 306 passing, and the wider selection's failure set is still byte-identical to the unmodified backend.

When the Hub cannot answer, the fallback reads the cache, which cannot
see a sibling cancelled before any file landed. That is exactly when a
resume has nowhere else to surface, so it now goes through the same
merge as the disk-only branches.
@shimmyshimmer

Copy link
Copy Markdown
Member Author

@codex review

@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: 7a9db28523

ℹ️ 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 +44 to +45

/** Split the listed repos into resolved rows, repos still being read, and

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 Include marker-only partial state in the fingerprint

When another tab or external process cancels a sibling quant before any file lands, the inventory row's partial state changes but this fingerprint does not: _gguf_variant_state_summary reports zero bytes for a marker-only quant, while _repo_gguf_last_modified considers GGUF files rather than the marker. The existing sole-quant entry therefore remains settled indefinitely, so the repo stays collapsed to its complete quant and hides the canceled sibling's resume path. Fresh evidence after the earlier disk-drift fix is that the new backend enrichment specifically supports marker-only siblings, but soleQuantFingerprint still omits the inventory field that detects them; include that partial/state signal in the key.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Right about the gap, fixed in e51d1b2, though not with the field you suggested.

Measured it on a constructed cache, adding a marker-only cancelled sibling to a repo holding one complete quant:

BEFORE: {'size_bytes': 256, 'last_modified': 1785674608.38, 'partial': False}
AFTER : {'size_bytes': 256, 'last_modified': 1785674608.38, 'partial': False}

So the fingerprint does not move, exactly as you say. But partial does not move either, so including it would have fixed nothing. That is deliberate: is_gguf_repo_partial keeps the row's flag false while another quant is clean, otherwise a good quant becomes unchattable over an unrelated cancelled sibling.

The signal that does move was already being computed and thrown away. _scan_cached_gguf calls _gguf_variant_state_summary, whose first element flips false to true when a manifest or marker appears:

SUMMARY BEFORE: (False, 0)
SUMMARY AFTER : (True, 0)

So the row now carries has_variant_state, and soleQuantFingerprint includes it. Threaded through the inventory view model, the picker's row type, and the probe key.

Tests, all of which fail without the change:

✔ a cancelled sibling's marker shows on the repo row   (backend, asserts size, mtime and partial all stay put)
✔ a cancelled sibling moves the key even though bytes do not
✔ download state clearing moves the key back

Backend suites 307 passing, wider selection's failure set unchanged, frontend 251 passing, typecheck and build clean.

Worth noting this closes the loop with the last two fixes rather than adding a separate mechanism: the probe now re-reads when a sibling is cancelled elsewhere, and the response it re-reads lists that sibling as partial, so the repo stops collapsing and the resume comes back.

@shimmyshimmer

Copy link
Copy Markdown
Member Author

@codex review

A sibling cancelled before any file landed moves neither the repo's size
nor its mtime, and the repo's own partial flag stays false while another
quant is clean, so the probe key never moved and the row stayed
collapsed with the sibling's resume hidden.

The scan already computes whether variant state exists; the row now
carries it and the probe key includes it.
@shimmyshimmer

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Can't wait for the next one!

Reviewed commit: e51d1b2994

ℹ️ 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".

@shimmyshimmer
shimmyshimmer merged commit 63307b1 into main Aug 2, 2026
41 of 43 checks passed
@shimmyshimmer
shimmyshimmer deleted the studio-single-quant-row branch August 2, 2026 13:01
danielhanchen added a commit that referenced this pull request Aug 2, 2026
main is red: tests/studio/test_model_picker_contracts.py fails on every PR since
#7736, which is unrelated to what those PRs change.

The assertion counts the sites that pass the pinned snapshot id into the load
meta, and expected exactly two: the safetensors row and the gear beside it. #7736
added a third, the collapsed single-quant GGUF row, which is a load site like the
other two and correctly carries the pin. The code is right and the count was
stale.

Bisected to 63307b1. Counted rather than matched loosely on purpose, so a new
row that forgets the pin fails here rather than silently loading from the default
ref, so the count follows the code instead of being relaxed. Verified it still
fails when any one of the three sites drops the pin.
danielhanchen added a commit that referenced this pull request Aug 3, 2026
The model-config Playwright job has been failing on main since #7736, on every
PR branched after it, for reasons unrelated to what those PRs change.

  FAIL: could not open run-settings for a model matching 'gemma-3-270m'
  FAIL: could not reopen run-settings after reload
  FAIL: Reset button not found in run-settings

The behaviour is intentional and the test had not followed it. #7736 collapses a
single-quant row and, as its own comment says, "loads it in one click". The
helper clicked the row first and then looked for the gear, so by then the model
was loading and the picker had closed. The three failures are one cause: the
first is that click, and the other two follow from run-settings never opening.

data-model-picker-option sits on the row button and the gear is its sibling, so
the gear cannot be reached through the row at all. It is now matched by the model
its own aria-label names, which drops the row click and also fixes a second
latent bug: `.first` pressed whichever gear came first in the popover rather than
the one belonging to the model under test.

Bisected on a runner, one commit per run, nothing else changed:

  3742317 (parent of #7736)  pass
  63307b1 (#7736)            fail
  origin/main                  fail
  origin/main + this change    pass
danielhanchen added a commit that referenced this pull request Aug 3, 2026
… row (#7772)

* Fix the model-config Playwright driver for the collapsed single-quant row

Chat UI Tests has been red on main since #7736. That PR made a GGUF repo with
one quant on disk render as a single collapsed row, and flipped the show-all-
quantizations default to false, so the row that used to expand on click now
selects the model and closes the picker.

The driver still clicked the row and then looked for the inference-settings
gear inside the popover, which by then was unmounted, so open_config returned
None and three checks failed: run-settings could not be opened, could not be
reopened after a reload, and the Reset button was reported missing. All three
controls are still in the UI; only the way to reach them changed.

The gear is a sibling of the row rather than a descendant, so it is now located
by the repo id in its aria-label and clicked without touching the row. Repos
with several quants still expand first, which keeps that path working.

* Wait for the sole-quant probe instead of sleeping past it

The collapsed single-quant row is painted only after an /api/hub/gguf-variants
fetch that restarts on every reload, and while it is pending the row renders no
gear at all. An absent gear therefore means either a multi-quant repo or a probe
still in flight, and the driver separated the two with fixed sleeps.

If the probe landed during the 700 ms wait before the fallback click, the click
hit the row just as it collapsed, which selects the model and closes the picker:
the failure this branch fixes, reintroduced by timing. The gear is now waited
for rather than counted once, and if the click does close the picker it is
reopened and the gear taken from there.

The multi-quant path is unchanged except that it now waits for the expander's
own async listing rather than a fixed sleep.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Match the gear case-insensitively and use the driver's own settle budget

The row is found with has_text, which Playwright matches case-insensitively,
while the gear used a CSS attribute selector, which does not. A STUDIO_MODEL_HINT
whose casing differed from the repo id would find the row and never its gear, so
both lookups now go through the same case-insensitive match.

The settle cap was an arbitrary six seconds. There is no DOM condition to wait on
instead, since a pending probe and a real multi-quant repo render through the
same branch and the pending flag never reaches the DOM, so the cap is now the 30s
this driver already allows elsewhere. Only a multi-quant repo waits it out.

* Condense the model config driver comments

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
danielhanchen added a commit that referenced this pull request Aug 3, 2026
…drives (#7760)

* Open run-settings from the gear, not by selecting the collapsed row

The model-config Playwright job has been failing on main since #7736, on every
PR branched after it, for reasons unrelated to what those PRs change.

  FAIL: could not open run-settings for a model matching 'gemma-3-270m'
  FAIL: could not reopen run-settings after reload
  FAIL: Reset button not found in run-settings

The behaviour is intentional and the test had not followed it. #7736 collapses a
single-quant row and, as its own comment says, "loads it in one click". The
helper clicked the row first and then looked for the gear, so by then the model
was loading and the picker had closed. The three failures are one cause: the
first is that click, and the other two follow from run-settings never opening.

data-model-picker-option sits on the row button and the gear is its sibling, so
the gear cannot be reached through the row at all. It is now matched by the model
its own aria-label names, which drops the row click and also fixes a second
latent bug: `.first` pressed whichever gear came first in the popover rather than
the one belonging to the model under test.

Bisected on a runner, one commit per run, nothing else changed:

  3742317 (parent of #7736)  pass
  63307b1 (#7736)            fail
  origin/main                  fail
  origin/main + this change    pass

* Fall back to expanding a multi-quant row when it has no gear of its own

Review on #7760 is right that a multi-quant parent mounts no inference-settings
button until it is expanded, so a gear lookup against it finds nothing. It is not
what fails CI today -- that job downloads one quant and Show all quantizations
defaults off, so the collapsed path is the only one exercised -- but the helper
should not depend on the test model having exactly one quant on disk.

Gear first, and only if there is none, click the row and look again. Safe in that
order and only in that order: the expandable parent's onClick is
toggleGgufExpanded, while the collapsed single-quant row that loads and closes
the picker is exactly the row that already had a gear. So the fallback can never
reach the row whose click would dismiss the popover.

The lookup is also polled now. A row still waiting on its sole-quant probe
renders with no gear at all for a moment, and a single miss there would have read
as the model having no run-settings.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Match the gear case-insensitively, and scope it to the row after expanding

Two defects in the fallback, both found reviewing my own change.

find_on_device_row matches with Playwright has_text, which is case-insensitive,
while find_gear matched with a CSS attribute substring, which is not. So a hint
whose case differs from the repo id would find the row and miss the gear -- and
then take the new fallback and click a row that loads, which is exactly the bug
this PR exists to prevent, now reachable through an env var. Both matchers are
case-insensitive now.

After expanding, every variant mounts its own gear and all of them carry the repo
id, so `.first` over the popover picked an arbitrary quant, possibly one not on
disk, and the test would then configure and try to load it. The comment above it
claimed the opposite. The second lookup is scoped to the row's own group, with
the popover kept only as a fallback.

The poll is now a wait_for, which returns the moment the gear mounts instead of
sleeping out six fixed intervals -- and the old loop slept after its last attempt
too, so a miss cost 3s and the fallback path paid it twice.

* Harden the model-config driver, and pin the hooks it drives

Reproduced the main failure locally first: the same three FAILs, from one cause.
With the gear fix the run now passes end to end, which exposed what the cascade
had been hiding.

- A staged edit made in run-settings' first moments is discarded: the panel
  re-derives its baseline once mount-time work lands, so Save reports "Default
  settings kept" and stores nothing. Measured on gemma-3-270m: fails at 0ms,
  passes from 500ms, and neither the input value, the Reset state nor the primary
  button label differs across that window, so there is nothing to poll. Bounded
  settle wait, with the measurement written down.
- Steps 3 and 3b inherited the popover from step 2, which is why one root cause
  reported as three failures and why the re-type-shown regression had been
  silently skipping. Each step opens its own now, and the skip is a soft_fail
  rather than prose.
- The hidden-model step asserts an absence, so it passed for free when the picker
  rendered nothing at all. It now proves the picker is populated first.
- Persistence, reset and migration scanned every stored entry, so another model's
  value satisfied them. Scoped to the entry under test; the fallback only fires
  when no key has the versioned shape.
- read_configs turned unreadable storage into {}, which several assertions treat
  as success, and _count turned a closed page into "selector missing". Both say
  what happened now.
- primary_button swept "Load model" first, which substring-matches "Reload
  model", so the reload case was found under the wrong name.
- A miss now writes a diagnostics sidecar naming the selector, the option rows and
  the gear labels actually present.

Also pinned the hooks the driver depends on in the CPU contract suite. Renaming
one used to type check, lint, pass every unit test and then fail a 25-minute
browser job; the pins catch it in a second.

Unsloth UI CI no longer cancels in-progress runs on main. Pushes land in bursts
there, and four cancelled runs are why this break went unreported for 14 hours.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Name the quant, and stop two pins passing on a substring

Four review items, all mine, all correct.

The two contract pins I added were passing vacuously. The trigger hook is
carried by triggerDataTour, and my assertion's first term named a prop that does
not exist, so it only ever passed on the bare substring -- which the popover's
own value contains. It would have gone green with the trigger hook deleted, and
the driver's very first click is the thing that would then fail. Same shape for
Reset: the fallback searched the whole file, and this file says Reset in two of
its own comments, so the pin passed with the button gone. Both now name what
they mean, and both fail against a scratch tree with the hook renamed.

The expanded-variant lookup passed only the repo hint. Every variant mounts its
own gear and all of them carry the repo id, so .first picked an arbitrary quant,
possibly one not on disk. The labels are "<repo> <quant>", so it names
GGUF_VARIANT now, falling back to the repo-only match so a label format change
degrades rather than breaks.

entries_for_model matched the repo as a substring of the serialised key, which
also matches this repo's other quants -- so a stale entry for one quant could
stand in for the one under test and mask its failed save. It parses the key and
requires repo and quant to match. Verified it rejects a sibling quant that the
substring version accepted.

* Pin the construct each contract names, not a string anywhere in the file

Five review items, all the same shape: an assertion that reads the whole file and
so stays green through the change it exists to catch. These pins were added to
turn a 25-minute browser failure into a two-second one, and four of them could
not have done it.

- The automation-attribute test proved the props are declared and returned, but
  not that ModelRow spreads them onto the button. It reads optionProps?.onKeyDown
  separately, so the prop stays used and type checks while
  data-model-picker-option leaves the DOM and every row lookup fails. Now pins
  {...optionProps} on the row button.
- The gear-label test matched "Inference settings for ${". pickers.tsx
  interpolates that at five sites, and only the expander's names both the repo and
  the quant, which is what tells one variant from another. Now pins that label.
- The parent-row test proved an aria-hidden 42px element exists somewhere. Adding
  a gear to the parent while leaving the spacer satisfies it -- and that is
  precisely the change that inverts the driver's "no gear means this row expands
  rather than loads". Now reads the parent block and requires the spacer and no
  ModelLoadSettingsAction.
- The primary-action test proved four string literals exist. They live in the
  primaryActionLabel calculation, so they outlive the button being deleted or made
  a non-button. Now requires the label to be rendered inside the handleRun Button.

Each verified by making the change it names: dropping the spread, removing the
quant from the expander label, giving the parent a gear, and unwiring handleRun
each fail now. None did before.

The fifth is the driver. The quant was named only inside `if gear is None`, so
with "Expand quantizations" on the expander is already mounted, a repo-only lookup
succeeds immediately and that branch is never reached -- and the expander orders
variants by fit, not by GGUF_VARIANT, so it configures an arbitrary one. The first
lookup names the quant now, with repo-only behind it.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Wait for the inventory before calling the picker empty

The populated check counted rows once, 400ms after clicking On Device. Until
cachedReady flips, the picker renders its loading state with no rows at all, so a
slow cache scan would be reported as a broken picker -- a hard failure on timing
rather than on anything true.

It waits for the first row to attach instead. A populated picker attaches one as
soon as it has it, so the normal case returns immediately and the timeout is only
spent when there really is nothing, which is the case the check exists for.

Note this guards the assertion added above it: the hidden-model check asserts an
absence, so it passes for free against an empty picker. Both halves have to be
right for either to mean anything.

* Pin the gear to the exact quant and mirror the app's identity folding

* Pin the parent-row spacer by its gutter, not its pixel width

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants