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: stop benchmarking embedding-only models on the Performance page
Adam Eivyfefb53e03cdf
diff --git a/server/lib/aiToolkit/errorDetection.js b/server/lib/aiToolkit/errorDetection.jsindex ed15dc8a62..a44f44ca1e 100644--- a/server/lib/aiToolkit/errorDetection.js+++ b/server/lib/aiToolkit/errorDetection.js@@ -104,7 +104,16 @@ const ERROR_PATTERNS = [// `global.anthropic.claude-opus-5`). Categorize it alongside the// not-found/invalid-model phrasings so the cooldown + fallback path treats// it as the config problem it is.- pattern: /model.*(not found|does not exist|unavailable)|invalid model|model identifier is invalid/i,+ // `"<model>" does not support chat` is Ollama's 400 when a request routes a+ // model at an endpoint it doesn't serve — the everyday case being an+ // embedding-only model (nomic-embed-text, bge-*, mxbai-embed-*) reached+ // through /api/chat. It names no "model" token, so the clauses above miss+ // it and it used to land in UNKNOWN: a 1-minute bench of a perfectly+ // healthy daemon plus a tier-4 investigation task. It is the same class of+ // fault as an unknown model id — this request named the wrong model for+ // this endpoint — so it belongs here, where the cooldown treats it as+ // request-specific and tier 1 corrects the model instead.+ pattern: /model.*(not found|does not exist|unavailable)|invalid model|model identifier is invalid|does not support (?:chat|generate|completions?|embeddings?)/i,category: ERROR_CATEGORIES.MODEL_NOT_FOUND,requiresFallback: true,actionable: true,diff --git a/server/lib/aiToolkit/errorDetection.test.js b/server/lib/aiToolkit/errorDetection.test.jsindex e5edd29e2c..52c6f82a17 100644--- a/server/lib/aiToolkit/errorDetection.test.js+++ b/server/lib/aiToolkit/errorDetection.test.js@@ -111,6 +111,16 @@ describe('Error Detection', () => {expect(result.requiresFallback).toBe(true);});+ it('classifies Ollama\'s "does not support chat" 400 as model-not-found', () => {+ // The everyday trigger is an embedding-only model reached through+ // /api/chat. It names no "model" token, so it used to fall through to+ // UNKNOWN — which benches a healthy daemon for a minute and escalates to a+ // tier-4 investigation instead of correcting the model (tier 1).+ const result = analyzeError('Ollama returned 400: {"error":"\\"nomic-embed-text:latest\\" does not support chat"}', 1);+ expect(result.hasError).toBe(true);+ expect(result.category).toBe(ERROR_CATEGORIES.MODEL_NOT_FOUND);+ });+it('should detect network errors', () => {const result = analyzeError('Error: ECONNREFUSED 127.0.0.1:8080');expect(result.hasError).toBe(true);diff --git a/server/services/localModelAssessments.js b/server/services/localModelAssessments.jsindex 03758c9947..be79a9046b 100644--- a/server/services/localModelAssessments.js+++ b/server/services/localModelAssessments.js@@ -84,6 +84,7 @@ import {tuningSpecsFor,} from '../lib/localModelTuning.js';import { claimHeavyLocalJob } from '../lib/heavyJobClaim.js';+import { isEmbeddingModel } from '../lib/localModelHeuristics.js';import { ServerError } from '../lib/errorHandler.js';import { probeOpenAiModels } from '../lib/openAiModelsProbe.js';import { getAllProviders } from './providers.js';@@ -342,6 +343,18 @@ export async function runAssessment({ backend, modelId, contextTokens = DEFAULT_try { onProgress({ scope: 'assessment', backend, modelId, ...frame }); }catch (err) { console.error(`❌ Local LLM: assessment progress listener failed: ${err.message}`); }};+ // Refuse an embedding-only model before anything is claimed or spawned. The+ // report already keeps them out of `unassessed`, so reaching here means a+ // direct API call (or a stale page) — and every path below would spend the+ // accelerator claim on a sample the backend answers with+ // `400 "<model>" does not support chat`. Failing fast with a reason beats+ // recording that as a verdict about the machine.+ if (isEmbeddingModel(modelId)) {+ throw new ServerError(+ `${modelId} is an embedding-only model — it has no chat endpoint to benchmark. Measure a generation model instead.`,+ { status: 400, code: 'MODEL_NOT_ASSESSABLE', context: { backend, modelId } },+ );+ }// A measurement is only valid if it had the machine to itself. This is the// SAME machine-wide claim local image/video/3D rendering and LoRA training// take (`lib/heavyJobClaim.js`), for a stronger reason than theirs: a@@ -819,6 +832,15 @@ export async function getAssessmentReport({ intent = 'balanced' } = {}) {const unassessed = [];for (const runtime of ASSESSABLE_RUNTIMES) {for (const model of listed[runtime].models || []) {+ // Embedding-only models are excluded from the MEASURABLE list, not from+ // the runtime's catalog above: they serve `/api/embed`, never+ // `/api/chat`, so the sample this module runs comes back+ // `400 "<model>" does not support chat`. Listing one here would offer a+ // Measure button that cannot produce a measurement, and put it in every+ // sweep scope — where the failed run also fires the provider-failure hook+ // and files a CoS investigation about a model that was never going to+ // generate text (run b361be1a, nomic-embed-text:latest).+ if (isEmbeddingModel(model?.id || '')) continue;if (model?.id && !assessedModels.has(assessmentKey(runtime, model.id))) {unassessed.push({ backend: runtime, modelId: model.id, params: model.params ?? null });}diff --git a/server/services/localModelAssessments.test.js b/server/services/localModelAssessments.test.jsindex c2a728ea5a..1eb9cf23fa 100644--- a/server/services/localModelAssessments.test.js+++ b/server/services/localModelAssessments.test.js@@ -233,6 +233,21 @@ describe('loadAssessments / getAssessmentReport (read path)', () => {it('falls back to the balanced intent for an unrecognized one', async () => {expect((await svc.getAssessmentReport({ intent: 'nonsense' })).intent).toBe('balanced');});++ it('leaves embedding-only models out of the measurable list', async () => {+ // They serve /api/embed, never /api/chat, so the benchmark sample comes back+ // `400 "<model>" does not support chat` — a failed run that also fires the+ // provider-failure hook and files a CoS investigation task. Offering a+ // Measure button for one, or sweeping it, is work that cannot succeed.+ listModels.mockImplementation(async (backend) => (backend === 'ollama'+ ? [{ id: 'example-model:7b', params: '7B' }, { id: 'nomic-embed-text:latest', params: '137M' }]+ : []));+ const report = await svc.getAssessmentReport();+ expect(report.unassessed.map((u) => u.modelId)).toEqual(['example-model:7b']);+ // Still counted as installed — the runtime really does serve it, and the+ // count is about the catalog, not about what a benchmark can measure.+ expect(report.runtimes.find((r) => r.id === 'ollama').modelCount).toBe(2);+ });});describe('runAssessment — machine-wide accelerator claim', () => {@@ -298,6 +313,21 @@ describe('runAssessment — machine-wide accelerator claim', () => {});describe('runAssessment', () => {+ it('refuses an embedding-only model before claiming the machine', async () => {+ // Reaching here means a direct API call or a stale page — the report already+ // keeps embedding models out of `unassessed`. Every sample would come back+ // `400 "<model>" does not support chat`, which is not a verdict about this+ // machine, so fail fast with a reason instead of recording one.+ await expect(svc.runAssessment({ backend: 'ollama', modelId: 'nomic-embed-text:latest', contextTokens: [512] }))+ .rejects.toMatchObject({ code: 'MODEL_NOT_ASSESSABLE', status: 400 });+ expect(runLocalLlmTest).not.toHaveBeenCalled();+ expect(await svc.loadAssessments()).toEqual([]);+ // The claim was never taken, so the next measurement can start immediately.+ const after = await claimHeavyLocalJob({ kind: 'probe', id: 'after-embed-refusal' });+ expect(after.ok).toBe(true);+ await after.release();+ });+it('samples every context in ascending order and persists the result', async () => {runLocalLlmTest.mockResolvedValue(okRun());const result = await svc.runAssessment({ backend: 'ollama', modelId: 'example-model:7b', contextTokens: [4096, 512] });