Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

fix(local-models): finish retiring the embedding role instead of half-leaving it

rubenluetke10-beepfca67beaf161
diff --git a/docs/BUGS.md b/docs/BUGS.md
index bde08e3220..6ed91481a1 100644
--- a/docs/BUGS.md
+++ b/docs/BUGS.md
@@ -14568,3 +14568,50 @@ test file. Every consumer used to monkeypatch it to a fixed pair, so the
function producing those pairs had no coverage: the Apple branch and the
"nothing readable" fallback had never been executed. All legs are driven through
fakes, so the suite proves them on a headless container too.
+
+## BUG-207: the shortlist kept recommending an embedding model for a job that no longer exists (MEDIUM, FIXED 2026-08-28)
+
+**Symptom.** The Local models catalogue marked `qwen3-embedding:4b` as the
+recommended download for an "Embedding" role — but the section's role list has
+no embedding slot, so there was nowhere to put it. The verify panel promised
+"one embedding" as a step it never ran, the empty-state offered to download
+"the recommended chat and embedding models", and the health badge carried a
+permanent `model_unavailable` for the same role.
+
+**Cause.** Removing the UltraWiki semantic memory (5118ce130, 2026-08-28) took
+the embedding slot out of `ollama_roles.ROLES` but left every other half of the
+feature standing:
+
+* `ollama_pull.ROLE_ORDER` still listed `"embedding"`, and two curated entries
+ still carried `role="embedding"`, so `recommendations()` kept ranking and
+ recommending them.
+* `assistant_test._embedding_check` became unreachable — the runner derives its
+ roles from `WRITABLE_ROLE_IDS`, and passing `"embedding"` explicitly raises.
+* Four user-facing strings in all three locales still described the embedding
+ step.
+* `write_health_record()` starts from `payload = dict(previous)`, so the last
+ embedding result was carried forward on every badge update. A merge writer
+ cannot drop a key by construction: the entry would have outlived the role
+ indefinitely.
+
+The mirror image of "finish a feature everywhere" — a REMOVAL landed everywhere
+but one place, and the leftovers each looked like a live feature.
+
+**Fix.** The role is gone from the shortlist vocabulary and the curated list;
+the dead check and its dispatch are deleted; the four strings now describe what
+verify actually does (server, chat, voice); and `_without_retired_roles()`
+prunes results for roles the list no longer has on the way out. The pruner
+returns a COPY — `since` is derived from the previous record afterwards, and
+mutating it in place would freeze that clock.
+
+**Kept on purpose.** `inventory.embed_probe` and the `"embedding"` capability
+word stay: an embedding model already on disk still appears in the ledger with
+its capability, and the probe has its own test. Only the ROLE is retired.
+
+**Guard.** `test_the_shortlist_only_advertises_roles_a_slot_can_take` asserts
+every `ROLE_ORDER` entry maps to a `ROLES` slot, so the next retirement cannot
+leave an orphan behind; three tests in `test_health_monitor.py` cover the prune
+and the `since` clock.
+
+**Related.** BUG-205 (the other half of this audit — two surfaces disagreeing
+about one machine) and BUG-206 (the accelerator probe).
diff --git a/jarvis/brain/ollama_pull.py b/jarvis/brain/ollama_pull.py
index 3f6b2b5cf9..6b283f3e87 100644
--- a/jarvis/brain/ollama_pull.py
+++ b/jarvis/brain/ollama_pull.py
@@ -60,13 +60,21 @@ _OVERHEAD_GB = 2.0
#: The jobs a local install has to fill. Each one is a separate decision — a
-#: machine needs a chat model AND an embedder, they do not substitute for each
-#: other — so the shortlist offers a best pick per role rather than one ranked
-#: list where the embedder looks like a weak chat model.
-Role = Literal["chat", "vision", "coder", "embedding"]
+#: machine needs a chat model AND a model that can see a screen, they do not
+#: substitute for each other — so the shortlist offers a best pick per role
+#: rather than one ranked list where a specialist looks like a weak chat model.
+#:
+#: ``embedding`` was retired with the UltraWiki semantic memory (2026-08-28):
+#: nothing in the product embeds locally any more — the remaining wiki searches
+#: by term overlap — and `ollama_roles.ROLES` has no slot to assign an embedder
+#: to. Advertising a "recommended" download for a job that cannot be filled is
+#: worse than offering nothing (BUG-207). An embedding model already installed
+#: still appears in the ledger with its capability; only the shortlist role is
+#: gone.
+Role = Literal["chat", "vision", "coder"]
#: Display order of the roles, most-load-bearing first.
-ROLE_ORDER: tuple[Role, ...] = ("chat", "vision", "coder", "embedding")
+ROLE_ORDER: tuple[Role, ...] = ("chat", "vision", "coder")
@dataclass(frozen=True, slots=True)
@@ -211,23 +219,6 @@ RECOMMENDED_MODELS: tuple[RecommendedModel, ...] = (
purpose="Large agentic coding worker for a big card.",
role="coder",
),
- # ── embeddings (retrieval; not chat models) ─────────────────────────────
- RecommendedModel(
- id="embeddinggemma",
- label="EmbeddingGemma",
- size_gb=0.6,
- purpose="Embeddings for search on any machine. Not a chat model.",
- role="embedding",
- tools=False,
- ),
- RecommendedModel(
- id="qwen3-embedding:4b",
- label="Qwen 3 Embedding 4B",
- size_gb=2.5,
- purpose="Higher-capacity current multilingual embeddings for retrieval.",
- role="embedding",
- tools=False,
- ),
)
diff --git a/jarvis/brain/ollama_roles.py b/jarvis/brain/ollama_roles.py
index 4cb9203d15..ebbad20e97 100644
--- a/jarvis/brain/ollama_roles.py
+++ b/jarvis/brain/ollama_roles.py
@@ -1,10 +1,11 @@
"""The model slots Ollama fills, read and written from ONE place.
-Today the local brain is spread over five config keys the user never sees
+Today the local brain is spread over four config keys the user never sees
side by side: the chat model, the voice model (the managed voice server's
-brain, baked into its launch command), the tool/screen model, the deep model
-and the wiki's embedding model — plus two read-only consumers (the quick ack,
-dictation polish) that pin their own tag.
+brain, baked into its launch command), the tool/screen model and the deep
+model — plus two read-only consumers (the quick ack, dictation polish) that
+pin their own tag. The wiki's embedding slot was retired with the UltraWiki
+semantic memory (2026-08-28); nothing embeds locally any more.
This module names every slot as a :class:`RoleSpec`, reads its current pick
from a loaded config, judges which INSTALLED downloads qualify for it (by the
capabilities ``/api/show`` declares) and recommends one, so the "Local
@@ -245,9 +246,9 @@ def current_pick(cfg: Any, role_id: str) -> tuple[str, str]:
"""``(tag, note)`` the config holds for ``role_id``.
``tag`` is ``""`` for discovery; ``note`` is one sentence when the slot
- is served by something other than Ollama (the wiki embedding with a
- cloud provider, dictation polish on another provider), so the row can
- say so instead of showing an unrelated tag as if Ollama ran it.
+ is served by something other than Ollama (dictation polish on another
+ provider, say), so the row can say so instead of showing an unrelated tag
+ as if Ollama ran it.
"""
if cfg is None:
return "", ""
@@ -672,7 +673,7 @@ def set_role(role_id: str, model: str, *, cfg: Any = None) -> dict[str, Any]:
which case the drift guard may revert it and the caller should say so.
Raises ``ValueError`` for an unknown or read-only role, and for an empty
- embedding model (the wiki needs a name; there is no discovery there).
+ model on a slot that cannot discover one (the voice server needs a name).
"""
spec = role_spec(role_id)
if not spec.writable:
diff --git a/jarvis/local_models/assistant_test.py b/jarvis/local_models/assistant_test.py
index c43ffbf238..1eada1f38b 100644
--- a/jarvis/local_models/assistant_test.py
+++ b/jarvis/local_models/assistant_test.py
@@ -6,9 +6,8 @@ runner asks the server (``probe_host``), then makes one REAL call per
configured role: a 1-token generation for the chat / deep / tools_screen
roles (through :func:`jarvis.brain.provider_test.run_provider_test`, so the
status vocabulary is the one the API-keys cards already speak), a
-capability assertion on top for ``tools_screen``, an embedding round trip
-for the embedding role, and — only when the managed voice server is
-configured — the voice smoke probe. The report is persisted to
+capability assertion on top for ``tools_screen``, and — only when the managed
+voice server is configured — the voice smoke probe. The report is persisted to
``DATA_DIR/state/local_models_health.json`` so the section badge and the
health monitor read the same file.
"""
@@ -50,7 +49,6 @@ HEALTH_FILE_NAME = "local_models_health.json"
#: The generation-tested roles and the role whose pick embeds.
_GENERATION_ROLES: tuple[str, ...] = ("chat", "tools_screen", "deep")
-_EMBEDDING_ROLE = "embedding"
_VOICE_ROLE = "voice"
_DEFAULT_TIMEOUT_S = 90.0
@@ -238,26 +236,6 @@ async def _capability_check(root: str, check: RoleCheck, *, transport: Any) -> R
return RoleCheck(check.model, "ok", check.latency_ms, "Answered; declares tools + vision.")
-async def _embedding_check(root: str, model: str, *, transport: Any) -> RoleCheck:
- import time
-
- from jarvis.brain import ollama_inventory as inventory
- from jarvis.brain.provider_test import ERROR, MODEL_UNAVAILABLE, UNREACHABLE
-
- started = time.perf_counter()
- try:
- dim = await inventory.embed_probe(root, model, transport=transport)
- except inventory.OllamaModelNotFound as exc:
- return RoleCheck(model, MODEL_UNAVAILABLE, _ms(started), str(exc))
- except inventory.OllamaServerError as exc:
- text = str(exc)
- status = UNREACHABLE if "No Ollama" in text or "unreachable" in text.lower() else ERROR
- return RoleCheck(model, status, _ms(started), text)
- if dim <= 0:
- return RoleCheck(model, ERROR, _ms(started), f"{model} returned no embedding vector.")
- return RoleCheck(model, "ok", _ms(started), f"Embeds ({dim} dimensions).")
-
-
async def _voice_check(
cfg: Any,
*,
@@ -351,9 +329,7 @@ async def run_setup_test(
if not server.get("ok"):
checks[role] = RoleCheck(model, UNREACHABLE, 0.0, str(server.get("detail") or ""))
continue
- if role == _EMBEDDING_ROLE:
- checks[role] = await _embedding_check(root, model, transport=transport)
- elif role in _GENERATION_ROLES:
+ if role in _GENERATION_ROLES:
check = await _generation_check(
cfg, model, timeout_s=timeout_s, brain_probe=brain_probe
)
diff --git a/jarvis/local_models/health_monitor.py b/jarvis/local_models/health_monitor.py
index 478a928f6f..10c0bfd6b4 100644
--- a/jarvis/local_models/health_monitor.py
+++ b/jarvis/local_models/health_monitor.py
@@ -129,11 +129,46 @@ def read_health_record() -> dict[str, Any]:
}
+def _without_retired_roles(payload: dict[str, Any]) -> dict[str, Any]:
+ """Drop per-role results for roles this install no longer has.
+
+ The record is written by MERGING into the previous one, so a role's last
+ result outlives the role itself: when the embedding slot was retired with
+ the UltraWiki semantic memory, its `model_unavailable` entry stayed in the
+ file for good, and the badge kept reporting a job the section does not show
+ and the user cannot fix (BUG-207). A merge writer cannot clean that up by
+ construction, so it is pruned on the way out instead.
+
+ Unknown-but-current roles are kept: the role list is the authority, and a
+ role added since this file was written is not stale.
+ """
+ pruned = dict(payload) # a COPY: the caller still reads `previous` afterwards
+ roles = payload.get("roles")
+ if not isinstance(roles, dict):
+ return pruned
+ try:
+ from jarvis.brain.ollama_roles import WRITABLE_ROLE_IDS # noqa: PLC0415 — lazy (AP-26)
+
+ live = set(WRITABLE_ROLE_IDS)
+ except Exception: # noqa: BLE001 — without the role list, prune nothing
+ log.debug("local-models: role list unavailable; keeping every health entry")
+ return pruned
+ kept = {name: result for name, result in roles.items() if name in live}
+ if len(kept) != len(roles):
+ log.info(
+ "local-models: dropped %d retired role(s) from the health record: %s",
+ len(roles) - len(kept),
+ ", ".join(sorted(set(roles) - live)),
+ )
+ pruned["roles"] = kept
+ return pruned
+
+
def write_health_record(status: str, reason: str, *, checked_at: str | None = None) -> bool:
"""Merge the badge keys into the health file; ``since`` holds while the status does."""
stamp = checked_at or _dt.datetime.now(_dt.UTC).isoformat(timespec="seconds")
previous = load_last_report() or {}
- payload = dict(previous)
+ payload = _without_retired_roles(previous)
payload["status"] = status
payload["reason"] = reason
payload["checked_at"] = stamp
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/local_models/de.json b/jarvis/ui/web/frontend/src/i18n/locales/local_models/de.json
index 53181028b4..555f6f66fe 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/local_models/de.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/local_models/de.json
@@ -250,7 +250,7 @@
"setup_pulling": "{model} wird heruntergeladen",
"setup_assigning": "{role} wird zugewiesen: {model}…",
"setup_tuning": "Einstellungen für {model} werden gewählt…",
- "setup_verifying": "Prüft die Einrichtung — Server, eine Chat-Antwort, eine Einbettung…",
+ "setup_verifying": "Prüft die Einrichtung — Server, eine Chat-Antwort, ein Sprach-Durchlauf…",
"setup_saving": "Speichert — der Server startet ab jetzt mit Jarvis…",
"setup_done": "Alles ist eingerichtet und getestet.",
"setup_done_nothing": "Alles war schon eingerichtet; die Prüfung ist bestanden.",
@@ -290,7 +290,7 @@
"verify": {
"eyebrow": "Prüfung",
"title": "Einrichtung prüfen",
- "subtitle": "Je ein echter Aufruf: der Server antwortet, das Chat-Modell antwortet, das Einbettungsmodell bettet ein. Aktualisiert auch das Abzeichen in der Seitenleiste.",
+ "subtitle": "Je ein echter Aufruf: der Server antwortet, das Chat-Modell antwortet, das Sprachmodell spricht. Aktualisiert auch das Abzeichen in der Seitenleiste.",
"run": "Prüfung starten",
"running": "Prüft…",
"server": "Server",
@@ -327,7 +327,7 @@
"download_recommended": "{model} herunterladen",
"tune": "Einstellen",
"more_roles": "Weitere Rollen",
- "empty_body": "Noch ist nichts installiert. Ein Klick lädt die empfohlenen Chat- und Einbettungsmodelle für diesen Rechner und füllt jede Rolle.",
+ "empty_body": "Noch ist nichts installiert. Ein Klick lädt die empfohlenen Modelle für diesen Rechner und füllt jede Rolle.",
"setup_button": "Empfohlene Modelle einrichten",
"progress_pulling": "Lädt herunter",
"progress_assigning": "Rolle wird zugewiesen…",
@@ -353,7 +353,7 @@
"server": {
"host_eyebrow": "Host",
"host_title": "Serveradresse",
- "host_subtitle": "Jede Rolle — Chat, Tools, Deep, Embedding, Stimme — spricht mit dieser einen Adresse.",
+ "host_subtitle": "Jede Rolle — Chat, Tools, Deep, Stimme — spricht mit dieser einen Adresse.",
"test": "Testen",
"testing": "Teste…",
"probe_ok": "Erreichbar — Ollama {version}, {ms} ms",
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/local_models/en.json b/jarvis/ui/web/frontend/src/i18n/locales/local_models/en.json
index e1f11283f2..cb71dcb417 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/local_models/en.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/local_models/en.json
@@ -250,7 +250,7 @@
"setup_pulling": "Downloading {model}",
"setup_assigning": "Assigning {role}: {model}…",
"setup_tuning": "Choosing the settings for {model}…",
- "setup_verifying": "Testing the setup — the server, one chat answer, one embedding…",
+ "setup_verifying": "Testing the setup — the server, one chat answer, one voice round trip…",
"setup_saving": "Saving — the server will start with Jarvis from now on…",
"setup_done": "Everything is set up and tested.",
"setup_done_nothing": "Everything was already set up; the check passed.",
@@ -290,7 +290,7 @@
"verify": {
"eyebrow": "Check",
"title": "Check the setup",
- "subtitle": "One real round trip each: the server answers, the chat model answers, the embedding model embeds. Also refreshes the badge in the sidebar.",
+ "subtitle": "One real round trip each: the server answers, the chat model answers, the voice model speaks. Also refreshes the badge in the sidebar.",
"run": "Run a check",
"running": "Checking…",
"server": "Server",
@@ -327,7 +327,7 @@
"download_recommended": "Download {model}",
"tune": "Tune",
"more_roles": "More roles",
- "empty_body": "Nothing is installed yet. One click downloads the recommended chat and embedding models for this machine and fills every role.",
+ "empty_body": "Nothing is installed yet. One click downloads the recommended models for this machine and fills every role.",
"setup_button": "Set up the recommended models",
"progress_pulling": "Downloading",
"progress_assigning": "Assigning the role…",
@@ -353,7 +353,7 @@
"server": {
"host_eyebrow": "Host",
"host_title": "Server address",
- "host_subtitle": "Every role — chat, tools, deep, embedding, voice — talks to this one address.",
+ "host_subtitle": "Every role — chat, tools, deep, voice — talks to this one address.",
"test": "Test",
"testing": "Testing…",
"probe_ok": "Reachable — Ollama {version}, {ms} ms",
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/local_models/es.json b/jarvis/ui/web/frontend/src/i18n/locales/local_models/es.json
index 9a1759015b..8a352050eb 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/local_models/es.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/local_models/es.json
@@ -250,7 +250,7 @@
"setup_pulling": "Descargando {model}",
"setup_assigning": "Asignando {role}: {model}…",
"setup_tuning": "Eligiendo los ajustes para {model}…",
- "setup_verifying": "Probando la configuración: el servidor, una respuesta de chat, una incrustación…",
+ "setup_verifying": "Probando la configuración: el servidor, una respuesta de chat, una prueba de voz…",
"setup_saving": "Guardando: el servidor arrancará con Jarvis a partir de ahora…",
"setup_done": "Todo está configurado y probado.",
"setup_done_nothing": "Todo ya estaba configurado; la comprobación pasó.",
@@ -290,7 +290,7 @@
"verify": {
"eyebrow": "Comprobación",
"title": "Comprobar la configuración",
- "subtitle": "Una llamada real de cada: el servidor responde, el modelo de chat responde, el modelo de incrustaciones incrusta. También actualiza la insignia de la barra lateral.",
+ "subtitle": "Una llamada real de cada: el servidor responde, el modelo de chat responde, el modelo de voz habla. También actualiza la insignia de la barra lateral.",
"run": "Ejecutar una comprobación",
"running": "Comprobando…",
"server": "Servidor",
@@ -327,7 +327,7 @@
"download_recommended": "Descargar {model}",
"tune": "Ajustar",
"more_roles": "Más roles",
- "empty_body": "Todavía no hay nada instalado. Un clic descarga los modelos de chat e incrustaciones recomendados para este equipo y llena todos los roles.",
+ "empty_body": "Todavía no hay nada instalado. Un clic descarga los modelos recomendados para este equipo y llena todos los roles.",
"setup_button": "Configurar los modelos recomendados",
"progress_pulling": "Descargando",
"progress_assigning": "Asignando el rol…",
@@ -353,7 +353,7 @@
"server": {
"host_eyebrow": "Host",
"host_title": "Dirección del servidor",
- "host_subtitle": "Cada rol — chat, herramientas, profundo, embedding, voz — habla con esta única dirección.",
+ "host_subtitle": "Cada rol — chat, herramientas, profundo, voz — habla con esta única dirección.",
"test": "Probar",
"testing": "Probando…",
"probe_ok": "Accesible — Ollama {version}, {ms} ms",
diff --git a/jarvis/ui/web/local_models_routes.py b/jarvis/ui/web/local_models_routes.py
index 2b4d4a9183..11a6d5c127 100644
--- a/jarvis/ui/web/local_models_routes.py
+++ b/jarvis/ui/web/local_models_routes.py
@@ -80,7 +80,7 @@ class LocalModelRow(BaseModel):
capabilities: list[str]
license: str
probed: bool
- #: Role ids (``chat`` / ``tools_screen`` / ``deep`` / ``embedding``) whose
+ #: Role ids (``chat`` / ``voice`` / ``tools_screen`` / ``deep``) whose
#: configured pick is this download.
used_by: list[str] = Field(default_factory=list)
#: Present when ``/api/ps`` lists it — the download itself or one of its
@@ -287,7 +287,7 @@ async def delete_inventory_model(
) -> DeleteResponse:
"""Remove a download from the server (``DELETE /api/delete``).
- 409 while a configured role (chat / tools & screen / deep / embeddings)
+ 409 while a configured role (chat / voice / tools & screen / deep)
still names the model and no ``reassign`` is given; with one, the roles
are rewritten through the config writers first, then the delete runs.
"""
@@ -348,7 +348,7 @@ def _reassign_roles(cfg: Any, roles: list[str], target: str) -> list[str]:
"""Persist ``target`` for every role in ``roles`` through the roles module.
One writer per slot lives in :mod:`jarvis.brain.ollama_roles` (chat, voice,
- tools/screen, deep, embedding); going through it keeps the delete path
+ tools/screen, deep); going through it keeps the delete path
honest for the voice slot, whose pick is not a plain config field.
"""
from jarvis.brain.ollama_roles import set_role
@@ -987,7 +987,7 @@ async def put_autostart(
class VerifyStep(BaseModel):
- #: ``server`` | ``chat`` | ``voice`` | ``tools_screen`` | ``embedding``.
+ #: ``server`` | ``chat`` | ``voice`` | ``tools_screen`` | ``deep``.
id: str
#: ``None`` = not run (the role is not configured, or the server is down).
ok: bool | None
@@ -1006,8 +1006,8 @@ class VerifyResponse(BaseModel):
@router.post("/verify", response_model=VerifyResponse)
async def post_verify(provider_id: str, request: Request) -> VerifyResponse:
- """Prove the setup works — the server, one real chat answer, one real
- embedding — and refresh the sidebar's health badge with the result."""
+ """Prove the setup works — the server answers, the chat model answers, and
+ the voice round trip returns audio — then refresh the sidebar's badge."""
_require_pull_capable(provider_id)
from jarvis.local_models import health_monitor
diff --git a/tests/unit/brain/test_ollama_pull.py b/tests/unit/brain/test_ollama_pull.py
index ff71437ebf..7a0e9a7283 100644
--- a/tests/unit/brain/test_ollama_pull.py
+++ b/tests/unit/brain/test_ollama_pull.py
@@ -466,7 +466,6 @@ async def test_an_installed_role_stops_being_recommended(fake_tags, monkeypatch)
assert not any("vision" in m["recommended_for"] for m in result["models"])
# Other roles are untouched — one installed model does not silence the rest.
assert any(m["recommended"] for m in result["models"] if m["role"] == "coder")
- assert any(m["recommended"] for m in result["models"] if m["role"] == "embedding")
async def test_real_registry_sizes_replace_the_estimates(fake_tags, monkeypatch) -> None:
@@ -479,7 +478,7 @@ async def test_real_registry_sizes_replace_the_estimates(fake_tags, monkeypatch)
assert by_id["qwen3.5"]["size_gb"] == 9.0
# A model the registry did not answer for keeps its curated estimate rather
# than vanishing or reporting zero.
- assert by_id["qwen3-embedding:4b"]["size_gb"] > 0
+ assert by_id["qwen3-vl:2b"]["size_gb"] == 1.9
async def test_an_offline_registry_leaves_a_usable_panel(fake_tags, monkeypatch) -> None:
@@ -556,3 +555,16 @@ async def test_installed_models_reads_the_shared_snapshot_when_fresh(
# Aliases count as "on the server" for the bookkeeping, even though the
# ledger hides them.
assert installed == {"qwen3.5:latest", "qwen3.5-latest-jarvis-ab12cd34:latest"}
+
+
+def test_the_shortlist_only_advertises_roles_a_slot_can_take() -> None:
+ """A "recommended" download for a job nothing can be assigned to is worse
+ than offering none: the embedding role went with the UltraWiki semantic
+ memory, and the shortlist kept urging `qwen3-embedding:4b` on people who
+ then had nowhere to put it (BUG-207)."""
+ from jarvis.brain.ollama_roles import ROLES
+
+ assignable = {spec.pull_role for spec in ROLES}
+ orphaned = set(pull.ROLE_ORDER) - assignable
+ assert not orphaned, f"shortlist roles with no slot to fill: {sorted(orphaned)}"
+ assert {m.role for m in pull.RECOMMENDED_MODELS} <= set(pull.ROLE_ORDER)
diff --git a/tests/unit/brain/test_ollama_roles_fit.py b/tests/unit/brain/test_ollama_roles_fit.py
index 9cd33e4b4d..4847db0836 100644
--- a/tests/unit/brain/test_ollama_roles_fit.py
+++ b/tests/unit/brain/test_ollama_roles_fit.py
@@ -95,7 +95,6 @@ async def test_list_roles_carries_the_verdict_on_the_current_pick(shortlist) ->
assert by_id["chat"].current_fit == "fits"
assert [c[0] for c in by_id["chat"].choices] == ["qwen3.5:4b", "blind:7b"]
assert by_id["chat"].spec.layout == "card"
- assert by_id["embedding"].spec.layout == "row"
assert by_id["ack"].spec.layout == "footnote"
@@ -124,7 +123,9 @@ def test_download_picks_respect_the_jobs_gates() -> None:
assert voice == ["blind:9b", "small:4b"] # under 6 GB, not installed, largest first
screen = ollama_roles.role_spec("tools_screen")
assert [t for t, *_ in ollama_roles.download_picks(screen, rows)] == ["big:27b", "small:4b"]
- assert ollama_roles.download_picks(ollama_roles.role_spec("embedding"), rows) == ()
+ # A role whose job none of these rows serves gets nothing rather than a
+ # chat model dressed up as a pick (`deep` pulls the "coder" shortlist).
+ assert ollama_roles.download_picks(ollama_roles.role_spec("deep"), rows) == ()
def test_set_role_voice_refuses_when_nothing_reached_the_toml(monkeypatch) -> None:
diff --git a/tests/unit/local_models/test_health_monitor.py b/tests/unit/local_models/test_health_monitor.py
index 4447769b20..567a149ed7 100644
--- a/tests/unit/local_models/test_health_monitor.py
+++ b/tests/unit/local_models/test_health_monitor.py
@@ -243,3 +243,73 @@ async def test_a_failing_check_never_ends_the_schedule() -> None:
await asyncio.wait_for(gate.wait(), timeout=2.0)
await monitor.stop()
assert monitor.runs == 2
+
+
+# ── Retired roles must not outlive the role list ─────────────────────────
+
+
+def test_a_retired_role_is_dropped_from_the_record(monkeypatch, tmp_path) -> None:
+ """The record is written by MERGING, so a role's last result used to outlive
+ the role itself: when the embedding slot went with the UltraWiki semantic
+ memory, its `model_unavailable` entry stayed in the file for good and the
+ badge kept reporting a job the section does not show (BUG-207)."""
+ monkeypatch.setattr(cfg_mod, "DATA_DIR", tmp_path)
+ path = hm.health_path()
+ path.parent.mkdir(parents=True, exist_ok=True)
+ path.write_text(
+ json.dumps(
+ {
+ "status": "degraded",
+ "roles": {
+ "chat": {"model": "qwen3.5:4b", "status": "ok"},
+ "embedding": {"model": "qwen3-embedding:4b", "status": "model_unavailable"},
+ },
+ }
+ ),
+ encoding="utf-8",
+ )
+
+ assert hm.write_health_record("ok", "everything answered") is True
+ saved = json.loads(path.read_text(encoding="utf-8"))
+ assert set(saved["roles"]) == {"chat"}
+ assert saved["roles"]["chat"]["status"] == "ok"
+
+
+def test_pruning_does_not_disturb_the_since_clock(monkeypatch, tmp_path) -> None:
+ """`since` is derived from the PREVIOUS record, so the pruner has to hand
+ back a copy — mutating the original in place would make every write look
+ like an unchanged status and freeze the clock."""
+ monkeypatch.setattr(cfg_mod, "DATA_DIR", tmp_path)
+ path = hm.health_path()
+ path.parent.mkdir(parents=True, exist_ok=True)
+ path.write_text(
+ json.dumps(
+ {
+ "status": "ok",
+ "since": "2026-08-01T00:00:00+00:00",
+ "roles": {"embedding": {"model": "gone", "status": "model_unavailable"}},
+ }
+ ),
+ encoding="utf-8",
+ )
+
+ hm.write_health_record(
+ "degraded", "the chat model stopped answering", checked_at="2026-08-28T12:00:00+00:00"
+ )
+ saved = json.loads(path.read_text(encoding="utf-8"))
+ # The status CHANGED, so the clock restarts rather than keeping August 1st.
+ assert saved["since"] == "2026-08-28T12:00:00+00:00"
+ assert saved["roles"] == {}
+
+
+def test_a_role_the_list_still_has_is_kept(monkeypatch, tmp_path) -> None:
+ monkeypatch.setattr(cfg_mod, "DATA_DIR", tmp_path)
+ path = hm.health_path()
+ path.parent.mkdir(parents=True, exist_ok=True)
+ path.write_text(
+ json.dumps({"roles": {"chat": {"status": "ok"}, "deep": {"status": "ok"}}}),
+ encoding="utf-8",
+ )
+ hm.write_health_record("ok", "fine")
+ saved = json.loads(path.read_text(encoding="utf-8"))
+ assert set(saved["roles"]) == {"chat", "deep"}