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(voice): mission-failure announcements name the provider error class
Ruben Lütke452fbf440f43
diff --git a/jarvis/missions/voice/announcer.py b/jarvis/missions/voice/announcer.pyindex e10ff59a32..897d38db3f 100644--- a/jarvis/missions/voice/announcer.py+++ b/jarvis/missions/voice/announcer.py@@ -36,7 +36,7 @@ from typing import TYPE_CHECKING, Literalfrom jarvis.brain.output_filter import scrub_for_voicefrom jarvis.core.bus import EventBusfrom jarvis.core.events import AnnouncementRequested-from jarvis.missions.voice.readback import FAILURE_REASON_PHRASES+from jarvis.missions.voice.readback import FAILURE_REASON_PHRASES, failure_phrase_keyfrom jarvis.voice.contextual_readback import render_readbackif TYPE_CHECKING:@@ -240,7 +240,9 @@ class MissionAnnouncer:# boot. Map the reason to a short human cue so the user# knows what to do next.reason = (getattr(payload, "reason", "") or "").strip()- short_reason = reason.split(":", 1)[0].strip()+ short_reason = failure_phrase_key(+ reason, getattr(payload, "error_class", None)+ )# crash_recovery and interrupted are boot-time housekeeping, NOT# live failures: on every startup `startup_recover` sweeps# still-in-flight missions to FAILED('crash_recovery') ordiff --git a/jarvis/missions/voice/readback.py b/jarvis/missions/voice/readback.pyindex 52be16c0c6..0d380ac3fb 100644--- a/jarvis/missions/voice/readback.py+++ b/jarvis/missions/voice/readback.py@@ -198,6 +198,13 @@ FAILURE_REASON_PHRASES: Final[dict[str, dict[str, str]]] = {"Jarvis-Agents brauchen einen Git-Checkout, bitte über den " # i18n-allow"Git-Installer installieren, nicht als ZIP." # i18n-allow),+ # error_class keys (looked up BEFORE the reason key; see+ # failure_phrase_key). Same table so announcer + direct-TTS listener+ # cannot drift (2026-05-27 finding #7).+ "provider_auth": "Die Anmeldung beim KI-Anbieter ist ungültig oder abgelaufen.", # i18n-allow+ "provider_quota": "Das Kontingent des KI-Anbieters ist erschöpft.", # i18n-allow+ "provider_unreachable": "Der KI-Anbieter ist gerade nicht erreichbar.", # i18n-allow+ "worker_timeout": "Der Worker hat das Zeitlimit überschritten.", # i18n-allow},"en": {"critic_loop_exhausted": "Three attempts were not enough.",@@ -218,6 +225,10 @@ FAILURE_REASON_PHRASES: Final[dict[str, dict[str, str]]] = {"Jarvis-Agents require a git checkout (install via the ""git-based installer, not a ZIP download)."),+ "provider_auth": "The AI provider sign-in is invalid or expired.",+ "provider_quota": "The AI provider's quota is exhausted.",+ "provider_unreachable": "The AI provider is currently unreachable.",+ "worker_timeout": "The worker hit its time limit.",},# Spanish is an equal supported product-surface language (CLAUDE.md §1).# Only the two git-setup reason keys added with this fix carry ``es`` for@@ -233,6 +244,20 @@ FAILURE_REASON_PHRASES: Final[dict[str, dict[str, str]]] = {}+def failure_phrase_key(reason: str, error_class: str | None) -> str:+ """Pick the phrase-table key for a failed mission.++ A populated ``error_class`` (e.g. ``provider_auth``) is more specific+ than the mission-level ``reason`` (often the generic ``task_error``), so+ it wins whenever the table carries it. Falls back to the reason's short+ form. Single source for the announcer AND the direct-TTS listener.+ """+ ec = (error_class or "").strip()+ if ec and ec in FAILURE_REASON_PHRASES["en"]:+ return ec+ return (reason or "").split(":", 1)[0].strip()++def _truncate(text: str, max_chars: int = MAX_VOICE_CHARS) -> str:"""Truncate to max_chars; no suffix so TTS does not say '...'.@@ -320,8 +345,14 @@ class MissionReadback:safe_summary = safe_summary[:max_insert].rstrip()return _truncate(template.format(summary=safe_summary))- def render_failed(self, *, reason: str = "", language: Lang = "de") -> str:- short_reason = (reason or "").split(":", 1)[0].strip()+ def render_failed(+ self,+ *,+ reason: str = "",+ language: Lang = "de",+ error_class: str | None = None,+ ) -> str:+ short_reason = failure_phrase_key(reason, error_class)# crash_recovery and interrupted are swept/interrupted previous-session# missions, not live task failures — speak a dedicated non-alarming phrase# instead of framing them as "gescheitert. Grund: <reason>"@@ -393,4 +424,5 @@ __all__ = ["MissionReadback","READBACK_TEMPLATES","TemplateKey",+ "failure_phrase_key",]diff --git a/tests/missions/test_voice_announcer.py b/tests/missions/test_voice_announcer.pyindex 0f32b03234..75144f9c03 100644--- a/tests/missions/test_voice_announcer.py+++ b/tests/missions/test_voice_announcer.py@@ -392,6 +392,100 @@ async def test_failed_attempts_timed_out_speaks_honest_timeout(store_and_bus) ->)+async def test_failed_announcement_names_provider_auth_cause_de(store_and_bus) -> None:+ """error_class beats the generic reason phrase: a provider_auth failure+ must not be spoken as the meaningless "Der Worker ist abgebrochen." i18n-allow+ ("The worker aborted.")."""+ store, bus = store_and_bus+ speech_bus = EventBus()+ captured = _collect_announcements(speech_bus)++ announcer = MissionAnnouncer(bus=bus, store=store, speech_bus=speech_bus)+ await announcer.start()++ mid = await _seed_voice_mission(store, language="de")+ await store.append_and_publish(+ EventEnvelope(+ mission_id=mid,+ source_actor="kontrollierer",+ ts_ms=now_ms(),+ payload=MissionFailed(+ reason="task_error",+ error_class="provider_auth",+ last_state="RUNNING",+ partial_artifacts=[],+ ),+ )+ )++ assert len(captured) == 1+ assert "Anmeldung" in captured[0].text # i18n-allow: asserted German TTS output+++async def test_failed_announcement_names_provider_auth_cause_en(store_and_bus) -> None:+ """Same as above in English: the honest provider_auth cause must be+ spoken, never the generic 'worker aborted' phrasing."""+ store, bus = store_and_bus+ speech_bus = EventBus()+ captured = _collect_announcements(speech_bus)++ announcer = MissionAnnouncer(bus=bus, store=store, speech_bus=speech_bus)+ 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=MissionFailed(+ reason="task_error",+ error_class="provider_auth",+ last_state="RUNNING",+ partial_artifacts=[],+ ),+ )+ )++ assert len(captured) == 1+ assert "sign-in" in captured[0].text+ assert "worker aborted" not in captured[0].text.lower()+++async def test_failed_announcement_without_error_class_keeps_reason_phrase(+ store_and_bus,+) -> None:+ """No error_class populated (the common case for non-worker-caused+ failures) must keep behaving exactly as before: the reason-keyed phrase+ is spoken unchanged."""+ store, bus = store_and_bus+ speech_bus = EventBus()+ captured = _collect_announcements(speech_bus)++ announcer = MissionAnnouncer(bus=bus, store=store, speech_bus=speech_bus)+ 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=MissionFailed(+ reason="task_error",+ last_state="RUNNING",+ partial_artifacts=[],+ ),+ )+ )++ assert len(captured) == 1+ assert "The worker aborted." in captured[0].text++@pytest.mark.asyncioasync def test_interrupted_is_not_announced(store_and_bus) -> None:"""'interrupted' is startup-sweep housekeeping — the same suppression rule