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
Never probe or download a voice LLM when voice is disabled
Adam Eivy2d1d7633faf3
diff --git a/server/services/voice/bootstrap.js b/server/services/voice/bootstrap.jsindex e051329623..bf042f45e4 100644--- a/server/services/voice/bootstrap.js+++ b/server/services/voice/bootstrap.js@@ -286,9 +286,16 @@ const sizeOf = (id) => {const FAST_VOICE_MODEL_MAX_B = 10;export const ensureToolCapableModel = async (cfg) => {- // Only intervene when the user opted in: tools on AND model is 'auto'.- // An explicit model id means they know what they want — respect it even- // if incompatible.+ // Only intervene when the user opted in: voice on, tools on AND model is+ // 'auto'. An explicit model id means they know what they want — respect it+ // even if incompatible.+ //+ // The `enabled` gate is deliberately duplicated from `reconcile`'s early+ // return rather than left to the caller: this function shells out to+ // `lms get`, a multi-GB download the user never asked for, so an install+ // with voice OFF must never reach it even if a future caller forgets the+ // gate. `preloadModel` guards itself the same way for the same reason.+ if (!cfg?.enabled) return { skipped: 'voice-disabled' };if (!cfg?.llm?.tools?.enabled) return { skipped: 'tools-disabled' };if (cfg?.llm?.model && cfg.llm.model !== 'auto') return { skipped: 'explicit-model' };if (!(await isEffectiveLmStudioVoiceProvider(cfg))) return { skipped: 'non-lmstudio-provider', provider: cfg?.llm?.provider };diff --git a/server/services/voice/bootstrap.retirement.test.js b/server/services/voice/bootstrap.retirement.test.jsindex 6a05b10137..76fd5806ec 100644--- a/server/services/voice/bootstrap.retirement.test.js+++ b/server/services/voice/bootstrap.retirement.test.js@@ -24,7 +24,7 @@ const { execPm2 } = await import('../pm2.js');const { execFile } = await import('../../lib/childProcess.js');const { getProviderById } = await import('../providers.js');const { VOICE_DEFAULTS } = await import('./config.js');-const { reconcile } = await import('./bootstrap.js');+const { reconcile, ensureToolCapableModel } = await import('./bootstrap.js');it('does not download or preload anything when an upgraded install boots before Piper setup', async () => {const cfg = { ...VOICE_DEFAULTS, enabled: true, tts: { ...VOICE_DEFAULTS.tts, retiredEngine: 'kokoro' } };@@ -46,3 +46,15 @@ it('starts provisioned Whisper while deferring missing Piper setup and LLM preloexpect(execFile).not.toHaveBeenCalled();expect(getProviderById).not.toHaveBeenCalled();});++// Voice OFF must never reach `lms get`. `reconcile` already returns early, so+// this pins the guard on ensureToolCapableModel ITSELF — the export is what+// shells out to a multi-GB download, and a future caller that forgets the+// reconcile gate would otherwise arm it on an install that never opted in.+it('does not probe or download a tool-capable model when voice is disabled', async () => {+ vi.clearAllMocks();+ const cfg = { ...VOICE_DEFAULTS, enabled: false, llm: { ...VOICE_DEFAULTS.llm, provider: 'lmstudio', model: 'auto', tools: { enabled: true } } };+ await expect(ensureToolCapableModel(cfg)).resolves.toEqual({ skipped: 'voice-disabled' });+ expect(execFile).not.toHaveBeenCalled();+ expect(getProviderById).not.toHaveBeenCalled();+});