project-nomad/admin/app
Chris Sherwood 447b174832 fix(ai): don't classify the backend as non-Ollama when it is merely unreachable
getModels() and the _isNativeBackend() probe both set isOllamaNative =
false in their catch blocks for ANY failure of GET /api/tags - including
a plain 5s timeout while Ollama is busy or still starting, or a refused
connection while the container is down. The probe memoized that verdict
for the process lifetime. Every model download then failed with 'Model
is not available in your AI host... (model pulling is only supported
for Ollama backends)' on stock single-Ollama installs (#1349, two
reporters on GA).

The fix separates 'the backend answered and is not Ollama' from 'the
request failed'. Only an actual HTTP response - a non-2xx status, or a
200 whose body fails the Ollama shape check - proves a live non-Ollama
server and classifies false. No response at all leaves the
classification untouched (null, or a previously proven value), the
probe unmemoized for re-probing, and the download path falls through to
the pull attempt, whose existing error handling reports the real
network error as a retryable failure.

Verified live (v1.35.0-rc.1 + this patch, Ollama container stopped):
- stock behavior reproduced verbatim: dispatch fails with the
  'only supported for Ollama backends' message
- patched: the same dispatch fails with 'Failed to download model:
  getaddrinfo ENOTFOUND nomad_ollama' and stays retryable
- after starting Ollama again, the retrying BullMQ job recovered on
  its own and installed the model with no user action

Fixes #1349

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-09-29 15:54:41 -07:00
..
controllers feat(zim): let users browse the Kiwix library in any language 2026-09-29 15:54:41 -07:00
data refactor(drug-reference): make collections JSON the single source for curated data (#1130) 2026-08-04 03:38:35 +00:00
exceptions fix(Docs): documentation renderer fixes 2025-12-23 16:00:33 -08:00
jobs fix(queue): clear terminal jobs before re-dispatch so downloads aren't silently dropped 2026-09-29 15:54:41 -07:00
middleware fix(API): skip compression for Server-Sent Events (#798) 2026-05-20 10:16:00 -07:00
models feat(kb): per-file active toggle + collection grouping/bulk toggle (#1286) 2026-09-29 15:54:41 -07:00
services fix(ai): don't classify the backend as non-Ollama when it is merely unreachable 2026-09-29 15:54:41 -07:00
utils fix(seeder): derive ui_location from the merged config, not the live row 2026-09-29 15:54:41 -07:00
validators feat(zim): let users browse the Kiwix library in any language 2026-09-29 15:54:41 -07:00