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: make STT handoff cleanup observable

Ruben Lütkea940a45f9931
diff --git a/jarvis/speech/pipeline.py b/jarvis/speech/pipeline.py
index 77d2be0d73..8d9d7275a2 100644
--- a/jarvis/speech/pipeline.py
+++ b/jarvis/speech/pipeline.py
@@ -3109,10 +3109,7 @@ class SpeechPipeline:
task = getattr(self, "_probe_task", None)
if task is None or task.done():
return
- try:
- current = asyncio.current_task()
- except RuntimeError:
- current = None
+ current = asyncio.current_task(loop=task.get_loop())
if task is not current:
task.cancel()
@@ -3127,11 +3124,13 @@ class SpeechPipeline:
if not task.done():
task.cancel()
try:
- await task
- except asyncio.CancelledError:
- pass
- except Exception as exc: # noqa: BLE001 - preview failure is non-fatal
- log.debug("Stale STT preview cleanup failed: %s", exc)
+ outcome = (await asyncio.gather(task, return_exceptions=True))[0]
+ if isinstance(outcome, Exception):
+ log.debug("Stale STT preview cleanup failed: %s", outcome)
+ elif isinstance(outcome, BaseException) and not isinstance(
+ outcome, asyncio.CancelledError
+ ):
+ raise outcome
finally:
if getattr(self, "_probe_task", None) is task:
self._probe_task = None