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): keep mission heartbeats out of calls that did not start them

rubenluetke10-beep2f5b5a57e0a8
diff --git a/jarvis/speech/pipeline.py b/jarvis/speech/pipeline.py
index e419b4f5bf..3a96137964 100644
--- a/jarvis/speech/pipeline.py
+++ b/jarvis/speech/pipeline.py
@@ -6171,7 +6171,9 @@ class SpeechPipeline:
``_cancel_spawn_heartbeats``."""
loop = asyncio.get_running_loop()
task = loop.create_task(
- self._spawn_watchdog_body(),
+ self._spawn_watchdog_body(
+ origin_session_id=getattr(self, "_current_voice_session_id", None)
+ ),
name=f"spawn-watchdog-{len(self._spawn_watchdog_tasks)}",
)
self._spawn_watchdog_tasks.append(task)
@@ -6249,7 +6251,9 @@ class SpeechPipeline:
recent.append(choice)
return (choice, lang)
- async def _spawn_watchdog_body(self) -> None:
+ async def _spawn_watchdog_body(
+ self, *, origin_session_id: str | None = None
+ ) -> None:
"""Speak a bounded, varied, language-resolved "still on it" heartbeat
while a background mission runs.
@@ -6270,6 +6274,14 @@ class SpeechPipeline:
voice session open forever, because the success path never publishes the
``JarvisAgentBackgroundCompleted`` event that would otherwise drain it. The
hard cap bounds the in-flight hold to the heartbeat lifetime.
+
+ A beat belongs to the voice session the mission was started in
+ (``origin_session_id``; ``None`` for a typed chat). It is skipped once
+ a DIFFERENT voice session is open: that call never asked for the
+ mission, and inside a live call the line lands as backend commentary
+ that the duplex model voices over the user and that stalls its reply
+ to a short greeting (live bug 2026-10-02 17:58, "Hallo, was geht ab?"
+ unanswered for 6 s after a chat mission's beat entered the new call).
"""
try:
max_count = max(1, getattr(self, "_heartbeat_max_count", 3))
@@ -6284,6 +6296,17 @@ class SpeechPipeline:
if getattr(self, "_muted", False):
log.debug("Spawn-heartbeat: muted, skipping beat %d", beat)
continue
+ current_session_id = getattr(self, "_current_voice_session_id", None)
+ if (
+ current_session_id is not None
+ and current_session_id != origin_session_id
+ ):
+ log.info(
+ "Spawn-heartbeat #%d skipped — the mission was not "
+ "started in the open voice session",
+ beat,
+ )
+ continue
if self._bus is None:
return
phrase, lang = self._pick_heartbeat_phrase()
diff --git a/tests/unit/speech/test_spawn_watchdog.py b/tests/unit/speech/test_spawn_watchdog.py
index 397624fa50..d353a09dcb 100644
--- a/tests/unit/speech/test_spawn_watchdog.py
+++ b/tests/unit/speech/test_spawn_watchdog.py
@@ -492,3 +492,47 @@ async def test_heartbeat_still_spoken_while_listening_in_active_session() -> Non
"in-session (LISTENING) heartbeat must still be spoken"
)
assert pipe._deferred_announcements == []
+
+
+# --------------------------------------------------------------------------- #
+# Session scope (live bug 2026-10-02): a beat stays in the call it belongs to #
+# --------------------------------------------------------------------------- #
+
+
+async def test_heartbeat_skipped_in_a_voice_session_that_did_not_start_it() -> None:
+ """A mission started outside a call (typed chat) must not reassure a NEW
+ call. Live 2026-10-02 17:58: such a beat entered a fresh live call as
+ commentary and the greeting "Hallo, was geht ab?" went unanswered."""
+ bus = EventBus()
+ pipe = _pipeline(bus, watchdog_delay_s=0.05)
+
+ announcements: list[AnnouncementRequested] = []
+ bus.subscribe(AnnouncementRequested, lambda ev: announcements.append(ev))
+
+ pipe._current_voice_session_id = None # spawned from a typed chat
+ await bus.publish(JarvisAgentAnnouncement(action="bauen", target="x"))
+ await asyncio.sleep(0.01)
+ pipe._current_voice_session_id = "fresh-call" # the user then opens a call
+ await asyncio.sleep(0.3)
+
+ assert _heartbeats(announcements) == [], (
+ "a heartbeat from another context was published into a new call"
+ )
+ assert pipe._live_spawn_watchdogs() == [], "the skipped watchdog must still end"
+
+
+async def test_heartbeat_kept_in_the_voice_session_that_started_it() -> None:
+ """Boundary: the call that started the mission still hears its beat."""
+ bus = EventBus()
+ pipe = _pipeline(bus, watchdog_delay_s=0.05)
+
+ announcements: list[AnnouncementRequested] = []
+ bus.subscribe(AnnouncementRequested, lambda ev: announcements.append(ev))
+
+ pipe._current_voice_session_id = "same-call"
+ await bus.publish(JarvisAgentAnnouncement(action="bauen", target="x"))
+ await asyncio.sleep(0.3)
+
+ assert len(_heartbeats(announcements)) == 1