Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
address review (codex): stop the editor and launcher pinning values nobody chose
Adam Eivyfa284f01186f
diff --git a/client/src/components/settings/LocalLlmTab.jsx b/client/src/components/settings/LocalLlmTab.jsxindex 961e2ae6a1..1149a782c6 100644--- a/client/src/components/settings/LocalLlmTab.jsx+++ b/client/src/components/settings/LocalLlmTab.jsx@@ -808,21 +808,29 @@ export function LocalLlmTab() {return Boolean(entry?.path && !entry.exists && entry.path === (field || '').trim());};const baseWeightMissing = missingWeight('model');- const draftWeightMissing = missingWeight('draftModel');- const llamaStartBlocked = llamaModelMissing || baseWeightMissing || draftWeightMissing;// Rendered from the server's list (status payload) so the card never carries a// second copy of the llama.cpp vocabulary.const specTypeSuggestions = llamaStatus?.specTypes || [];- // MIRROR of `isDraftSpecType` / `parseSpecTypes` in- // server/lib/specDecodePresets.js. The launcher drops drafter-based types when- // no drafter is configured; say so here rather than letting the server quietly- // rewrite the launch line the user thought they were starting.- const draftlessSpecTypes = (llamaForm.draftModel || '').trim()- ? []- : String(llamaForm.specType || '').split(',').map((t) => t.trim()).filter((t) => t.startsWith('draft-'));- const draftlessSpecNotice = draftlessSpecTypes.length > 0- ? `${draftlessSpecTypes.join(', ')} will be skipped until a Drafter Model is set.`- : '';+ // MIRROR of `parseSpecTypes` / `isDraftSpecType` in+ // server/lib/specDecodePresets.js, and of how `startLlamaServer` resolves the+ // two fields against each other. An EMPTY spec type still drafts (llama.cpp+ // speculates off a bare `--model-draft`), so it counts as using the drafter.+ const requestedSpecTypes = String(llamaForm.specType || '').split(',').map((t) => t.trim()).filter(Boolean);+ const draftSpecTypes = requestedSpecTypes.filter((t) => t.startsWith('draft-'));+ const drafterInUse = requestedSpecTypes.length === 0 || draftSpecTypes.length > 0;+ const drafterConfigured = Boolean((llamaForm.draftModel || '').trim());+ // Only block Start on a missing drafter GGUF when the launch would actually+ // load one — an `ngram-*` run needs no drafter, so a preset's undownloaded+ // drafter path must not hold it hostage.+ const draftWeightMissing = drafterInUse && missingWeight('draftModel');+ const llamaStartBlocked = llamaModelMissing || baseWeightMissing || draftWeightMissing;+ // Say what the launcher will do with a mismatched pair rather than letting the+ // server quietly rewrite the launch line the user thought they were starting.+ const specTypeNotice = !drafterConfigured && draftSpecTypes.length > 0+ ? `${draftSpecTypes.join(', ')} will be skipped until a Drafter Model is set.`+ : drafterConfigured && !drafterInUse+ ? 'The Drafter Model will be ignored — none of these spec types use one.'+ : '';const llamaStartBlockedReason = llamaModelMissing? 'Enter a Target Base Model path to enable Start': baseWeightMissing@@ -962,7 +970,7 @@ export function LocalLlmTab() {Both backends can be installed and running at the same time — <span className="text-gray-400">Default</span> just sets which one PortOS routes local-LLM runs to. Use <span className="text-gray-400">Import from…</span> to copy or link models between them without re-downloading.</p><p className="text-xs text-gray-500">- For local coding agents, configure the shared <Link to="/ai" className="text-port-accent hover:underline">temperature, top-p and thinking defaults in AI Providers</Link>. Every local OpenAI-compatible backend receives them — Ollama, llama.cpp and MTPLX, whether reached directly or through an OpenCode CLI/TUI wrapper. New local providers start at temperature 0.6.+ For local coding agents, configure the shared <Link to="/ai" className="text-port-accent hover:underline">temperature, top-p and thinking defaults in AI Providers</Link>. Every local OpenAI-compatible backend receives them — Ollama, llama.cpp and MTPLX, whether reached directly or through an OpenCode CLI/TUI wrapper. Every control left blank is simply not sent, so the backend keeps its own default — Ollama agent runs fall back to temperature 0.6.</p>{loading && !status ? (@@ -1274,8 +1282,8 @@ export function LocalLlmTab() {<code className="text-gray-400">ngram-*</code> ones speculate from the tokens already in context, so they runwith the Drafter field empty.</p>- {draftlessSpecNotice && (- <p className="text-[11px] text-port-warning mt-1">{draftlessSpecNotice}</p>+ {specTypeNotice && (+ <p className="text-[11px] text-port-warning mt-1">{specTypeNotice}</p>)}</div><div>diff --git a/client/src/pages/AIProviders.jsx b/client/src/pages/AIProviders.jsxindex b662eae465..6a4702ec42 100644--- a/client/src/pages/AIProviders.jsx+++ b/client/src/pages/AIProviders.jsx@@ -859,11 +859,12 @@ function ProviderForm({ provider, onClose, onSave, onEditProvider, allProvidersfallbackProvider: provider?.fallbackProvider || '',fallbackModel: provider?.fallbackModel || '',numCtx: provider?.numCtx ?? '',- temperature: provider?.temperature ?? 0.6,- // Blank means "don't send a top_p" — the backend keeps its own default,- // which is NOT the same as pinning 1. No numeric seed here for that reason.+ // All three seed from the record ONLY. Seeding a value the provider does not+ // have would let an unrelated Save pin it — the editor must be able to leave+ // "unset" alone, since unset is what lets each backend keep its own default.+ temperature: provider?.temperature ?? '',topP: provider?.topP ?? '',- thinking: provider?.thinking ?? true,+ thinking: provider?.thinking === true ? 'true' : provider?.thinking === false ? 'false' : '',contextWindow: provider?.contextWindow ?? '',timeout: provider?.timeout || 300000,enabled: provider?.enabled !== false,@@ -1005,13 +1006,11 @@ function ProviderForm({ provider, onClose, onSave, onEditProvider, allProvidersif (showsNumCtx && outOfRange(formData.numCtx, PROVIDER_FIELD_RANGES.numCtx)) {return { tab: 'generation', message: rangeMessage('Local num_ctx', PROVIDER_FIELD_RANGES.numCtx, 'tokens') };}- if (generationControls) {- if (outOfRange(formData.temperature, PROVIDER_FIELD_RANGES.temperature)) {- return { tab: 'generation', message: rangeMessage('Temperature', PROVIDER_FIELD_RANGES.temperature) };- }- if (outOfRange(formData.topP, PROVIDER_FIELD_RANGES.topP)) {- return { tab: 'generation', message: rangeMessage('Top-P', PROVIDER_FIELD_RANGES.topP) };- }+ if (generationControls?.temperature && outOfRange(formData.temperature, PROVIDER_FIELD_RANGES.temperature)) {+ return { tab: 'generation', message: rangeMessage('Temperature', PROVIDER_FIELD_RANGES.temperature) };+ }+ if (generationControls?.topP && outOfRange(formData.topP, PROVIDER_FIELD_RANGES.topP)) {+ return { tab: 'generation', message: rangeMessage('Top-P', PROVIDER_FIELD_RANGES.topP) };}return null;};@@ -1040,21 +1039,22 @@ function ProviderForm({ provider, onClose, onSave, onEditProvider, allProvidersheadlessArgs: formData.headlessArgs ? formData.headlessArgs.split(' ').filter(Boolean) : [],contextWindow: parseOptionalIntField(formData.contextWindow),numCtx: showsNumCtx ? parseOptionalIntField(formData.numCtx) : null,- // Blank Top-P clears back to "let the backend pick" (null) rather than- // `undefined`, which the server's spread-merge would read as "unchanged"- // and leave the old pin in place.- ...(generationControls- ? { temperature: parseNumberField(formData.temperature), topP: parseNumberField(formData.topP) ?? null }+ // A blank generation field clears back to "let the backend pick" — `null`+ // rather than `undefined`, which the server's spread-merge would read as+ // "unchanged" and leave the old pin in place.+ ...(generationControls?.temperature ? { temperature: parseNumberField(formData.temperature) ?? null } : {}),+ ...(generationControls?.topP ? { topP: parseNumberField(formData.topP) ?? null } : {}),+ ...(generationControls?.thinking+ ? { thinking: formData.thinking === '' ? null : formData.thinking === 'true' }: {}),};// `data` opens as a spread of the WHOLE form, so a control this provider- // doesn't offer rides along regardless of the branch above — and `topP: ''`- // isn't even a number the server schema accepts. Drop what can't be used;- // the server merges by spread, so anything already stored is left alone.- if (!generationControls) {- delete data.temperature;- delete data.topP;- }+ // doesn't offer rides along regardless of the branches above — and a blank+ // field is `''`, which is not a number (or a boolean) the server schema+ // accepts. Drop what can't be used; the server merges by spread, so+ // anything already stored is left alone.+ if (!generationControls?.temperature) delete data.temperature;+ if (!generationControls?.topP) delete data.topP;if (!generationControls?.thinking) delete data.thinking;// The generation/fallback pickers filter out embedding-only models, so a// stored embedding (from an older config) would be hidden in the UI yet@@ -1579,57 +1579,62 @@ function ProviderForm({ provider, onClose, onSave, onEditProvider, allProviders<p className="text-xs text-gray-500 mb-3">Applied to every run this provider starts — HTTP, CLI, and TUI alike. OpenCode wrappersreceive them as its <code className="text-gray-400">agent.build</code> options; a task can- still override temperature and thinking for one run.+ still override temperature and thinking for one run. Every field left blank is simply not+ sent, so the backend keeps its own default.</p><div className="grid grid-cols-1 sm:grid-cols-2 gap-3">- <FormField label="Temperature">- <input- type="number"- min={PROVIDER_FIELD_RANGES.temperature.min}- max={PROVIDER_FIELD_RANGES.temperature.max}- step="0.1"- value={formData.temperature}- onChange={(e) => setFormData(prev => ({ ...prev, temperature: e.target.value }))}- className="w-full px-3 py-2 bg-port-bg border border-port-border rounded-lg text-white focus:border-port-accent focus:outline-hidden"- />- <p className="text-xs text-gray-500 mt-1">Defaults to 0.6 for local Ollama agent runs.</p>- </FormField>- <FormField label="Top-P">- <input- type="number"- min={PROVIDER_FIELD_RANGES.topP.min}- max={PROVIDER_FIELD_RANGES.topP.max}- step="0.05"- value={formData.topP}- onChange={(e) => setFormData(prev => ({ ...prev, topP: e.target.value }))}- placeholder="Backend default"- className="w-full px-3 py-2 bg-port-bg border border-port-border rounded-lg text-white focus:border-port-accent focus:outline-hidden"- />- <p className="text-xs text-gray-500 mt-1">Nucleus sampling. Leave blank to send no top_p at all.</p>- </FormField>+ {generationControls.temperature && (+ <FormField label="Temperature">+ <input+ type="number"+ min={PROVIDER_FIELD_RANGES.temperature.min}+ max={PROVIDER_FIELD_RANGES.temperature.max}+ step="0.1"+ value={formData.temperature}+ onChange={(e) => setFormData(prev => ({ ...prev, temperature: e.target.value }))}+ placeholder="Backend default"+ className="w-full px-3 py-2 bg-port-bg border border-port-border rounded-lg text-white focus:border-port-accent focus:outline-hidden"+ />+ <p className="text-xs text-gray-500 mt-1">Local Ollama agent runs fall back to 0.6 when this is blank.</p>+ </FormField>+ )}+ {generationControls.topP && (+ <FormField label="Top-P">+ <input+ type="number"+ min={PROVIDER_FIELD_RANGES.topP.min}+ max={PROVIDER_FIELD_RANGES.topP.max}+ step="0.05"+ value={formData.topP}+ onChange={(e) => setFormData(prev => ({ ...prev, topP: e.target.value }))}+ placeholder="Backend default"+ className="w-full px-3 py-2 bg-port-bg border border-port-border rounded-lg text-white focus:border-port-accent focus:outline-hidden"+ />+ <p className="text-xs text-gray-500 mt-1">Nucleus sampling. Leave blank to send no top_p at all.</p>+ </FormField>+ )}{generationControls.thinking && (- /* Hand-rolled rather than FormField: the control is a- checkbox inside its own <label>, so FormField's- "bind the label to the first child" rule would point- htmlFor at that <label> instead of the input. */- <div>- <span className="block text-sm text-gray-400 mb-1">Thinking mode</span>- <label htmlFor="provider-thinking" className="flex items-center gap-2 min-h-10 text-sm text-gray-300">- <input- id="provider-thinking"- type="checkbox"- checked={formData.thinking}- onChange={(e) => setFormData(prev => ({ ...prev, thinking: e.target.checked }))}- className="w-4 h-4 rounded border-port-border bg-port-bg"- />- Enable model reasoning- </label>+ /* Tri-state rather than a checkbox: a checkbox cannot say+ "leave the model's own reasoning mode alone", so it+ forced a pin onto every provider the moment anyone+ pressed Save. */+ <FormField label="Thinking mode">+ <select+ value={formData.thinking}+ onChange={(e) => setFormData(prev => ({ ...prev, thinking: e.target.value }))}+ className="w-full px-3 py-2 bg-port-bg border border-port-border rounded-lg text-white focus:border-port-accent focus:outline-hidden"+ >+ <option value="">Model default</option>+ <option value="true">Enabled</option>+ <option value="false">Disabled</option>+ </select><p className="text-xs text-gray-500 mt-1">Ollama receives its native <code className="text-gray-400">think</code> flag; llama.cpp and- MTPLX get <code className="text-gray-400">enable_thinking</code> through the chat template.+ MTPLX get <code className="text-gray-400">enable_thinking</code> through the chat template;+ a Claude harness on Ollama gets <code className="text-gray-400">MAX_THINKING_TOKENS</code>.Models without a reasoning mode ignore it.</p>- </div>+ </FormField>)}</div></div>diff --git a/client/src/pages/AIProviders.test.jsx b/client/src/pages/AIProviders.test.jsxindex b04281131c..2ec8d06e83 100644--- a/client/src/pages/AIProviders.test.jsx+++ b/client/src/pages/AIProviders.test.jsx@@ -663,9 +663,9 @@ describe('provider reasoning defaults', () => {const effort = await screen.findByLabelText('Default Effort');fireEvent.change(effort, { target: { value: 'high' } });- const thinking = screen.getByLabelText('Enable model reasoning');- expect(thinking).toBeChecked();- fireEvent.click(thinking);+ const thinking = screen.getByLabelText('Thinking mode');+ expect(thinking).toHaveValue('true');+ fireEvent.change(thinking, { target: { value: 'false' } });fireEvent.click(screen.getByRole('button', { name: 'Save' }));await waitFor(() => expect(api.updateProvider).toHaveBeenCalledWith(@@ -704,7 +704,7 @@ describe('provider reasoning defaults', () => {fireEvent.change(await screen.findByLabelText('Default Effort'), { target: { value: 'high' } });fireEvent.change(screen.getByLabelText('Temperature'), { target: { value: '0.2' } });fireEvent.change(screen.getByLabelText('Top-P'), { target: { value: '0.9' } });- expect(screen.getByLabelText('Enable model reasoning')).toBeChecked();+ expect(screen.getByLabelText('Thinking mode')).toHaveValue('true');fireEvent.click(screen.getByRole('button', { name: 'Save' }));await waitFor(() => expect(api.updateProvider).toHaveBeenCalledWith(@@ -713,6 +713,75 @@ describe('provider reasoning defaults', () => {));});+ // The editor must be able to leave "unset" alone: seeding a default would let+ // an unrelated Save pin a temperature/thinking mode the backend never had, and+ // only Ollama has a documented server-side fallback to pin back to.+ it('saves an untouched llama.cpp provider without pinning any generation default', async () => {+ api.getProviders.mockResolvedValue({+ providers: [{+ id: 'opencode-llama-tui',+ name: 'OpenCode llama TUI',+ type: 'tui',+ command: 'opencode',+ args: [],+ enabled: true,+ llamaBacked: true,+ models: ['qwen3.8-27b'],+ defaultModel: 'qwen3.8-27b',+ envVars: {},+ }],+ activeProvider: 'opencode-llama-tui',+ });++ renderPage();++ fireEvent.click(await screen.findByRole('button', { name: 'Edit' }));+ await openEditorTab('Generation');++ expect(await screen.findByLabelText('Temperature')).toHaveValue(null);+ expect(screen.getByLabelText('Thinking mode')).toHaveValue('');++ fireEvent.click(screen.getByRole('button', { name: 'Save' }));+ await waitFor(() => expect(api.updateProvider).toHaveBeenCalled());+ expect(api.updateProvider.mock.calls[0][1]).toMatchObject({ temperature: null, topP: null, thinking: null });+ });++ // A Claude harness on Ollama is forwarded only MAX_THINKING_TOKENS+ // (server/lib/cliChildEnv.js) — it owns its own sampling, so offering a+ // temperature there would be a control that silently does nothing.+ it('offers only the thinking control on a Claude/Ollama provider', async () => {+ api.getProviders.mockResolvedValue({+ providers: [{+ id: 'claude-ollama-tui',+ name: 'Claude Ollama TUI',+ type: 'tui',+ command: 'claude',+ args: [],+ enabled: true,+ ollamaBacked: true,+ models: ['qwen3:32b'],+ defaultModel: 'qwen3:32b',+ envVars: {},+ }],+ activeProvider: 'claude-ollama-tui',+ });++ renderPage();++ fireEvent.click(await screen.findByRole('button', { name: 'Edit' }));+ await openEditorTab('Generation');++ expect(await screen.findByLabelText('Thinking mode')).toBeInTheDocument();+ expect(screen.queryByLabelText('Temperature')).toBeNull();+ expect(screen.queryByLabelText('Top-P')).toBeNull();++ fireEvent.click(screen.getByRole('button', { name: 'Save' }));+ await waitFor(() => expect(api.updateProvider).toHaveBeenCalled());+ const payload = api.updateProvider.mock.calls[0][1];+ expect(payload).not.toHaveProperty('temperature');+ expect(payload).not.toHaveProperty('topP');+ });+// A stored default PortOS never forwards is a control that lies. The editor// hides the block for cloud providers, and the payload must not carry the// form's seeded values either (`topP: ''` isn't even a valid number).@@ -737,7 +806,7 @@ describe('provider reasoning defaults', () => {await openEditorTab('Generation');expect(screen.queryByLabelText('Temperature')).toBeNull();- expect(screen.queryByLabelText('Enable model reasoning')).toBeNull();+ expect(screen.queryByLabelText('Thinking mode')).toBeNull();fireEvent.click(screen.getByRole('button', { name: 'Save' }));await waitFor(() => expect(api.updateProvider).toHaveBeenCalled());diff --git a/client/src/utils/providers.js b/client/src/utils/providers.jsindex 5337efb317..1445481778 100644--- a/client/src/utils/providers.js+++ b/client/src/utils/providers.js@@ -999,10 +999,15 @@ export const isOrcaRouterBackedProvider = (provider) => provider?.orcarouterBack* excluded: PortOS sends it no sampling fields at all, so offering a stored* temperature there would be a control that silently does nothing.*- * `thinking` is false for OrcaRouter, whose upstream models own their own- * reasoning switch. MIRROR of `THINKING_STYLE` / `buildAgentGeneration` in- * server/lib/opencodeConfig.js and `apiGenerationOptions` in- * server/lib/aiToolkit/internal/generationOptions.js; keep in lockstep.+ * Each control is reported separately because the forwarding is uneven:+ * OrcaRouter's upstream models own their own reasoning switch, so it has no+ * thinking toggle; and the Claude Code harness pointed at Ollama takes ONLY a+ * thinking signal (`MAX_THINKING_TOKENS=0` in server/lib/cliChildEnv.js) — it+ * owns its own sampling, so a temperature or top-p stored on one of those+ * records would never reach the daemon. MIRROR of `THINKING_STYLE` /+ * `buildAgentGeneration` in server/lib/opencodeConfig.js and+ * `apiGenerationOptions` in server/lib/aiToolkit/internal/generationOptions.js;+ * keep in lockstep.* @param {object|null|undefined} provider* @returns {{temperature:boolean, topP:boolean, thinking:boolean}|null}*/@@ -1012,6 +1017,9 @@ export const generationControlsFor = (provider) => {|| provider?.llamaBacked === true|| provider?.mtplxBacked === true;if (!local && !orcarouter) return null;+ if (commandBasename(provider?.command) === 'claude') {+ return { temperature: false, topP: false, thinking: true };+ }return { temperature: true, topP: true, thinking: !orcarouter };};diff --git a/client/src/utils/providers.test.js b/client/src/utils/providers.test.jsindex 3173150317..23771f21c8 100644--- a/client/src/utils/providers.test.js+++ b/client/src/utils/providers.test.js@@ -148,7 +148,9 @@ describe('generationControlsFor', () => {it.each([['OpenCode llama TUI', { id: 'opencode-llama-tui', command: 'opencode', llamaBacked: true }, { temperature: true, topP: true, thinking: true }],['OpenCode MTPLX', { id: 'opencode-mtplx', command: 'opencode', mtplxBacked: true }, { temperature: true, topP: true, thinking: true }],- ['Claude Ollama TUI', { id: 'claude-ollama-tui', command: 'claude', ollamaBacked: true }, { temperature: true, topP: true, thinking: true }],+ // A Claude harness on Ollama is forwarded only MAX_THINKING_TOKENS+ // (server/lib/cliChildEnv.js) — it owns its own sampling.+ ['Claude Ollama TUI', { id: 'claude-ollama-tui', command: 'claude', ollamaBacked: true }, { temperature: false, topP: false, thinking: true }],['native Ollama API', { id: 'ollama', type: 'api', endpoint: 'http://localhost:11434/v1' }, { temperature: true, topP: true, thinking: true }],// OrcaRouter proxies cloud models that own their own reasoning switch.['OpenCode OrcaRouter', { id: 'opencode-orcarouter', command: 'opencode', orcarouterBacked: true }, { temperature: true, topP: true, thinking: false }],diff --git a/docs/features/dflash2.md b/docs/features/dflash2.mdindex 42170c1269..cf1f53de73 100644--- a/docs/features/dflash2.md+++ b/docs/features/dflash2.md@@ -111,10 +111,19 @@ llama-server \```In PortOS, set this in **Settings → Local LLMs → Speculative Decoding →-Advanced options → Spec Type** (the picker suggests the types above). Leaving the-**Drafter Model** field empty is a supported configuration: PortOS drops the-`draft-*` entries from the launch line — logging which ones — and starts with the-`ngram-*` half. Vocabulary reference: llama.cpp `docs/speculative.md`.+Advanced options → Spec Type** (the picker suggests the types above). The two+fields are resolved against each other at launch, so a preset's prefilled paths+can't fight your choice:++- **Drafter Model empty + `draft-*` types** — those entries are dropped (logged),+ and the launch starts with whatever `ngram-*` half remains.+- **Drafter Model set + only `ngram-*` types** — the drafter is ignored rather+ than loaded, and Start is no longer blocked on a drafter GGUF that was never+ downloaded.+- **Spec Type empty + Drafter Model set** — left alone: llama.cpp speculates off+ a bare `--model-draft`, so PortOS does not second-guess it.++Vocabulary reference: llama.cpp `docs/speculative.md`.### 3. Use in PortOS1. Navigate to **AI Providers** (`/ai`) or **Settings → Local LLMs**.@@ -131,12 +140,20 @@ local model keeps one posture however it is reached; OpenCode receives them asits `agent.build` options, and a CoS task can still override temperature andthinking for a single run.-The block is offered only for the backends PortOS actually forwards these to —-Ollama, llama.cpp, and MTPLX, plus the OrcaRouter gateway. Thinking is not a-portable flag: Ollama takes its native `think` boolean while llama.cpp and MTPLX-receive `enable_thinking` through the chat template, so a model with no reasoning-mode simply ignores it. Leaving **Top-P** blank sends no `top_p` at all, which is-not the same as pinning `1` — the backend keeps its own default.+Each control appears only where PortOS actually forwards it. Sampling+(temperature, top-p) reaches Ollama, llama.cpp, and MTPLX, plus the OrcaRouter+gateway — but not a Claude Code harness pointed at Ollama, which owns its own+sampling and takes only the thinking signal. Thinking itself is not a portable+flag: Ollama gets its native `think` boolean, llama.cpp and MTPLX get+`enable_thinking` through the chat template, a Claude/Ollama harness gets+`MAX_THINKING_TOKENS`, and OrcaRouter gets nothing (its upstream models own the+switch). A model with no reasoning mode ignores it either way.++**Every field left blank is simply not sent**, so the backend keeps its own+default — blank Top-P is not the same as pinning `1`, and blank Temperature is+not the same as pinning `0.6` (though Ollama agent runs still fall back to `0.6`+server-side). This is why the editor never seeds a value a provider does not+already have: an unrelated Save must not silently pin one.### Checking the requirements from the Providers pagediff --git a/server/lib/aiToolkit/validation.js b/server/lib/aiToolkit/validation.jsindex cdc7e9b942..62a8a90f72 100644--- a/server/lib/aiToolkit/validation.js+++ b/server/lib/aiToolkit/validation.js@@ -90,11 +90,13 @@ export const providerSchema = z.object({// (Ollama, llama.cpp, MTPLX) and the OpenCode wrappers in front of them.// Provider-level so the same local model keeps its defaults across API, CLI,// and TUI launchers; a run may still override them per task.- temperature: z.number().min(0).max(2).optional(),- // Nucleus sampling. Optional with no default: a backend that is never told a- // top_p keeps its own, which is not the same as being pinned to 1.+ // All three are nullable, and null is the UI's "unset" — a backend that is+ // never told a temperature / top_p / thinking mode keeps its own, which is not+ // the same as being pinned to a value. Without a clearable null the editor+ // could only ever add a pin, never remove one.+ temperature: z.number().min(0).max(2).nullable().optional(),topP: z.number().min(0).max(1).nullable().optional(),- thinking: z.boolean().optional(),+ thinking: z.boolean().nullable().optional(),// Planning-time context window (tokens) the editorial budgeter may assume for// this provider — distinct from numCtx (what we *ask Ollama for*). For cloud// providers numCtx stays null and this reflects the model's real ceiling.diff --git a/server/services/llamaServerManager.js b/server/services/llamaServerManager.jsindex 51ed3e56f5..6b27f5813c 100644--- a/server/services/llamaServerManager.js+++ b/server/services/llamaServerManager.js@@ -212,25 +212,38 @@ export async function startLlamaServer(options = {}) {// Validate the weights before building the launch lineawait assertModelFileExists('The base model', model.trim());- const draftPath = typeof draftModel === 'string' && draftModel.trim()+ const configuredDraftPath = typeof draftModel === 'string' && draftModel.trim()? draftModel.trim(): null;- if (draftPath) await assertModelFileExists('The drafter model', draftPath);// `--spec-type` is a comma-separated LIST, and only its `draft-*` entries want// a drafter GGUF — every `ngram-*` implementation speculates off the tokens// already in the context window. Emitting the flag only alongside a drafter// therefore threw away perfectly valid drafter-free launches// (`--spec-type ngram-map-k`) and silently ignored the ngram half of a mixed- // one (`draft-dflash,ngram-map-k`). Drop just the drafter-based entries when- // no drafter is set — that keeps the card's documented "clear the field to run- // without it" working — and pass everything else through.+ // one (`draft-dflash,ngram-map-k`).+ //+ // The two halves are resolved against each other, because the launcher card+ // seeds BOTH fields from a preset: switching Spec Type to an `ngram-*` leaves+ // the preset's drafter path sitting in the form, and passing that as+ // `--model-draft` would load weights the run can't use — or fail the+ // existence check below on a preset GGUF that was never downloaded. So a+ // drafter is only carried when some requested type actually drafts with one,+ // and drafter-based types are dropped (with a log line) when no drafter is+ // set, which keeps the card's documented "clear the field to run without it"+ // working. An EMPTY spec type deliberately still counts as wanting the+ // drafter: llama.cpp speculates off a bare `--model-draft`, so dropping it+ // there would silently disable a working configuration.const requestedSpecTypes = parseSpecTypes(specType);+ const drafterInUse = requestedSpecTypes.length === 0 || requestedSpecTypes.some(isDraftSpecType);+ const draftPath = drafterInUse ? configuredDraftPath : null;const effectiveSpecTypes = draftPath? requestedSpecTypes: requestedSpecTypes.filter((type) => !isDraftSpecType(type));const droppedSpecTypes = requestedSpecTypes.filter((type) => !effectiveSpecTypes.includes(type));+ if (draftPath) await assertModelFileExists('The drafter model', draftPath);+const args = ['-m', expandHome(model.trim())];if (draftPath) args.push('--model-draft', expandHome(draftPath));if (effectiveSpecTypes.length > 0) args.push('--spec-type', effectiveSpecTypes.join(','));@@ -246,11 +259,17 @@ export async function startLlamaServer(options = {}) {appendLog(`Ignoring spec-type ${droppedSpecTypes.join(',')} — no drafter model is set`);console.log(`🦙 llama-server dropping drafter-based spec types ${droppedSpecTypes.join(',')} (no --model-draft configured)`);}+ if (configuredDraftPath && !draftPath) {+ appendLog(`Ignoring drafter ${configuredDraftPath} — no requested spec type uses one`);+ console.log(`🦙 llama-server ignoring drafter ${configuredDraftPath} (spec types ${effectiveSpecTypes.join(',') || 'none'} need no drafter)`);+ }appendLog(`Starting: llama-server ${args.join(' ')}`);currentConfig = {model,- draftModel: draftModel || null,+ // The drafter actually on the launch line, so the status card reports what+ // is running rather than what the form happened to be holding.+ draftModel: draftPath,// The types actually on the launch line, so the status card reports what is// running rather than what was asked for.specType: effectiveSpecTypes.join(','),diff --git a/server/services/llamaServerManager.test.js b/server/services/llamaServerManager.test.jsindex 936659f02a..0b451d39a3 100644--- a/server/services/llamaServerManager.test.js+++ b/server/services/llamaServerManager.test.js@@ -218,6 +218,32 @@ describe('llamaServerManager', () => {expect(status.config.specType).toBe('ngram-map-k');});+ it('ignores a preset drafter path when only ngram spec types were requested', async () => {+ // The launcher card seeds BOTH fields from a preset, so switching Spec Type+ // to an ngram implementation leaves the drafter path behind — loading it+ // would cost VRAM the run can't use, and a preset GGUF that was never+ // downloaded would fail the existence check and block Start outright.+ vi.spyOn(processEnv, 'findCommandOnPath').mockReturnValue('/usr/local/bin/llama-server');++ await startLlamaServer({ model: modelPath, draftModel: draftPath, specType: 'ngram-map-k' });++ const startCall = execPm2Calls.find((c) => c[0] === 'start');+ expect(startCall).not.toContain('--model-draft');+ expect(startCall[startCall.indexOf('--spec-type') + 1]).toBe('ngram-map-k');+ const status = await getLlamaServerStatus();+ expect(status.config.draftModel).toBeNull();+ });++ it('keeps a drafter when no spec type is set at all — llama.cpp drafts off --model-draft alone', async () => {+ vi.spyOn(processEnv, 'findCommandOnPath').mockReturnValue('/usr/local/bin/llama-server');++ await startLlamaServer({ model: modelPath, draftModel: draftPath, specType: '' });++ const startCall = execPm2Calls.find((c) => c[0] === 'start');+ expect(startCall[startCall.indexOf('--model-draft') + 1]).toBe(draftPath);+ expect(startCall).not.toContain('--spec-type');+ });+it('omits --spec-type entirely when the only requested type needs an absent drafter', async () => {vi.spyOn(processEnv, 'findCommandOnPath').mockReturnValue('/usr/local/bin/llama-server');