Skip to content

Voice-to-text dictation app with local (Nvidia Parakeet/Whisper) and cloud models (BYOK). Privacy-first and available cross-platform.

fix(local-llm): Phase 0 correctness + hygiene fixes for local model params and canaries (#1714)

Chad Piha41cf1d461761
diff --git a/CLAUDE.md b/CLAUDE.md
index 13e70e068..143d6138c 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -397,7 +397,7 @@ All AI model definitions are centralized in `src/models/modelRegistryData.json`
**Local model features:**
- Each model has `hfRepo` for direct HuggingFace download URLs
-- `promptTemplate` defines the chat format (ChatML, Llama, Mistral)
+- Chat formatting comes from the GGUF's embedded template (llama-server runs with `--jinja`); the registry carries no prompt templates
- Download URLs constructed as: `{baseUrl}/{hfRepo}/resolve/main/{fileName}`
### 9. API Integrations and Updates
diff --git a/scripts/llm-canary.mjs b/scripts/llm-canary.mjs
index 51a3c8919..47239163d 100644
--- a/scripts/llm-canary.mjs
+++ b/scripts/llm-canary.mjs
@@ -10,7 +10,9 @@
*
* Run: node --import tsx scripts/llm-canary.mjs
* Keys come from LLM_CANARY_<PROVIDER>_KEY env vars; providers without a key
- * are skipped and listed. Exit 1 when any probe on a keyed provider fails.
+ * are skipped and listed. Exit 1 when any probe on a keyed provider fails, or
+ * when no key is configured at all — an all-skip run probed nothing and must
+ * not report green.
*/
import { applyChatCompletionsParams } from "../src/services/ai/chatRequestBody.ts";
import registryData from "../src/models/modelRegistryData.json" with { type: "json" };
@@ -173,6 +175,10 @@ for (const entry of PROVIDERS) {
}
}
+if (skipped.length === PROVIDERS.length) {
+ failures.push("no canary secrets configured — every provider was skipped, nothing was probed");
+}
+
console.log("## LLM request-shape canary\n");
console.log("| provider | model | result |\n|---|---|---|");
for (const line of report) console.log(line);
diff --git a/scripts/stt-canary.mjs b/scripts/stt-canary.mjs
index bc4f3b31a..a7d94cab9 100644
--- a/scripts/stt-canary.mjs
+++ b/scripts/stt-canary.mjs
@@ -8,7 +8,9 @@
*
* Run: node scripts/stt-canary.mjs
* Keys come from STT_CANARY_<PROVIDER>_KEY env vars; providers without a key
- * are skipped and listed. Exit 1 when any probe on a keyed provider fails.
+ * are skipped and listed. Exit 1 when any probe on a keyed provider fails, or
+ * when no key is configured at all — an all-skip run probed nothing and must
+ * not report green.
* Corti is not probed (needs tenant/environment credentials beyond a key).
*/
import WebSocket from "ws";
@@ -119,6 +121,10 @@ for (const probe of PROBES) {
if (!result.ok) failures.push(`${probe.id}: ${result.detail}`);
}
+if (skipped.length === PROBES.length) {
+ failures.push("no canary secrets configured — every provider was skipped, nothing was probed");
+}
+
console.log("## Realtime STT canary\n");
console.log("| provider | result |\n|---|---|");
for (const line of report) console.log(line);
diff --git a/src/config/InferenceConfig.ts b/src/config/InferenceConfig.ts
deleted file mode 100644
index d6adee723..000000000
--- a/src/config/InferenceConfig.ts
+++ /dev/null
@@ -1,87 +0,0 @@
-import { cpus } from "os";
-
-export interface InferenceConfig {
- temperature: number;
- maxTokens: number;
- topK: number;
- topP: number;
- repeatPenalty: number;
- threads: number;
- contextSize: number;
- timeout: number;
-}
-
-export class InferenceConfigManager {
- private static instance: InferenceConfigManager;
- private config: InferenceConfig;
-
- private constructor() {
- this.config = this.getDefaultConfig();
- }
-
- static getInstance(): InferenceConfigManager {
- if (!InferenceConfigManager.instance) {
- InferenceConfigManager.instance = new InferenceConfigManager();
- }
- return InferenceConfigManager.instance;
- }
-
- getConfig(): InferenceConfig {
- return { ...this.config };
- }
-
- updateConfig(updates: Partial<InferenceConfig>) {
- this.config = {
- ...this.config,
- ...updates,
- };
- }
-
- getOptimalThreadCount(): number {
- // Use 75% of available CPUs for optimal performance
- const cpuCount = cpus().length;
- return Math.max(1, Math.floor(cpuCount * 0.75));
- }
-
- private getDefaultConfig(): InferenceConfig {
- return {
- temperature: 0.3,
- maxTokens: 512,
- topK: 40,
- topP: 0.9,
- repeatPenalty: 1.1,
- threads: this.getOptimalThreadCount(),
- contextSize: 2048,
- timeout: 30000,
- };
- }
-
- // Get config optimized for specific use cases
- getConfigForUseCase(useCase: "reasoning" | "creative" | "factual"): Partial<InferenceConfig> {
- switch (useCase) {
- case "reasoning":
- return {
- temperature: 0.3,
- topK: 40,
- topP: 0.9,
- repeatPenalty: 1.1,
- };
- case "creative":
- return {
- temperature: 0.8,
- topK: 100,
- topP: 0.95,
- repeatPenalty: 1.0,
- };
- case "factual":
- return {
- temperature: 0.1,
- topK: 20,
- topP: 0.85,
- repeatPenalty: 1.2,
- };
- }
- }
-}
-
-export const inferenceConfig = InferenceConfigManager.getInstance();
diff --git a/src/models/ModelRegistry.ts b/src/models/ModelRegistry.ts
index 3a5efb30a..ef157fed8 100644
--- a/src/models/ModelRegistry.ts
+++ b/src/models/ModelRegistry.ts
@@ -26,7 +26,6 @@ export interface LocalProviderData {
id: string;
name: string;
baseUrl: string;
- promptTemplate: string;
models: ModelDefinition[];
}
@@ -35,7 +34,6 @@ export interface ModelProvider {
name: string;
baseUrl: string;
models: ModelDefinition[];
- formatPrompt(text: string, systemPrompt: string): string;
getDownloadUrl(model: ModelDefinition): string;
}
@@ -136,12 +134,6 @@ if (cachedTinfoilModels.length > 0) {
}
}
-function createPromptFormatter(template: string): (text: string, systemPrompt: string) => string {
- return (text: string, systemPrompt: string) => {
- return template.replace("{system}", systemPrompt).replace("{user}", text);
- };
-}
-
class ModelRegistry {
private static instance: ModelRegistry;
private providers = new Map<string, ModelProvider>();
@@ -205,14 +197,11 @@ class ModelRegistry {
const localProviders = modelData.localProviders;
for (const providerData of localProviders) {
- const formatPrompt = createPromptFormatter(providerData.promptTemplate);
-
this.registerProvider({
id: providerData.id,
name: providerData.name,
baseUrl: providerData.baseUrl,
models: providerData.models,
- formatPrompt,
getDownloadUrl(model: ModelDefinition): string {
return `${providerData.baseUrl}/${model.hfRepo}/resolve/main/${model.fileName}`;
},
@@ -402,6 +391,7 @@ export function getModelProvider(modelId: string): string {
modelId.includes("llama") ||
modelId.includes("mistral") ||
modelId.includes("lfm2") ||
+ modelId.includes("gemma") ||
modelId.includes("gpt-oss-20b-mxfp4")
)
return "local";
diff --git a/src/models/modelRegistryData.json b/src/models/modelRegistryData.json
index 753f6b1ff..875d3f9b3 100644
--- a/src/models/modelRegistryData.json
+++ b/src/models/modelRegistryData.json
@@ -721,7 +721,6 @@
"id": "qwen",
"name": "Qwen",
"baseUrl": "https://huggingface.co",
- "promptTemplate": "<|im_start|>system\n{system}<|im_end|>\n<|im_start|>user\n{user}<|im_end|>\n<|im_start|>assistant\n",
"models": [
{
"id": "qwen3.5-9b-q4_k_m",
@@ -882,7 +881,6 @@
"id": "mistral",
"name": "Mistral",
"baseUrl": "https://huggingface.co",
- "promptTemplate": "[INST] {system}\n\n{user} [/INST]",
"models": [
{
"id": "mistral-nemo-12b-instruct-q4_k_m",
@@ -927,7 +925,6 @@
"id": "llama",
"name": "Meta Llama",
"baseUrl": "https://huggingface.co",
- "promptTemplate": "<|begin_of_text|><|start_header_id|>system<|end_header_id|>\n\n{system}<|eot_id|><|start_header_id|>user<|end_header_id|>\n\n{user}<|eot_id|><|start_header_id|>assistant<|end_header_id|>\n\n",
"models": [
{
"id": "llama-3.2-1b-instruct-q4_k_m",
@@ -972,7 +969,6 @@
"id": "openai-oss",
"name": "OpenAI",
"baseUrl": "https://huggingface.co",
- "promptTemplate": "<|im_start|>system\n{system}<|im_end|>\n<|im_start|>user\n{user}<|im_end|>\n<|im_start|>assistant\n",
"models": [
{
"id": "gpt-oss-20b-mxfp4",
@@ -994,7 +990,6 @@
"id": "gemma",
"name": "Gemma (Google)",
"baseUrl": "https://huggingface.co",
- "promptTemplate": "<bos><start_of_turn>user\n{system}\n\n{user}<end_of_turn>\n<start_of_turn>model\n",
"models": [
{
"id": "gemma-4-31b-it-q4_k_m",
@@ -1148,7 +1143,6 @@
"id": "liquidai",
"name": "Liquid AI",
"baseUrl": "https://huggingface.co",
- "promptTemplate": "<|im_start|>system\n{system}<|im_end|>\n<|im_start|>user\n{user}<|im_end|>\n<|im_start|>assistant\n",
"models": [
{
"id": "lfm2.5-1.2b-instruct-q4_k_m",
diff --git a/src/services/ai/thinkingSuppressionDialects.ts b/src/services/ai/thinkingSuppressionDialects.ts
index 935d14d3f..654d67cf0 100644
--- a/src/services/ai/thinkingSuppressionDialects.ts
+++ b/src/services/ai/thinkingSuppressionDialects.ts
@@ -87,7 +87,9 @@ export function suppressThinking(
} else if (providerKey === "lan") {
// `lan` always talks to an OpenAI-compat /v1 endpoint: the `reasoning` object
// disables Ollama thinking; other backends drop it (flat reasoning_effort trips vLLM).
- requestBody.reasoning = { effort: "none" };
+ // The effort value is the family's — gpt-oss has no off switch, so "none" would
+ // contradict the "low" cleanup pin the same body carries.
+ requestBody.reasoning = { effort: family?.reasoningEffort?.suppressValue ?? "none" };
} else {
requestBody.reasoning_effort = family?.reasoningEffort?.suppressValue ?? "none";
}
diff --git a/src/services/localReasoningBridge.js b/src/services/localReasoningBridge.js
index 8b751b43a..b60935c5b 100644
--- a/src/services/localReasoningBridge.js
+++ b/src/services/localReasoningBridge.js
@@ -32,13 +32,14 @@ class LocalReasoningService {
try {
const inferenceConfig = {
- maxTokens: config.maxTokens || this.calculateMaxTokens(text.length),
- temperature: config.temperature || 0.7,
- topK: config.topK || 40,
- topP: config.topP || 0.9,
- repeatPenalty: config.repeatPenalty || 1.1,
+ maxTokens: config.maxTokens ?? this.calculateMaxTokens(text.length),
+ temperature: config.temperature ?? 0.7,
+ topK: config.topK ?? 40,
+ topP: config.topP ?? 0.9,
+ repeatPenalty: config.repeatPenalty ?? 1.1,
systemPrompt: config.systemPrompt || "",
disableThinking: config.disableThinking !== false,
+ requireCompleteOutput: config.requireCompleteOutput,
};
debugLogger.logReasoning("LOCAL_BRIDGE_INFERENCE", {
diff --git a/src/stores/settingsStore.ts b/src/stores/settingsStore.ts
index 054f2fc04..ad8ea34c4 100644
--- a/src/stores/settingsStore.ts
+++ b/src/stores/settingsStore.ts
@@ -380,13 +380,7 @@ function migrateProviderSettings() {
reasoningProvider === "vertex"
) {
newReasoningMode = "enterprise";
- } else if (
- reasoningProvider === "qwen" ||
- reasoningProvider === "llama" ||
- reasoningProvider === "mistral" ||
- reasoningProvider === "openai-oss" ||
- reasoningProvider === "gemma"
- ) {
+ } else if (reasoningProvider && localLlmProviderIds.has(reasoningProvider)) {
newReasoningMode = "local";
} else {
newReasoningMode = "providers";
@@ -443,7 +437,6 @@ function migrateAgentMode() {
let agentInferenceMode: InferenceMode = "openwhispr";
if (cloudAgentMode === "byok") {
- const localProviders = ["qwen", "llama", "mistral", "openai-oss", "gemma"];
if (agentProvider === "custom") {
agentInferenceMode = "self-hosted";
} else if (
@@ -452,7 +445,7 @@ function migrateAgentMode() {
agentProvider === "vertex"
) {
agentInferenceMode = "enterprise";
- } else if (agentProvider && localProviders.includes(agentProvider)) {
+ } else if (agentProvider && localLlmProviderIds.has(agentProvider)) {
agentInferenceMode = "local";
} else {
agentInferenceMode = "providers";
diff --git a/src/utils/llamaOutputParser.js b/src/utils/llamaOutputParser.js
deleted file mode 100644
index e8c93061e..000000000
--- a/src/utils/llamaOutputParser.js
+++ /dev/null
@@ -1,73 +0,0 @@
-/**
- * Utility for parsing llama.cpp CLI output.
- * Extracts only the generated text, filtering out diagnostic messages and system noise.
- */
-
-// Patterns that indicate diagnostic/system output to filter out
-const DIAGNOSTIC_PATTERNS = [
- /^llama_/i,
- /^ggml_/i,
- /^log_/i,
- /^main:/i,
- /^sampling:/i,
- /^generate:/i,
- /^system_info:/i,
- /^\s*load time\s*=/i,
- /^\s*sample time\s*=/i,
- /^\s*prompt eval time\s*=/i,
- /^\s*eval time\s*=/i,
- /^\s*total time\s*=/i,
- /^Log start$/i,
- /^build: \d+/i,
- /^n_threads/i,
- /^Using .* backend/i,
- /^\s*\d+\s+tokens?\s+/i,
-];
-
-// Special end tokens that models may output
-const END_TOKEN_PATTERNS = [/<\|im_end\|>$/, /<\|end\|>$/, /<\/s>$/, /\[end of text\]$/i];
-
-/**
- * Parse llama.cpp output to extract only the generated text.
- * Filters out diagnostic messages, timing stats, and other noise.
- * @param {string} rawOutput - Raw output from llama.cpp CLI
- * @returns {string} Cleaned output containing only generated text
- */
-function parseLlamaCppOutput(rawOutput) {
- if (!rawOutput) return "";
-
- const lines = rawOutput.split("\n");
- const filteredLines = [];
-
- for (const line of lines) {
- const trimmedLine = line.trim();
-
- // Skip empty lines at the start (but keep them in the middle of content)
- if (filteredLines.length === 0 && !trimmedLine) {
- continue;
- }
-
- // Check if line matches any diagnostic pattern
- const isDiagnostic = DIAGNOSTIC_PATTERNS.some((pattern) => pattern.test(trimmedLine));
-
- if (!isDiagnostic) {
- filteredLines.push(line);
- }
- }
-
- // Trim trailing empty lines
- let result = filteredLines.join("\n").trim();
-
- // Remove common end tokens if they appear at the very end
- for (const pattern of END_TOKEN_PATTERNS) {
- result = result.replace(pattern, "").trim();
- }
-
- return result;
-}
-
-module.exports = {
- parseLlamaCppOutput,
- DIAGNOSTIC_PATTERNS,
- END_TOKEN_PATTERNS,
-};
diff --git a/test/helpers/canaryZeroSecrets.test.js b/test/helpers/canaryZeroSecrets.test.js
new file mode 100644
index 000000000..c0aa41dcd
--- /dev/null
+++ b/test/helpers/canaryZeroSecrets.test.js
@@ -0,0 +1,37 @@
+const test = require("node:test");
+const assert = require("node:assert/strict");
+const cp = require("node:child_process");
+const path = require("node:path");
+
+// A canary that skips every provider (no secrets configured, or the secrets
+// silently dropped from the workflow) must fail loudly: an all-skip run probed
+// nothing, so "All probes passed" would hide a dead canary behind a green check.
+// Per-provider skips stay allowed — only the zero-secret case is a failure.
+
+const repoRoot = path.resolve(__dirname, "../..");
+
+function runCanaryWithoutSecrets(scriptArgs) {
+ const env = Object.fromEntries(
+ Object.entries(process.env).filter(([name]) => !name.includes("_CANARY_"))
+ );
+ return cp.spawnSync(process.execPath, scriptArgs, {
+ cwd: repoRoot,
+ env,
+ encoding: "utf8",
+ timeout: 60_000,
+ });
+}
+
+for (const [name, scriptArgs] of [
+ ["llm-canary", ["--import", "tsx", "scripts/llm-canary.mjs"]],
+ ["stt-canary", ["scripts/stt-canary.mjs"]],
+]) {
+ test(`${name} exits non-zero when no secrets are configured`, () => {
+ const result = runCanaryWithoutSecrets(scriptArgs);
+ const output = `${result.stdout}\n${result.stderr}`;
+
+ assert.notEqual(result.status, 0, output);
+ assert.match(output, /no .*secrets? configured/i);
+ assert.doesNotMatch(output, /All probes passed/);
+ });
+}
diff --git a/test/helpers/localReasoningBridgeChain.test.js b/test/helpers/localReasoningBridgeChain.test.js
new file mode 100644
index 000000000..85eee1c77
--- /dev/null
+++ b/test/helpers/localReasoningBridgeChain.test.js
@@ -0,0 +1,120 @@
+const test = require("node:test");
+const assert = require("node:assert/strict");
+const Module = require("node:module");
+const fs = require("node:fs/promises");
+const http = require("node:http");
+const os = require("node:os");
+const path = require("node:path");
+
+const modelRegistryData = require("../../src/models/modelRegistryData.json");
+
+// Drives the primary local LLM path end to end — the IPC bridge
+// (localReasoningBridge) → modelManagerBridge.runInference →
+// llamaServer.inference — against an HTTP stub standing in for llama-server,
+// so the request body that actually reaches the wire is what gets asserted.
+// Electron is stubbed the same way modelManagerBridgeDownloadStatus.test.js
+// does; the fake model file and the pre-"started" server keep runInference on
+// its happy path without spawning anything.
+
+const originalLoad = Module._load;
+const CHAIN_MODULES = [
+ "../../src/services/localReasoningBridge.js",
+ "../../src/helpers/modelManagerBridge.js",
+ "../../src/helpers/modelDirUtils.js",
+ "../../src/helpers/llamaServer.js",
+].map((relative) => require.resolve(relative));
+let electronHome = os.tmpdir();
+
+function loadChain() {
+ for (const modulePath of CHAIN_MODULES) delete require.cache[modulePath];
+
+ Module._load = function loadWithMocks(request, parent, isMain) {
+ if (request === "electron") {
+ return {
+ app: {
+ isReady: () => true,
+ getAppPath: () => process.cwd(),
+ getPath: (name) => (name === "home" ? electronHome : path.join(electronHome, name)),
+ },
+ net: {},
+ };
+ }
+ return originalLoad.call(this, request, parent, isMain);
+ };
+
+ try {
+ require("../../src/helpers/modelDirUtils.js");
+ const bridge = require("../../src/services/localReasoningBridge.js").default;
+ const modelManager = require("../../src/helpers/modelManagerBridge.js").default;
+ return { bridge, modelManager };
+ } finally {
+ Module._load = originalLoad;
+ }
+}
+
+const OVER_MIN_FILE_SIZE = Buffer.alloc(1_000_001, 1);
+
+// Stands up the stub server plus a bridge whose model manager already
+// believes llama-server is running that model on the stub's port.
+async function setupChain(t, respond) {
+ const home = await fs.mkdtemp(path.join(os.tmpdir(), "openwhispr-local-chain-"));
+ electronHome = home;
+ t.after(() => fs.rm(home, { recursive: true, force: true }));
+
+ const requests = [];
+ const server = http.createServer((req, res) => {
+ let raw = "";
+ req.on("data", (chunk) => (raw += chunk));
+ req.on("end", () => {
+ requests.push(JSON.parse(raw));
+ res.writeHead(200, { "Content-Type": "application/json" });
+ res.end(JSON.stringify(respond()));
+ });
+ });
+ await new Promise((resolve) => server.listen(0, "127.0.0.1", resolve));
+ t.after(() => new Promise((resolve) => server.close(resolve)));
+
+ const { bridge, modelManager } = loadChain();
+ const model = modelRegistryData.localProviders[0].models[0];
+ modelManager.ensureInitialized();
+ await fs.mkdir(modelManager.modelsDir, { recursive: true });
+ await fs.writeFile(path.join(modelManager.modelsDir, model.fileName), OVER_MIN_FILE_SIZE);
+
+ const serverManager = modelManager.serverManager;
+ serverManager.cachedServerBinaryPaths = { default: "/stub/llama-server" };
+ serverManager.ready = true;
+ serverManager.process = {};
+ serverManager.port = server.address().port;
+ modelManager.currentServerModelId = model.id;
+ t.after(() => serverManager.clearIdleTimer());
+
+ return { bridge, modelId: model.id, requests };
+}
+
+const completion = (finishReason, content) => ({
+ choices: [{ finish_reason: finishReason, message: { content } }],
+});
+
+test("requireCompleteOutput rejects a truncated reply through the whole local chain", async (t) => {
+ const { bridge, modelId } = await setupChain(t, () => completion("length", "partial edi"));
+
+ await assert.rejects(
+ () => bridge.processText("edit this", modelId, { requireCompleteOutput: true }),
+ /truncated/
+ );
+});
+
+test("a truncated reply still resolves when the caller did not require complete output", async (t) => {
+ const { bridge, modelId } = await setupChain(t, () => completion("length", "partial"));
+
+ assert.equal(await bridge.processText("clean this", modelId, {}), "partial");
+});
+
+test("an explicit temperature of 0 reaches llama-server instead of the 0.7 default", async (t) => {
+ const { bridge, modelId, requests } = await setupChain(t, () => completion("stop", "ok"));
+
+ await bridge.processText("clean this", modelId, { temperature: 0 });
+
+ assert.equal(requests.length, 1);
+ assert.equal(requests[0].temperature, 0);
+});
diff --git a/test/helpers/modelRegistryProviderFallback.test.js b/test/helpers/modelRegistryProviderFallback.test.js
new file mode 100644
index 000000000..fe11b2b1b
--- /dev/null
+++ b/test/helpers/modelRegistryProviderFallback.test.js
@@ -0,0 +1,53 @@
+const test = require("node:test");
+const assert = require("node:assert/strict");
+const { createRendererServer, installBrowserGlobals } = require("../lib/rendererTestHarness");
+
+const modelRegistryData = require("../../src/models/modelRegistryData.json");
+
+// getModelProvider falls back to id heuristics for ids outside the registry
+// (a GGUF the user renamed, a catalog entry not yet synced). Every local model
+// family the catalog ships must resolve "local" there, or a non-registry id
+// fails closed to "" and the dictation is dropped instead of routed.
+test("non-registry ids of every local family fall back to the local provider", async (t) => {
+ installBrowserGlobals(t, {
+ initialStorage: { _providerSettingsMigrated: "1", cleanupMode: "local" },
+ });
+ const vite = await createRendererServer(t, {
+ cachePrefix: "openwhispr-model-provider-fallback-test-",
+ });
+ const { getModelProvider } = await vite.ssrLoadModule("/models/ModelRegistry.ts");
+
+ const nonRegistryLocalIds = [
+ "qwen3-4b-custom-finetune-q4_k_m",
+ "llama-3.2-3b-custom-q4_k_m",
+ "mistral-7b-custom-q4_k_m",
+ "lfm2-1.2b-custom-q4_k_m",
+ "gpt-oss-20b-mxfp4-custom",
+ "gemma-4-e4b-custom-q4_0",
+ ];
+ for (const modelId of nonRegistryLocalIds) {
+ assert.equal(getModelProvider(modelId), "local", modelId);
+ }
+});
+
+test("gemma fallback does not capture gemini ids or registry cloud gemma models", async (t) => {
+ installBrowserGlobals(t, {
+ initialStorage: { _providerSettingsMigrated: "1", cleanupMode: "local" },
+ });
+ const vite = await createRendererServer(t, {
+ cachePrefix: "openwhispr-model-provider-fallback-test-",
+ });
+ const { getModelProvider } = await vite.ssrLoadModule("/models/ModelRegistry.ts");
+
+ assert.equal(getModelProvider("gemini-9-ultra-preview"), "gemini");
+
+ // Gemini and Tinfoil serve Gemma too; those ids are in the registry, so the
+ // catalog lookup must keep winning over the local-family heuristic.
+ const cloudGemmaIds = modelRegistryData.cloudProviders.flatMap((provider) =>
+ provider.models.filter((model) => /gemma/i.test(model.id)).map((model) => model.id)
+ );
+ assert.ok(cloudGemmaIds.length > 0, "expected at least one cloud gemma id in the registry");
+ for (const modelId of cloudGemmaIds) {
+ assert.notEqual(getModelProvider(modelId), "local", modelId);
+ }
+});
diff --git a/test/helpers/settingsStoreLocalProviderMigrations.test.js b/test/helpers/settingsStoreLocalProviderMigrations.test.js
new file mode 100644
index 000000000..c998a6649
--- /dev/null
+++ b/test/helpers/settingsStoreLocalProviderMigrations.test.js
@@ -0,0 +1,35 @@
+const test = require("node:test");
+const assert = require("node:assert/strict");
+const { createRendererServer, installBrowserGlobals } = require("../lib/rendererTestHarness");
+
+const modelRegistryData = require("../../src/models/modelRegistryData.json");
+
+// The one-shot byok → mode migrations decide "local" from a provider list. That
+// list used to be hand-maintained and missed `liquidai` when LFM landed
+// (#1176), so a legacy LFM selection would have migrated to `providers`. Every
+// registry local provider must classify as local in both migrations.
+test("provider migrations classify every registry local provider as local", async (t) => {
+ const localProviderIds = modelRegistryData.localProviders.map((provider) => provider.id);
+ assert.ok(localProviderIds.includes("liquidai"), "the regression case must be in the registry");
+
+ const { storage } = installBrowserGlobals(t);
+ const vite = await createRendererServer(t, {
+ cachePrefix: "openwhispr-local-provider-migration-test-",
+ });
+
+ for (const providerId of localProviderIds) {
+ storage.clear();
+ storage.setItem("cloudReasoningMode", "byok");
+ storage.setItem("reasoningProvider", providerId);
+ storage.setItem("cloudAgentMode", "byok");
+ storage.setItem("agentProvider", providerId);
+
+ // Each migration runs once per module evaluation, so re-evaluate the store per provider.
+ vite.moduleGraph.invalidateAll();
+ const { useSettingsStore } = await vite.ssrLoadModule("/stores/settingsStore.ts");
+ const state = useSettingsStore.getState();
+
+ assert.equal(state.cleanupMode, "local", `${providerId}: cleanupMode`);
+ assert.equal(state.chatAgentMode, "local", `${providerId}: chatAgentMode`);
+ }
+});
diff --git a/test/helpers/thinkingSuppressionDialects.test.js b/test/helpers/thinkingSuppressionDialects.test.js
index aa0b5dd99..13f72b640 100644
--- a/test/helpers/thinkingSuppressionDialects.test.js
+++ b/test/helpers/thinkingSuppressionDialects.test.js
@@ -95,6 +95,19 @@ test("lan gets the nested reasoning object plus chat_template_kwargs", async ()
});
});
+test("lan sends a family's suppress floor inside the reasoning object, not a flat effort", async () => {
+ const { suppressThinking } = await load();
+
+ const body = {};
+ suppressThinking(body, "lan", "gpt-oss-20b-mxfp4");
+
+ assert.deepEqual(body, {
+ reasoning: { effort: "low" },
+ chat_template_kwargs: { enable_thinking: false },
+ });
+ assert.ok(!("reasoning_effort" in body), "flat reasoning_effort trips vLLM on lan (#1611)");
+});
+
test("unlisted providers keep the legacy reasoning_effort none plus chat_template_kwargs", async () => {
const { suppressThinking } = await load();
diff --git a/test/services/llmRequestShapeMatrix.test.js b/test/services/llmRequestShapeMatrix.test.js
index 2f40bb70e..8173446a9 100644
--- a/test/services/llmRequestShapeMatrix.test.js
+++ b/test/services/llmRequestShapeMatrix.test.js
@@ -66,6 +66,10 @@ const MATRIX = [
// --- Self-hosted ---
["lan disables Ollama thinking via the nested reasoning object (#1021)", "lan", "qwen3.5:9b", null, CLEANUP_NO_THINK,
{ max_tokens: MAX_TOKENS, temperature: 0, reasoning: { effort: "none" }, chat_template_kwargs: { enable_thinking: false } }],
+ ["lan gpt-oss cleanup: family low floor in both the pin and the reasoning object, no contradictory none", "lan", "gpt-oss-20b-mxfp4", null, CLEANUP_NO_THINK,
+ { max_tokens: MAX_TOKENS, temperature: 0, reasoning_effort: "low", reasoning: { effort: "low" }, chat_template_kwargs: { enable_thinking: false } }],
+ ["lan gpt-oss suppression sends the family floor, never the off value the family lacks", "lan", "gpt-oss-20b-mxfp4", null, AGENT_NO_THINK,
+ { max_tokens: MAX_TOKENS, temperature: 0.3, reasoning: { effort: "low" }, chat_template_kwargs: { enable_thinking: false } }],
["local llama.cpp gets think false plus chat_template_kwargs (#783)", "local", "qwen3.5-4b-gguf", null, CLEANUP_NO_THINK,
{ max_tokens: MAX_TOKENS, temperature: 0, think: false, chat_template_kwargs: { enable_thinking: false } }],