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): drop background progress heartbeats when no session is listening

Ruben Lütke3b38775b3529
diff --git a/jarvis/speech/pipeline.py b/jarvis/speech/pipeline.py
index fb6c0a898f..ceb7253b8a 100644
--- a/jarvis/speech/pipeline.py
+++ b/jarvis/speech/pipeline.py
@@ -2533,20 +2533,24 @@ class SpeechPipeline:
quiet_ms, elapsed * 1000.0, event.text[:80],
)
return
- # Symmetric turn-boundary guard (AD-OE5). Jarvis already has barge-in
- # (the user interrupts Jarvis via priority="interrupt" below); this is
- # the missing reverse — Jarvis must not start speaking while the USER
- # holds the floor. Only non-interrupt announcements are gated; an
+ # Symmetric turn-boundary guard (AD-OE5) + idle guard (live bug 2026-07-01).
+ # A background "still on it" heartbeat (kind="progress") is only meaningful
+ # while the user is ACTIVELY in a session waiting for the mission — the mic
+ # is open and Jarvis is LISTENING. It is dropped in every other state:
+ # during a foreground turn (THINKING/JARVIS_SPEAKING/…) it would talk over
+ # that turn, and while IDLE there is NO active session at all, so speaking
+ # it is Jarvis "talking out of nowhere" into a machine the user walked away
+ # from (live bug 2026-07-01: a force-spawned mission's three bounded beats
+ # spoke into fresh, empty wake sessions after the user hung up). An
# interrupt is a deliberate barge and still punches through.
current_turn_state = getattr(self, "_turn_state", TurnTakingState.IDLE)
if (
event.priority != "interrupt"
and is_progress
- and current_turn_state
- not in {TurnTakingState.IDLE, TurnTakingState.LISTENING}
+ and current_turn_state is not TurnTakingState.LISTENING
):
log.info(
- "Progress announcement dropped — foreground turn active (%s): %r",
+ "Progress announcement dropped — no active listening session (%s): %r",
getattr(current_turn_state, "value", current_turn_state),
event.text[:80],
)
diff --git a/tests/unit/speech/test_spawn_watchdog.py b/tests/unit/speech/test_spawn_watchdog.py
index 49a289e479..397624fa50 100644
--- a/tests/unit/speech/test_spawn_watchdog.py
+++ b/tests/unit/speech/test_spawn_watchdog.py
@@ -439,3 +439,56 @@ async def test_heartbeat_dropped_not_deferred_while_turn_is_processing() -> None
"stale heartbeat was deferred; progress beats must be dropped during "
"active foreground turns"
)
+
+
+async def test_heartbeat_not_spoken_into_idle_no_active_session() -> None:
+ """A 'still on it' heartbeat must NOT be spoken while the state is IDLE —
+ there is NO active voice session (the user hung up / walked away). Speaking a
+ background-mission reassurance into an idle machine is Jarvis 'talking out of
+ nowhere'.
+
+ Live bug 2026-07-01 (voice session 21:27–21:29): a force-spawn armed a
+ heartbeat watchdog; the user hung up (state -> IDLE); the three bounded beats
+ then spoke into fresh, empty wake sessions ("no user text recorded"), leaving
+ the user asking "Wieso? Was ist denn das?". A progress beat is only meaningful
+ while the user is actively LISTENING; in every other state — including IDLE —
+ it is dropped (kind="progress" is droppable when stale).
+ """
+ from jarvis.speech.pipeline import TurnTakingState
+
+ bus = EventBus()
+ pipe = _pipeline(bus, watchdog_delay_s=0.03)
+ pipe._turn_state = TurnTakingState.IDLE # no active session
+
+ await bus.publish(JarvisAgentAnnouncement(action="bauen", target="x"))
+ await asyncio.sleep(0.2) # heartbeat fires into _on_announcement
+
+ assert pipe._player.plays == [], (
+ "heartbeat spoken into an idle machine with no active session — "
+ "'talking out of nowhere'"
+ )
+ assert pipe._deferred_announcements == [], (
+ "an idle heartbeat must be dropped, never deferred/replayed"
+ )
+
+
+async def test_heartbeat_still_spoken_while_listening_in_active_session() -> None:
+ """Regression boundary for the idle fix: while the user is ACTIVELY in a
+ session waiting (LISTENING), the reassurance is STILL spoken. The idle fix
+ must only silence 'out of nowhere' beats — never the legitimate in-session
+ 'still on it' the heartbeat exists to provide (design 2026-06-19)."""
+ from jarvis.speech.pipeline import TurnTakingState
+
+ bus = EventBus()
+ pipe = _pipeline(bus, watchdog_delay_s=0.03)
+ pipe._turn_state = TurnTakingState.LISTENING # user actively waiting
+
+ await bus.publish(JarvisAgentAnnouncement(action="bauen", target="x"))
+ await asyncio.sleep(0.2) # heartbeat fires into _on_announcement
+
+ assert pipe._player.plays == ["play"], (
+ "in-session (LISTENING) heartbeat must still be spoken"
+ )
+ assert pipe._deferred_announcements == []