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(ui): show persistent Jarvis Bar at app startup

Ruben Lütke74ea79be7b02
diff --git a/jarvis/ui/desktop_app.py b/jarvis/ui/desktop_app.py
index 5dbd46cd90..a54defff50 100644
--- a/jarvis/ui/desktop_app.py
+++ b/jarvis/ui/desktop_app.py
@@ -1899,7 +1899,7 @@ class DesktopApp:
logger.opt(exception=exc).warning("Virtual mouse overlay not startable")
self._virtual_cursor = None
- def _build_overlay_surface(self, style: str, *, start_hidden: bool = False):
+ def _build_overlay_surface(self, style: str):
"""Construct (and start) the overlay surface for a display style.
Returns a ``NullOverlay`` for ``"none"`` (no Tk window, no-op surface),
@@ -1921,22 +1921,12 @@ class DesktopApp:
if style == "jarvis_bar":
from jarvis.ui.jarvisbar import JarvisBarOverlay
- # Synchronized appearance (2026-06-29): when ``start_hidden`` is set,
- # the persistent bar starts WITHDRAWN and is revealed only on the
- # honest ``VoiceBootStatus(ready=True)`` (via
- # ``reveal_bar_when_voice_ready``), so the bar appears AT THE SAME
- # MOMENT the voice stack is genuinely ready — no more "bar shows at
- # boot, then 'ready' a few seconds later" desync. An earlier attempt
- # at this left the bar hidden until the first wake word because
- # ready=True fired unreliably/too early on the fast-boot path; that
- # root cause is fixed (ready now fires once, after the deferred
- # loaders bring up wake+VAD+TTS), and a 30 s reveal timeout backstops
- # it so the bar can never be stuck hidden. A non-persistent bar starts
- # withdrawn regardless (it pops on a session).
+ # A persistent bar maps immediately. The non-persistent variant
+ # still starts withdrawn through its own ``persistent`` contract and
+ # appears on the first genuine voice session.
surface = JarvisBarOverlay(
persistent=self.cfg.ui.bar_persistent,
accent=self.cfg.ui.bar_accent,
- start_hidden=start_hidden,
)
else: # "mascot" (and any legacy style value)
from ui.orb.overlay import OrbOverlay
@@ -2225,12 +2215,9 @@ class DesktopApp:
from ui.orb.bus_bridge import OrbBusBridge
# NullOverlay for "none" still gets a bridge, so a live switch to
- # bar/mascot works without a restart. Synchronized appearance:
- # the persistent bar starts WITHDRAWN (start_hidden=True) and is
- # revealed only on the honest VoiceBootStatus(ready=True), so it
- # appears exactly when the voice stack is genuinely ready — no
- # "bar at boot, ready a few seconds later" desync.
- surface = self._build_overlay_surface(orb_style, start_hidden=True)
+ # bar/mascot works without a restart. A persistent bar maps now;
+ # voice readiness is reported separately by the desktop UI.
+ surface = self._build_overlay_surface(orb_style)
hide_on_idle = (
(not self.cfg.ui.bar_persistent)
if orb_style == "jarvis_bar"
@@ -2238,15 +2225,12 @@ class DesktopApp:
)
bridge = OrbBusBridge(bus=bus, orb=surface, hide_on_idle=hide_on_idle)
bridge.attach()
- # Visibility gate: the persistent bar started withdrawn (above),
- # so this task is what actually SHOWS it — it waits for
- # VoiceBootStatus(ready=True) (full stack: wake+VAD+TTS) and then
- # maps + lifts the idle pill. Bounded by a 30 s timeout fallback
- # so the bar can never be stuck hidden. A non-persistent bar / the
- # mascot is left untouched (it pops on a real session).
+ # The persistent bar is already visible. Once the rest of the
+ # desktop and voice stack have mapped, re-assert its current
+ # mode/topmost state without changing visibility or turn state.
loop.create_task(
- bridge.reveal_bar_when_voice_ready(),
- name="overlay-boot-reveal",
+ bridge.reassert_persistent_bar_when_voice_ready(),
+ name="overlay-boot-reassert",
)
self._orb = surface
self._bridge = bridge
diff --git a/jarvis/ui/jarvisbar/overlay.py b/jarvis/ui/jarvisbar/overlay.py
index c091d2f895..02fbd85a61 100644
--- a/jarvis/ui/jarvisbar/overlay.py
+++ b/jarvis/ui/jarvisbar/overlay.py
@@ -156,17 +156,10 @@ class JarvisBarOverlay:
persistent: bool = True,
accent: str = "#e7c46e",
opacity: float = BAR_ALPHA,
- start_hidden: bool = False,
) -> None:
self._persistent = persistent
self._accent = accent
self._opacity = max(0.2, min(1.0, float(opacity))) # clamp to sane range
- # Boot gate: when set, the bar starts WITHDRAWN even if persistent, so it
- # does not appear before the speech pipeline is ready to listen (the
- # "looks ready but isn't" boot confusion). The boot wiring reveals it via
- # show("idle") once VoiceBootStatus(ready=True) arrives. Default False
- # keeps every other caller (live swap / set_bar_persistent) unchanged.
- self._start_hidden = bool(start_hidden)
self._mode = "idle"
self._ext_level = 0.0
# perf_counter() of the last set_level() that carried real sound
@@ -276,13 +269,12 @@ class JarvisBarOverlay:
# Lifecycle #
# ------------------------------------------------------------------ #
def _should_start_withdrawn(self) -> bool:
- """True when ``start()`` must withdraw the window instead of mapping it.
+ """True only for the wake-triggered, non-persistent variant.
- A non-persistent bar always starts hidden (it pops on a session). A
- persistent bar normally maps immediately, but the boot gate
- (``start_hidden=True``) keeps it hidden until voice is ready.
+ A persistent bar is an always-visible desktop element and maps as soon
+ as its Tk window starts. Voice readiness must never gate its visibility.
"""
- return (not self._persistent) or self._start_hidden
+ return not self._persistent
def start_in_thread(self, timeout: float = 3.0) -> None:
def _run() -> None:
diff --git a/tests/unit/ui/jarvisbar/test_boot_visibility.py b/tests/unit/ui/jarvisbar/test_boot_visibility.py
index 7d2a4fc0d0..a56c674a2e 100644
--- a/tests/unit/ui/jarvisbar/test_boot_visibility.py
+++ b/tests/unit/ui/jarvisbar/test_boot_visibility.py
@@ -10,6 +10,7 @@ always; a non-persistent bar still pops on a real session.
"""
from __future__ import annotations
+import inspect
from types import SimpleNamespace
from jarvis.ui.desktop_app import DesktopApp
@@ -39,8 +40,11 @@ def test_boot_persistent_bar_is_visible_not_withdrawn(monkeypatch) -> None:
assert isinstance(surface, JarvisBarOverlay)
assert surface._persistent is True
# Visible at boot — NOT gated behind VoiceBootStatus(ready=True) / a wake word.
- assert surface._start_hidden is False
assert surface._should_start_withdrawn() is False
+ assert "start_hidden" not in inspect.signature(JarvisBarOverlay).parameters
+ assert "start_hidden" not in inspect.signature(
+ DesktopApp._build_overlay_surface
+ ).parameters
def test_boot_non_persistent_bar_still_starts_withdrawn(monkeypatch) -> None:
diff --git a/tests/unit/ui/jarvisbar/test_show_lifts_topmost.py b/tests/unit/ui/jarvisbar/test_show_lifts_topmost.py
index 25c2c83c2f..41308c272b 100644
--- a/tests/unit/ui/jarvisbar/test_show_lifts_topmost.py
+++ b/tests/unit/ui/jarvisbar/test_show_lifts_topmost.py
@@ -1,13 +1,11 @@
"""The reveal path must LIFT + re-pin topmost, not just deiconify.
-Forensic (2026-06-27): on the fast-boot path the persistent bar's boot reveal
-(``VoiceBootStatus(ready=True)`` → ``show("idle")``) fires within ~200 ms of
-window creation, before the desktop main window + tray finish mapping. A
-withdrawn→deiconified ``overrideredirect`` window loses its topmost z-order on
-Windows, so the later boot windows mapped on top of the bar and it stayed hidden
-until the first wake-word re-showed it ("bar does not appear when ready, only
-after the wake-word"). ``_do_show`` now re-asserts ``-topmost`` and lifts, matching
-the mascot orb. These tests pin that contract without a real Tk window.
+Forensic (2026-06-27): a withdrawn→deiconified ``overrideredirect`` window can
+lose its topmost z-order on Windows, so later desktop windows map above it until
+the next wake re-shows it. The persistent bar now maps immediately at boot, and
+the voice-ready maintenance pass re-shows its current mode only to re-pin
+topmost. ``_do_show`` re-asserts ``-topmost`` and lifts, matching the mascot orb.
+These tests pin that contract without a real Tk window.
Forensic (2026-06-30): re-asserting ``-topmost`` is itself a Win32 style
mutation on this layered (color-key + alpha) window, and Windows can silently
diff --git a/tests/unit/ui/jarvisbar/test_start_hidden.py b/tests/unit/ui/jarvisbar/test_start_hidden.py
index e152330a34..e1dfa3e9db 100644
--- a/tests/unit/ui/jarvisbar/test_start_hidden.py
+++ b/tests/unit/ui/jarvisbar/test_start_hidden.py
@@ -1,35 +1,25 @@
-"""The ``start_hidden`` capability of the JarvisBar overlay.
-
-A persistent bar normally maps its Tk window the moment the mainloop runs (no
-``withdraw``); ``start_hidden=True`` lets a caller opt it into starting
-withdrawn instead. NOTE: the boot wiring no longer uses ``start_hidden`` for the
-persistent bar — the bar is visible immediately at boot, decoupled from the
-voice/wake path (see ``tests/unit/ui/jarvisbar/test_boot_visibility.py``). These
-tests pin the overlay's own start-withdrawn decision so the boot path stays
-headless-testable (no real Tk window needed).
+"""The JarvisBar initial-visibility contract.
+
+A persistent bar always maps when its Tk mainloop starts. Only the
+non-persistent, wake-triggered variant starts withdrawn. There is deliberately
+no voice-readiness override that can hide a persistent bar at boot.
"""
from __future__ import annotations
-from jarvis.ui.jarvisbar.overlay import JarvisBarOverlay
-
+import inspect
-def test_persistent_bar_with_start_hidden_starts_withdrawn() -> None:
- bar = JarvisBarOverlay(persistent=True, start_hidden=True)
- assert bar._start_hidden is True
- assert bar._should_start_withdrawn() is True
+from jarvis.ui.jarvisbar.overlay import JarvisBarOverlay
-def test_persistent_bar_default_does_not_start_withdrawn() -> None:
- # Backward compatibility: without start_hidden a persistent bar is mapped
- # immediately, exactly as before (e.g. the live swap / set_bar_persistent
- # paths that explicitly show it after construction).
+def test_persistent_bar_does_not_start_withdrawn() -> None:
bar = JarvisBarOverlay(persistent=True)
- assert bar._start_hidden is False
assert bar._should_start_withdrawn() is False
-def test_non_persistent_bar_starts_withdrawn_regardless() -> None:
- # The non-persistent bar already starts hidden (pops on a session); the new
- # flag must not change that.
+def test_non_persistent_bar_starts_withdrawn() -> None:
bar = JarvisBarOverlay(persistent=False)
assert bar._should_start_withdrawn() is True
+
+
+def test_start_hidden_override_is_not_part_of_the_surface_api() -> None:
+ assert "start_hidden" not in inspect.signature(JarvisBarOverlay).parameters
diff --git a/tests/unit/ui/test_orb_bus_bridge.py b/tests/unit/ui/test_orb_bus_bridge.py
index 90bcec6889..93a420e9a7 100644
--- a/tests/unit/ui/test_orb_bus_bridge.py
+++ b/tests/unit/ui/test_orb_bus_bridge.py
@@ -59,8 +59,10 @@ class _RecordingBus:
class _FakeOrb:
def __init__(self) -> None:
self.calls: list[tuple[str, str | None]] = []
+ self._mode = "idle"
def show(self, mode: str = "listen") -> None:
+ self._mode = mode
self.calls.append(("show", mode))
def set_level(self, level: float) -> None:
@@ -578,34 +580,32 @@ async def test_reply_is_reset_between_turns() -> None:
assert ("show_listening_transcript", "Antwort aus Turn 1.") not in orb.calls
-# --- Boot readiness gate: the persistent bar stays hidden until voice is ready.
-# The persistent JarvisBar used to map its window the instant its mainloop ran,
-# i.e. during backend boot — seconds before the speech pipeline could actually
-# hear "Hey Jarvis". The user saw the bar and assumed Jarvis was listening when
-# it was not. The bridge now reveals the persistent bar only on the existing
-# VoiceBootStatus(ready=True) signal (with a bounded fallback so a voice-offline
-# host still gets its bar).
+# --- Boot z-order maintenance: visibility never waits for voice readiness.
+# The persistent JarvisBar maps immediately. VoiceBootStatus(ready=True) only
+# re-asserts its current mode/topmost state after later desktop windows map.
-async def test_persistent_bar_waits_for_voice_ready_then_reveals_once() -> None:
+async def test_persistent_bar_reasserts_current_mode_once_when_voice_ready() -> None:
orb = _FakeOrb()
+ orb._mode = "listen"
bridge = OrbBusBridge( # type: ignore[arg-type]
bus=_FakeBus(), orb=orb, idle_animations_enabled=False, hide_on_idle=False
)
- task = asyncio.create_task(bridge.reveal_bar_when_voice_ready(timeout_s=5.0))
+ task = asyncio.create_task(
+ bridge.reassert_persistent_bar_when_voice_ready(timeout_s=5.0)
+ )
await asyncio.sleep(0.05)
- # No ready signal yet → the persistent bar must NOT be shown.
- assert ("show", "idle") not in orb.calls
+ # The bridge does not own initial visibility and has not changed the mode.
+ assert orb.calls == []
await bridge._on_voice_boot_status(VoiceBootStatus(ready=True)) # noqa: SLF001
await asyncio.wait_for(task, timeout=1.0)
- # Revealed exactly once.
- assert orb.calls.count(("show", "idle")) == 1
+ assert orb.calls.count(("show", "listen")) == 1
-async def test_voice_boot_status_not_ready_does_not_reveal_bar() -> None:
+async def test_voice_boot_status_not_ready_does_not_reassert_bar() -> None:
orb = _FakeOrb()
bridge = OrbBusBridge( # type: ignore[arg-type]
bus=_FakeBus(), orb=orb, idle_animations_enabled=False, hide_on_idle=False
@@ -616,23 +616,21 @@ async def test_voice_boot_status_not_ready_does_not_reveal_bar() -> None:
assert ("show", "idle") not in orb.calls
-async def test_persistent_bar_revealed_by_timeout_when_ready_never_comes() -> None:
- """A voice-offline host (pipeline crashed at startup, no mic) never emits
- ready=True. The bar must still appear after a bounded fallback so the user
- is not left with no bar at all — just a few seconds late instead of never."""
+async def test_persistent_bar_reasserted_by_timeout_when_ready_never_comes() -> None:
+ """A voice-offline host still gets one bounded z-order reassert."""
orb = _FakeOrb()
bridge = OrbBusBridge( # type: ignore[arg-type]
bus=_FakeBus(), orb=orb, idle_animations_enabled=False, hide_on_idle=False
)
- await bridge.reveal_bar_when_voice_ready(timeout_s=0.05)
+ await bridge.reassert_persistent_bar_when_voice_ready(timeout_s=0.05)
assert ("show", "idle") in orb.calls
-async def test_non_persistent_surface_not_revealed_on_voice_ready() -> None:
+async def test_non_persistent_surface_not_reasserted_on_voice_ready() -> None:
"""A non-persistent bar / the mascot (hide_on_idle=True) is hidden at idle
- by design — it pops on a real session. The boot-ready reveal must leave it
+ by design — it pops on a real session. The boot reassert must leave it
untouched."""
orb = _FakeOrb()
bridge = OrbBusBridge( # type: ignore[arg-type]
@@ -640,21 +638,21 @@ async def test_non_persistent_surface_not_revealed_on_voice_ready() -> None:
)
await bridge._on_voice_boot_status(VoiceBootStatus(ready=True)) # noqa: SLF001
- await bridge.reveal_bar_when_voice_ready(timeout_s=0.05)
+ await bridge.reassert_persistent_bar_when_voice_ready(timeout_s=0.05)
assert ("show", "idle") not in orb.calls
-async def test_boot_reveal_is_idempotent_across_ready_and_timeout() -> None:
+async def test_boot_reassert_is_idempotent_across_ready_and_timeout() -> None:
orb = _FakeOrb()
bridge = OrbBusBridge( # type: ignore[arg-type]
bus=_FakeBus(), orb=orb, idle_animations_enabled=False, hide_on_idle=False
)
await bridge._on_voice_boot_status(VoiceBootStatus(ready=True)) # noqa: SLF001
- await bridge.reveal_bar_when_voice_ready(timeout_s=1.0)
+ await bridge.reassert_persistent_bar_when_voice_ready(timeout_s=1.0)
# A second invocation (e.g. a stray late call) must not show the bar twice.
- await bridge.reveal_bar_when_voice_ready(timeout_s=0.05)
+ await bridge.reassert_persistent_bar_when_voice_ready(timeout_s=0.05)
assert orb.calls.count(("show", "idle")) == 1
diff --git a/ui/orb/bus_bridge.py b/ui/orb/bus_bridge.py
index 5a69eedb32..03ec9b6fb2 100644
--- a/ui/orb/bus_bridge.py
+++ b/ui/orb/bus_bridge.py
@@ -210,17 +210,18 @@ class OrbBusBridge:
# drives _on_state without publishing VoiceSession events (and the
# very first session before any end-event) behaves exactly as before.
self._suppress_show_until_session: bool = False
- # Boot z-order re-lift latch. The persistent bar is now visible from
+ # Boot z-order re-lift latch. The persistent bar is visible from
# boot (the overlay maps its window immediately — see
# DesktopApp._build_overlay_surface), so this is NO LONGER a visibility
- # gate. Once voice is ready, ``reveal_bar_when_voice_ready`` re-asserts
- # the bar's topmost (after the main window + tray have finished mapping).
- # ``_boot_reveal_done`` makes the re-lift idempotent across the ready
+ # gate. Once voice is ready,
+ # ``reassert_persistent_bar_when_voice_ready`` re-asserts the bar's
+ # topmost after the main window + tray have finished mapping.
+ # ``_boot_reassert_done`` makes the re-lift idempotent across the ready
# signal and the fallback timeout. asyncio.Event() is loop-agnostic at
# construction (Py3.10+ dropped the loop param; project minimum is
# 3.11), so it is safe to build off the running loop.
self._voice_ready_event = asyncio.Event()
- self._boot_reveal_done: bool = False
+ self._boot_reassert_done: bool = False
# Backend asyncio loop the bridge's bus handlers run on. The Tk gesture
# callbacks (_publish_mute_toggle / _publish_show_window /
# _publish_visible_feedback) fire on the overlay's *Tk thread*, which has
@@ -535,8 +536,8 @@ class OrbBusBridge:
prevents the resurrection that follows.
"""
log.info(
- "OrbBridge._on_session_ended: session=%s reason=%s — orb stays hidden "
- "until next wake.",
+ "OrbBridge._on_session_ended: session=%s reason=%s — late active "
+ "states suppressed until next wake.",
event.session_id,
event.hangup_reason,
)
@@ -553,18 +554,14 @@ class OrbBusBridge:
if event.ready:
self._voice_ready_event.set()
- async def reveal_bar_when_voice_ready(self, *, timeout_s: float = 30.0) -> None:
- """Show the persistent bar once the voice stack is genuinely ready.
-
- Synchronized appearance (2026-06-29): the persistent bar is now started
- WITHDRAWN (``start_hidden=True`` — see DesktopApp._build_overlay_surface),
- so THIS is the visibility gate. Scheduled once on the event loop at boot,
- it waits for ``VoiceBootStatus(ready=True)`` (emitted after the deferred
- loaders bring up wake+VAD+TTS) — or a bounded ``timeout_s`` fallback so
- the bar can never be stuck hidden — and then shows the idle pill, which
- maps + lifts the bar exactly when the user can actually talk. A
- non-persistent bar / the mascot (``hide_on_idle``) is left untouched: it
- pops on a real session, not at boot.
+ async def reassert_persistent_bar_when_voice_ready(
+ self, *, timeout_s: float = 30.0
+ ) -> None:
+ """Re-assert the already-visible persistent bar after desktop boot.
+
+ The bar maps immediately and does not wait for voice readiness. This
+ bounded task only re-pins its current mode/topmost state after later boot
+ windows have mapped. A non-persistent bar or mascot remains untouched.
"""
reason = "timeout-fallback"
try:
@@ -572,26 +569,24 @@ class OrbBusBridge:
reason = "voice-ready"
except TimeoutError:
pass
- self._reveal_persistent_bar(reason)
-
- def _reveal_persistent_bar(self, reason: str) -> None:
- """Show the persistent bar's idle pill exactly once (the boot reveal).
+ self._reassert_persistent_bar(reason)
- Idempotent (``_boot_reveal_done``). The bar starts withdrawn
- (start_hidden), so ``show("idle")`` here maps + lifts it — this is the
- moment the bar first becomes visible, synchronized with voice-ready.
- """
- if self._boot_reveal_done:
+ def _reassert_persistent_bar(self, reason: str) -> None:
+ """Re-show the persistent bar's current mode exactly once."""
+ if self._boot_reassert_done:
return
- self._boot_reveal_done = True
+ self._boot_reassert_done = True
if self._hide_on_idle:
# Non-persistent bar / mascot: stays hidden until a voice session.
return
try:
- self._orb.show("idle")
- log.info("Persistent overlay revealed after boot (%s).", reason)
+ mode = str(getattr(self._orb, "_mode", "idle") or "idle")
+ self._orb.show(mode)
+ log.info(
+ "Persistent overlay z-order reasserted after boot (%s).", reason
+ )
except Exception: # noqa: BLE001
- log.debug("persistent bar boot reveal failed", exc_info=True)
+ log.debug("persistent bar boot reassert failed", exc_info=True)
async def _on_state(self, event: SystemStateChanged) -> None:
# Lazily pin the backend loop (idempotent) so Tk-thread gestures can