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
fix: load review backend managers only when selected
[._.]/ Adam Eivyeb2a6561cb51
diff --git a/server/lib/importScoping.test.js b/server/lib/importScoping.test.jsindex 148edbdd25..30d09ca8fe 100644--- a/server/lib/importScoping.test.js+++ b/server/lib/importScoping.test.js@@ -147,6 +147,12 @@ describe('Tailcat shared owners stay independent of forwarding (#6570)', () => {// [entry, target, why, specifier] — same first three columns as NARROWED above,// plus the specifier the call site must still name in its `await import()`.const DEFERRED = [+ ['services/codeReview.js', 'services/lmStudioManager.js',+ 'reads the live endpoint only for a selected LM Studio review', './lmStudioManager.js'],+ ['services/codeReview.js', 'services/ollamaManager.js',+ 'reads endpoints and model capabilities only for an Ollama review', './ollamaManager.js'],+ ['services/codeReview.js', 'services/mtplxServerManager.js',+ 'resolves the managed daemon only for an MTPLX review', './mtplxServerManager.js'],['services/agentManagement.js', 'lib/privateSecuritySandbox.js','loads sandbox cleanup only for private assessments', '../lib/privateSecuritySandbox.js'],['services/cos.js', 'services/persistentMindAdapter.js',diff --git a/server/services/codeReview.js b/server/services/codeReview.jsindex fa8fe9c788..8a300ed552 100644--- a/server/services/codeReview.js+++ b/server/services/codeReview.js@@ -51,11 +51,6 @@ import {resolveGoalFidelityConfig,} from '../lib/goalFidelity.js'import { getSettings, settingsEvents } from './settings.js'-import { getBaseUrl as getLmStudioBaseUrl } from './lmStudioManager.js'-import {- getBaseUrl as getOllamaBaseUrl,- getModelCapabilities as getOllamaModelCapabilities,-} from './ollamaManager.js'// LM Studio (`:1234`), Ollama (`:11434`) and MTPLX (`:8000/v1`) all ship// OpenAI-compatible `/v1/chat/completions`. Resolve through each manager's live@@ -64,16 +59,13 @@ import {// otherwise the catalog UI and the reviewer would silently desync when a user// relocates their install.//-// Every entry is awaited at the call site, which lets MTPLX's stay a DYNAMIC-// import. That is deliberate: `mtplxServerManager.js` pulls in the managed-daemon-// watcher and its PM2/filesystem graph, and this module is imported by the agent-// spawn path — a static import would put that whole graph behind every one of its-// importers (and did break suites that partially mock `lib/fileUtils.js`). The-// review request is a one-off HTTP call, so paying the resolve lazily costs-// nothing.+// Every entry is awaited at the call site. Keep all manager imports lazy:+// defaults-only callers (agent prompting, task generation and cleanup) must not+// load model download/install or daemon-management dependencies. Each manager+// remains the owner of its live endpoint; only a selected backend loads it.const BACKEND_BASE_URLS = {- lmstudio: () => getLmStudioBaseUrl(),- ollama: () => getOllamaBaseUrl(),+ lmstudio: async () => (await import('./lmStudioManager.js')).getBaseUrl(),+ ollama: async () => (await import('./ollamaManager.js')).getBaseUrl(),mtplx: async () => (await import('./mtplxServerManager.js')).getMtplxServerEndpoint(),}@@ -368,7 +360,8 @@ async function modelRejectsThinking(backend, model) {const cacheKey = thinkingCacheKey(backend, model)if (thinkingUnsupportedModels.get(cacheKey) === true) return trueif (backend !== 'ollama') return false- const capabilities = await getOllamaModelCapabilities(model).catch(() => null)+ const { getModelCapabilities } = await import('./ollamaManager.js')+ const capabilities = await getModelCapabilities(model).catch(() => null)if (!Array.isArray(capabilities) || capabilities.length === 0) return falseif (capabilities.includes('thinking')) return falsethinkingUnsupportedModels.set(cacheKey, true)