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(voice): stop local speech-to-text from vanishing into a cloud provider

rubenluetke10-beep0ce1c45b5ca6
diff --git a/docs/BUGS.md b/docs/BUGS.md
index 1f04f3ab62..dd327626e1 100644
--- a/docs/BUGS.md
+++ b/docs/BUGS.md
@@ -12759,6 +12759,70 @@ a shortcut that targets the in-venv branded exe directly skips it.
---
+## BUG-183: local speech-to-text silently disappeared after a restart because the launcher shortcut had been repointed at a Python without the engine (HIGH, FIXED 2026-08-25)
+
+**Symptom.** Local voice transcription "sometimes" stops working after a
+restart. The window opens normally, the models are on disk, and nothing
+announces a change — until dictation starts returning errors from a cloud
+provider. `data/jarvis_desktop.log`:
+
+```
+Interpreter: …\Programs\Python\Python312\pythonw.exe (Python 3.12.10)
+Local STT is selected but the faster-whisper engine is not installed on this
+ host; using 'openrouter-stt' instead.
+final dictation transcription refused (STTHTTPError: OpenRouter STT failed:
+ OpenRouter account out of credit) — not retrying
+🎙️ dictation ended (0 chars, … LOST 24.3s after 6 failed call(s))
+```
+
+Meanwhile the API-Keys health panel kept reporting `faster-whisper` as the
+active recognizer, and the package was demonstrably installed — in three of
+the machine's four Python installs.
+
+**Root cause.** Three layers, each individually reasonable:
+
+1. **Whether the engine exists is a property of the PROCESS, not the host.**
+ `jarvis` is importable from every install carrying an editable `.pth`,
+ so the app boots fine anywhere; only the heavy voice extras
+ (`faster_whisper`, `ctranslate2`, `torch`) live in one of them. The log
+ line said "not installed on this host", which sent the reader looking for
+ a package that was present and hid the real question — *which* Python.
+2. **The launcher shortcut was repointed by the wrong interpreter.**
+ `ensure_desktop_integration` rewrites the Start-Menu and Desktop entries
+ on every boot, gated by `_interpreter_can_open_a_window()`. That guard was
+ added on 2026-08-16 after a window-less interpreter stole the entry — but
+ it asks about ONE capability. Python 3.12 had pywebview and no
+ `faster_whisper`, so it passed, took the shortcut, and every later launch
+ inherited the interpreter that cannot transcribe locally. Self-reinforcing:
+ the same repair had already been made once, on 2026-08-09, and drifted back.
+3. **The health panel and the pipeline answered the question differently.**
+ `build_stt_from_config` knew about the engine-missing crossing;
+ `_active_stt` (what the UI renders) only knew about the *keyless* one. So
+ the app displayed a recognizer it had refused to build, and the swap became
+ visible only when the borrowed cloud account ran out of credit — a
+ privacy problem too: someone who chose on-device speech was uploading it.
+
+**Fix.**
+* `jarvis/plugins/stt/__init__.py`: `_resolve_effective_stt` is now the ONE
+ answer to "which recognizer is in front", covering both crossings;
+ `resolve_effective_stt_provider` is what the health panel reads.
+ `local_stt_unavailable_reason()` names `sys.executable` instead of "this host".
+* `jarvis/ui/web/provider_routes.py`: `_active_stt` asks that resolver, so the
+ panel can no longer name a provider the factory declined to build.
+* `jarvis/ui/icon_utils.py`: `_interpreter_may_own_the_launcher_shortcut()`
+ gates both shortcut writers on window *and* speech capability. Conditional on
+ the user's CHOICE, never on the package — a cloud-first base install has no
+ on-device engine and must still own its own shortcut.
+
+**Tests.** `tests/unit/plugins/stt/test_effective_stt_parity.py`,
+`tests/unit/ui/test_start_menu_shortcut_target.py::TestSpeechCapabilityProbe`,
+`::TestShortcutWriterRefusesASpeechLessInterpreter`.
+
+**Also fixed here.** `tests/unit/plugins/stt/conftest.py`: the Vertex keyless
+ADC probe reads the machine rather than the test's credential double, so ten
+cross-family assertions passed in CI and failed on any host with `gcloud` ADC
+configured — the AP-28 shape.
+
## BUG-182: the desktop app "does not start" because a leftover headless instance holds the lock and focus is rejected as CSRF (HIGH, FIXED 2026-08-25)
**Symptom.** Clicking the Start-Menu shortcut or `run.bat` does nothing.
diff --git a/jarvis/plugins/stt/__init__.py b/jarvis/plugins/stt/__init__.py
index 1bd7c5d8c4..717b9905e5 100644
--- a/jarvis/plugins/stt/__init__.py
+++ b/jarvis/plugins/stt/__init__.py
@@ -9,6 +9,7 @@ from __future__ import annotations
import json
import os
+import sys
import time
from collections.abc import Iterable
from functools import lru_cache
@@ -201,7 +202,7 @@ def _stt_family_has_key(provider_name: str) -> bool:
return _stt_keyless_credential(provider_name)
-def _resolve_keyed_stt_provider(primary_name: str) -> str:
+def _resolve_keyed_stt_provider(primary_name: str, *, quiet: bool = False) -> str:
"""Pick a cloud STT the host can actually run (open-source AP-22).
Keeps the configured provider when it has a usable key — so the maintainer
@@ -210,6 +211,10 @@ def _resolve_keyed_stt_provider(primary_name: str) -> str:
an entry-point. When NO cloud family has a usable key, returns the configured
name unchanged; the caller then drops to the key-free local faster-whisper as
the universal floor. Mirrors the TTS factory's ``_resolve_keyed_tts_provider``.
+
+ ``quiet`` suppresses the log line. The health panel asks this question on
+ every poll to render which recognizer is really in front; a warning per poll
+ is log spam that buries the one occurrence that mattered.
"""
if _stt_family_has_key(primary_name):
return primary_name
@@ -217,18 +222,98 @@ def _resolve_keyed_stt_provider(primary_name: str) -> str:
if cand == primary_name:
continue
if _stt_family_has_key(cand) and _load_provider_class(cand) is not None:
- logger.warning(
- "STT provider {!r} has no usable API key; crossing to {!r} — the "
- "cloud STT family the user actually has a key for — so voice input "
- "still works for a single-key user (open-source AP-22). Set "
- "[stt].provider to silence this.",
- primary_name,
- cand,
- )
+ if not quiet:
+ logger.warning(
+ "STT provider {!r} has no usable API key; crossing to {!r} — the "
+ "cloud STT family the user actually has a key for — so voice input "
+ "still works for a single-key user (open-source AP-22). Set "
+ "[stt].provider to silence this.",
+ primary_name,
+ cand,
+ )
return cand
return primary_name
+def local_stt_unavailable_reason() -> str:
+ """Why the on-device recognizer cannot run *in this interpreter*, or ``""``.
+
+ Named the way it is because the distinction is the whole bug. Whether
+ ``faster-whisper`` is importable is a property of the PYTHON PROCESS, not of
+ the machine: ``jarvis`` itself is commonly importable from several installs
+ at once (an editable install, a project ``.venv``, a system Python), while
+ the heavy voice extras were only ever installed into one of them. Boot
+ through a different shortcut and the same computer, the same config and the
+ same models produce "local speech recognition is gone".
+
+ Saying "not installed on this host" sent the reader looking for a package
+ that is demonstrably present and made the real cause — *which* Python is
+ running — invisible. So the sentence names the interpreter.
+ """
+ if _faster_whisper_installed():
+ return ""
+ return (
+ "the local speech engine (faster-whisper) is not installed in the Python "
+ f"running Jarvis ({sys.executable})"
+ )
+
+
+def _resolve_effective_stt(provider_name: str) -> tuple[str, str]:
+ """``(recognizer that will really run, English reason it is not the configured one)``.
+
+ THE one place that answers "which recognizer is in front", because two
+ places answering it is how the app came to display a provider it was not
+ using. Until this existed the on-device-engine-missing crossing lived inside
+ ``build_stt_from_config`` alone, so the runtime crossed to a cloud family
+ while the health panel — which only knew about the *keyless* crossing below
+ — kept reporting ``faster-whisper``. The user was told local speech was
+ running right up to the moment the cloud account it had silently moved to
+ ran out of credit (live 2026-08-25: six failed calls, 24.3 s of speech lost).
+
+ Silent by contract: the health panel calls this on every poll. The caller
+ that BUILDS the provider owns the log line.
+ """
+ name = (provider_name or "").strip()
+ if not name:
+ return name, ""
+ # A user who deliberately SELECTED the on-device engine can still arrive on
+ # an interpreter where it is absent — a fresh machine, a rebuilt venv, a
+ # base install that carried the config over, a shortcut aimed at a second
+ # Python. Building it anyway yields a provider that raises on the first
+ # utterance, which reads as "voice input is broken" with no cause. Cross to
+ # a cloud family this host holds a key for instead (AP-22); with no key
+ # anywhere the local path stands and ``_maybe_hint_no_working_stt`` states
+ # the dead-end honestly.
+ if name == "faster-whisper":
+ reason = local_stt_unavailable_reason()
+ if not reason:
+ return name, ""
+ alternatives = [
+ cand for cand in available_stt_provider_names() if cand != "faster-whisper"
+ ]
+ if not alternatives:
+ return name, ""
+ return alternatives[0], reason
+ # Open-source AP-22: when the configured cloud STT has no usable key, cross
+ # to a cloud STT family the user DOES have a key for BEFORE dropping to local
+ # faster-whisper (which is not installed on a base/headless host). The
+ # maintainer (whose configured key resolves) is unaffected; local whisper
+ # stays the last-resort floor when no cloud family has a usable key.
+ crossed = _resolve_keyed_stt_provider(name, quiet=True)
+ if crossed == name:
+ return name, ""
+ return crossed, f"{name!r} has no usable API key on this host"
+
+
+def resolve_effective_stt_provider(provider_name: str) -> str:
+ """The recognizer that will really transcribe, for callers that only need the name.
+
+ What the health panel renders, so the UI and the pipeline never disagree
+ about which provider is in front. See :func:`_resolve_effective_stt`.
+ """
+ return _resolve_effective_stt(provider_name)[0]
+
+
#: Class attribute a recognizer plugin sets to declare that it transcribes on
#: THIS machine. The capability the plugin answers for ITSELF (AP-21) — and the
#: seam a second on-device engine plugs into, because the dictation polish
@@ -412,34 +497,22 @@ def build_stt_from_config(stt_cfg: Any) -> Any:
Falls back to a local FasterWhisperProvider if the configured provider has
no entry-point or raises on construction.
"""
- provider_name = (getattr(stt_cfg, "provider", "") or "").strip()
- # The mirror image of the cross-family rule below: a user who deliberately
- # SELECTED the on-device engine can still arrive on a host where it is not
- # installed — a fresh machine, a rebuilt venv, a base install that carried
- # the config over. Building it anyway yields a provider that raises on the
- # first utterance, which reads to the user as "voice input is broken" with
- # no cause. Cross to a cloud family this host holds a key for instead
- # (AP-22); with no key anywhere the local path stands and
- # ``_maybe_hint_no_working_stt`` states the dead-end honestly.
- if provider_name == "faster-whisper" and not _faster_whisper_installed():
- alternatives = [
- name for name in available_stt_provider_names() if name != "faster-whisper"
- ]
- if alternatives:
- logger.warning(
- "Local STT is selected but the faster-whisper engine is not "
- "installed on this host; using {!r} instead. Install the local "
- "engine from the API-Keys view to switch back.",
- alternatives[0],
- )
- provider_name = alternatives[0]
- # Open-source AP-22: when the configured cloud STT has no usable key, cross to
- # a cloud STT family the user DOES have a key for BEFORE dropping to local
- # faster-whisper (which is not installed on a base/headless host). The
- # maintainer (whose configured key resolves) is unaffected; local whisper stays
- # the last-resort floor when no cloud family has a usable key.
- if provider_name and provider_name != "faster-whisper":
- provider_name = _resolve_keyed_stt_provider(provider_name)
+ configured_name = (getattr(stt_cfg, "provider", "") or "").strip()
+ # Both crossings — the on-device engine missing from THIS interpreter, and a
+ # cloud family with no usable key — live in one resolver so the health panel
+ # reports the provider the pipeline actually built. See
+ # ``_resolve_effective_stt``; the log line is owned here because this is the
+ # call that happens once per pipeline build, not once per health poll.
+ provider_name, crossed_reason = _resolve_effective_stt(configured_name)
+ if crossed_reason:
+ logger.warning(
+ "Speech-to-text falls back from {!r} to {!r}: {}. Install the local "
+ "engine from the API-Keys view, or start Jarvis with the Python that "
+ "has it, to switch back.",
+ configured_name,
+ provider_name,
+ crossed_reason,
+ )
language = getattr(stt_cfg, "language", "auto")
language = language if language and language != "auto" else None
bias_prompt = (getattr(stt_cfg, "bias_prompt", "") or "").strip()
diff --git a/jarvis/ui/icon_utils.py b/jarvis/ui/icon_utils.py
index e8c32892fc..a98d83a8ce 100644
--- a/jarvis/ui/icon_utils.py
+++ b/jarvis/ui/icon_utils.py
@@ -220,6 +220,83 @@ def _interpreter_can_open_a_window() -> bool:
return False
+#: Config value that means "transcribe on this machine". The shortcut guard has
+#: to recognise the choice without importing the STT package — that package pulls
+#: the whole provider catalogue, and this runs while the app is booting.
+_ON_DEVICE_STT_PROVIDER = "faster-whisper"
+
+
+def _configured_stt_provider() -> str:
+ """The recognizer named in ``jarvis.toml``, or ``""`` when it cannot be read.
+
+ A direct, BOM-safe TOML read (the idiom
+ ``jarvis.ui.jarvisbar.interaction._load_jarvisbar_section`` already uses):
+ one file stat and a parse, no pydantic, no provider catalogue, nothing
+ initialised (AP-26). An unreadable or absent file answers ``""``, which the
+ caller treats as "cannot tell" and therefore never as a reason to refuse.
+ """
+ import tomllib
+
+ try:
+ from jarvis.core.config import DEFAULT_CONFIG_FILE
+
+ raw = Path(DEFAULT_CONFIG_FILE).read_bytes()
+ data = tomllib.loads(raw.decode("utf-8-sig"))
+ except (OSError, UnicodeDecodeError, tomllib.TOMLDecodeError, ImportError) as exc:
+ # Silence is correct and load-bearing here (AP-30): every one of these
+ # means "this build cannot tell what the user chose", and the caller
+ # reads "" as "no reason to refuse". Logging a warning per boot for a
+ # base install that has no config file yet would be pure noise.
+ logger.debug("Could not read the configured STT provider: {}", exc)
+ return ""
+ section = data.get("stt")
+ if not isinstance(section, dict):
+ return ""
+ provider = section.get("provider")
+ return provider.strip() if isinstance(provider, str) else ""
+
+
+def _interpreter_can_run_the_configured_speech() -> bool:
+ """Can the RUNNING interpreter do the speech recognition the config asks for?
+
+ The other half of the 2026-08-16 rule, learned the hard way on 2026-08-25.
+ That rule stopped a window-LESS interpreter from claiming the launcher; this
+ stops a speech-less one. Python 3.12 on the maintainer's box had pywebview
+ but not ``faster_whisper``, so it passed the window probe, rewrote the
+ Start-Menu entry to itself, and every launch after that opened a perfectly
+ normal window whose local transcription had silently been swapped for a
+ cloud provider. The swap only surfaced when that cloud account ran out of
+ credit and a dictation lost 24.3 s of speech.
+
+ Deliberately conditional on the CHOICE, not on the package: a cloud-first
+ install (the default, and what a base download gets) never has the on-device
+ engine and must still be able to own its own shortcut. Only a user who
+ picked the on-device recognizer has an interpreter without it refused — for
+ them, a launcher that cannot transcribe locally is a broken launcher.
+
+ ``find_spec`` only resolves; nothing is imported (AP-26).
+ """
+ if _configured_stt_provider() != _ON_DEVICE_STT_PROVIDER:
+ return True
+ import importlib.util
+
+ try:
+ return importlib.util.find_spec("faster_whisper") is not None
+ except (ImportError, ValueError): # broken/partial install
+ return False
+
+
+def _interpreter_may_own_the_launcher_shortcut() -> bool:
+ """Whether this interpreter is allowed to (re)write the launcher shortcuts.
+
+ One gate in front of both entries, because "last run wins" is the failure
+ mode: whichever interpreter last reached this code used to take the shortcut,
+ however much less it could do than the one already there. A capability it
+ lacks is a capability the user loses on their next double-click.
+ """
+ return _interpreter_can_open_a_window() and _interpreter_can_run_the_configured_speech()
+
+
def _replace_exe_icon(exe_path: Path, ico_path: Path) -> bool:
"""Overwrite ``exe_path``'s embedded application icon with ``ico_path``.
@@ -765,13 +842,15 @@ def ensure_start_menu_shortcut(
reveal_real_path(lnk)
- if not _interpreter_can_open_a_window():
- # This interpreter cannot start the desktop app, so it must not become
- # the shortcut's target. Leave whatever is there — a working entry from
- # the installer or from a real desktop run — strictly alone.
+ if not _interpreter_may_own_the_launcher_shortcut():
+ # This interpreter cannot start the desktop app the way the user
+ # configured it, so it must not become the shortcut's target. Leave
+ # whatever is there — a working entry from the installer or from a real
+ # desktop run — strictly alone.
logger.debug(
- "Start-Menu shortcut left untouched: {} has no pywebview and would "
- "be a dead launch target",
+ "Start-Menu shortcut left untouched: {} cannot open the window or "
+ "cannot run the configured on-device recognizer, and would be a "
+ "degraded launch target",
pythonw,
)
return lnk.is_file()
@@ -919,9 +998,9 @@ def ensure_desktop_shortcut(
if not lnk.is_file() and not create_if_missing:
return False
- if not _interpreter_can_open_a_window():
+ if not _interpreter_may_own_the_launcher_shortcut():
# Same rule as the Start-Menu entry: never aim it at an interpreter that
- # cannot open the window.
+ # can do less than the one it would replace.
return lnk.is_file()
if lnk.is_file() and _shortcut_matches_install(
lnk,
diff --git a/jarvis/ui/web/provider_routes.py b/jarvis/ui/web/provider_routes.py
index 588fa33d01..842dbc495f 100644
--- a/jarvis/ui/web/provider_routes.py
+++ b/jarvis/ui/web/provider_routes.py
@@ -757,6 +757,12 @@ def _active_stt(request: Request) -> str | None:
"""The STT provider actually powering voice input — the resolved cross-family
provider, not the raw configured default (which may be a dead, keyless default
the runtime already crossed away from). See ``_active_tts`` for the rationale.
+
+ Asks the SAME resolver the pipeline builds from. It used to ask only about
+ missing keys, so a host whose on-device engine was absent from the running
+ interpreter had its panel report ``faster-whisper`` while every utterance
+ went to a cloud provider — and the swap only became visible when that cloud
+ account ran out of credit.
"""
cfg = _resolve_cfg(request)
stt_cfg = getattr(cfg, "stt", None) if cfg else None
@@ -766,9 +772,9 @@ def _active_stt(request: Request) -> str | None:
if not configured:
return configured
try:
- from jarvis.plugins.stt import _resolve_keyed_stt_provider
+ from jarvis.plugins.stt import resolve_effective_stt_provider
- resolved = _resolve_keyed_stt_provider(configured)
+ resolved = resolve_effective_stt_provider(configured)
if resolved and resolved != configured:
return resolved
except Exception as exc: # noqa: BLE001 — the health panel must never 500
diff --git a/tests/unit/plugins/stt/conftest.py b/tests/unit/plugins/stt/conftest.py
new file mode 100644
index 0000000000..70db184270
--- /dev/null
+++ b/tests/unit/plugins/stt/conftest.py
@@ -0,0 +1,35 @@
+"""Keep STT provider-selection tests independent of THIS machine's credentials.
+
+Every test in this package substitutes ``get_secret_any`` to say exactly which
+credential slots exist, which is what makes "one keyed family gives an honest
+empty chain" a statement about the resolver rather than about the developer's
+keyring.
+
+One credential escapes that seam: Vertex authenticates with Application Default
+Credentials, so ``_STT_KEYLESS_CREDENTIAL_PROBES`` asks the machine instead of
+the keyring. On a box with ``gcloud`` ADC configured — or a Vertex service
+account, the documented production setup — ``vertex-stt`` therefore appears as a
+keyed family no test asked for, and ten assertions about the cross-family chain
+fail on a real machine while staying green in CI. That is the shape AP-28 warns
+about: a check whose verdict depends on something the test never pinned.
+
+So the probe is off by default here and a test that wants the Vertex-ADC host
+turns it on explicitly with the ``vertex_adc`` fixture.
+"""
+from __future__ import annotations
+
+import pytest
+
+import jarvis.core.config as cfg
+
+
[email protected](autouse=True)
+def _no_ambient_vertex_adc(monkeypatch: pytest.MonkeyPatch) -> None:
+ """Pin the keyless Vertex probe to "not configured" unless a test says otherwise."""
+ monkeypatch.setattr(cfg, "vertex_credential_configured", lambda: False, raising=False)
+
+
+def vertex_adc(monkeypatch: pytest.MonkeyPatch) -> None:
+ """Opt back IN to a host that authenticates Vertex through ADC."""
+ monkeypatch.setattr(cfg, "vertex_credential_configured", lambda: True, raising=False)
diff --git a/tests/unit/plugins/stt/test_effective_stt_parity.py b/tests/unit/plugins/stt/test_effective_stt_parity.py
new file mode 100644
index 0000000000..add432a560
--- /dev/null
+++ b/tests/unit/plugins/stt/test_effective_stt_parity.py
@@ -0,0 +1,110 @@
+"""The health panel and the pipeline must name the SAME recognizer.
+
+The live failure this pins down (2026-08-25): the desktop app booted through a
+shortcut aimed at a second Python install. ``jarvis`` was importable there via an
+editable install, so the app started normally — but ``faster_whisper`` was not,
+so the factory quietly crossed voice input to a cloud family. The health panel
+asked a different question (``has a key?``) and went on reporting
+``faster-whisper``. Nothing told the user local speech had stopped until the
+cloud account ran out of credit and a dictation lost 24.3 s of speech.
+
+One resolver answers "which recognizer is in front" for both sides, and these
+tests are what keeps it one.
+"""
+from __future__ import annotations
+
+from typing import Any
+
+import jarvis.core.config as cfg
+import jarvis.plugins.stt as stt_pkg
+import jarvis.plugins.stt.fwhisper as fwhisper
+from jarvis.core.config import ResolvedEndpoint, STTConfig
+
+
+class _FakeCloudSTT:
+ name = "groq-api"
+
+ def __init__(self, **kwargs: Any) -> None:
+ self.kwargs = kwargs
+
+
+class _FakeLocalSTT:
+ def __init__(self, **kwargs: Any) -> None:
+ self.kwargs = kwargs
+
+
+def _no_proxy(monkeypatch) -> None:
+ monkeypatch.setattr(
+ cfg,
+ "resolve_provider_endpoint",
+ lambda pid, **kw: ResolvedEndpoint(base_url=None, credential=None, via_proxy=False),
+ )
+ monkeypatch.setattr(fwhisper, "FasterWhisperProvider", _FakeLocalSTT)
+
+
+def test_panel_reports_the_cloud_takeover_when_the_local_engine_is_absent(monkeypatch):
+ """The resolver the panel reads must see the engine-missing crossing too.
+
+ Reporting the configured name here is the whole defect: the user believes
+ their words stay on this machine while they are being uploaded, and they get
+ no warning until the borrowed cloud account fails.
+ """
+ _no_proxy(monkeypatch)
+ monkeypatch.setattr(stt_pkg, "_faster_whisper_installed", lambda: False)
+ monkeypatch.setattr(stt_pkg, "_load_provider_class", lambda name: _FakeCloudSTT)
+ monkeypatch.setattr(cfg, "get_secret_any", lambda candidates: "key")
+
+ assert stt_pkg.resolve_effective_stt_provider("faster-whisper") != "faster-whisper"
+
+
+def test_panel_and_pipeline_agree_on_the_recognizer(monkeypatch):
+ """Same input, same answer — whichever side of the app asks."""
+ _no_proxy(monkeypatch)
+ monkeypatch.setattr(stt_pkg, "_faster_whisper_installed", lambda: False)
+ monkeypatch.setattr(stt_pkg, "_load_provider_class", lambda name: _FakeCloudSTT)
+ monkeypatch.setattr(cfg, "get_secret_any", lambda candidates: "key")
+
+ reported = stt_pkg.resolve_effective_stt_provider("faster-whisper")
+ built = stt_pkg.build_stt_from_config(STTConfig(provider="faster-whisper"))
+
+ assert reported != "faster-whisper" and isinstance(built, _FakeCloudSTT), (
+ "The panel must not name a recognizer the factory refused to build."
+ )
+
+
+def test_installed_local_engine_is_reported_as_itself(monkeypatch):
+ """No crossing, no noise: a working local install stays local on both sides."""
+ _no_proxy(monkeypatch)
+ monkeypatch.setattr(stt_pkg, "_faster_whisper_installed", lambda: True)
+ monkeypatch.setattr(cfg, "get_secret_any", lambda candidates: "key")
+
+ assert stt_pkg.resolve_effective_stt_provider("faster-whisper") == "faster-whisper"
+ assert isinstance(
+ stt_pkg.build_stt_from_config(STTConfig(provider="faster-whisper")),
+ _FakeLocalSTT,
+ )
+
+
+def test_the_reason_names_the_interpreter_not_the_host(monkeypatch):
+ """Which Python is running IS the diagnosis — a host-level sentence hides it.
+
+ Three of the four Python installs on the machine that produced this bug had
+ the engine. "not installed on this host" sent the reader looking for a
+ package that was demonstrably there.
+ """
+ import sys
+
+ monkeypatch.setattr(stt_pkg, "_faster_whisper_installed", lambda: False)
+
+ reason = stt_pkg.local_stt_unavailable_reason()
+
+ assert sys.executable in reason, (
+ "The reason must name the interpreter Jarvis is running in; without it "
+ "the user cannot tell a missing package from the wrong shortcut."
+ )
+
+
+def test_no_reason_when_the_engine_is_present(monkeypatch):
+ monkeypatch.setattr(stt_pkg, "_faster_whisper_installed", lambda: True)
+
+ assert stt_pkg.local_stt_unavailable_reason() == ""
diff --git a/tests/unit/ui/test_start_menu_shortcut_target.py b/tests/unit/ui/test_start_menu_shortcut_target.py
index 431ee9f545..b6bc106592 100644
--- a/tests/unit/ui/test_start_menu_shortcut_target.py
+++ b/tests/unit/ui/test_start_menu_shortcut_target.py
@@ -406,3 +406,98 @@ class TestImportPathHasNoShortcutSideEffect:
"importing jarvis.ui.desktop_app must not rewrite the Start-Menu "
"shortcut — an import is no promise of a window"
)
+
+
+class TestSpeechCapabilityProbe:
+ """The other half of the rule: a speech-LESS interpreter may not claim it either.
+
+ Live failure 2026-08-25. The maintainer's box carries four Python installs
+ with an editable ``jarvis`` in each; only some have the on-device speech
+ engine. A boot through the 3.12 install passed the window probe, rewrote the
+ Start-Menu entry to itself, and from then on every launch opened a normal
+ window whose local transcription had been swapped for a cloud provider —
+ invisible until that account ran out of credit mid-dictation.
+ """
+
+ def test_a_cloud_first_install_is_never_refused(
+ self, monkeypatch: pytest.MonkeyPatch
+ ) -> None:
+ """A base download has no on-device engine and must still own its shortcut.
+
+ Requiring the engine unconditionally would leave the common install with
+ no Start-Menu entry at all — a far worse bug than the one being fixed.
+ """
+ monkeypatch.setattr(icon_utils, "_configured_stt_provider", lambda: "groq-api")
+
+ assert icon_utils._interpreter_can_run_the_configured_speech() is True
+
+ def test_the_on_device_choice_requires_the_on_device_engine(
+ self, monkeypatch: pytest.MonkeyPatch
+ ) -> None:
+ import importlib.util
+
+ monkeypatch.setattr(
+ icon_utils, "_configured_stt_provider", lambda: "faster-whisper"
+ )
+ monkeypatch.setattr(importlib.util, "find_spec", lambda name: None)
+
+ assert icon_utils._interpreter_can_run_the_configured_speech() is False
+
+ def test_an_unreadable_config_is_not_a_reason_to_refuse(
+ self, monkeypatch: pytest.MonkeyPatch
+ ) -> None:
+ """"Cannot tell" must behave exactly as it did before this guard existed."""
+ monkeypatch.setattr(icon_utils, "_configured_stt_provider", lambda: "")
+
+ assert icon_utils._interpreter_can_run_the_configured_speech() is True
+
+ def test_the_gate_needs_both_capabilities(
+ self, monkeypatch: pytest.MonkeyPatch
+ ) -> None:
+ monkeypatch.setattr(icon_utils, "_interpreter_can_open_a_window", lambda: True)
+ monkeypatch.setattr(
+ icon_utils, "_interpreter_can_run_the_configured_speech", lambda: False
+ )
+ assert icon_utils._interpreter_may_own_the_launcher_shortcut() is False
+
+ monkeypatch.setattr(icon_utils, "_interpreter_can_open_a_window", lambda: False)
+ monkeypatch.setattr(
+ icon_utils, "_interpreter_can_run_the_configured_speech", lambda: True
+ )
+ assert icon_utils._interpreter_may_own_the_launcher_shortcut() is False
+
+ def test_config_read_never_raises_on_a_missing_file(
+ self, tmp_path: Path, monkeypatch: pytest.MonkeyPatch
+ ) -> None:
+ import jarvis.core.config as core_cfg
+
+ monkeypatch.setattr(core_cfg, "DEFAULT_CONFIG_FILE", tmp_path / "absent.toml")
+
+ assert icon_utils._configured_stt_provider() == ""
+
+
+@windows_only
+class TestShortcutWriterRefusesASpeechLessInterpreter:
+ def test_leaves_an_existing_shortcut_untouched(
+ self, tmp_path: Path, monkeypatch: pytest.MonkeyPatch
+ ) -> None:
+ """The 2026-08-25 regression: a speech-less run must not steal the entry."""
+ programs = tmp_path / "Programs"
+ programs.mkdir()
+ lnk = programs / icon_utils.START_MENU_SHORTCUT_NAME
+ lnk.write_bytes(b"the working shortcut, written by an interpreter that can")
+ before = lnk.read_bytes()
+
+ monkeypatch.setattr(icon_utils, "_interpreter_can_open_a_window", lambda: True)
+ monkeypatch.setattr(
+ icon_utils, "_interpreter_can_run_the_configured_speech", lambda: False
+ )
+ result = icon_utils.ensure_start_menu_shortcut(
+ aumid=_TEST_AUMID, programs_dir=programs
+ )
+
+ assert lnk.read_bytes() == before, (
+ "an interpreter without the configured on-device recognizer rewrote "
+ "the shortcut, which is how local speech silently disappears"
+ )
+ assert result is True, "an existing entry is still present, so report it"