Skip to content

Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.

Studio: recover compare-pane settings through a snapshot path (#10505)

Chaitanya Laxmanb75ed881568d
diff --git a/studio/frontend/src/features/chat/shared-composer.tsx b/studio/frontend/src/features/chat/shared-composer.tsx
index 05c9ac32f69..32c2aaed924 100644
--- a/studio/frontend/src/features/chat/shared-composer.tsx
+++ b/studio/frontend/src/features/chat/shared-composer.tsx
@@ -116,7 +116,7 @@ import {
DEFAULT_PER_MODEL_CONFIG,
isServedByMlx,
savedContextPin,
- resolveInitialConfig,
+ resolveResidentInitialConfig,
type PerModelConfig,
loadedContextFields,
} from "@/features/model-picker";
@@ -1287,7 +1287,7 @@ export function SharedComposer({
// for this model/quant, never the other pane's. No saved config means all-null defaults.
const resolved = config
? { config, remembered: true }
- : resolveInitialConfig(sel.id, sel.ggufVariant ?? null);
+ : resolveResidentInitialConfig(sel.id, sel.ggufVariant ?? null);
const ownConfig = resolved.config;
const ownRemembered = resolved.remembered;
const isAlreadyActive =
diff --git a/studio/frontend/tests/resident-remembered-config.test.ts b/studio/frontend/tests/resident-remembered-config.test.ts
index dfeb56147b8..7a80d42b053 100644
--- a/studio/frontend/tests/resident-remembered-config.test.ts
+++ b/studio/frontend/tests/resident-remembered-config.test.ts
@@ -2,6 +2,7 @@
// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0
import assert from "node:assert/strict";
+import { readFileSync } from "node:fs";
import test from "node:test";
import {
@@ -109,3 +110,34 @@ test("a repo id resolves exactly as before", () => {
false,
);
});
+
+const composer = readFileSync(
+ new URL("../src/features/chat/shared-composer.tsx", import.meta.url),
+ "utf8",
+);
+const ensureModelLoaded = composer.slice(
+ composer.indexOf("async function ensureModelLoaded("),
+ composer.indexOf("if (handle1 && model1?.id)"),
+);
+
+test("compare ensureModelLoaded recovers a repo-keyed pin through a snapshot path", () => {
+ store.clear();
+ savePerModelConfig(REPO_ID, "Q4_K_M", {
+ ...config(null),
+ customContextLength: 8192,
+ });
+ assert.equal(resolveInitialConfig(SNAPSHOT_PATH, "Q4_K_M").remembered, false);
+ assert.equal(
+ resolveResidentInitialConfig(SNAPSHOT_PATH, "Q4_K_M").config
+ .customContextLength,
+ 8192,
+ );
+ assert.match(
+ ensureModelLoaded,
+ /resolveResidentInitialConfig\(\s*sel\.id,\s*sel\.ggufVariant \?\? null,?\s*\)/,
+ );
+ assert.doesNotMatch(
+ ensureModelLoaded,
+ /resolveInitialConfig\(\s*sel\.id,/,
+ );
+});