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(dictation): the provider Test button probes the model that will really run

Haralda0b08813c0f6
diff --git a/jarvis/dictation/polish_probe.py b/jarvis/dictation/polish_probe.py
index cacdbd496f..3b71fae177 100644
--- a/jarvis/dictation/polish_probe.py
+++ b/jarvis/dictation/polish_probe.py
@@ -60,13 +60,27 @@ def _default_make_client(family: Any, model: str) -> Any:
def _resolve_probe_model(family: Any, dictation_cfg: Any, model: str) -> str:
- """The model the real pass would use for *family*; its default on trouble."""
+ """The model the real pass would use for *family*; its default on trouble.
+
+ Reads the TRANSLATE switch, because with it on the pass runs on the
+ family's translation tier and that is a different model — often a larger
+ one, and one the account may not be entitled to. A probe that dialled the
+ formatter's model instead would answer "ready" for a setup whose very next
+ dictation 404s, which is the exact claim this module exists to stop the
+ provider cards from making.
+ """
if model:
return model
try:
+ from jarvis.dictation.polish import resolve_translate_target
from jarvis.dictation.polish_client import resolve_model
- return resolve_model(family, dictation_cfg, primary_id=getattr(family, "id", ""))
+ return resolve_model(
+ family,
+ dictation_cfg,
+ primary_id=getattr(family, "id", ""),
+ translating=bool(resolve_translate_target(dictation_cfg)),
+ )
except Exception as exc: # noqa: BLE001 — a resolver hiccup is not a verdict
log.debug("polish probe model resolution failed (%s); using the default.", exc)
return str(getattr(family, "default_model", "") or "")
diff --git a/tests/unit/dictation/test_translate.py b/tests/unit/dictation/test_translate.py
index 95bb663cf4..ee2d8d7b1e 100644
--- a/tests/unit/dictation/test_translate.py
+++ b/tests/unit/dictation/test_translate.py
@@ -829,3 +829,60 @@ def test_the_openai_wording_models_come_from_the_verified_catalog() -> None:
assert family.default_model in served
assert family.translate_model in served
+
+
+async def test_the_provider_test_button_probes_the_translation_tier(
+ monkeypatch: pytest.MonkeyPatch,
+) -> None:
+ """"Ready" must mean the model the NEXT dictation will really use.
+
+ With translation on, that is the family's translation tier — a different,
+ usually larger model, and one an account may not be entitled to. Probing
+ the formatter's model instead would hand back a green card for a setup
+ whose very next dictation 404s, which is the precise claim
+ ``polish_probe`` exists to stop the provider cards from making.
+ """
+ from jarvis.dictation.polish_probe import probe_polish_family
+
+ family = next(f for f in POLISH_FAMILIES if f.id == "groq")
+ asked: list[str] = []
+
+ class _Ok:
+ async def complete(self, system: str, user: str, **kwargs: Any) -> str:
+ return "We can ship it on Tuesday."
+
+ def _builder(fam: Any, model: str) -> Any:
+ asked.append(model)
+ return _Ok()
+
+ class _App:
+ dictation = _cfg(translate=True, translate_target="en")
+
+ await probe_polish_family(family, _App(), make_client=_builder)
+
+ assert asked == [family.translate_model]
+
+
+async def test_the_provider_test_button_probes_the_formatter_when_not_translating(
+ monkeypatch: pytest.MonkeyPatch,
+) -> None:
+ """And with the switch off it is the formatter's own model again."""
+ from jarvis.dictation.polish_probe import probe_polish_family
+
+ family = next(f for f in POLISH_FAMILIES if f.id == "groq")
+ asked: list[str] = []
+
+ class _Ok:
+ async def complete(self, system: str, user: str, **kwargs: Any) -> str:
+ return "We can ship it on Tuesday."
+
+ def _builder(fam: Any, model: str) -> Any:
+ asked.append(model)
+ return _Ok()
+
+ class _App:
+ dictation = _cfg()
+
+ await probe_polish_family(family, _App(), make_client=_builder)
+
+ assert asked == [family.default_model]