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: guard desktop dependency regressions

rubenluetke10-beep79e17e2d5d57
diff --git a/jarvis/ui/tray.py b/jarvis/ui/tray.py
index 3cf9e5e03f..c5414ca739 100644
--- a/jarvis/ui/tray.py
+++ b/jarvis/ui/tray.py
@@ -138,10 +138,13 @@ class JarvisTray:
)
def _run(self) -> None:
- # Lazy import to keep startup cheap.
- from pystray import Icon # type: ignore[import-untyped]
-
try:
+ # Lazy import to keep startup cheap. It belongs inside the guarded
+ # region: optional desktop dependencies may be absent on a repaired
+ # or legacy install, and a daemon-thread traceback must never be the
+ # only signal that the tray could not start.
+ from pystray import Icon # type: ignore[import-untyped]
+
icon_image = _make_icon(self._state)
self._icon = Icon(
"jarvis",
@@ -150,6 +153,14 @@ class JarvisTray:
menu=self._build_menu(),
)
self._icon.run()
+ except ModuleNotFoundError as exc:
+ log.warning(
+ "Tray not started: optional desktop dependency %r is unavailable. "
+ "Repair the installation with the advertised [full] profile; "
+ "continuing without a tray.",
+ exc.name or "unknown",
+ )
+ self._icon = None
except Exception: # noqa: BLE001 — a missing tray host must not die silently (AD-6)
log.warning(
"Tray icon could not start (no notification-area / AppIndicator "
diff --git a/tests/unit/install/test_full_extra_contents.py b/tests/unit/install/test_full_extra_contents.py
index ef70775786..d8117d41ae 100644
--- a/tests/unit/install/test_full_extra_contents.py
+++ b/tests/unit/install/test_full_extra_contents.py
@@ -1,12 +1,15 @@
"""Packaging guards for the one-official-full-install decision (spec 2026-07-07).
-[full] must carry local-voice so the advertised install path ships the local
-Whisper wake/STT runtime; pvporcupine (dead, proprietary-keyed, branded
-built-in keywords) must be gone from the dependency surface entirely.
+[full] must carry desktop and local-voice so the advertised install path ships
+the native window, tray, and local Whisper wake/STT runtime. Pvporcupine (dead,
+proprietary-keyed, branded built-in keywords) must be gone from the dependency
+surface entirely.
"""
import tomllib
from pathlib import Path
+from packaging.requirements import Requirement
+
_PYPROJECT = Path(__file__).resolve().parents[3] / "pyproject.toml"
@@ -20,6 +23,23 @@ def test_full_extra_includes_local_voice():
assert "local-voice" in full, "[full] must include the local-voice extra"
+def test_full_extra_includes_desktop():
+ full_requirements = [Requirement(item) for item in _extras()["full"]]
+ included_extras = {
+ extra.casefold()
+ for requirement in full_requirements
+ for extra in requirement.extras
+ }
+ assert "desktop" in included_extras, "[full] must include the desktop extra"
+
+
+def test_desktop_extra_ships_native_shell_dependencies():
+ dependency_names = {
+ Requirement(item).name.casefold() for item in _extras()["desktop"]
+ }
+ assert {"pystray", "pywebview"} <= dependency_names
+
+
def test_local_voice_ships_faster_whisper():
names = " ".join(_extras()["local-voice"])
assert "faster-whisper" in names
diff --git a/tests/unit/ui/test_tray.py b/tests/unit/ui/test_tray.py
index 3656ef9c31..edeadd51a3 100644
--- a/tests/unit/ui/test_tray.py
+++ b/tests/unit/ui/test_tray.py
@@ -164,6 +164,19 @@ def test_tray_start_spawns_thread_with_display(monkeypatch) -> None:
assert ran == [True]
+def test_tray_run_degrades_when_pystray_is_missing(monkeypatch, caplog) -> None:
+ """A damaged legacy install must not leak an exception from its tray thread."""
+ monkeypatch.setitem(sys.modules, "pystray", None)
+ tray = JarvisTray()
+
+ with caplog.at_level(logging.WARNING):
+ tray._run()
+
+ assert tray._icon is None
+ assert "desktop dependency 'pystray' is unavailable" in caplog.text
+ assert "[full] profile" in caplog.text
+
+
def test_tray_menu_strings_are_english() -> None:
src = Path(tray_mod.__file__).read_text(encoding="utf-8")
for german in (