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
fix(realtime): let now-playing questions run in hybrid (BUG-156)
Harald24f3969b78ee
diff --git a/docs/BUGS.md b/docs/BUGS.mdindex 6d2ddcbe7b..5d9db10fb2 100644--- a/docs/BUGS.md+++ b/docs/BUGS.md@@ -10777,3 +10777,154 @@ sibling. Covers every realtime transport; Vertex Live is the forensic.`tests/unit/brain/test_paired_plugin_capture_veto.py`(`test_capture_rematches_before_the_disconnected_veto`,`test_match_skill_for_turn_swaps_disconnected_spotify`).+++## BUG-155: "I'm still on it" during a realtime call speaks a different voice — native-tool progress and surface fallbacks default to Charon (HIGH, FIXED 2026-08-19)++**Symptom.** Realtime voice session `bc7e99c9` (2026-08-19 17:45, Vertex Live,+`gemini-live-2.5-flash-native-audio`, hybrid). The live replies were a+female native-audio voice. After the user confirmed a playlist start, a 13.7 s+`youtube_music` call ran and Jarvis said the German progress pool line+("still on it") in a different, male voice. The same flip hit the short+success and failure readbacks — every line that left the live socket.++**Reconstruction (`data/jarvis_desktop.log` + `voice_turns`).**++| Time | What spoke | Voice label |+|---|---|---|+| 17:45:19 | live native reply | *(empty — `_active_voice` was blank)* |+| 17:45:43 | surface TTS fallback of the short success | Charon @ vertex-tts |+| 17:46:20 | `native tool youtube_music still running after 3.0s; speaking the instant ack on the surface channel` | Charon @ vertex-tts |+| 17:46:37 | live native short "running" readback | *(empty; the progress line had already stamped Charon on the turn)* |+| 17:46:44 | surface TTS fallback of the canned failure | Charon @ vertex-tts |++`build_realtime_surface_tts` logged `same-family 'vertex-tts' (voice 'Charon')`+on the first fallback of the process.++**Root cause, two layers.**++1. *Vertex Live had no voice catalog.* `REALTIME_VOICES` / `REALTIME_MODELS`+ keyed only `gemini-live`. The Vertex card's picker was empty, so+ `[brain.providers.vertex-live].voice` was never written. The live adapter+ omitted `PrebuiltVoiceConfig` and Google picked its undocumented+ native-audio default (female on this box).+2. *Surface TTS had a different default.* `_active_voice` stayed `""`,+ `_surface_speech_message` sent no voice hint, and+ `build_realtime_surface_tts` hard-fell through to Charon (masculine).+ Native-tool acks cannot ride the live model (it is blocked on the+ function call, ADR-0034) so they *must* use that surface channel —+ and it was the wrong speaker.++Same class as BUG-089 / BUG-090 (a second voice mid-call) and the+rejected ADR-0033 alternative ("Surface TTS for the realtime ack — a+second voice mid-call is the exact BUG-090 failure"). The live-model+bridge path already keeps one voice; the native-tool / no-audio+surface path did not.++**Fix.**++- `REALTIME_VOICES["vertex-live"]` is the same 30-voice Gemini roster;+ `REALTIME_MODELS["vertex-live"]` leads with+ `gemini-live-2.5-flash-native-audio`. The Vertex card picker and+ preview work.+- `GeminiLiveProvider.default_voice = "Kore"` (inherited by Vertex Live).+ An empty card pin still sends `PrebuiltVoiceConfig` and fills+ `_active_voice`, so the live socket and the surface sibling name the+ same voice. A per-card pin still overrides it.+- `build_realtime_surface_tts(..., session_voice=)` takes the live+ session's voice first. The desktop `error_spoken` path passes the hint+ into the builder, not only into `synthesize`.++**Class rule.** A progress / fallback line mid-call is not a second+assistant. If the live model cannot speak it, the surface sibling must+use the session's voice name — never a family default that disagrees+with the socket. A realtime provider without a voice catalog cannot+keep that promise.++**Parity.** Catalog + default + surface hint cover gemini-live and+vertex-live (the two families with a same-voice TTS sibling).+openai-realtime / local-realtime have no surface TTS sibling; their+progress lines stay on the live socket or stay text-only.++**Guards.** `tests/unit/brain/test_model_catalog.py`+(`test_every_realtime_card_has_a_voice_catalog`,+`test_vertex_live_models_lead_with_the_hardcoded_default`);+`tests/unit/web/test_realtime_provider_category.py`+(`test_get_realtime_options_vertex_live_shares_the_gemini_voice_roster`);+`tests/unit/realtime/test_session.py`+(`test_active_provider_selection_falls_back_to_adapter_default_voice`,+`test_progress_line_carries_the_active_voice_hint`);+`tests/unit/realtime/test_gemini_live.py`+(`test_open_session_pins_the_adapter_default_voice_when_unset`);+`tests/unit/plugins/tts/test_realtime_surface_tts.py`+(`test_session_voice_override_wins_over_empty_config`).+++## BUG-156: "Welches Lied" while music plays answers "that did not work" — hybrid execute treated a now-playing read as smalltalk (HIGH, FIXED 2026-08-19) <!-- i18n-allow: quoted live German utterance under forensic analysis -->++**Symptom (Windows live forensic, 17:46, `vertex-live` /+`gemini-live-2.5-flash-native-audio`, hybrid tool mode).** Music was+playing. The user asked "Welches Lied". Jarvis spoke "Das hat gerade+nicht geklappt." Three seconds later the live model produced a 68-character+reply (the track name) and it was withheld because of the surface TTS+fallback. <!-- i18n-allow: quoted live German utterances and spoken replies under forensic analysis -->++**Timeline (`data/jarvis_desktop.log` + flight recorder, session+`bc7e99c9`).**++| Time | What happened |+|---|---|+| 17:46:38 | Previous turn said "Läuft." — Ed Sheeran *Perfect* was playing |+| 17:46:43 | User: "Welches Lied". Routing: orchestrator, `capability,connected_data` |+| 17:46:43 | Native `youtube_music` in 30 ms → `ActionDenied`: "nothing in the user's words asks for it" |+| 17:46:44 | Vertex Live interrupted; surface TTS of the 30-char canned failure |+| 17:46:47 | Live model audio 2.2 s / 38 chars, then another `youtube_music`, then 2.7 s / 68 chars — withheld after the fallback |++**Three stacked faults.**++1. *The shape guard used the static tool tier.* `youtube_music` is+ `monitor` because play mutates. `risk_tier_for_args(now_playing)` is+ `safe`. `_turn_shape_refusal` read only `descriptor.risk_tier`.+2. *Bare `plan_turn("Welches Lied")` had no reason.* The session planner+ saw a skill/capability. The execute guard calls `plan_turn` with no+ skill index and no context. `_CONNECTED_DOMAIN_RE` had gmail/calendar,+ not a now-playing question.+3. *The canned fallback hid the later correct reply.* Same Vertex empty+ generation + interrupt shape as BUG-152/153. The first fix is to let+ the read run so the grounded result is the track, not the denial.++**Fix.**++- Catalog descriptors carry `risk_tier_for_args`. The hybrid guard uses+ the per-call tier, so `now_playing` / empty args are `safe` and never+ shape-refused.+- A music *write* (play/pause/skip) still needs an action order —+ "Welches Lied" must not restart the player.+- Planner: service names (`spotify`, `youtube music`, `playlist`) join+ `_CONNECTED_DOMAIN_RE`. A dedicated now-playing matcher+ (`welches lied`, `what song is this`, `que cancion es`) adds+ `CONNECTED_DATA`. Bare `song`/`lied` stay out so "Which song won+ Eurovision?" remains a public fact. The matcher is also a+ non-public-evidence exception so a local model that requires+ public-fact grounding does not web-search the playing track.++**Class rule.** A read of connected state is not a side effect. Resolve+the risk tier per arguments at execute time. A now-playing question is+connected data, not smalltalk and not a public-song fact.++**Parity.** Session-level hybrid execute, every realtime transport+(`openai-realtime` / `gemini-live` / `vertex-live`). Direct and+delegate do not use this shape guard; they already reach `now_playing`+through the orchestrator. The planner change is shared, so classic chat+and the deterministic delegate get the same now-playing routing. Classic+pipeline and every OS.++**Guards.** `tests/unit/realtime/test_hybrid_tool_mode.py`+(`test_now_playing_question_runs_the_music_read`,+`test_now_playing_question_does_not_start_playback`);+`tests/unit/brain/test_turn_planner.py`+(`test_now_playing_questions_are_connected_data`,+`test_public_song_trivia_is_not_connected_music_state`,+`test_smalltalk_is_not_music_connected_data`);+`tests/unit/brain/test_factory_supervisor_gateway.py`+(`test_catalog_carries_the_per_args_risk_tier_hook`).diff --git a/jarvis/brain/tool_gateway.py b/jarvis/brain/tool_gateway.pyindex f844658a95..af3a350859 100644--- a/jarvis/brain/tool_gateway.py+++ b/jarvis/brain/tool_gateway.py@@ -61,6 +61,7 @@ class BrainSupervisorToolGateway:RiskTier,raw_risk_tier if raw_risk_tier in _VALID_RISK_TIERS else "monitor",)+ hook = getattr(tool, "risk_tier_for_args", None)descriptors.append(SupervisorToolDescriptor(name=str(name),@@ -68,6 +69,7 @@ class BrainSupervisorToolGateway:input_schema=copy.deepcopy(schema),risk_tier=risk_tier,is_action_tool=bool(getattr(tool, "is_action_tool", False)),+ risk_tier_for_args=hook if callable(hook) else None,))return tuple(descriptors)diff --git a/jarvis/brain/turn_planner.py b/jarvis/brain/turn_planner.pyindex 5ebe39457d..5dd6bb4223 100644--- a/jarvis/brain/turn_planner.py+++ b/jarvis/brain/turn_planner.py@@ -233,7 +233,24 @@ _CONNECTED_DOMAIN_RE = re.compile(r"github|gitlab|drive|notion|slack|discord|telegram|whatsapp|"r"repositor(?:y|ies)|pull requests?|deployments?|cloud billing|contact\w*|"r"postfach|posteingang|kalender|termin\w*|kontakt\w*|abrechnung\w*|"- r"correo|bandeja|calendario|cita\w*|contacto\w*)\b" # i18n-allow: speech input+ r"correo|bandeja|calendario|cita\w*|contacto\w*|"+ r"spotify|youtube\s+music|yt\s*music|ytmusic|playlist\w*)\b" # i18n-allow: speech input+)+# A now-playing question is the user's connected player, not public-song+# trivia and not smalltalk. Live 2026-08-19 17:46: "Welches Lied" while a+# track was playing. Bare "song"/"lied" stay out of _CONNECTED_DOMAIN_RE+# so "Which song won Eurovision?" remains a public fact.+_MUSIC_NOW_PLAYING_RE = re.compile(+ r"(?:"+ r"welches\s+lied|" # i18n-allow: spoken-input vocabulary+ r"welche\s+musik|" # i18n-allow: spoken-input vocabulary+ r"was\s+(?:fuer\s+(?:ein\s+)?)?(?:lied|song|musik)\s+(?:ist|laeuft|spielt)|" # i18n-allow+ r"what\s+song\s+is\s+(?:this|that|it)|"+ r"which\s+song\s+is\s+(?:this|that|it)|"+ r"what(?:'s|\s+is)\s+playing|"+ r"que\s+cancion\s+es|" # i18n-allow: spoken-input vocabulary+ r"now\s+playing"+ r")")# App/runtime nouns that are too common for the bare-mention LOCAL_STATE rule# — they count only combined with a lookup, action, or ownership signal,@@ -708,6 +725,7 @@ def is_public_fact_question(text: str) -> bool:or _APP_STATE_RE.search(normalized)or _OWNERSHIP_RE.search(normalized)or _CONNECTED_DOMAIN_RE.search(normalized)+ or _MUSIC_NOW_PLAYING_RE.search(normalized)or _CONTACT_DETAIL_RE.search(normalized)):return False@@ -866,6 +884,8 @@ def plan_turn(and (lookup or action_intent or private)):reasons.add(TurnReason.CONNECTED_DATA)+ if _MUSIC_NOW_PLAYING_RE.search(normalized) and not definition:+ reasons.add(TurnReason.CONNECTED_DATA)if (_APP_STATE_RE.search(normalized)and not definition@@ -1032,6 +1052,7 @@ def plan_turn(required_without_public_searchor evidence_domain_hitor _CONNECTED_DOMAIN_RE.search(normalized)+ or _MUSIC_NOW_PLAYING_RE.search(normalized)or _CONTACT_DETAIL_RE.search(normalized)or private):diff --git a/jarvis/core/protocols.py b/jarvis/core/protocols.pyindex 7386c238aa..7dcb87f11c 100644--- a/jarvis/core/protocols.py+++ b/jarvis/core/protocols.py@@ -191,6 +191,10 @@ class SupervisorToolDescriptor:input_schema: dict[str, Any]risk_tier: RiskTieris_action_tool: bool = False+ # Optional per-call hook (same contract as ``Tool.risk_tier_for_args``).+ # Catalog build captures it so the hybrid execute guard can treat a+ # ``now_playing`` read as ``safe`` without holding the Tool object.+ risk_tier_for_args: Any = None@dataclass(frozen=True, slots=True)diff --git a/jarvis/realtime/tools.py b/jarvis/realtime/tools.pyindex 13a6e6beeb..1b4a270a2f 100644--- a/jarvis/realtime/tools.py+++ b/jarvis/realtime/tools.py@@ -165,7 +165,48 @@ def _plugin_id_of(name: str) -> str:return pid if sep else ""-def _turn_shape_refusal(descriptor: SupervisorToolDescriptor, name: str, user_text: str) -> str:+_CALL_RISK_TIERS = frozenset({"safe", "monitor", "ask", "block"})+++def _effective_call_tier(+ descriptor: SupervisorToolDescriptor,+ arguments: dict[str, Any] | None,+) -> str:+ """Static descriptor tier, refined by ``risk_tier_for_args`` when present.++ ``youtube_music`` / ``spotify`` are statically ``monitor`` because play+ mutates. ``now_playing`` is ``safe``. Live 2026-08-19 17:46: the shape+ guard used only the static tier and refused "Welches Lied". # i18n-allow+ """+ static = str(getattr(descriptor, "risk_tier", "monitor") or "monitor")+ if static not in _CALL_RISK_TIERS:+ static = "monitor"+ hook = getattr(descriptor, "risk_tier_for_args", None)+ if not callable(hook):+ return static+ try:+ dynamic = hook(arguments if isinstance(arguments, dict) else {})+ except Exception: # noqa: BLE001 — a broken hook must not brick the call+ return static+ if dynamic in _CALL_RISK_TIERS:+ return str(dynamic)+ return static+++def _is_music_plugin(name: str) -> bool:+ try:+ from jarvis.core.music_constants import MUSIC_PLUGIN_IDS+ except Exception: # noqa: BLE001 — a missing constant must not brick the guard+ return False+ return name in MUSIC_PLUGIN_IDS+++def _turn_shape_refusal(+ descriptor: SupervisorToolDescriptor,+ name: str,+ user_text: str,+ arguments: dict[str, Any] | None = None,+) -> str:"""Refuse a native call whose tool the user's words cannot have asked for.The live model holds the whole catalog (ADR-0035) and, on a garbled or@@ -186,6 +227,11 @@ def _turn_shape_refusal(descriptor: SupervisorToolDescriptor, name: str, user_teasks for the user's world (a planner reason) — a turn with none ofthose ("Was geht ab?", "Okay.") gets no side effect. # i18n-allow: quoted utterances+ The effective tier is per-call: ``risk_tier_for_args`` can mark a read+ such as ``now_playing`` ``safe`` even when the tool is statically+ ``monitor``. A music *write* (play/pause/skip) still needs an order —+ "Welches Lied" must not restart the player. # i18n-allow+Read-only ``safe`` tools are never refused here. An empty utterance(non-conversational launch routes) fails open. Returns the model-facingrefusal text, or ``""`` to allow.@@ -208,7 +254,7 @@ def _turn_shape_refusal(descriptor: SupervisorToolDescriptor, name: str, user_te"Answer the user's actual request; call a plugin function only ""when the user names that service or clearly asks for it.")- tier = str(getattr(descriptor, "risk_tier", "monitor") or "monitor")+ tier = _effective_call_tier(descriptor, arguments)if tier == "safe":return ""orders = is_action_order(text)@@ -223,6 +269,13 @@ def _turn_shape_refusal(descriptor: SupervisorToolDescriptor, name: str, user_te)if orders or is_assistant_tasking(text):return ""+ if _is_music_plugin(name):+ return (+ f"{name} was not run: the user's words do not order an action — "+ "they are a question, a remark, or a greeting. Never start a "+ "consequential action from such a turn. Answer the user directly, "+ "or ask what they want done."+ )try:has_world_reason = bool(plan_turn(text).reasons)except Exception: # noqa: BLE001 — the planner must not brick a tool call@@ -390,12 +443,14 @@ class RealtimeToolBridge:raw_tier if raw_tier in {"safe", "monitor", "ask", "block"}else "monitor",)+ hook = getattr(tool, "risk_tier_for_args", None)descriptors[str(name)] = SupervisorToolDescriptor(name=str(name),description=str(getattr(tool, "description", "")),input_schema=schema,risk_tier=risk_tier,is_action_tool=bool(getattr(tool, "is_action_tool", False)),+ risk_tier_for_args=hook if callable(hook) else None,)return descriptors@@ -788,7 +843,7 @@ class RealtimeToolBridge:# a fresh turn to shape-check: "Yes." orders nothing by itself.return ""else:- message = _turn_shape_refusal(descriptor, name, user_text)+ message = _turn_shape_refusal(descriptor, name, user_text, arguments)if not message:return ""await self._publish_denied(name, message)diff --git a/tests/unit/brain/test_factory_supervisor_gateway.py b/tests/unit/brain/test_factory_supervisor_gateway.pyindex d7cadba606..c5c031ae63 100644--- a/tests/unit/brain/test_factory_supervisor_gateway.py+++ b/tests/unit/brain/test_factory_supervisor_gateway.py@@ -41,3 +41,26 @@ def test_factory_registration_publishes_manager_and_public_gateway() -> None:gateway = runtime_refs.get_supervisor_tool_gateway()assert isinstance(gateway, BrainSupervisorToolGateway)assert [descriptor.name for descriptor in gateway.catalog()] == ["health"]+++def test_catalog_carries_the_per_args_risk_tier_hook() -> None:+ class _Music:+ name = "youtube_music"+ description = "Play and read YouTube Music."+ schema = {"type": "object", "properties": {}}+ risk_tier = "monitor"++ async def execute(self, _arguments, _context):+ return ToolResult(success=True, output="ok")++ def risk_tier_for_args(self, args):+ action = str((args or {}).get("action") or "now_playing")+ return "safe" if action == "now_playing" else "monitor"++ gateway = BrainSupervisorToolGateway(+ SimpleNamespace(_tools={"youtube_music": _Music()}, _tool_executor=None)+ )+ descriptor = gateway.catalog()[0]+ assert descriptor.risk_tier == "monitor"+ assert descriptor.risk_tier_for_args({"action": "now_playing"}) == "safe"+ assert descriptor.risk_tier_for_args({"action": "play"}) == "monitor"diff --git a/tests/unit/brain/test_turn_planner.py b/tests/unit/brain/test_turn_planner.pyindex b5b6f1d512..cb308e462e 100644--- a/tests/unit/brain/test_turn_planner.py+++ b/tests/unit/brain/test_turn_planner.py@@ -252,6 +252,38 @@ def test_plural_connected_domains_never_route_to_public_search(assert PUBLIC_FACT_GROUNDING_CAPABILITY not in plan.required_capabilities+ "utterance",+ [+ "Welches Lied", # i18n-allow: live 2026-08-19 17:46+ "Welche Musik läuft?", # i18n-allow: spoken-input fixture+ "What song is this?",+ "Que cancion es esta?", # i18n-allow: spoken-input fixture+ ],+)+def test_now_playing_questions_are_connected_data(utterance: str) -> None:+ plan = plan_turn(utterance, requires_public_fact_grounding=True)+ assert TurnReason.CONNECTED_DATA in plan.reasons+ assert plan.path is TurnPath.ORCHESTRATOR+ assert plan.requires_public_fact_grounding is False+ assert PUBLIC_FACT_GROUNDING_CAPABILITY not in plan.required_capabilities+ assert is_public_fact_question(utterance) is False+++def test_public_song_trivia_is_not_connected_music_state() -> None:+ plan = plan_turn(+ "Which song won Eurovision 2023?",+ requires_public_fact_grounding=True,+ )+ assert TurnReason.CONNECTED_DATA not in plan.reasons+++def test_smalltalk_is_not_music_connected_data() -> None:+ plan = plan_turn("Was geht ab?") # i18n-allow: spoken-input fixture+ assert TurnReason.CONNECTED_DATA not in plan.reasons+ assert plan.path is TurnPath.NATIVE_REALTIME++def test_read_only_dynamic_connector_matches_live_capability(registry: CapabilityRegistry,) -> None:diff --git a/tests/unit/realtime/test_hybrid_tool_mode.py b/tests/unit/realtime/test_hybrid_tool_mode.pyindex 8d3af2d718..1e9996e325 100644--- a/tests/unit/realtime/test_hybrid_tool_mode.py+++ b/tests/unit/realtime/test_hybrid_tool_mode.py@@ -381,16 +381,33 @@ def _music_services_are_local(monkeypatch):)-def _descriptor_with_tier(name: str, tier: str) -> SupervisorToolDescriptor:+def _descriptor_with_tier(+ name: str, tier: str, *, risk_tier_for_args=None+) -> SupervisorToolDescriptor:return SupervisorToolDescriptor(name=name,description=f"{name} tool",input_schema={"type": "object", "properties": {}},risk_tier=tier, # type: ignore[arg-type]is_action_tool=False,+ risk_tier_for_args=risk_tier_for_args,)+def _music_read_tier(args: dict) -> str:+ action = str((args or {}).get("action") or "now_playing").strip() or "now_playing"+ if action in {+ "now_playing",+ "search",+ "list_playlists",+ "playlist_tracks",+ "liked_songs",+ "list_devices",+ }:+ return "safe"+ return "monitor"++class _RecordingGateway:def __init__(self, descriptors):self._items = tuple(descriptors)@@ -554,6 +571,59 @@ async def test_disconnected_music_tool_reroutes_to_the_connected_sibling(assert gateway.executed == ["youtube_music"]+async def test_now_playing_question_runs_the_music_read():+ """Live 2026-08-19 17:46: 'Welches Lied' while a track was playing.++ youtube_music is statically monitor because play mutates. now_playing+ is safe per args. The shape guard used the static tier and treated the+ question as smalltalk — ActionDenied, canned failure spoken.+ """+ gateway = _RecordingGateway(+ [+ _descriptor_with_tier(+ "youtube_music", "monitor", risk_tier_for_args=_music_read_tier+ ),+ _descriptor_with_tier("spotify", "monitor"),+ ]+ )+ bridge = RealtimeToolBridge(gateway=gateway, language="de", compact=True)+ result = await _call(bridge, "youtube_music", "Welches Lied") # i18n-allow+ assert result["success"] is True+ assert gateway.executed == ["youtube_music"]++ result = await _call(bridge, "youtube_music", "What song is this")+ assert result["success"] is True++ result = await _call(+ bridge, "youtube_music", "Que cancion es esta?" # i18n-allow+ )+ assert result["success"] is True++ result = await _call(bridge, "spotify", "Was geht ab?") # i18n-allow+ assert result["success"] is False and "was not run" in result["error"]+ assert gateway.executed == ["youtube_music", "youtube_music", "youtube_music"]+++async def test_now_playing_question_does_not_start_playback():+ gateway = _RecordingGateway(+ [+ _descriptor_with_tier(+ "youtube_music", "monitor", risk_tier_for_args=_music_read_tier+ ),+ ]+ )+ bridge = RealtimeToolBridge(gateway=gateway, language="de", compact=True)+ await bridge.handle_user_transcript("Welches Lied") # i18n-allow+ _name, result = await bridge.execute(+ wire_name="youtube_music", arguments={"action": "play"}+ )+ assert result["success"] is False+ assert "was not run" in result["error"]+ assert gateway.executed == []++def _wire_suffix(name: str) -> str:import hashlib