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
feat(missions): speak a voice mission's result without an extra model call
rubenluetke10-beepaf19b64dc888
diff --git a/jarvis/missions/init.py b/jarvis/missions/init.pyindex 73aa5bcf4c..5347bdfa9b 100644--- a/jarvis/missions/init.py+++ b/jarvis/missions/init.py@@ -1321,19 +1321,10 @@ async def bootstrap_missions(# the listener is the direct-TTS fallback._readback_mode = _resolve_readback_mode(tts_speak_fn=tts_speak_fn, speech_bus=speech_bus)- # Context-aware readback composer (maintainer mandate: no fixed stock- # phrases). One instance shared by whichever readback path is active. Built- # in fallback-only mode when the flash path is off, so the spoken line is the- # existing canned/signed text unless [ack_brain] is enabled. Lazy import +- # best-effort so an import cycle / wiring fault never blocks the bootstrap.- _readback_composer = None- try:- from jarvis.brain.factory import build_readback_composer-- _readback_composer = build_readback_composer()- except Exception as exc: # noqa: BLE001- logger.warning("Mission readback composer wiring skipped: %s", exc)-+ # The spoken line is the mission's own signed summary or a fixed status+ # phrase — no extra model call rephrases it (2026-09-30: the flash+ # composer billed an API key for every background result). Inside a live+ # call the realtime model already words the announcement itself.voice_listener: MissionVoiceListener | None = Noneif _readback_mode == "listener":voice_listener = MissionVoiceListener(@@ -1343,7 +1334,6 @@ async def bootstrap_missions(tts_speak_fn=tts_speak_fn,announce_critic_loop=voice_announce_critic_loop,language_default=voice_language_default, # type: ignore[arg-type]- readback_composer=_readback_composer,)await voice_listener.start()logger.info("Phase-6 voice listener active (direct-TTS readback)")@@ -1367,7 +1357,6 @@ async def bootstrap_missions(speech_bus=speech_bus,announce_critic_loop=voice_announce_critic_loop,language_default=voice_language_default, # type: ignore[arg-type]- readback_composer=_readback_composer,)await mission_announcer.start()logger.info("Phase-6 mission-announcer active (mission-bus -> speech-bus)")diff --git a/jarvis/missions/voice/announcer.py b/jarvis/missions/voice/announcer.pyindex a3716b5f9e..e9e475d249 100644--- a/jarvis/missions/voice/announcer.py+++ b/jarvis/missions/voice/announcer.py@@ -32,7 +32,7 @@ from __future__ import annotationsimport jsonimport logging-from typing import TYPE_CHECKING, Literal+from typing import Literalfrom jarvis.brain.output_filter import scrub_for_voicefrom jarvis.brain.scrub_verdict import is_harmless_scrub_residue@@ -43,10 +43,6 @@ from jarvis.missions.voice.readback import (failure_phrase_key,render_agent_brand,)-from jarvis.voice.contextual_readback import render_readback--if TYPE_CHECKING:- from jarvis.voice.contextual_readback import ReadbackComposerfrom ..event_bus import MissionBusfrom ..event_store import MissionEventStore@@ -100,7 +96,6 @@ class MissionAnnouncer:scrub: bool = True,announce_critic_loop: bool = False,language_default: _Lang = "de",- readback_composer: ReadbackComposer | None = None,) -> None:self._bus = busself._store = store@@ -108,12 +103,6 @@ class MissionAnnouncer:self._scrub = scrubself._announce_critic_loop = announce_critic_loopself._lang_default: _Lang = language_default- # Context-aware readbacks (maintainer mandate: no fixed stock phrases).- # The signed/canned line from _render is the deterministic ground truth;- # the composer only rephrases it naturally, honesty-bound for the signed- # MissionApproved summary (ADR-0009 — rephrase, never invent). None =>- # the canned line is spoken unchanged (risk-free when unwired).- self._readback_composer = readback_composer# Cache (mission_id -> (is_voice_source, language))self._mission_voice_cache: dict[str, tuple[bool, _Lang]] = {}self._unsubscribe = None # set by start()@@ -142,30 +131,13 @@ class MissionAnnouncer:if not is_voice:return+ # The runtime-signed summary or a fixed status phrase, spoken as it+ # is: no model call rephrases it (2026-09-30). Inside a live call the+ # realtime model words it from this line; otherwise classic TTS reads it.text, priority = self._render(env, lang)if not text:return- # Context-aware rephrasing of the signed/canned line. honesty_bound for- # the MissionApproved summary so the spoken surface stays a faithful- # rephrasing of the Kontrollierer-signed observation (ADR-0009); failure/- # timeout/cancel are status, not observations, so they phrase more freely- # (digit + vocab guards + strict persona still apply). Falls back to the- # exact canned line on any miss (AD-OE6, zero silent drops).- instruction, honesty_bound = self._situation(env.payload)- canned_line = text- text = await render_readback(- self._readback_composer,- instruction=instruction,- language=lang,- canned=lambda: canned_line,- facts={"result": canned_line},- honesty_bound=honesty_bound,- latency_budget_ms=2500,- )- if not text:- return-if self._scrub:scrubbed = scrub_for_voice(text, language=lang)if scrubbed.actions:@@ -225,32 +197,6 @@ class MissionAnnouncer:detail["reason"] = payload.reasonreturn json.dumps(detail, ensure_ascii=True, separators=(",", ":"))- @staticmethod- def _situation(payload: object) -> tuple[str, bool]:- """English (instruction, honesty_bound) for a terminal mission event.-- ``honesty_bound`` is True ONLY for the signed success summary, so its- spoken surface stays a faithful rephrasing (ADR-0009). Failure / timeout- / cancel are status lines, not observations, so they phrase freely.- """- if isinstance(payload, MissionApproved):- return (- "A background task the user asked for has finished successfully; "- "tell them naturally, keeping the reported result faithfully.",- True,- )- if isinstance(payload, MissionFailed):- return (- "A background task the user asked for did not succeed; tell them "- "plainly and kindly, keeping any reason given.",- False,- )- if isinstance(payload, MissionTimedOut):- return ("A background task the user asked for ran out of time.", False)- if isinstance(payload, MissionCancelled):- return ("A background task the user asked for was cancelled.", False)- return ("A background task the user asked for has an update.", False)-def _render(self, env: EventEnvelope, lang: _Lang,) -> tuple[str, Literal["normal", "interrupt"]]:diff --git a/jarvis/missions/voice/listener.py b/jarvis/missions/voice/listener.pyindex 716ffa0319..8d0a9b1df0 100644--- a/jarvis/missions/voice/listener.py+++ b/jarvis/missions/voice/listener.py@@ -21,11 +21,9 @@ from __future__ import annotationsimport loggingfrom collections.abc import Awaitable, Callable-from typing import TYPE_CHECKINGfrom jarvis.brain.output_filter import scrub_for_voicefrom jarvis.brain.scrub_verdict import is_harmless_scrub_residue-from jarvis.voice.contextual_readback import render_readbackfrom ..event_bus import MissionBusfrom ..event_store import MissionEventStore@@ -41,10 +39,6 @@ from ..events import ()from .readback import Lang, MissionReadback-if TYPE_CHECKING:- from jarvis.voice.contextual_readback import ReadbackComposer--logger = logging.getLogger(__name__)@@ -66,7 +60,6 @@ class MissionVoiceListener:tts_speak_fn: TTSSpeakFn,announce_critic_loop: bool = False,language_default: Lang = "de",- readback_composer: ReadbackComposer | None = None,) -> None:self._bus = busself._store = store@@ -74,11 +67,6 @@ class MissionVoiceListener:self._tts = tts_speak_fnself._announce_critic_loop = announce_critic_loopself._lang_default = language_default- # Context-aware readbacks (maintainer mandate: no fixed stock phrases).- # The signed/canned line from _render is the ground truth; the composer- # rephrases it, honesty-bound for the signed MissionApproved summary- # (ADR-0009). None => canned line spoken unchanged (risk-free).- self._readback_composer = readback_composer# Cache: mission_id -> (is_voice, language). Filled lazily on the# first event per mission. None = not yet resolved.self._mission_voice_cache: dict[str, tuple[bool, Lang]] = {}@@ -101,28 +89,12 @@ class MissionVoiceListener:if not is_voice:return+ # The signed summary or a fixed status phrase, spoken as it is: no+ # model call rephrases it (2026-09-30).text = self._render(env, lang)if not text:return- # Context-aware rephrasing of the signed/canned line (maintainer mandate).- # honesty_bound only for the signed success summary (ADR-0009 — rephrase,- # never invent); other statuses phrase more freely. Falls back to the- # exact canned line on any miss (AD-OE6).- instruction, honesty_bound = self._situation(env.payload)- canned_line = text- text = await render_readback(- self._readback_composer,- instruction=instruction,- language=lang,- canned=lambda: canned_line,- facts={"result": canned_line},- honesty_bound=honesty_bound,- latency_budget_ms=2500,- )- if not text:- return-# Audit F-AUDIT-2: send the mission readback through the output# filter before handing it to TTS. Otherwise mission outputs with# tool-use markup / "Sir" address / engineering jargon reached the@@ -151,38 +123,6 @@ class MissionVoiceListener:await self._tts(scrubbed.cleaned, lang)- @staticmethod- def _situation(payload: object) -> tuple[str, bool]:- """English (instruction, honesty_bound) for a mission event.-- ``honesty_bound`` is True ONLY for the signed success summary, so its- spoken surface stays a faithful rephrasing (ADR-0009). Everything else is- status, not an observation, so it phrases freely.- """- if isinstance(payload, MissionApproved):- return (- "A background task the user asked for has finished successfully; "- "tell them naturally, keeping the reported result faithfully.",- True,- )- if isinstance(payload, MissionFailed):- return (- "A background task the user asked for did not succeed; tell them "- "plainly and kindly, keeping any reason given.",- False,- )- if isinstance(payload, MissionTimedOut):- return ("A background task the user asked for ran out of time.", False)- if isinstance(payload, MissionCancelled):- return ("A background task the user asked for was cancelled.", False)- if isinstance(payload, MissionBudgetWarning):- return ("A background task is approaching its budget limit.", False)- if isinstance(payload, WorkerKilled):- return ("A background task was stopped for a safety reason.", False)- if isinstance(payload, WorkerCorrectionRequired):- return ("A background task is still being worked on.", False)- return ("A background task the user asked for has an update.", False)-def _render(self, env: EventEnvelope, lang: Lang) -> str:"""Map event payload -> voice text. Empty string if the event typehas no voice response.diff --git a/tests/missions/test_voice_announcer.py b/tests/missions/test_voice_announcer.pyindex c89fd8216f..08566a5072 100644--- a/tests/missions/test_voice_announcer.py+++ b/tests/missions/test_voice_announcer.py@@ -30,28 +30,6 @@ from jarvis.missions.ids import uuid7_strfrom jarvis.missions.voice.announcer import MissionAnnouncer-class _FakeAckProvider:- """Minimal flash-provider stand-in for ReadbackComposer wiring tests."""-- def __init__(self, reply: str | None) -> None:- self.reply = reply-- async def run(self, utterance: str, language: str, *, persona_prompt: str) -> str | None:- return self.reply---def _composer_with(reply: str | None):- from jarvis.brain.ack_brain import CircuitBreaker- from jarvis.brain.ack_brain.config import AckBrainConfig- from jarvis.voice.contextual_readback import ReadbackComposer-- return ReadbackComposer(- provider=_FakeAckProvider(reply),- config=AckBrainConfig(timeout_ms=1500),- breaker=CircuitBreaker(threshold=3, cooldown_s=60),- )--@pytest.fixtureasync def store_and_bus(tmp_missions_db: Path):bus = MissionBus()@@ -154,56 +132,20 @@ async def test_approved_emits_announcement(store_and_bus) -> None:@pytest.mark.asyncio-async def test_approved_readback_is_contextually_rephrased(store_and_bus) -> None:- """With a composer wired, the signed summary is spoken in a fresh phrasing- (maintainer mandate: no fixed stock phrases) — but still faithfully."""- store, bus = store_and_bus- speech_bus = EventBus()- captured = _collect_announcements(speech_bus)-- announcer = MissionAnnouncer(- bus=bus, store=store, speech_bus=speech_bus,- readback_composer=_composer_with("All done — the mission completed."),- )- await announcer.start()-- mid = await _seed_voice_mission(store, language="en")- await store.append_and_publish(- EventEnvelope(- mission_id=mid,- source_actor="kontrollierer",- ts_ms=now_ms(),- payload=MissionApproved(- result_uri=f"mission://{mid}", tokens_used=100, cost_usd=0.05,- wall_ms=1000, summary_de="Mission abgeschlossen.",- summary_en="Mission completed.",- ),- )- )-- assert len(captured) == 1- text = captured[0].text- assert text != "Mission completed." # rephrased, not the canned summary- assert "completed" in text.lower() # but still faithful to the signed fact+async def test_the_signed_summary_is_spoken_without_a_model_call(store_and_bus) -> None:+ """No flash composer rephrases a mission result any more (2026-09-30): the+ announcer has no composer to wire, and the Kontrollierer-signed summary is+ the spoken line, verbatim (ADR-0009)."""+ import inspect--async def test_approved_falls_back_to_signed_summary_when_generation_fails(- store_and_bus,-) -> None:- """A composer whose provider yields nothing must fall back to the exact- Kontrollierer-signed summary (ADR-0009 + AD-OE6 zero silent drops)."""+ assert "readback_composer" not in inspect.signature(MissionAnnouncer).parametersstore, bus = store_and_busspeech_bus = EventBus()captured = _collect_announcements(speech_bus)-- announcer = MissionAnnouncer(- bus=bus, store=store, speech_bus=speech_bus,- readback_composer=_composer_with(""), # provider returns empty -> fallback- )+ announcer = MissionAnnouncer(bus=bus, store=store, speech_bus=speech_bus)await announcer.start()- mid = await _seed_voice_mission(store, language="de")+ mid = await _seed_voice_mission(store, language="en")await store.append_and_publish(EventEnvelope(mission_id=mid,@@ -217,8 +159,8 @@ async def test_approved_falls_back_to_signed_summary_when_generation_fails())- assert len(captured) == 1- assert captured[0].text == "Mission abgeschlossen."+ assert [a.text for a in captured] == ["Mission completed."]+ assert captured[0].kind == "subagent", "still owed to the user who asked"@pytest.mark.asyncio