Skip to content

Studio: load a second quant of a loaded GGUF repo beside it - #19169

Merged
danielhanchen merged 43 commits into
unslothai:mainfrom
NilayYadav:unable-load-models-same-parent
Nov 24, 2026
Merged

danielhanchen merged 43 commits into
unslothai:mainfrom
NilayYadav:unable-load-models-same-parent

Conversation

@NilayYadav

@NilayYadav NilayYadav commented Nov 23, 2026 •

Copy link
Copy Markdown
Collaborator

Related to #19072

With Keep multiple models loaded on, picking another quant of an already loaded repo replaced the loaded quant. Now both stay loaded if they fit; otherwise the new quant replaces the old one, as before. With the setting off, nothing changes.

Each loaded quant gets its own dot and Eject in the picker, and chat goes to the quant that was picked.

Before / after

Keep multiple models loaded set to When they fit, then unsloth/SmolLM2-135M-Instruct-GGUF loaded as Q4_K_M and then Q8_0, both with alongside. Before, the Q8_0 load replaced Q4_K_M and only Q8_0 is marked loaded; after, both quants stay loaded, each with its own dot, and the header offers Eject all.

Composer model picker after loading Q4_K_M then Q8_0 of one repo: before, only Q8_0 is loaded; after, both are

merge base cf00c93 this PR
serving_quants after both loads null (one copy: Q8_0) ["Q4_K_M", "Q8_0"]
llama-server processes 1 (Q8_0) 2 (Q4_K_M, Q8_0)
chat naming ...:Q4_K_M 404, downloaded but not loaded served by the Q4_K_M server
chat naming ...:Q8_0 served served by the Q8_0 server

Before / after

Keep multiple models loaded on, loading unsloth/SmolLM2-135M-Instruct-GGUF Q4_K_M and then Q8_0. Before, Q8_0 replaces Q4_K_M (one resident copy, one quant marked loaded). After, both stay resident (serving_quants is ["Q4_K_M", "Q8_0"]) and the picker marks both quants loaded.

Picker before and after loading two quants of one repo

[skip ci]
@NilayYadav

Copy link
Copy Markdown
Collaborator Author

@codex review

@NilayYadav

Copy link
Copy Markdown
Collaborator Author

@codex security review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-24T18:31:19.958500Z 287690b Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

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

@chatgpt-codex-connector 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: 33d0ac7e2b

ℹ️ 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 +23690 to +23692
response.serving_checkpoints = [
f"{c}:{q}" if q and names.count(c) > 1 else c for c, q in served
]

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 snapshot checkpoint identities reloadable

When two quants are loaded from the same absolute snapshot directory, as supported by On Device rows with a path-valued load_id, this publishes identifiers such as /hub/.../snapshots/abc123:Q4_K_M and copies them into model_identifier. However, both frontend withoutNamedQuant and backend strip_named_quant deliberately remove suffixes only from Hub repo IDs. Status synchronization consequently stores the synthetic path as the checkpoint, and a subsequent Apply/reload sends that nonexistent directory to validation/loading. Preserve the real load path separately or make these path-based identities round-trip through both clients and load requests.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Path-valued load ids only come from repos outside the active cache, and this needs keep-loaded plus two quants of such a snapshot; the reload is refused with an error, nothing wrong runs. Not fixing here.

