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(voice): a question about the machine is answered by reading it
Harald0349ded1ee66
diff --git a/jarvis/brain/tool_gateway.py b/jarvis/brain/tool_gateway.pyindex af3a350859..7860f60bc3 100644--- a/jarvis/brain/tool_gateway.py+++ b/jarvis/brain/tool_gateway.py@@ -62,6 +62,7 @@ class BrainSupervisorToolGateway:raw_risk_tier if raw_risk_tier in _VALID_RISK_TIERS else "monitor",)hook = getattr(tool, "risk_tier_for_args", None)+ impact = getattr(tool, "describe_args", None)descriptors.append(SupervisorToolDescriptor(name=str(name),@@ -70,6 +71,7 @@ class BrainSupervisorToolGateway:risk_tier=risk_tier,is_action_tool=bool(getattr(tool, "is_action_tool", False)),risk_tier_for_args=hook if callable(hook) else None,+ describe_args=impact if callable(impact) else None,))return tuple(descriptors)diff --git a/jarvis/brain/turn_planner.py b/jarvis/brain/turn_planner.pyindex 28351f7c97..88a328e4c1 100644--- a/jarvis/brain/turn_planner.py+++ b/jarvis/brain/turn_planner.py@@ -79,7 +79,21 @@ _LOOKUP_SHAPE_RE = re.compile(r"zeig\w*|lies|lese|list\w*|"r"find\w*|such\w*|pruef\w*|fass\w*|habe ich|hab ich|gibt es|"r"que|cuando|donde|cual\w*|quien|cuantos|muestra|lee|lista|"- r"busca|revisa|resume|tengo|hay)\b" # i18n-allow: multilingual speech-input matching data+ r"busca|revisa|resume|tengo|hay)\b|" # i18n-allow: multilingual speech-input matching data+ # Indirect questions. Spoken language wraps a lookup in a statement —+ # "ich möchte fragen, ob mein PC überlastet ist" carries no question word+ # and no question mark, so every question-word rule above missed it and+ # the whole sentence scored NO reason at all (live 2026-08-20 15:35: the+ # user asked twice about his own machine and got "actions don't work right+ # now" both times). The idiom is what makes it a lookup, not the+ # punctuation. # i18n-allow: quoted German utterance+ r"\b(?:moechte|will|wollte|wuerde gern\w*)\s+(?:mal\s+)?" # i18n-allow: speech input+ r"(?:kurz\s+)?(?:fragen|wissen)\b|" # i18n-allow: speech input+ r"\bfrage mich\b|\bsag mir\b|\bweisst du\b|" # i18n-allow: speech input+ r"\b(?:schau|guck|sieh|pruef)\w*\s+(?:mal\s+)?(?:nach|ob)\b|" # i18n-allow: speech input+ r"\bwondering (?:if|whether)\b|\btell me (?:if|whether)\b|"+ r"\bdo you know (?:if|whether)\b|\blet me know\b|"+ r"\bme pregunto si\b|\bdime si\b|\bsabes si\b" # i18n-allow: speech input)# "what is this/that ..." is deictic (the user points at something live),# not a request for a definition — it must stay eligible for delegation.@@ -265,6 +279,40 @@ _APP_STATE_RE = re.compile(r"mauszeiger\w*|weckwort\w*|" # i18n-allow: speech inputr"proveedor\w*|microfono\w*|tarea\w*|pantalla|volumen)\b" # i18n-allow: speech input)+# The health of the machine Jarvis runs on. Only the local system can answer+# "is my PC overloaded" — the live model's own knowledge cannot, and before+# this vocabulary existed such a turn scored NO reason, so it was neither+# routed to the orchestrator nor allowed to read the machine (live 2026-08-20+# 15:35). Gated like the app-state nouns above (lookup, action, or ownership)+# because "computer" and "battery" are ordinary words. "Temperatur" stays out+# on purpose — it belongs to the weather far more often than to a+# processor. # i18n-allow: names the German token left out+_MACHINE_STATE_RE = re.compile(+ r"\b(?:cpu\w*|gpu\w*|ram|processor\w*|hard\s?(?:disk|drive)|"+ r"memory usage|batter(?:y|ies)|"+ r"pc|computer\w*|laptop\w*|notebook\w*|macbook\w*|desktop machine|"+ r"prozessor\w*|arbeitsspeicher|festplatte\w*|" # i18n-allow: speech input+ r"akku\w*|batterie\w*|luefter|rechner\w*|" # i18n-allow: speech input+ # "lagt"/"ruckelt" describe a machine AND a game or a video, and the ASR+ # homophone "es legt" is a plain remark — so they stay in the GATED half:+ # they count when the sentence also points at the user or asks something+ # ("warum ruckelt mein PC"), never on their own. # i18n-allow: names the German tokens+ r"lagt|laggt|ruckelt|" # i18n-allow: speech input+ r"procesador\w*|memoria|disco duro|bateria|ordenador\w*|" # i18n-allow: speech input+ r"ventilador)\b" # i18n-allow: speech input+)+# The SYMPTOM half of the same question, and the reason it needs its own rule:+# "Ist der Rechner überlastet?" is a yes/no question — no question word, no+# possessive — so the gating condition above never fires and the sentence+# scored nothing. A symptom word IS the question; nothing but the local system+# can answer it. Bare mention, exactly like the other strong-evidence+# vocabularies. Over-matching a metaphor ("die Diskussion ist überhitzt") costs+# one delegation; under-matching loses the answer. # i18n-allow: quoted German utterances+_MACHINE_SYMPTOM_RE = re.compile(+ r"\b(?:overheat\w*|overload\w*|disk\s?space|fan speed|uptime|"+ r"ueberhitz\w*|ueberlast\w*|auslastung|speicherplatz|" # i18n-allow: speech input+ r"sobrecalent\w*|sobrecarg\w*|espacio en disco)\b" # i18n-allow: speech input+)# A person's contact detail is never a definition question, so this rule is# deliberately NOT gated on the definition shape ("What is Anna's number?")._CONTACT_DETAIL_RE = re.compile(@@ -892,6 +940,14 @@ def plan_turn(and (lookup or action_intent or private)):reasons.add(TurnReason.LOCAL_STATE)+ if (+ _MACHINE_STATE_RE.search(normalized)+ and not definition+ and (lookup or action_intent or private)+ ):+ reasons.add(TurnReason.LOCAL_STATE)+ if _MACHINE_SYMPTOM_RE.search(normalized) and not definition:+ reasons.add(TurnReason.LOCAL_STATE)# Deliberately not gated on the definition shape: "What is Anna's# phone number?" is a contact lookup, never a definition.if _CONTACT_DETAIL_RE.search(normalized) and (lookup or action_intent):diff --git a/jarvis/core/protocols.py b/jarvis/core/protocols.pyindex 7dcb87f11c..2ceb829945 100644--- a/jarvis/core/protocols.py+++ b/jarvis/core/protocols.py@@ -195,6 +195,13 @@ class SupervisorToolDescriptor:# 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+ # Optional per-call impact hook (same contract as ``Tool.describe_args``):+ # ``{"level": "read" | "modify" | "destructive", ...}``. Captured for the+ # same reason as the tier hook — the execute guard has to know whether THIS+ # call only reads. A tool whose consequence depends on its arguments+ # (``run_shell``: ``systeminfo`` reads, ``rm -rf`` destroys) is otherwise+ # judged by its worst possible call on every turn.+ describe_args: Any = None@dataclass(frozen=True, slots=True)diff --git a/jarvis/realtime/session.py b/jarvis/realtime/session.pyindex 874cb229bf..227fafbe1e 100644--- a/jarvis/realtime/session.py+++ b/jarvis/realtime/session.py@@ -8343,10 +8343,15 @@ class RealtimeVoiceSession:speakable = [r for r in results if not r.get("blocked")]if not speakable:# Every call the model made was gated away. Nothing ran, nothing- # broke: the honest line says actions were not available, and the- # continuation prompt (``_direct_tool_result_retry_prompt``) is what- # actually gets the turn answered inline.- return action_phrase("actions_unavailable", self._language), False+ # broke — and nothing is missing either, which is why this is NOT+ # the ``actions_unavailable`` outage line: that sentence tells the+ # user his assistant cannot act at all, and he heard it twice in+ # one call for a plain question about his PC (2026-08-20 15:35).+ # The gate declined a call his words never ordered; the line says+ # exactly that, and the continuation prompt+ # (``_direct_tool_result_retry_prompt``) is what actually gets the+ # turn answered inline.+ return action_phrase("actions_not_requested", self._language), Falsesucceeded = [r for r in speakable if r.get("success")]failed = [r for r in speakable if not r.get("success")]diff --git a/jarvis/realtime/tools.py b/jarvis/realtime/tools.pyindex 9c2d09986f..aede6933ce 100644--- a/jarvis/realtime/tools.py+++ b/jarvis/realtime/tools.py@@ -40,6 +40,7 @@ from jarvis.core.protocols import (SupervisorToolGateway,SupervisorToolRequest,)+from jarvis.safety.command_impact import READfrom jarvis.safety.tool_executor import VOICE_CONFIRM_SENTINELfrom jarvis.voice.echo_confirmation import classify_responsefrom jarvis.voice.tool_confirmation import format_tool_confirmation@@ -207,6 +208,38 @@ def _effective_call_tier(return static+def _call_only_reads(+ descriptor: SupervisorToolDescriptor,+ arguments: dict[str, Any] | None,+) -> bool:+ """True when THIS call's own arguments make it a pure read.++ Asks the tool's ``describe_args`` hook, whose ``level`` vocabulary is the+ one in :mod:`jarvis.safety.command_impact` (``read`` / ``modify`` /+ ``destructive``) — the same deterministic classification the confirmation+ question already speaks. No hook, no answer: absent evidence a call counts+ as consequential, never as a read.++ Live forensic 2026-08-20 15:35: "ob mein PC gerade überhitzt, überlastet+ ist" made the live model call ``run_shell``. The tool is statically a+ side-effect tool, so the shape gate below judged the call by the worst+ command ``run_shell`` could ever carry and refused a read of the user's own+ machine — twice in a row, and the user heard "actions don't work right+ now". A question about the user's world is exactly the turn a READ answers;+ the imperative rule exists for commands that CHANGE something.+ """+ hook = getattr(descriptor, "describe_args", None)+ if not callable(hook):+ return False+ try:+ described = hook(arguments if isinstance(arguments, dict) else {})+ except Exception: # noqa: BLE001 — a broken hook must not brick the call+ return False+ if not isinstance(described, dict):+ return False+ return str(described.get("level", "")).strip().lower() == READ++def _is_music_plugin(name: str) -> bool:try:from jarvis.core.music_constants import MUSIC_PLUGIN_IDS@@ -257,10 +290,14 @@ def _turn_shape_refusal(asks 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+ Both the tier and the consequence are per-call, not per-tool:+ ``risk_tier_for_args`` can mark a read such as ``now_playing`` ``safe``+ even when the tool is statically ``monitor``, and ``describe_args`` says+ whether THIS call's arguments only read. A call that only reads skips the+ imperative rule and lands on the world-reason rule instead — a question+ about the user's machine is answered by reading it, not by refusing. A+ music *write* (play/pause/skip) still needs an order — "Welches Lied" must+ not restart the player. # i18n-allowRead-only ``safe`` tools are never refused here. An empty utterance(non-conversational launch routes) fails open. Returns the model-facing@@ -288,7 +325,8 @@ def _turn_shape_refusal(if tier == "safe":return ""orders = is_action_order(text)- if tier in {"ask", "block"} or _is_side_effect_tool(descriptor):+ reads_only = _call_only_reads(descriptor, arguments)+ if not reads_only and (tier in {"ask", "block"} or _is_side_effect_tool(descriptor)):if orders:return ""return (@@ -299,7 +337,7 @@ def _turn_shape_refusal()if orders or is_assistant_tasking(text):return ""- if _is_music_plugin(name):+ if _is_music_plugin(name) and not reads_only: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 "diff --git a/jarvis/voice/action_phrases.py b/jarvis/voice/action_phrases.pyindex 08b766884b..5e86b97e0f 100644--- a/jarvis/voice/action_phrases.py+++ b/jarvis/voice/action_phrases.py@@ -298,6 +298,19 @@ _PHRASES: dict[str, dict[str, str]] = {"en": "I can't run actions right now, but we can keep talking.","es": "Ahora mismo no puedo ejecutar acciones, pero podemos seguir hablando.",},+ # Every tool the model reached for was GATED — the user's words did not ask+ # for it. Distinct from ``actions_unavailable`` above, which claims a+ # capability outage: nothing was broken or missing here, the guard simply+ # declined a call nobody ordered. Speaking the outage line for a gated call+ # told the user his assistant was crippled when it was not (live forensic+ # 2026-08-20 15:35, twice in one call, on a plain question about his PC),+ # and it named no cause — the standing rule is that a line like this always+ # says WHY. Ends with the one thing the user can act on.+ "actions_not_requested": {+ "de": "Ich habe dafür nichts ausgeführt — sag mir, was ich tun soll.", # i18n-allow+ "en": "I didn't run anything for that — tell me what you want done.",+ "es": "No ejecuté nada para eso — dime qué quieres que haga.",+ },# A local action that ran past its short deadline. Replaces the old# tool-name-prefixed "X timeout after 3s" machine string (which leaked the# internal tool name) with a plain, honest sentence.diff --git a/tests/fixtures/voice_scenarios/scenarios.yaml b/tests/fixtures/voice_scenarios/scenarios.yamlindex 242cf24c66..f39dcd857a 100644--- a/tests/fixtures/voice_scenarios/scenarios.yaml+++ b/tests/fixtures/voice_scenarios/scenarios.yaml@@ -133,3 +133,24 @@ scenarios:expect:spoken_equals: "Soll ich die Mail wirklich senden?"continues_turn: false++ - name: a-gated-call-is-not-a-broken-assistant+ why: >+ Live 2026-08-20 15:35 — a plain question about the user's own PC. The+ shape guard refused the read, and the user heard "Aktionen gehen gerade+ nicht": an outage that never happened, twice in one call. Nothing was+ missing; a call his words had not ordered was declined. The line says+ that, and names the one thing he can do about it.+ language: de+ user: "ich möchte fragen, ob mein PC gerade überlastet ist"+ tools:+ - name: run_shell+ outcome: blocked+ error: >+ run_shell was not run: the user's words do not order an action —+ they are a question, a remark, or a greeting.+ expect:+ spoken_excludes:+ - "Aktionen gehen gerade nicht"+ - "run_shell"+ continues_turn: truediff --git a/tests/unit/brain/test_factory_supervisor_gateway.py b/tests/unit/brain/test_factory_supervisor_gateway.pyindex c5c031ae63..a77a1c1e8f 100644--- a/tests/unit/brain/test_factory_supervisor_gateway.py+++ b/tests/unit/brain/test_factory_supervisor_gateway.py@@ -64,3 +64,24 @@ def test_catalog_carries_the_per_args_risk_tier_hook() -> None:assert descriptor.risk_tier == "monitor"assert descriptor.risk_tier_for_args({"action": "now_playing"}) == "safe"assert descriptor.risk_tier_for_args({"action": "play"}) == "monitor"+++def test_catalog_carries_the_per_args_impact_hook() -> None:+ """Without this the realtime shape guard cannot tell a read from a write.++ The guard's unit tests build descriptors by hand; only this one proves the+ hook survives the trip through the live catalog, which is where the+ 2026-08-20 15:35 refusal happened.+ """+ from jarvis.plugins.tool.run_shell import RunShellTool++ gateway = BrainSupervisorToolGateway(+ SimpleNamespace(_tools={"run_shell": RunShellTool()}, _tool_executor=None)+ )+ descriptor = gateway.catalog()[0]+ assert descriptor.name == "run_shell"+ assert descriptor.describe_args({"command": "systeminfo"})["level"] == "read"+ assert (+ descriptor.describe_args({"command": "Remove-Item C:/x -Recurse"})["level"]+ == "destructive"+ )diff --git a/tests/unit/brain/test_turn_planner.py b/tests/unit/brain/test_turn_planner.pyindex cb308e462e..408bd2471e 100644--- a/tests/unit/brain/test_turn_planner.py+++ b/tests/unit/brain/test_turn_planner.py@@ -908,3 +908,58 @@ def test_calendar_evidence_domain_is_connected_not_public(assert TurnReason.CONNECTED_DATA in plan.reasonsassert TurnReason.PUBLIC_FACT not in plan.reasonsassert plan.requires_public_fact_grounding is False+++# ---------------------------------------------------------------------------+# The user's own machine (live forensic 2026-08-20 15:35)+# ---------------------------------------------------------------------------+#+# Two turns in a row asked whether the PC was overloaded. Both scored NO reason+# at all: the health of the machine Jarvis runs on was nowhere in the planner's+# vocabulary, and an indirect question ("ich möchte fragen, ob ...") carries+# neither a question word nor a question mark. So the router sent a question+# only the local system can answer to a model that cannot, and the execute-time+# shape guard refused the read it would have taken to answer it.+++ "utterance",+ [+ # Verbatim from the transcript.+ (+ "Wie siehst eigentlich mit meinem Akku, wie siehst du " # i18n-allow: live utterance+ "mit meinem PC aus? Lagt er gerade komplett rum?" # i18n-allow: live utterance+ ),+ (+ "Nein, ich möchte fragen, ob mein PC gerade irgendwie " # i18n-allow: live utterance+ "komplett überhitzt, überlastet ist." # i18n-allow: live utterance+ ),+ # A yes/no question has no question word and needs no possessive.+ "Ist der Rechner überlastet?", # i18n-allow: German speech-input fixture+ "Wie voll ist meine Festplatte?", # i18n-allow: German speech-input fixture+ "Wie viel Speicherplatz habe ich noch?", # i18n-allow: German speech-input fixture+ "How is my CPU doing right now?",+ "Is the laptop overheating?",+ "¿Está sobrecargado mi ordenador?", # i18n-allow: Spanish speech-input fixture+ ],+)+def test_a_question_about_the_users_machine_is_local_state(utterance: str) -> None:+ assert TurnReason.LOCAL_STATE in plan_turn(utterance).reasons+++ "utterance",+ [+ # Smalltalk, gratitude and definitions keep scoring nothing — the+ # machine vocabulary must not turn conversation into a system probe.+ "Was geht ab?", # i18n-allow: German speech-input fixture+ "Okay.",+ "Hallo, sprich mal mit mir.", # i18n-allow: German speech-input fixture+ "Was ist ein Computer?", # i18n-allow: German speech-input fixture+ "Erzähl mir einen Witz.", # i18n-allow: German speech-input fixture+ "Danke dir, das war gut.", # i18n-allow: German speech-input fixture+ "Wer war Albert Einstein?", # i18n-allow: German speech-input fixture+ ],+)+def test_conversation_scores_no_machine_reason(utterance: str) -> None:+ assert TurnReason.LOCAL_STATE not in plan_turn(utterance).reasonsdiff --git a/tests/unit/realtime/test_hybrid_tool_mode.py b/tests/unit/realtime/test_hybrid_tool_mode.pyindex 1e9996e325..ea0ac9a86b 100644--- a/tests/unit/realtime/test_hybrid_tool_mode.py+++ b/tests/unit/realtime/test_hybrid_tool_mode.py@@ -628,3 +628,94 @@ def _wire_suffix(name: str) -> str:import hashlibreturn hashlib.sha256(name.encode("utf-8")).hexdigest()[:10]+++# --- A read is not an action (live forensic 2026-08-20 15:35) ---------------+++def _shell_descriptor() -> SupervisorToolDescriptor:+ """The REAL ``run_shell`` hooks, so this guard cannot drift from the tool."""+ from jarvis.plugins.tool.run_shell import RunShellTool++ tool = RunShellTool()+ return SupervisorToolDescriptor(+ name="run_shell",+ description="Run a shell command.",+ input_schema=tool.schema,+ risk_tier="monitor",+ risk_tier_for_args=tool.risk_tier_for_args,+ describe_args=tool.describe_args,+ )+++async def _shell_call(bridge, user_text: str, command: str):+ await bridge.handle_user_transcript(user_text)+ _name, result = await bridge.execute(+ wire_name="run_shell", arguments={"command": command}+ )+ return result+++def _shell_bridge():+ gateway = _RecordingGateway([_shell_descriptor()])+ return gateway, RealtimeToolBridge(gateway=gateway, language="de", compact=True)+++async def test_a_question_about_the_machine_may_read_the_machine():+ """The 15:35 transcript verbatim.++ "ob mein PC gerade überhitzt, überlastet ist" is a question, so the shape+ guard refused ``run_shell`` — judging the call by the worst command that+ tool could ever carry. The user asked twice and heard "Aktionen gehen+ gerade nicht" both times. A READ answers the question; it starts nothing.+ """+ gateway, bridge = _shell_bridge()+ asked = (+ "Nein, ich möchte fragen, ob mein PC gerade irgendwie " # i18n-allow: live utterance+ "komplett überhitzt, überlastet ist." # i18n-allow: live utterance+ )+ result = await _shell_call(bridge, asked, "systeminfo")+ assert result["success"] is True++ again = "Wie sieht es mit meinem PC aus? Lagt er gerade rum?" # i18n-allow: live utterance+ result = await _shell_call(+ bridge, again, "Get-Process | Sort-Object CPU -Descending"+ )+ assert result["success"] is True+ assert gateway.executed == ["run_shell", "run_shell"]+++async def test_a_question_still_starts_nothing_that_changes_the_machine():+ """The read exemption is per CALL, not per tool: the same question must+ not carry a command that deletes, moves or pushes anything."""+ gateway, bridge = _shell_bridge()+ question = "Ist der Rechner überlastet?" # i18n-allow: German speech-input fixture++ result = await _shell_call(bridge, question, "Remove-Item C:/temp -Recurse")+ assert result["success"] is False and "was not run" in result["error"]++ result = await _shell_call(bridge, question, "git push")+ assert result["success"] is False and "was not run" in result["error"]+ assert gateway.executed == []+++async def test_smalltalk_still_reads_nothing():+ """A read needs a reason in the user's words — the imperative is what it+ no longer needs. "Was geht ab?" asks for neither."""+ gateway, bridge = _shell_bridge()+ result = await _shell_call(bridge, "Was geht ab?", "systeminfo") # i18n-allow+ assert result["success"] is False and "was not run" in result["error"]+ assert gateway.executed == []+++async def test_an_explicit_order_still_runs_a_destructive_command():+ """The order path is untouched — the executor's confirmation owns it."""+ gateway, bridge = _shell_bridge()+ order = "Lösch bitte den Ordner Urlaub." # i18n-allow: German speech-input fixture+ result = await _shell_call(bridge, order, "Remove-Item C:/Urlaub -Recurse")+ assert result["success"] is True+ assert gateway.executed == ["run_shell"]diff --git a/tests/unit/realtime/test_multi_step_turn_is_finished.py b/tests/unit/realtime/test_multi_step_turn_is_finished.pyindex 614791123d..742fc19f42 100644--- a/tests/unit/realtime/test_multi_step_turn_is_finished.py+++ b/tests/unit/realtime/test_multi_step_turn_is_finished.py@@ -159,7 +159,10 @@ async def test_a_turn_that_only_got_blocked_is_not_reported_as_broken() -> None:text, succeeded = await sess._direct_tool_fallback_text()assert succeeded is False- assert text == action_phrase("actions_unavailable", sess._language)+ # A gated call is not a capability outage: the line names the real cause+ # instead of telling the user actions do not work at all (2026-08-20 15:35).+ assert text == action_phrase("actions_not_requested", sess._language)+ assert text != action_phrase("actions_unavailable", sess._language)assert "spawn_worker" not in text