From 0b95f2e09a59ef080e073613b35742ac6017346d Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 22 Aug 2026 02:37:38 -0400 Subject: [PATCH] Codex finding: unreadable model entries cannot prove absence MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A 200 tags response whose models array contains entries without a readable string name is unobservable for the embed model (an unnamed entry could be it) — never absent. Positive matches still count amid malformed siblings; an empty, fully readable list still proves absence. Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_012T1XF1ZyJL7KW8AVRUJjiD --- src/app.js | 17 ++++++++++++++--- test/app.test.js | 41 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+), 3 deletions(-) diff --git a/src/app.js b/src/app.js index 890142c..11bf3b5 100644 --- a/src/app.js +++ b/src/app.js @@ -84,9 +84,20 @@ export function createApp(config, { fetchImpl = fetch } = {}) { return null; } const found = models.some((m) => modelNamesMatch(m?.name, config.embedModel)); - embedModelResult = probeResult(found ? OK : ABSENT, ollamaSurface, { - model: config.embedModel, - }); + if (found) { + // Positive evidence stands on its own, even amid malformed entries. + embedModelResult = probeResult(OK, ollamaSurface, { model: config.embedModel }); + return null; + } + // Absence is only provable from a FULLY readable list: an entry + // without a readable name could be the model we are looking for. + const allReadable = models.every((m) => typeof m?.name === "string"); + embedModelResult = allReadable + ? probeResult(ABSENT, ollamaSurface, { model: config.embedModel }) + : probeResult(UNOBSERVABLE, ollamaSurface, { + model: config.embedModel, + reason: "models list contains entries without a readable name", + }); return null; // do not override the reachability verdict }, }), diff --git a/test/app.test.js b/test/app.test.js index ee80ec9..6aa7911 100644 --- a/test/app.test.js +++ b/test/app.test.js @@ -234,6 +234,47 @@ test("/health: 200 tags response WITHOUT a models array is unobservable, never a } }); +test("/health: models list with unreadable entries cannot prove absence (unobservable)", async () => { + for (const badList of [ + [{}], + [{ model: "nomic-embed-text" }], // wrong field name + [{ name: "qwen3:30b-a3b" }, { name: 42 }], // mixed: one unreadable entry + ]) { + const routes = happyRoutes(); + routes["GET http://ollama.test:11436/api/tags"] = () => jsonResponse({ models: badList }); + await withServer(fakeFetch(routes), async (base) => { + const res = await fetch(`${base}/health`); + const body = await res.json(); + assert.equal( + body.dependencies.embed_model.status, + "unobservable", + `list ${JSON.stringify(badList)} has unreadable entries and cannot prove absence` + ); + }); + } +}); + +test("/health: positive evidence stands even amid malformed sibling entries", async () => { + const routes = happyRoutes(); + routes["GET http://ollama.test:11436/api/tags"] = () => + jsonResponse({ models: [{}, { name: "nomic-embed-text:latest" }] }); + await withServer(fakeFetch(routes), async (base) => { + const res = await fetch(`${base}/health`); + const body = await res.json(); + assert.equal(body.dependencies.embed_model.status, "ok"); + }); +}); + +test("/health: an empty models list IS readable and proves absence", async () => { + const routes = happyRoutes(); + routes["GET http://ollama.test:11436/api/tags"] = () => jsonResponse({ models: [] }); + await withServer(fakeFetch(routes), async (base) => { + const res = await fetch(`${base}/health`); + const body = await res.json(); + assert.equal(body.dependencies.embed_model.status, "absent"); + }); +}); + test("/health: non-JSON 200 tags body is unobservable", async () => { const routes = happyRoutes(); routes["GET http://ollama.test:11436/api/tags"] = () => new Response("proxy error", { status: 200 });