Comment on lines +19354 to +19355
return await load_model_gated(
request.model_copy(update = {"force_alongside": False}),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Preserve scoped cancellation across the replacement retry

If a scoped Stop request arrives while the failed alongside slot is being dropped in the preceding finally, _cancel_scoped_load_attempt sets the original attempt's cancellation event. _finish_load_attempt then removes that attempt, and this recursive call creates a fresh, uncancelled event for the same request ID. The accepted cancellation is therefore lost: the retry can still unload the previously resident quant and finish loading its replacement. Preserve the original attempt/cancellation state across the fallback, or check and propagate cancellation before retiring it.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

The fit check raises before llama-server starts, so the drop in finally returns almost at once; a Stop before it is caught by _raise_if_load_cancelled and one after it by the cancel tombstone the retry picks up. Not fixing.

@NilayYadav

Copy link
Copy Markdown
Collaborator 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: 19528a45c3

ℹ️ 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 +38873 to +38874
if quant and any(m["id"] == entry["id"] and m.get("quant") != quant for m in models):
entry = {**entry, "id": f"{entry['id']}:{quant}", "quant": 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 Align bare-model metadata with last-used routing

With Q4 in the primary slot and a more-recently-used Q8 copy alongside it, this loop leaves the bare repository entry describing Q4 and only qualifies the Q8 entry. However, serving_slot now routes requests for that bare ID to Q8. Thus model discovery and retrieval advertise Q4's quantization and context window for requests that actually execute on Q8—for example, advertising a 16K primary window while serving the bare ID on a 4K extra slot. Choose the bare entry using the same last-used routing decision, or give each resident quant an explicit identity, so clients receive metadata for the backend they will actually reach.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Metadata only: a bare-id request still runs and is routed to the last-used copy as intended; each quant is listed under its own repo:QUANT id. Not changing.

@NilayYadav

Copy link
Copy Markdown
Collaborator 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: 3803da6166

ℹ️ 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 +2199 to +2201
const copies = loadedModels.filter(
(m) => m.quant && m.id.toLowerCase() === hit.id.toLowerCase(),
);

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 Group loaded copies by checkpoint identity, not public label

When two standalone GGUF files with the same basename are loaded from different directories, status gives them the same public id but distinct checkpoint values, with a quant parsed from each filename. This filter treats them as copies of one repository, so selecting /models/b/model-Q4_K_M.gguf makes both inventory rows use B as loadedId; ejecting row A consequently unloads B. Group copies by their normalized base checkpoint and keep unrelated file-path rows tied to their own slots.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Only two standalone GGUF files with the same file name in different folders, loaded side by side, share a public label; hub repos and normal local files never do. Not changing.

@NilayYadav

Copy link
Copy Markdown
Collaborator 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: 776c4e4142

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

ggufVariantsMatch(m.quant, variant) &&
modelIdsMatch(withoutNamedQuant(m.checkpoint, m.quant), checkpoint),
);
return copy?.checkpoint ?? checkpoint;

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 Preserve the selected quant when the resident inventory is stale

When a tab has Q4 selected and another tab/API client loads Q8 alongside it, the tab's cached Q4 entry still has checkpoint === repo. This helper finds no qualified copy and returns the bare repo even though variant is Q4. The fresh evidence is this fallback in the new helper, rather than the already-fixed routine-refresh call site: the next chat routes to last-used Q8, and the first refresh also adopts Q8 instead of retaining the still-resident Q4 selection. Resolve the selected quant independently of cached synthetic checkpoints, or refresh the inventory before allowing the bare fallback.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Needs another tab or an API client to load the twin while this tab's list is stale; the focus refresh adopts and shows it before a send, as a cross-tab load did before. Not changing.

readResident: async () => {
const status = await bounded(getInferenceStatus);
const checkpoint = resolveInferenceCheckpointId(status);
const checkpoint = servedInferenceCheckpointId(status);

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 the selected sibling quant after a loaded-panel eject

With Q4 in the primary slot and Q8 selected, ejecting the Q4 row uses the qualified checkpoint here but still includes status.active_model, the bare repo, in unloadedAliases. The subsequent clearChatSelectionFor(unloadedAliases) matches that repo against Q8's bare params.checkpoint and clears Q8's selection and runtime/context state even though Q8 remains loaded. Ejecting an extra-slot sibling has the same problem because ejectServingRow explicitly adds entry.name before clearing. Check the selected quant or served checkpoint before clearing, rather than treating the shared repo alias as proof that the selected copy was unloaded.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Only the picker selection is reset; the selected quant stays loaded and nothing runs on the wrong model. Not changing here.

Comment on lines +19642 to +19643
beside = keeps and request.alongside and not _replaces_its_repo.get()
if slot is None and request.gguf_variant and not beside:

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 Audio-page quant switches when loading beside a repo

With Keep multiple models loaded enabled and a llama.cpp TTS GGUF already in the primary slot, picking another quant on the Audio page sends alongside: true from useAudioModelSlot.loadTtsModel, so this new guard puts it in an extra slot when it fits. However, the Audio page's refreshStatus still reads unscoped status, and describeAudioSlot immediately keeps the primary whenever is_audio is true, leaving the audio slot routing ID null. Subsequent synthesis therefore uses the old primary quant despite successfully loading the newly chosen quant. Preserve replacement semantics for these loads, or update Audio selection/status/generation to retain the new quant's served ID.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Needs keep-loaded on (off by default), a llama.cpp TTS GGUF repo with several quants and a quant switch on the Audio page that fits beside the old one. Not changing in this PR.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Nov 24, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Nov 24, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Nov 24, 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: 4c7882520c

ℹ️ 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 +2370 to +2371
alone = gguf and _is_hub_model_id(model_id)
return {**entry, "id": pinned} if sibling or alone else entry

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 capability detection for pinned singleton quants

When an agent selects an explicit quant and that repo has only one resident copy, this changes its ID to repo:QUANT, but the scoped status endpoint still returns bare active_model and model_identifier values for a singleton. _vscode_capabilities() compares those fields against the pinned ID using _model_id_matches(), rejects the model's own status, and returns (True, False, False) instead of its actual capabilities. Consequently, VS Code loses vision/reasoning support, other _accepts_images() consumers disable images, and models without tool support are advertised as supporting tools. Make these status identity checks quant-aware when introducing the pinned ID.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Fixed in the latest push: status identity checks (capabilities, memory warning, Vibe temperature) also accept the status's own repo:QUANT name.

@danielhanchen

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Something went wrong. Try again later by commenting “@codex review”.

Failed to sample tokens
ℹ️ 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".

@danielhanchen

Copy link
Copy Markdown
Member

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

ℹ️ 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 +38969 to +38970
if quant and any(m["id"] == entry["id"] and m.get("quant") != quant for m in models):
entry = {**entry, "id": f"{entry['id']}:{quant}", "quant": 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 Keep quant aliases out of the CLI's literal-tag fallback

When Q4_K_M and Q8_0 are both resident, unsloth start claude --model org/repo:Q8_0 --gguf-variant Q4_K_M now fails instead of applying the explicit quant override. The CLI documents --gguf-variant as “GGUF quant variant to load” (unsloth_cli/commands/start.py:301), but publishing this qualified ID triggers _connect's exact-listed-ID fallback at lines 5391–5403, which restores the unsplit name as though it were an intrinsic Ollama tag. _resolve_model consequently posts model_path='org/repo:Q8_0' with gguf_variant='Q4_K_M'; strip_named_quant leaves the mismatched suffix intact, producing an invalid Hub identifier. Update the CLI fallback to distinguish these synthetic quant aliases from genuine tagged IDs.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Fixed in the latest push: a listed entry carrying its quant (the repo:QUANT alias) no longer triggers the literal-tag fallback, so --gguf-variant still applies.

@danielhanchen

Copy link
Copy Markdown
Member

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

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread studio/backend/routes/inference.py Outdated
Comment on lines +19417 to +19419
served = tuple(getattr(intent, name, None) for name in _TWIN_SETTINGS)
# Case kept: two local paths differing only in case are two files on most filesystems.
return (str(llama.model_identifier), llama.hf_variant.casefold(), served)

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 Compare artifact identities before reusing a fallback twin

If a quant's cached GGUF or projector is updated while its old server remains resident, an alongside load that falls back to that quant can load different artifacts with the same repository, quant and _TWIN_SETTINGS. This new comparison ignores _gguf_load_identity, so load_model_gated treats the servers as twins, drops the freshly loaded server and returns its successful load response while inference continues on the old weights or projector. Compare the resolved artifact identities before reusing the survivor, as matches_load_source() already does for source-aware same-slot reuse.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Fixed in the latest push: the twin key includes the backend's resolved GGUF load identity, so a copy loaded from updated files is kept.

@danielhanchen

Copy link
Copy Markdown
Member

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

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

setModelsError: (modelsError) => set({ modelsError }),
setLastModelLoadError: (lastModelLoadError) => set({ lastModelLoadError }),
setCheckpoint: (modelId, ggufVariant, options) => {
modelId = withoutNamedQuant(modelId, ggufVariant);

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 API examples to the selected resident quant

With Q4_K_M in the primary slot and Q8_0 selected alongside it, normalizing the checkpoint here leaves the API Keys examples with the bare repository ID. useExampleModelName() in features/settings/components/usage-examples.tsx:484–494 chooses the first sameBaseModelId catalog row and pins entry.quant; that row describes Q4, so the generated curl/Python/JavaScript requests name repo:Q4_K_M despite Q8 being selected. Match the loaded catalog row against activeGgufVariant as well before choosing the example model, so copying an example does not silently run a different quant.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Fixed in the latest push: the examples pick the catalog row whose quant matches the selected one before pinning it.

@danielhanchen

Copy link
Copy Markdown
Member

@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: 51c066135e

ℹ️ 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 +52 to +53
variant = request.gguf_variant
if variant and request.model_path.lower().endswith(f":{variant.lower()}"):

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 Parse listed quant IDs when the separate variant is omitted

With two quants of a Hub repo loaded, MCP list_models(loaded_only=True, kind='llm') now exposes an ID such as org/repo:Q8_0. Passing that listed ID back to MCP load_model—for example, to change max_seq_length—leaves variant=None in loading.load_llm, so this guard neither strips the suffix nor populates gguf_variant. The value then reaches ModelConfig.from_identifier as a colon-containing Hub repo name, and the load fails instead of reloading Q8. Parse the suffix when the separate variant is absent, or normalize the MCP caller, so these newly published load handles round-trip.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Fixed in the latest push: a load or validate naming org/repo:QUANT with no separate variant now splits into the repo and that quant.

@danielhanchen

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Chef's kiss.

Reviewed commit: 287690b3f8

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

danielhanchen pushed a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Nov 24, 2026
@danielhanchen
danielhanchen merged commit 4739f8c into unslothai:main Nov 24, 2026
63 of 67 checks passed
danielhanchen added a commit that referenced this pull request Nov 24, 2026
…ody that throws (#19343)

## Problem


`tests/studio/test_chat_eject_in_flight.py::test_eject_toasts_before_the_check_and_refuses_a_second_click_as_unloading`
fails on main since #19169 (load a second quant of a loaded GGUF repo
beside it):

```
AssertionError: assert ['info', 'Wait for the model to finish unloading.'] in [['loading', 'Unloading model'], ['loading', 'Unloading model']]
```

It passes on the commit before it (`5db9913658`).

## Cause

The test slices the body of `ejectModel` out of
`use-chat-model-runtime.ts` and runs it in a small harness that stubs
the hook's dependencies. #19169 made the eject resolve its target once
per click with the module-level `servedSelection()`, since a second
loaded model can now be beside the first. The harness had no
`servedSelection`, so the first click threw a `ReferenceError` inside
the body's `try`, the `catch` swallowed it into `setModelsError` (a
no-op stub), and `finally` released the unload lease. The second click
then found nothing unloading and started a second unload, which is what
the assertion saw.

The product code is right; the harness lost track of a new dependency,
and the swallowed error made it look like a behaviour change.

## Fix

Test only:

- add `servedSelection()` to the harness, returning the checkpoint the
eject targets;
- have the `setModelsError` stub record what it is given, and assert it
recorded nothing, so the next missing stub fails as `the eject body
threw inside the harness` with the `ReferenceError` text instead of as a
toast mismatch.

## Verification

- The test passes on main with the change (failed on `4739f8c3cc` before
it).
- Removing the new `servedSelection` stub makes it fail with `assert
['servedSelection is not defined'] == []`.
- `tests/studio` in full: 17,148 passed before this change with only
this test failing.
Hubert9204 pushed a commit to Hubert9204/Ganjalf-Studio that referenced this pull request Nov 24, 2026
…-11-23..25)

Merge of unslothai/unsloth main 2e1afd5..bd1ddf2. No textual conflicts; audited for
Ganjalf invariants (Claude API alignment, thinking budget, Qwen thinking presence 0,
check_page, guards, plugins/hooks/run_agent stop, branding via messages.ts, Ganjalf updater):
all intact.

Taken: llama.cpp/GGUF fixes (thinking budget counted with the real template unslothai#19143, native
prompt count in context fit unslothai#19159, host RAM growth priced before pinning unslothai#19231, second quant
of a loaded repo unslothai#19169, small Auto context on low-RAM CPU hosts unslothai#19142), security and
stability hardening (media bytes checked, remote-code gate, sandbox cache, managed accounts,
IPv6 loopback listeners), chat fixes (Files menu, deleted turns from other tabs, composer,
tool approvals tied to their tool), MCP, chat templates (phi-3, mistral), training/core
kernels, installer AMD/ROCm mixed hosts, Tauri security bumps, unsloth-zoo>=2026.11.11.
Branding stays Ganjalf (upstream strings are rebranded at runtime by i18n/messages.ts).

Ganjalf follow-up: the thread sampling simulation oracle expects presence 0 for Qwen
3.5/3.6 with thinking (non-thinking 1.5), as the chat table does since 369d05c.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01EVYBhJeMQGvLT6Ka4nMMUE
danielhanchen added a commit that referenced this pull request Nov 24, 2026
…#19349)

## Problem

`Long-chat cost against the base build` is red on chat PRs that did not
cause the slowdown it reports. On #19169 (load a second quant of a GGUF
repo):

| stream_scroll | base median | head median | head/base |
|---|---|---|---|
| blocked_ms | 31 | 496 | 4.96x |
| long_tasks | 1 | 7 | |

This is the same `stream_scroll` slowdown #19172 introduced (26 to 337
ms, 1 to 7 long tasks; see the comment there).

## Cause

The step measured against `github.event.pull_request.base.sha`, which
does not move when main advances. The checkout, though, is the PR merge
ref built on the current base tip. For #19169:

- `BASE_SHA` (event base): `cf00c93`, which predates #19172;
- merge ref: `Merge b6c005f into 7d4eb4a`, which includes #19172.

So the head arm carried #19172's slowdown and the base arm did not, and
any chat PR opened before #19172 merged now fails the gate for a change
it does not contain. The tool is right; the step handed it the wrong
base.

## Fix

`studio-frontend-ci.yml`, `long-chat-ab`: read the base from the
checkout. When `HEAD` is a merge commit (the PR merge ref), `BASE_SHA`
is its first parent, the base tip the merge was built on; otherwise it
falls back to the event base as before. `git cat-file -p HEAD` keeps the
parent lines in the depth-1 checkout, so no deeper fetch is needed. The
step now prints both SHAs.

`tests/studio/test_long_chat_ab_measures_against_the_merge_base_tip.py`
runs the step's own resolution lines in bash:

- in a depth-1 clone of a merge whose PR branch forked from an older
base, it resolves the tip the merge was built on, not the event base;
- in a checkout that is not a merge, it keeps the event base;
- `BASE_SHA` is no longer taken from the event directly.

The new guard is listed in `workflow-trigger-lint.yml`, so a
workflow-only edit still runs it.

## Verification

- New tests: 3 passed; against the workflow on main all 3 fail.
- Every test that reads `studio-frontend-ci.yml` or
`workflow-trigger-lint.yml`: 743 passed.

## Not changed

- The regression itself: that is #19172's, now on main and noted on that
PR. With this change, later chat PRs measure against a base that already
contains it, so the gate goes back to judging each PR's own change.
- Other workflows also read `pull_request.base.sha` (`lint-ci.yml`,
`security-audit.yml`, `studiobench-ui-parity.yml`, the Windows installer
and AMSI differentials). The ones that only diff the PR's own changes
are fine with it; any that build or measure a base arm against the merge
ref can drift the same way and are worth a look, but are left alone
here.
danielhanchen added a commit that referenced this pull request Nov 24, 2026
…outer (#19351)

## Problem


`studio/backend/tests/test_sampling_defaults_route.py::test_a_kept_model_resolves_against_its_own_slot`
fails on main since #19169 (load a second quant of a loaded GGUF repo
beside it):

```
TypeError: test_a_kept_model_resolves_against_its_own_slot.<locals>.route() got an unexpected keyword argument 'touch'
```

## Cause

#19169 gave `_route_to_extra_slot` a `touch: bool = True` parameter, and
read-only callers such as `get_sampling_defaults` now pass `touch =
False` so looking up a kept model's defaults does not refresh its place
in the eviction order. The test replaces `_route_to_extra_slot` with a
stub that only takes `requested`, so the call now raises. The route is
right; the stub fell behind its signature.

## Fix

Test only:

- the stub takes `*args, **kwargs` and binds them with
`inspect.signature` of the real `_route_to_extra_slot`, so it accepts
exactly what the real router accepts and still fails if the route passes
something the router does not;
- the test now also checks what the route passed: one call, with `touch
= False`. Reading defaults is not a use of the kept model.

## Verification

- `tests/test_sampling_defaults_route.py`: 5 passed (1 failed on main at
`5ea3aec943`).
- Dropping `touch = False` from the call in `get_sampling_defaults`
makes the new assertion fail with `[True] == [False]`.
oobabooga added a commit to oobabooga/unsloth that referenced this pull request Nov 24, 2026
Keep both header menus in chat-page.tsx: the Files menu from unslothai#19172 and the
character chat view menu.

Write my reply now names the model through servedCheckpoint, as chat replies
do since unslothai#19169, so a quant loaded beside its repo's other quant answers it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants