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 frontend test: drain the previous runtime's writes before each reasoning-effort scenario (#12367)

Daniel Hanac0ce6fe585a
diff --git a/studio/frontend/tests/model-reasoning-preferences.test.ts b/studio/frontend/tests/model-reasoning-preferences.test.ts
index 164c58e7dc0..83fe857af92 100644
--- a/studio/frontend/tests/model-reasoning-preferences.test.ts
+++ b/studio/frontend/tests/model-reasoning-preferences.test.ts
@@ -31,7 +31,19 @@ const CAPS: ExternalReasoningCapabilities = {
type RuntimeModule = typeof import("../src/features/chat/stores/chat-runtime-store.ts");
const runtimeUrl = new URL("../src/features/chat/stores/chat-runtime-store.ts", import.meta.url).href;
+// Each boot imports a fresh copy of the runtime store, but every copy writes to the same
+// settingsHttp and threadRows stubs. A copy left with a debounced write (400 ms, on the real
+// clock) would land it in the NEXT test's stubs after they were reset: on a slow runner the
+// eject test saw an earlier test's { reasoningEffort: "low" } PUT and failed. Drain the
+// previous copy before resetting.
+let previousRuntime: RuntimeModule | null = null;
+
async function boot(scenario: string, paired: boolean | null = true): Promise<RuntimeModule> {
+ if (previousRuntime !== null) {
+ await previousRuntime.flushPendingChatSettings();
+ await previousRuntime.awaitThreadScopedSettingsWrite(THREAD);
+ await previousRuntime.awaitStartedThreadScopedSettingsWrites();
+ }
storageData.clear();
storageData.set("unsloth_chat_settings_imported_to_studio_db", "true");
useModelReasoningEffortStore.getState().syncFromStorage();
@@ -47,6 +59,7 @@ async function boot(scenario: string, paired: boolean | null = true): Promise<Ru
if (paired) store.getState().applyThreadScopedSettings(THREAD, { reasoningEffort: "medium" });
else if (paired === false) runtime.beginThreadScopedPairing(THREAD);
settingsHttp.puts.length = 0;
+ previousRuntime = runtime;
return runtime;
}