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): subagent switch picks the TARGET provider + accepts bare "codex"
Ruben Lütke0741a0241b61
diff --git a/jarvis/brain/app_control.py b/jarvis/brain/app_control.pyindex 526420779c..27564ab7d0 100644--- a/jarvis/brain/app_control.py+++ b/jarvis/brain/app_control.py@@ -623,7 +623,14 @@ async def _switch_subagent(}if canon not in JARVIS_TO_OPENCLAW:- known = ", ".join(sorted(JARVIS_TO_OPENCLAW))+ # List EVERY subagent-capable provider, not just the API/OpenClaw ones —+ # Codex and Antigravity route through their own workers, so omitting them+ # produced the false "codex is not a valid provider, only claude/gemini/+ # openai/openrouter" reply (forensic 2026-06-27).+ known = ", ".join(sorted(+ set(JARVIS_TO_OPENCLAW)+ | {CODEX_SUBAGENT_CANONICAL, ANTIGRAVITY_SUBAGENT_CANONICAL}+ ))return {"ok": False,"error_kind": "unknown_provider",diff --git a/jarvis/brain/voice_command_gate.py b/jarvis/brain/voice_command_gate.pyindex e89019610b..c30aa6055c 100644--- a/jarvis/brain/voice_command_gate.py+++ b/jarvis/brain/voice_command_gate.py@@ -148,21 +148,39 @@ _SUBAGENT_PREP = re.compile(r"\b(?:auf|zu|to)\b", re.IGNORECASE)_SUBAGENT_PROVIDER_NOUN = re.compile(r"\b(?:provider|anbieter)\b", re.IGNORECASE)+def _first_provider_word(text: str) -> str | None:+ """First provider alias in ``text``, scanned longest-first so 'openai-codex'+ wins over its 'openai' / 'codex' substrings."""+ for word in _SUBAGENT_PROVIDER_WORDS:+ if re.search(rf"\b{re.escape(word)}\b", text):+ return word+ return None++def _match_subagent_switch(t: str) -> str | None:if not _SUBAGENT_QUALIFIER.search(t):return None- for word in _SUBAGENT_PROVIDER_WORDS:- if re.search(rf"\b{re.escape(word)}\b", t):- # An explicit change verb is an unambiguous command. Otherwise accept- # only "... provider auf/to <X>" (a noun + preposition) so a STATEMENT- # like "der Sub-Agent läuft auf Gemini" (no verb, no 'provider' word)- # falls through to the brain instead of silently switching.- if _SUBAGENT_SWITCH_VERB.search(t):- return word- if _SUBAGENT_PREP.search(t) and _SUBAGENT_PROVIDER_NOUN.search(t):- return word- return None- return None+ # Gate: an explicit change verb is an unambiguous command; otherwise accept+ # only "... provider auf/to <X>" (a noun + preposition) so a STATEMENT like+ # "der Sub-Agent läuft auf Gemini" (no verb, no 'provider' word) falls through+ # to the brain instead of silently switching.+ if not (+ _SUBAGENT_SWITCH_VERB.search(t)+ or (_SUBAGENT_PREP.search(t) and _SUBAGENT_PROVIDER_NOUN.search(t))+ ):+ return None+ # The TARGET provider follows the directional preposition: "switch ... TO+ # codex", "von Antigravity AUF Codex". Look for a provider word AFTER the last+ # auf/zu/to first (the target); only then fall back to the whole sentence.+ # Without this the first word in alias-list ORDER wins, so "von Antigravity+ # auf Codex" switched to antigravity — the SOURCE, not the target (forensic+ # 2026-06-27).+ preps = list(_SUBAGENT_PREP.finditer(t))+ if preps:+ after_prep = _first_provider_word(t[preps[-1].end():])+ if after_prep:+ return after_prep+ return _first_provider_word(t)@dataclass(frozen=True)diff --git a/jarvis/missions/worker_runtime/provider_map.py b/jarvis/missions/worker_runtime/provider_map.pyindex 54d219cd84..99404a5b4c 100644--- a/jarvis/missions/worker_runtime/provider_map.py+++ b/jarvis/missions/worker_runtime/provider_map.py@@ -50,8 +50,13 @@ __all__ = [# (app_control._switch_subagent), the worker selector# (init._select_subagent_worker_kind) and the worker-env builder, so the# acceptance set can never drift across sites (BUG-008 class). The canonical-# persisted value is "openai-codex"; "chatgpt" is an accepted alias.-CODEX_SUBAGENT_SLUGS: Final[frozenset[str]] = frozenset({"openai-codex", "chatgpt"})+# persisted value is "openai-codex"; "chatgpt" and the bare spoken word "codex"+# are accepted aliases (the voice gate emits "codex"; forensic 2026-06-27 a+# "set the subagent to codex" answered "codex is not a valid provider" because+# the bare alias was missing here).+CODEX_SUBAGENT_SLUGS: Final[frozenset[str]] = frozenset(+ {"openai-codex", "chatgpt", "codex"}+)CODEX_SUBAGENT_CANONICAL: Final[str] = "openai-codex"diff --git a/tests/missions/worker_runtime/test_provider_map.py b/tests/missions/worker_runtime/test_provider_map.pyindex 6a0f13dfa9..dcc8032f9a 100644--- a/tests/missions/worker_runtime/test_provider_map.py+++ b/tests/missions/worker_runtime/test_provider_map.py@@ -216,3 +216,19 @@ def test_antigravity_subagent_slugs_ssot() -> None:assert ANTIGRAVITY_SUBAGENT_CANONICAL == "antigravity"# Not a MAPPINGS provider (OAuth CLI has no OpenClaw slug, like codex).assert "antigravity" not in JARVIS_TO_OPENCLAW+++def test_codex_subagent_slugs_accept_bare_codex_alias() -> None:+ """The voice gate emits the bare spoken word "codex"; the acceptance set must+ accept it. Forensic 2026-06-27: "set the subagent to codex" answered "codex+ is not a valid provider" because only "openai-codex"/"chatgpt" were accepted.+ "openai-codex" stays the canonical persisted value."""+ from jarvis.missions.worker_runtime.provider_map import (+ CODEX_SUBAGENT_CANONICAL,+ CODEX_SUBAGENT_SLUGS,+ )++ assert "codex" in CODEX_SUBAGENT_SLUGS+ assert "openai-codex" in CODEX_SUBAGENT_SLUGS+ assert "chatgpt" in CODEX_SUBAGENT_SLUGS+ assert CODEX_SUBAGENT_CANONICAL == "openai-codex"diff --git a/tests/unit/brain/test_voice_command_gate.py b/tests/unit/brain/test_voice_command_gate.pyindex b3080a1649..4e1052d5dd 100644--- a/tests/unit/brain/test_voice_command_gate.py+++ b/tests/unit/brain/test_voice_command_gate.py@@ -57,7 +57,58 @@ def test_harmless_does_not_match_provider(text: str) -> None:assert m is None or m.kind != "provider_switch"+ "text",+ [+ "Kannst du eine HTML-Datei machen, was morgen in Englisch drankommen kann?", # i18n-allow: German voice-command fixture+ "Mach mir eine Uebersicht auf Englisch.", # i18n-allow: German voice-command fixture+ ],+)+def test_artifact_requests_do_not_switch_reply_language(text: str) -> None:+ m = match_voice_command(text)+ assert m is None or m.kind != "language_switch"+++ "text,target",+ [+ ("stell auf Englisch um", "en"), # i18n-allow: German voice-command fixture+ ("antworte ab jetzt auf Englisch", "en"), # i18n-allow: German voice-command fixture+ ("respond in German", "de"),+ ],+)+def test_explicit_reply_language_switch_still_matches(text: str, target: str) -> None:+ m = match_voice_command(text)+ assert m is not None and m.kind == "language_switch"+ assert m.target == target++def test_cancel_and_depth_still_work() -> None:assert match_voice_command("jarvis stopp").kind == "cancel"assert match_voice_command("denk gründlich").kind == "depth_deep"assert match_voice_command("nimm haiku").kind == "depth_fast"+++def test_subagent_switch_picks_target_after_preposition_not_source() -> None:+ """ "von Antigravity auf Codex" must resolve to the TARGET (codex), not the+ mentioned SOURCE (antigravity). Forensic 2026-06-27: the alias-list-ORDER+ scan returned antigravity (it sits earlier in the list) so the worker was+ switched to the source the user was switching AWAY from."""+ m = match_voice_command(+ "stell den subagent provider von antigravity auf codex um"+ )+ assert m is not None and m.kind == "subagent_switch"+ assert m.target == "codex"+++def test_subagent_switch_longest_alias_after_preposition() -> None:+ # "openai-codex" must win over its "openai"/"codex" substrings after the prep.+ m = match_voice_command("wechsel den subagent von gemini auf openai-codex")+ assert m is not None and m.kind == "subagent_switch"+ assert m.target == "openai-codex"+++def test_subagent_switch_plain_target() -> None:+ m = match_voice_command("stell den subagent provider auf gemini")+ assert m is not None and m.kind == "subagent_switch"+ assert m.target == "gemini"