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.
Python agent-orchestrationai-agentai-coding-assistantclaude-codecoding-agentcomputer-usedesktop-applocal-firstmcppersonal-jarvisvoice-assistantvoice-coding
chore: auto-save WIP via Claude stop-hook safety net (2026-06-30 12:28)
Ruben Lütke86f8b8f59403
diff --git a/jarvis/ui/desktop_app.py b/jarvis/ui/desktop_app.pyindex 582aaa28d1..8898d3f13b 100644--- a/jarvis/ui/desktop_app.py+++ b/jarvis/ui/desktop_app.py@@ -2880,27 +2880,29 @@ class DesktopApp:return Falsedef _suppress_overlay_for_hidden_window(self) -> None:- """Take the overlay bar off the screen while the window is minimised.-- The persistent bar would otherwise stay on screen after the X (the app- keeps running in the tray for voice), which reads as "the bar won't- close". Drive the bar into the non-persistent (hide-at-idle) regime and- hide it now, WITHOUT mutating the user's saved ``bar_persistent``- preference. Voice activity still surfaces it (the bridge shows it on a- session and hides it again at idle); reopening the window restores the+ """Take a NON-persistent overlay bar off the screen on minimise — but+ NEVER touch a bar the user set to "show at all times".++ "Show at all times" (``bar_persistent``) makes the bar a standalone,+ always-on element by the user's explicit choice: minimising the main+ window to tray must leave it exactly where it is. Forcing an always-on+ bar into the hide-at-idle regime here was the regression where the bar+ "vanishes after a while and only the wake word brings it back" — every+ tray-minimise silently overrode the user's always-on preference. A user+ who wants the bar gone turns "show at all times" OFF instead.++ A non-persistent bar is already hide-at-idle, so we only make sure it is+ off the screen now (clean desktop). Reopening the window restores theconfigured regime via :meth:`_restore_overlay_for_visible_window`."""+ # Always-on bar: the tray-minimise must not disturb it.+ if bool(getattr(self.cfg.ui, "bar_persistent", True)):+ returnbar = getattr(self, "_orb", None)bridge = getattr(self, "_bridge", None)if bar is None or bridge is None:returntry:- if getattr(bridge, "_boot_reveal_done", True) is False:- # The persistent jarvis bar starts withdrawn at boot and is- # revealed once voice is ready. Before that first reveal there- # is no visible surface to suppress; flipping hide-on-idle here- # would turn the one-shot startup reveal into a no-op.- returnbridge._hide_on_idle = Trueif hasattr(bar, "_persistent"):bar._persistent = Falsediff --git a/jarvis/ui/jarvisbar/overlay.py b/jarvis/ui/jarvisbar/overlay.pyindex f7c7be0e03..00524095e8 100644--- a/jarvis/ui/jarvisbar/overlay.py+++ b/jarvis/ui/jarvisbar/overlay.py@@ -233,6 +233,23 @@ class JarvisBarOverlay:from PIL import ImageTk # noqa: F401 — fail fast here if Pillow missing+ # Per-monitor DPI awareness MUST be set before THIS surface's Tk root is+ # created — exactly like the orb (ui/orb/overlay.py). Without it, on a+ # scaled display (e.g. 150%) the window's geometry coordinate space and+ # the pointer-event space (``event.x_root``) drift apart, so dragging the+ # bar makes it run AWAY from the cursor toward the bottom-right and become+ # uncontrollable (the HiDPI "drag-teleport"). The bar boots in its own+ # thread, often before any other code has set process DPI awareness, so+ # it must assert it here itself. ``ensure_dpi_awareness`` is idempotent+ # and a no-op off Windows, so this is safe even when the process is+ # already aware.+ try:+ from jarvis.core.win32_dpi import ensure_dpi_awareness++ ensure_dpi_awareness()+ except Exception: # noqa: BLE001 — never block the bar on a DPI hiccup+ log.debug("jarvisbar DPI-awareness setup skipped", exc_info=True)+self._tk_thread_id = threading.get_ident()self._renderer = renderer.JarvisBarRenderer(accent=self._accent)@@ -368,6 +385,20 @@ class JarvisBarOverlay:self._root.deiconify()except Exception: # noqa: BLE001log.debug("jarvisbar deiconify failed", exc_info=True)+ # Re-assert topmost + lift after every reveal. A withdrawn→deiconified+ # ``overrideredirect`` window comes back on Windows WITHOUT its topmost+ # z-order (it is remapped as an ordinary window), so later-mapped windows+ # (the desktop main window + tray on the fast-boot path) land ON TOP of+ # the bar and hide it until the next wake-word incidentally re-shows it —+ # the "bar does not appear, only after the wake-word" forensic. Lifting ++ # re-pinning topmost here keeps the always-on bar reliably visible,+ # matching the mascot orb. Guarded separately so a lift failure never+ # undoes the deiconify. (Lost in the consolidate restore-trap; restored.)+ try:+ self._root.wm_attributes("-topmost", True)+ self._root.lift()+ except Exception: # noqa: BLE001+ log.debug("jarvisbar lift/topmost re-assert failed", exc_info=True)def _do_hide(self) -> None:if self._root is None:diff --git a/tests/unit/ui/jarvisbar/test_dpi_awareness.py b/tests/unit/ui/jarvisbar/test_dpi_awareness.pynew file mode 100644index 0000000000..fe5525969a--- /dev/null+++ b/tests/unit/ui/jarvisbar/test_dpi_awareness.py@@ -0,0 +1,73 @@+"""The JarvisBar makes its Tk window per-monitor DPI aware BEFORE creating it.++Regression (HiDPI "drag-teleport"): the bar's Tk root used to be created without+``ensure_dpi_awareness()`` — the orb sets it (ui/orb/overlay.py), the bar did+not. On a scaled display (e.g. 150%) the window's geometry coordinate space and+the pointer-event space then drift apart, so dragging the bar makes it run AWAY+from the cursor toward the bottom-right and become uncontrollable. The fix+mirrors the orb: assert DPI awareness in ``start()`` BEFORE ``tk.Tk()``.+"""+from __future__ import annotations++import tkinter++from jarvis.ui.jarvisbar.overlay import JarvisBarOverlay+++class _FakeTkRoot:+ """Minimal stand-in for a Tk root — every call the bar's ``start()`` makes+ on the root up to the (no-op'd) animation loops is a no-op here."""++ def title(self, *a, **k) -> None: ...+ def overrideredirect(self, *a, **k) -> None: ...+ def wm_attributes(self, *a, **k) -> None: ...+ def configure(self, *a, **k) -> None: ...+ def geometry(self, *a, **k) -> None: ...+ def winfo_screenwidth(self) -> int:+ return 1920++ def winfo_screenheight(self) -> int:+ return 1080++ def withdraw(self) -> None: ...+ def deiconify(self) -> None: ...+ def after(self, *a, **k) -> None: ...+ def mainloop(self) -> None: ...+++class _FakeCanvas:+ def __init__(self, *a, **k) -> None: ...+ def pack(self, *a, **k) -> None: ...+ def bind(self, *a, **k) -> None: ...+++def test_start_sets_dpi_awareness_before_creating_tk_root(monkeypatch) -> None:+ order: list[str] = []++ monkeypatch.setattr(+ "jarvis.core.win32_dpi.ensure_dpi_awareness",+ lambda: order.append("dpi"),+ )++ def _fake_tk(*_a, **_k) -> _FakeTkRoot:+ order.append("tk")+ return _FakeTkRoot()++ monkeypatch.setattr(tkinter, "Tk", _fake_tk)+ monkeypatch.setattr(tkinter, "Canvas", _FakeCanvas)++ bar = JarvisBarOverlay()+ # The animation / UI-queue after-loops need a live Tk root — no-op them so+ # ``start()`` returns immediately in the unit test.+ monkeypatch.setattr(bar, "_schedule_frame", lambda: None)+ monkeypatch.setattr(bar, "_schedule_ui_queue", lambda: None)+ monkeypatch.setattr(bar, "_schedule_frame_watchdog", lambda: None)++ bar.start()++ assert "dpi" in order, "start() must set DPI awareness"+ assert "tk" in order, "start() must create the Tk root"+ assert order.index("dpi") < order.index("tk"), (+ "DPI awareness must be set BEFORE the Tk root is created "+ "(HiDPI drag-teleport fix)"+ )diff --git a/tests/unit/ui/test_desktop_minimize_to_tray_overlay.py b/tests/unit/ui/test_desktop_minimize_to_tray_overlay.pyindex 6f822f281a..7bd5809722 100644--- a/tests/unit/ui/test_desktop_minimize_to_tray_overlay.py+++ b/tests/unit/ui/test_desktop_minimize_to_tray_overlay.py@@ -143,7 +143,8 @@ def test_restore_keeps_mascot_hide_on_idle() -> None:# --- the X / closing callback -------------------------------------------------def test_window_closing_minimises_and_clears_bar() -> None:+def test_window_closing_minimises_but_keeps_persistent_bar() -> None:+ """The X minimises to tray, but an always-on bar stays on screen."""bar = FakeBar()bridge = SimpleNamespace(_hide_on_idle=False)app = _app(persistent=True, orb=bar, bridge=bridge)@@ -156,9 +157,26 @@ def test_window_closing_minimises_and_clears_bar() -> None:assert result is False # destroy vetoed → minimise to trayassert app._window.hidden is Trueassert app._window_visible is False+ assert bar.hidden is False # always-on bar is NOT cleared+ assert bridge._hide_on_idle is False+ assert app.cfg.ui.bar_persistent is True # preference untouched+++def test_window_closing_clears_non_persistent_bar() -> None:+ """A non-persistent bar is cleared on minimise (clean desktop)."""+ bar = FakeBar()+ bridge = SimpleNamespace(_hide_on_idle=False)+ app = _app(persistent=False, orb=bar, bridge=bridge)+ app._window = FakeWindow()+ app._user_requested_quit = False+ app._window_visible = True++ result = app._on_window_closing()++ assert result is False+ assert app._window.hidden is Trueassert bar.hidden is Trueassert bridge._hide_on_idle is True- assert app.cfg.ui.bar_persistent is True # preference untoucheddef test_window_closing_allows_genuine_quit() -> None:diff --git a/tests/unit/ui/test_orb_bus_bridge.py b/tests/unit/ui/test_orb_bus_bridge.pyindex 6956533800..35e207388f 100644--- a/tests/unit/ui/test_orb_bus_bridge.py+++ b/tests/unit/ui/test_orb_bus_bridge.py@@ -659,6 +659,45 @@ async def test_boot_reveal_is_idempotent_across_ready_and_timeout() -> None:assert orb.calls.count(("show", "idle")) == 1[email protected]("state", ["ERROR", "PAUSED"])+async def test_persistent_bar_shows_idle_on_non_active_state_never_hides(+ state: str,+) -> None:+ """An always-on bar (hide_on_idle=False) must survive a non-active state.++ A transient ERROR (an STT/provider hiccup) or a manual PAUSE used to hit the+ bridge's ``else: self._orb.hide()`` and withdraw the always-on bar until the+ next wake word — a second 'the bar vanishes' path on top of the+ minimise-to-tray one. A persistent bar must show the idle pill instead and+ NEVER hide."""+ orb = _FakeOrb()+ bridge = OrbBusBridge( # type: ignore[arg-type]+ bus=_FakeBus(), orb=orb, idle_animations_enabled=False, hide_on_idle=False+ )++ await bridge._on_state( # noqa: SLF001+ SystemStateChanged(new_state=state, previous="IDLE")+ )++ assert ("hide", None) not in orb.calls, f"{state} must not hide the always-on bar"+ assert ("show", "idle") in orb.calls, f"{state} must show the idle pill"+++async def test_non_persistent_bar_hides_on_error_state() -> None:+ """The contrast: a hide-at-idle bar / the mascot still withdraws on a+ non-active state, unchanged."""+ orb = _FakeOrb()+ bridge = OrbBusBridge( # type: ignore[arg-type]+ bus=_FakeBus(), orb=orb, idle_animations_enabled=False, hide_on_idle=True+ )++ await bridge._on_state( # noqa: SLF001+ SystemStateChanged(new_state="ERROR", previous="IDLE")+ )++ assert ("hide", None) in orb.calls++async def test_listening_bubble_mirrors_pipeline_snapshot_one_to_one() -> None:"""Pendel-Episode 3 regression (2026-05-27).diff --git a/ui/orb/bus_bridge.py b/ui/orb/bus_bridge.pyindex 7d57dd01e6..02ffc364d8 100644--- a/ui/orb/bus_bridge.py+++ b/ui/orb/bus_bridge.py@@ -712,11 +712,19 @@ class OrbBusBridge:except Exception as exc: # noqa: BLE001log.debug("hide_comment failed: %s", exc)- if state == "IDLE" and not self._hide_on_idle:+ if not self._hide_on_idle:+ # Persistent "show at all times" bar: a standalone always-on+ # element. EVERY non-active state (IDLE, and also ERROR / PAUSED)+ # shows the idle pill and NEVER withdraws the bar. Hiding it on+ # ERROR/PAUSED was a second "the always-on bar vanishes until the+ # next wake word" path (a transient STT/provider ERROR or a manual+ # pause took it off screen). The salute + idle-animation scheduler+ # belong only to a genuine return to IDLE.self._orb.show(mode="idle")- if prev_state == "SPEAKING":- self._orb.play_animation("salute")- self._start_idle_scheduler()+ if state == "IDLE":+ if prev_state == "SPEAKING":+ self._orb.play_animation("salute")+ self._start_idle_scheduler()return# Drei Faelle, drei verzoegerte Hides — niemals instant-hide aus# einem aktiven Voice-State, sonst sieht der User den Mascot bei