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 never seizes the desktop — Computer-Use starts on an order, not on GUI vocabulary
rubenluetke10-beepa17502a97cab
diff --git a/jarvis/brain/local_action_gate.py b/jarvis/brain/local_action_gate.pyindex d076a007ac..1c46aee1f8 100644--- a/jarvis/brain/local_action_gate.py+++ b/jarvis/brain/local_action_gate.py@@ -188,6 +188,135 @@ _EXPLICIT_COMPUTER_USE_RE = re.compile()+# ---------------------------------------------------------------------------+# Question / narration guard (maintainer mandate 2026-08-25).+#+# Live bug, flight recorder 2026-08-25 16:50:08: "Wie nennt man das, wenn ...+# dann KLICKE ICH da drauf ... wie nennt sich das in der Fachsprache?" -- a pure+# vocabulary question -- was shipped verbatim to the computer-use harness. Two+# independent defects produced it:+#+# 1. ``_GUI_VERB_RE`` matched the narrated "klicke" and returned True BEFORE+# the instructional guard below could veto it, so a question that opens+# with "wie" could never be recognised as one.+# 2. The GUI-verb match ignored WHO acts. "klicke ICH" is the user describing+# their own habit; a command is addressed to Jarvis and carries no subject.+#+# The rule the maintainer stated: decide whether the turn is a TASK or a+# QUESTION. A polite request in question form stays a task ("Kannst du bitte+# einen Screenshot machen?") -- it carries no interrogative opener. An+# information question carries one and gives no order.+# ---------------------------------------------------------------------------++#: An interrogative that OPENS a clause -- at the start of the utterance or+#: right after a clause break. Trailing question clauses matter as much as+#: leading ones: the live utterance asked its real question in the LAST clause+#: ("..., wie nennt sich das in der Fachsprache?"), long after the narrated GUI+#: verb. Word-boundaried so "wo" never fires inside "worker" or "wonach".+_QUESTION_OPENER_RE = re.compile(+ r"(?:^|[,;:.!?]\s*|\b(?:und|oder|aber|and|or|but)\s+)"+ r"(?:"+ r"wie|was|warum|wieso|weshalb|wozu|wann|wo|wofuer|woran|worin|worum|"+ r"woher|wohin|wonach|welche[rsnm]?|wer|wen|wem|wessen"+ r"|how|what|why|when|where|which|who|whom|whose"+ r")\b",+ re.IGNORECASE,+)++#: 2nd-person imperative stems that address Jarvis. Mirrors the LLM-path guard+#: in ``jarvis.brain.tool_use_loop`` (``_IMPERATIVE_VERB_RE``) -- deliberately+#: kept to the desktop-control verbs this gate can actually route. German+#: infinitives cannot match: "oeffnen"/"klicken" carry no word boundary after+#: the imperative stem.+_ASSISTANT_IMPERATIVE_RE = re.compile(+ r"\b(?:"+ r"mach|mache|oeffne|starte|beende|schliess|schliesse|"+ r"klick|klicke|tipp|tippe|drueck|druecke|scroll|scrolle|"+ r"zeig|zeige|spiel|spiele|schreib|schreibe|such|suche|"+ r"wechsle|wechsel|geh|gehe|nimm|hol|hole|navigier|navigiere|"+ r"minimier|minimiere|maximier|maximiere|zieh|ziehe|verschieb|verschiebe"+ r"|open|close|click|type|press|scroll|show|play|write|search|switch|"+ r"start|launch|take|grab|drag|minimize|maximize|navigate"+ r")\b",+ re.IGNORECASE,+)++#: An explicit subject turns the identical German verb form into a 1st-person+#: indicative: "klicke ICH", "macht MAN", "gehe ICH". A real imperative never+#: carries one. Same token set as ``tool_use_loop._INDICATIVE_SUBJECT_RE`` so+#: the two guards classify the same sentence the same way.+_INDICATIVE_SUBJECT_AFTER_RE = re.compile(+ r"\s*(?:ich|man|wir|i|we|you|yo|uno)\b",+ re.IGNORECASE,+)+#: English (and the German infinitive marker) put the subject in FRONT of the+#: verb: "...how do I click", "...um zu klicken".+_INDICATIVE_SUBJECT_BEFORE_RE = re.compile(+ r"\b(?:i|you|we|they|to|ich|man|wir|zu)\s+$",+ re.IGNORECASE,+)+#: German subordinate clauses push the verb to the END, far from its subject:+#: "…, wenn ICH auf den roten Button KLICKE?". Adjacency alone therefore misses+#: the subject, so the clause in front of the verb is scanned as a whole. Only+#: 1st-person and impersonal subjects count here — never "du"/"you", which can+#: perfectly well address Jarvis ("du sollst mal runterscrollen" is an order,+#: not narration).+_CLAUSE_START_RE = re.compile(r"[,;:.!?]")+_NARRATING_SUBJECT_RE = re.compile(r"\b(?:ich|man|wir|i|we)\b", re.IGNORECASE)+++def _is_narrated(text: str, start: int, end: int) -> bool:+ """True when the verb at ``[start:end)`` carries an explicit subject.++ A described action ("dann klicke ich da drauf") is not an order. Same shape+ as ``spawn_gate._REPORTED_VEHICLE_RE``: the vocabulary matches, but the+ grammar says the user is reporting, not requesting.+ """+ before = text[:start]+ clause_breaks = list(_CLAUSE_START_RE.finditer(before))+ clause = before[clause_breaks[-1].end():] if clause_breaks else before+ return bool(+ _INDICATIVE_SUBJECT_AFTER_RE.match(text, end)+ or _INDICATIVE_SUBJECT_BEFORE_RE.search(before)+ or _NARRATING_SUBJECT_RE.search(clause)+ )+++def _has_assistant_imperative(text: str) -> bool:+ """True when the turn gives Jarvis an order somewhere in it."""+ return any(+ not _is_narrated(text, match.start(), match.end())+ for match in _ASSISTANT_IMPERATIVE_RE.finditer(text)+ )+++def _is_information_question(text: str) -> bool:+ """True when the turn ASKS something instead of ordering desktop work.++ Both halves are required. The interrogative opener alone would veto+ "Warum ist Spotify zu, mach es auf" -- which opens as a question and still+ ends in an order the user wants executed (the same stand-down as+ ``tool_use_loop._is_instructional_question``). An order alone is not enough+ either: "Kannst du bitte einen Screenshot machen?" carries no interrogative+ opener at all and stays a task.+ """+ if not _QUESTION_OPENER_RE.search(text):+ return False+ return not _has_assistant_imperative(text)+++def _has_commanding_gui_verb(text: str) -> bool:+ """True when a GUI verb is an ORDER, not the user narrating their own use.++ ``_GUI_VERB_RE`` alone matched "dann klicke ich da drauf" and handed a+ vocabulary question to the vision loop (live 2026-08-25).+ """+ return any(+ not _is_narrated(text, match.start(), match.end())+ for match in _GUI_VERB_RE.finditer(text)+ )++def _looks_like_desktop_control(text: str) -> bool:"""True for GUI-manipulation commands that should drive the computer-use loop.@@ -198,6 +327,14 @@ def _looks_like_desktop_control(text: str) -> bool:answer. The broader verbs are guarded against how-to questions so"wie navigiere ich…" / "wie mache ich einen Screenshot" stay brain answers."""+ # TASK or QUESTION — decided FIRST, for every branch below. Until 2026-08-25+ # the instructional guard sat UNDER the GUI-verb branch, so a question could+ # only ever be recognised when it contained no GUI vocabulary at all; the+ # narrated "klicke" inside a question about download terminology was enough+ # to seize the desktop. Nothing below can be desktop-control when the turn+ # asks a question and gives no order.+ if _is_information_question(text):+ return False# A "starte/oeffne X und Y" compound is desktop-control ONLY when X/Y is real# GUI work — never when it is heavy worker / research / sub-agent work. Live# bug 2026-06-15: "Starte eine Sub-Agent-Mission und recherchiere …" matched@@ -205,7 +342,9 @@ def _looks_like_desktop_control(text: str) -> bool:# verbs (klick/scroll/tippe/…) stay desktop-control regardless of the nouns.if _COMPOUND_OPEN_CONTROL_RE.match(text) and not _NOT_OPEN_APP_RE.search(text):return True- if _GUI_VERB_RE.search(text):+ # ...but only when the user ORDERS the click; "dann klicke ich da drauf" is+ # the user describing their own workflow (live 2026-08-25).+ if _has_commanding_gui_verb(text):return Trueif _OPEN_INSTRUCTIONAL_RE.search(text):return False@@ -967,6 +1106,11 @@ def _match_direct_open_app(text: str) -> LocalActionPlan | None:def _matches_visual_target(text: str) -> bool:+ # Same TASK-or-QUESTION rule as _looks_like_desktop_control: the leading+ # "klick" pattern also matches a narrated "Klick ich da jetzt drauf oder+ # nicht?", which is a question about the screen, not an order to touch it.+ if _is_information_question(text):+ return Falsereturn any(pattern.match(text) for pattern in _VISUAL_TARGET_PATTERNS)diff --git a/jarvis/brain/tool_use_loop.py b/jarvis/brain/tool_use_loop.pyindex a299a261f2..dd8872b1d6 100644--- a/jarvis/brain/tool_use_loop.py+++ b/jarvis/brain/tool_use_loop.py@@ -281,6 +281,12 @@ _SELF_IDENTIFICATION_RE = re.compile(_SIDE_EFFECT_TOOL_NAMES = {"click",+ # The LLM-visible computer-use tool was missing here while its internal+ # sibling ``dispatch_to_harness`` was listed, so the how-to-question guard+ # covered the deterministic path and left the model's own CU call open+ # (found while fixing the 2026-08-25 misroute of a vocabulary question onto+ # the screenshot harness). Both doors to the desktop are guarded now.+ "computer_use","dispatch_to_harness","dispatch_with_review","hotkey",diff --git a/tests/unit/brain/test_cu_vs_agentic_ide_routing.py b/tests/unit/brain/test_cu_vs_agentic_ide_routing.pyindex 93211d9ba2..87704b58ba 100644--- a/tests/unit/brain/test_cu_vs_agentic_ide_routing.py+++ b/tests/unit/brain/test_cu_vs_agentic_ide_routing.py@@ -17,6 +17,14 @@ that reads intent from single verbs cannot tell "copy this" from "copying isbroken", so the tie has to be broken by the stronger signal: the user named apane.+Since 2026-08-25 the desktop gate can also make that distinction itself. Its+TASK-or-QUESTION guard reads the clause+"wieso man ... nicht kopieren kann" # i18n-allow: quoted transcript+as a question and stands down. The pane-precedence rule below stays exactly as+it was — it is the layer that must hold when the wording is a genuine order+that merely sounds like desktop work, and one gate being fixed is no reason to+remove the other.+This is the sibling of ``test_cu_vs_spawn_routing.py``. There a depth marker("Deep Dive") wrongly beat an explicit screen request; here a screen verbwrongly beats an explicitly addressed terminal. Same shape, opposite direction:@@ -142,15 +150,24 @@ def _prompted(registry: Registry) -> list[str]:# --------------------------------------------------------------------------- #-def test_the_desktop_gate_really_does_claim_this_turn() -> None:- """Pin the precondition, so the guard below is never tested against a myth.+def test_the_desktop_gate_no_longer_claims_this_turn() -> None:+ """The root cause itself is gone as of 2026-08-25 — belt AND braces.++ This test used to pin the opposite: the desktop gate DID claim the turn,+ and only the pane-precedence rule below saved it. The header called that+ out as the real defect ("a gate that reads intent from single verbs cannot+ tell 'copy this' from 'copying is broken'"), and the TASK-or-QUESTION guard+ in ``local_action_gate`` now makes exactly that distinction: the clause+ "wieso man keine Texte rein kopieren KANN" # i18n-allow: quoted transcript+ asks about pasting, it does not order a paste.- If this ever stops holding, the ordering guard has become dead weight and- the tests that follow would pass for the wrong reason.+ The pane-precedence tests below are unaffected — they exercise+ ``intent.owns_turn`` and the end-to-end briefing directly, so they still+ fail loudly if the workspace ever stops owning an addressed turn. Two+ independent reasons now keep this utterance off the screen instead of one."""plan = match_local_action(LIVE_FAILURE, "de")- assert plan is not None- assert plan.mode is LocalActionMode.COMPUTER_USE+ assert plan is None or plan.mode is not LocalActionMode.COMPUTER_USEdef test_an_addressed_pane_outranks_the_desktop_gate() -> None:diff --git a/tests/unit/brain/test_local_action_gate.py b/tests/unit/brain/test_local_action_gate.pyindex 35fe7e86ba..7110e08b4a 100644--- a/tests/unit/brain/test_local_action_gate.py+++ b/tests/unit/brain/test_local_action_gate.py@@ -7,6 +7,7 @@ from jarvis.brain.local_action_gate import (LocalActionPlan,LocalToolCall,_CapabilityRegistryLike,+ _is_information_question,_unsupported_response,external_integration_terms,is_open_app_intent,@@ -1132,3 +1133,107 @@ def test_external_integration_terms_names_the_matched_systems() -> None:# matcher needs the product names a connected tool would carry.assert "twitter" in external_integration_terms("poste das auf X")assert external_integration_terms("analysier das repo") == ()+++# ---------------------------------------------------------------------------+# TASK or QUESTION (maintainer mandate 2026-08-25, flight recorder 16:50:08).+#+# "Wie nennt man das, wenn ... dann klicke ich da drauf ... wie nennt sich das+# in der Fachsprache?" - a vocabulary question - was shipped verbatim to the+# computer-use harness, which answered "Ich erledige das direkt am Bildschirm"+# and started clicking. The narrated "klicke" matched the GUI-verb branch, and+# that branch sat ABOVE the instructional guard, so a question containing any+# GUI word could never be recognised as a question.+#+# The rule: a turn that ASKS and gives no order never reaches the desktop; a+# polite request in question form ("Kannst du bitte einen Screenshot machen?")+# still does, because it carries no interrogative opener.+# ---------------------------------------------------------------------------++_LIVE_2026_08_25 = (+ "Wie nennt man das, wenn z.B. auf so einer Website auf so ein "+ "Download-Button geht oder auf IT-Fachsprache und sich dann eine App "+ "downloadet, nicht mehr in Ziel iCommand, sondern z.B. nicht in in den "+ "Chrome Browser runterladen will, dann gibt das so Download Chrome für "+ "Windows oder Mac Linux und dann klicke ich da drauf, dann wird irgendwie "+ "so eine Datei runtergeladen und dann so dann gehe ich halt durch diesen "+ "klassischen Downloading Prozess, wie nennt sich das in der Fachsprache?"+)+++ "utterance",+ [+ _LIVE_2026_08_25,+ # A GUI verb inside the QUESTION itself.+ "Wie klicke ich denn auf so einen Button?",+ "Was passiert, wenn ich auf den roten Button klicke?",+ "Wo klickt man da hin, um das Fenster zu schließen?",+ "Wieso scrollt die Seite nicht, wenn ich scrolle?",+ # Narration / complaint - the user reports, never orders.+ "Ich klicke da immer drauf und es passiert nichts, woran liegt das?",+ # Explanation requests that mention the harness or a window op.+ "Was ist Computer-Use eigentlich genau?",+ "Erklär mir mal, wie man ein Fenster minimiert",+ ],+)+def test_questions_never_seize_the_desktop(utterance: str) -> None:+ """A question is not a task - it must never reach the computer-use loop."""+ plan = match_local_action(utterance, _registry=None)+ assert plan is None or plan.mode is not LocalActionMode.COMPUTER_USE, (+ f"{utterance!r} wrongly routed to COMPUTER_USE: {plan} - the user "+ "asked something, they did not hand over the screen"+ )+++ "utterance",+ [+ # Bare imperatives.+ "Klick mal auf den grünen Button",+ "Mach einen Screenshot",+ "Scroll mal runter",+ "Minimier mal das Fenster",+ "Zieh das Fenster nach links",+ "Wechsel zum nächsten Tab",+ "Navigiere zu den Einstellungen",+ # A polite request IN QUESTION FORM is still a task - it carries no+ # interrogative opener, only a modal ("kannst/könntest du ...").+ "Kannst du bitte einen Screenshot machen?",+ "Kannst du mal auf den blauen Button klicken?",+ # Compound open-and-operate, and the named-instrument phrasing.+ "Öffne WhatsApp und schreib Mama hallo",+ "Mit Computer-Use in Spotify Shape of You abspielen",+ ],+)+def test_orders_still_reach_computer_use(utterance: str) -> None:+ """The guard must not cost a single real desktop command."""+ plan = match_local_action(utterance, _registry=None)+ assert plan is not None, f"{utterance!r} produced no plan at all"+ assert plan.mode is LocalActionMode.COMPUTER_USE, (+ f"{utterance!r} should drive the computer-use loop, got {plan.mode}"+ )+++ ("utterance", "is_question"),+ [+ # A question that ENDS in an order is an ORDER - the guard stands down+ # so the command can still run (same rule as+ # ``tool_use_loop._is_instructional_question``). That the window-op+ # pattern then fails to match "schliess ES" (noun before verb) is a+ # separate, pre-existing gap in _WINDOW_OP_RE, not this guard's doing.+ ("warum ist das fenster noch offen, schliess es mal", False),+ ("warum ist spotify nicht offen, mach es auf", False),+ # No interrogative opener at all - a polite order stays an order.+ ("kannst du bitte einen screenshot machen", False),+ # Pure questions, leading and trailing interrogative alike.+ ("wie klicke ich denn auf so einen button", True),+ ("das ist komisch, wieso scrollt die seite nicht", True),+ # "du" is the addressee, never a narrating subject: an order survives.+ ("du sollst mal runterscrollen", False),+ ],+)+def test_information_question_classifier(utterance: str, is_question: bool) -> None:+ """The TASK-or-QUESTION decision itself, on already-normalised input."""+ assert _is_information_question(utterance) is is_question