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(brain): close review gaps in the local-outcome run_shell mandate
rubenluetke10-beep211c8a9bcbfb
diff --git a/jarvis/brain/local_outcome_gate.py b/jarvis/brain/local_outcome_gate.pyindex 6ba61fece1..24b22aea48 100644--- a/jarvis/brain/local_outcome_gate.py+++ b/jarvis/brain/local_outcome_gate.py@@ -115,6 +115,24 @@ _CLOUD_STORAGE_RE = re.compile(r"sharepoint|nextcloud|cloud)\b")+# A foreign-domain noun makes the generic FS noun AMBIENT, not the target:+# "Verschieb die Mail in einen anderen Ordner" is a mailbox operation on a+# mail FOLDER, not a disk folder — the plugin/calendar/contact flows own it.+# Unconditional co-occurrence stand-down (code-review finding 2026-08-08):+# ``requires_external_integration`` alone cannot catch these because it needs+# a DISPATCH verb (schick/sende/…), and the outcome verbs this gate matches+# (verschieb/loesch/kopier/…) are deliberately not dispatch verbs.+_FOREIGN_DOMAIN_RE = re.compile(+ r"\b(?:"+ r"mails?|e-?mails?|gmail|outlook|postfach|posteingang|inbox|" # i18n-allow+ r"nachrichten?|messages?|chats?|" # i18n-allow+ r"whatsapp|telegram|discord|slack|signal|"+ r"termine?|kalender\w*|calendar|events?|" # i18n-allow+ r"kontakte?|contacts?|adressbuch|" # i18n-allow+ r"spotify|playlists?|wiki|notizen?" # i18n-allow+ r")\b"+)+# Per-turn directive injected into the system prompt when the mandate fires# (English — LLM-facing, mirrors CONTACT_WRITE_DIRECTIVE / the read gate).RUN_SHELL_OUTCOME_DIRECTIVE = (@@ -154,6 +172,8 @@ def resolve_local_outcome_mandate(utterance: str) -> tuple[str, str] | None:return Noneif _CLOUD_STORAGE_RE.search(t):return None+ if _FOREIGN_DOMAIN_RE.search(t):+ return None# External dispatch ("schick … per Mail") — checked on the RAW text,# the detector does its own normalisation.if requires_external_integration(raw):diff --git a/jarvis/brain/manager.py b/jarvis/brain/manager.pyindex be1d1e77da..249d13f8fa 100644--- a/jarvis/brain/manager.py+++ b/jarvis/brain/manager.py@@ -5483,6 +5483,27 @@ class BrainManager:if n in allowed}+ def _image_turn_tool_override(self) -> dict[str, Tool]:+ """Tool surface for a turn that carries an attached image.++ Historically hard ``{}`` — an image turn answers from the pixels, so+ the tool loop was withheld entirely. But a WRITE mandate must survive+ it (code-review finding 2026-08-08): "erstell einen Ordner hier auf+ dem Desktop" matches the screen-intent phrase "hier auf dem", the+ explicit screen-context path attaches a screenshot, and zeroing the+ surface would blind the very run_shell call the local-outcome mandate+ requires — the honest "never ran" fallback would fire instead of the+ action. Mirrors the mandated-tool exemption in the smalltalk override+ above: ONLY the mandated write tool stays visible, every other tool+ keeps the historical image-turn hide.+ """+ if self._evidence_required_is_write and self._evidence_required_tool:+ return {+ n: t for n, t in self._tools.items()+ if n == self._evidence_required_tool+ }+ return {}+def _gate_screen_tool(self,tools: dict[str, Tool],@@ -9879,9 +9900,12 @@ class BrainManager:# Mirror the save mandate above: deterministically mandate run_shell so# the directive + honest write backstop turn "sometimes works" into# "always works or fails honestly". Never overrides an earlier mandate- # (read evidence / save — those are more specific), and degrades to no- # mandate when run_shell is not registered (§3 open-source).- if not self._evidence_required_tool:+ # (read evidence / save — those are more specific), stands down on a+ # skill-matched turn (AD-S3/AD-S9: a matched skill IS the capability+ # and must not be steamrolled by a generic shell mandate), and+ # degrades to no mandate when run_shell is not registered (§3+ # open-source).+ if not self._evidence_required_tool and self._skill_turn_match is None:from jarvis.brain.local_outcome_gate import resolve_local_outcome_mandate_local_mandate = resolve_local_outcome_mandate(user_text)@@ -10212,7 +10236,9 @@ class BrainManager:vision_capable_seen = True_turn_tools = (- {}+ # Image turn: pixels answer the turn — tools withheld, EXCEPT+ # a mandated write tool (see _image_turn_tool_override).+ self._image_turn_tool_override()if screen_context.has_imageelse self._smalltalk_tool_override() if is_smalltalk_turn# Non-smalltalk turn: drop plugin tools irrelevant to thisdiff --git a/scripts/ci/german-allowlist.txt b/scripts/ci/german-allowlist.txtindex 849b38a987..207c4f2886 100644--- a/scripts/ci/german-allowlist.txt+++ b/scripts/ci/german-allowlist.txt@@ -135,6 +135,7 @@ tests/unit/brain/test_local_action_gate.py# fixtures — content under test ---jarvis/brain/local_outcome_gate.pytests/unit/brain/test_local_outcome_gate.py+tests/unit/brain/test_image_turn_tool_override.py# --- DIRECT-path acknowledgement language test: proves the German open_app# launch ack is localized for English/Spanish turns and preserved for Germandiff --git a/tests/unit/brain/test_image_turn_tool_override.py b/tests/unit/brain/test_image_turn_tool_override.pynew file mode 100644index 0000000000..76ca73ceb3--- /dev/null+++ b/tests/unit/brain/test_image_turn_tool_override.py@@ -0,0 +1,54 @@+"""Image-turn tool surface: historically ``{}`` (pixels answer the turn), but+a mandated WRITE tool must survive it (code-review finding 2026-08-08).++"erstell einen Ordner hier auf dem Desktop" matches the screen-intent phrase+"hier auf dem", the explicit screen-context path attaches a screenshot, and+the old hard ``{}`` stripped the very ``run_shell`` call the local-outcome+mandate requires — the honest "never ran" fallback fired instead of the+action. Mirrors ``test_smalltalk_tool_visibility.py``.+"""++from __future__ import annotations++from jarvis.brain.manager import BrainManager+++def _mgr(tools: dict, *, required: str = "", is_write: bool = False) -> BrainManager:+ m = BrainManager.__new__(BrainManager) # bypass heavy __init__+ m._tools = tools+ m._evidence_required_tool = required+ m._evidence_required_is_write = is_write+ return m+++def test_image_turn_hides_all_tools_without_mandate() -> None:+ m = _mgr({"run_shell": object(), "spawn_worker": object(), "screenshot": object()})+ assert m._image_turn_tool_override() == {}+++def test_image_turn_keeps_only_the_mandated_write_tool() -> None:+ shell = object()+ m = _mgr(+ {"run_shell": shell, "spawn_worker": object(), "screenshot": object()},+ required="run_shell",+ is_write=True,+ )+ assert m._image_turn_tool_override() == {"run_shell": shell}+++def test_image_turn_read_mandate_keeps_the_historical_hide() -> None:+ # A READ mandate answers from the mandated tool's data path elsewhere;+ # the image-turn hide only widens for WRITE mandates.+ m = _mgr(+ {"cli_gcloud": object(), "screenshot": object()},+ required="cli_gcloud",+ is_write=False,+ )+ assert m._image_turn_tool_override() == {}+++def test_image_turn_mandated_tool_missing_degrades_to_empty() -> None:+ # Mandate for a tool that is not registered (deployment without run_shell)+ # must not crash and keeps the historical hide.+ m = _mgr({"screenshot": object()}, required="run_shell", is_write=True)+ assert m._image_turn_tool_override() == {}diff --git a/tests/unit/brain/test_local_outcome_gate.py b/tests/unit/brain/test_local_outcome_gate.pyindex 832134c80d..dc1b8b9e65 100644--- a/tests/unit/brain/test_local_outcome_gate.py+++ b/tests/unit/brain/test_local_outcome_gate.py@@ -46,6 +46,12 @@ NO_MANDATE_UTTERANCES = ["How do I create a folder on Windows?",# External dispatch — the integration machinery owns it."Schick die Datei bitte per Mail an Harald",+ # Foreign-domain noun alongside a generic FS noun (code-review finding+ # 2026-08-08): a mail FOLDER is a mailbox operation, not a disk folder.+ "Verschieb die Mail in einen anderen Ordner",+ "move the email to a different folder",+ "Lösch die WhatsApp-Nachrichten in dem Ordner",+ "Kopier den Termin in den Kalender-Ordner",# Cloud storage — not the local disk."Lad die Datei in mein Google Drive hoch",# Explicit GUI vehicle — computer-use owns the screen.