Codex finding: unreadable model entries cannot prove absence
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 <[email protected]> Claude-Session: https://claude.ai/code/session_012T1XF1ZyJL7KW8AVRUJjiD
This commit is contained in:
+14
-3
@@ -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
|
||||
},
|
||||
}),
|
||||
|
||||
@@ -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("<html>proxy error</html>", { status: 200 });
|
||||
|
||||
Reference in New Issue
Block a user