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(agentic-ide): stop a misheard CLI name from silently costing a pane
Ruben Lütke62d9d29fb2a0
diff --git a/jarvis/agentic_ide/intent.py b/jarvis/agentic_ide/intent.pyindex 259f36427d..5eaf5faf9f 100644--- a/jarvis/agentic_ide/intent.py+++ b/jarvis/agentic_ide/intent.py@@ -526,7 +526,73 @@ _NUMBER_WORDS: dict[str, int] = {# says a product name in full while talking. Everything else (including no# mention at all) leaves the choice to the registry, which inherits the last# pane's agent: "noch drei davon" is the common intent.-_AGENT_RE = re.compile(r"\b(claude(?:\s+code)?|codex)\b", re.IGNORECASE)+#+# The spellings below are matching DATA, not prose: speech recognition writes a+# product name by ear, and every one of these is something a transcript has+# actually said or is one keystroke away from it. A name this parser could not+# spell used to cost a whole pane — "two new Codex terminals and one Cloude code+# terminal" opened two panes and dropped the third in silence, because one+# unmatched word takes the entire group with it (maintainer report 2026-07-27).+# The user's STT dictionary repairs this too, but only for the words that user+# thought to add; an arbitrary downloader with an empty dictionary gets the same+# request and must get the same three panes.+_AGENT_SPELLINGS: dict[str, tuple[str, ...]] = {+ "claude": ("claude", "cloude", "claud", "clode", "klaude", "kloude"),+ "codex": ("codex", "kodex", "codecs", "codeks"),+}++# Spellings that are ordinary words in their own right, so on their own they+# mean nothing here — "in the cloud" is not a request for a pane. They count+# only with the product's second word behind them: "cloud code" is unmistakable.+_AGENT_SPELLINGS_REQUIRING_CODE: dict[str, tuple[str, ...]] = {+ "claude": ("cloud", "clawed", "clod", "loud"),+}++_AGENT_BY_SPELLING: dict[str, str] = {+ spelling: canonical+ for table in (_AGENT_SPELLINGS, _AGENT_SPELLINGS_REQUIRING_CODE)+ for canonical, spellings in table.items()+ for spelling in spellings+}+++def _agent_alternation() -> str:+ """The regex fragment matching every accepted spelling of a CLI's name.++ Longest first so a spelling that is the prefix of another (``claud`` of+ ``claude``) can never shadow it.+ """+ parts = [+ rf"{re.escape(spelling)}(?:\s+code)?"+ for table in (_AGENT_SPELLINGS,)+ for spellings in table.values()+ for spelling in spellings+ ]+ parts += [+ rf"{re.escape(spelling)}\s+code"+ for spellings in _AGENT_SPELLINGS_REQUIRING_CODE.values()+ for spelling in spellings+ ]+ return "|".join(sorted(parts, key=len, reverse=True))+++_AGENT_ALTERNATION = _agent_alternation()++_AGENT_RE = re.compile(rf"\b(?P<agent>{_AGENT_ALTERNATION})\b", re.IGNORECASE)+++def _canonical_agent(raw: str) -> str | None:+ """The CLI a matched name means, or ``None`` for one this parser cannot place.++ ``None`` is unreachable through the pattern above — every alternative it+ offers is a key of the table — and callers still handle it, because a+ spelling added to one and not the other must degrade to "no CLI named"+ rather than to a wrong one.+ """+ name = " ".join(str(raw or "").casefold().split())+ if name.endswith(" code"):+ name = name[: -len(" code")].strip()+ return _AGENT_BY_SPELLING.get(name)@dataclass(frozen=True, slots=True)@@ -590,7 +656,7 @@ _COUNT_AGENT_RE = re.compile(r"\b(?P<count>\d{1,3}|[a-zäöüñ]+)\s+" # i18n-allow: input vocabr"(?:(?:neue|weitere|zus[aä]tzliche|more|new|extra|additional|de|del|" # i18n-allow: input vocabr"otros|otras|m[aá]s|terminals?|terminales|panes?|tabs?)\s+){0,2}"- r"(?P<agent>claude(?:\s+code)?|codex)\b",+ rf"(?P<agent>{_AGENT_ALTERNATION})\b",re.IGNORECASE,)@@ -618,9 +684,9 @@ def _spoken_groups(text: str) -> tuple[SpawnGroup, ...]:if cleaned not in _NUMBER_WORDS:continuecount = _NUMBER_WORDS[cleaned]- agent = (- "codex" if match.group("agent").casefold().startswith("codex") else "claude"- )+ agent = _canonical_agent(match.group("agent"))+ if agent is None:+ continuefound.append(SpawnGroup(count=max(1, count), agent=agent))if len(found) < 2:@@ -732,7 +798,7 @@ def detect_spawn(agent_match = _AGENT_RE.search(text)agent: str | None = Noneif agent_match is not None:- agent = "codex" if agent_match.group(1).lower().startswith("codex") else "claude"+ agent = _canonical_agent(agent_match.group("agent"))count = _spoken_count(text)return SpawnTerminalsRequest(count=count,diff --git a/tests/unit/agentic_ide/test_spawn_misheard_agent_name.py b/tests/unit/agentic_ide/test_spawn_misheard_agent_name.pynew file mode 100644index 0000000000..f11dfd9c59--- /dev/null+++ b/tests/unit/agentic_ide/test_spawn_misheard_agent_name.py@@ -0,0 +1,82 @@+"""A misheard CLI name must never cost the user a pane.++Live failure (Realtime voice session 2026-07-27 18:10): "Could you please open+two new Codex terminals and one Claude Code terminal?" reached the spawn parser+as "... and one **Cloude** code terminal". Nothing in the pattern matched that+word, so the group vanished before anything could report it: two Codex panes+opened, and the model — seeing three panes asked for and two names back —+invented a reason for the third ("that service is unavailable right now") that+no layer had ever reported.++Two properties are pinned here, and they pull against each other on purpose:++* a name spelled the way speech recognition heard it still opens its panes, and+* a spelling that is an ordinary English word ("cloud") still means nothing on+ its own — otherwise the fix would turn every sentence about the cloud into a+ request for a Claude pane.+"""+from __future__ import annotations++import pytest++from jarvis.agentic_ide import intent+++def _groups(utterance: str) -> list[tuple[int, str | None]]:+ request = intent.detect_spawn(utterance)+ assert request is not None, utterance+ return [(g.count, g.agent) for g in request.groups]+++def test_the_live_failure_opens_all_three_panes() -> None:+ """The verbatim transcript, down to the misspelling the log recorded."""+ assert _groups(+ "Could you please open two new Codex terminals and one Cloude code terminal?"+ ) == [(2, "codex"), (1, "claude")]+++ "spelling",+ ["Claude", "Cloude", "Claud", "Clode", "Klaude"],+)+def test_every_accepted_spelling_reaches_the_same_cli(spelling: str) -> None:+ assert _groups(f"open two Codex terminals and one {spelling} terminal") == [+ (2, "codex"),+ (1, "claude"),+ ]++[email protected]("spelling", ["Codex", "Kodex", "Codecs"])+def test_the_other_cli_is_spelled_by_ear_too(spelling: str) -> None:+ assert _groups(f"open three {spelling} terminals") == [(3, "codex")]++[email protected]("spelling", ["Cloud", "Clawed", "Clod"])+def test_an_everyday_word_counts_only_with_the_products_second_word(+ spelling: str,+) -> None:+ """A pane needs "cloud code"; "cloud" on its own is not a CLI at all."""+ assert _groups(f"open two Codex terminals and one {spelling} Code terminal") == [+ (2, "codex"),+ (1, "claude"),+ ]+ # Same word, no "code" behind it: the pane is opened, but no CLI is named,+ # so the registry inherits the last pane's agent instead of guessing.+ assert _groups(f"open two {spelling} terminals") == [(2, None)]+++def test_the_misspelling_survives_the_other_locales() -> None:+ """Spanish and German utterances go through the same table, not a copy."""+ german = "öffne zwei neue Kodex Terminals und drei Cloude Code Terminals" # i18n-allow+ assert _groups(german) == [(2, "codex"), (3, "claude")]+ assert _groups("abre dos terminales de Codex y una terminal de Cloude Code") == [+ (2, "codex"),+ (1, "claude"),+ ]+++def test_a_name_the_table_does_not_know_names_no_cli() -> None:+ """Unknown stays unknown — a near-miss must never become the wrong CLI."""+ assert intent._canonical_agent("gemini") is None+ assert intent._canonical_agent("cloud") == "claude"+ assert intent._canonical_agent("Cloude Code") == "claude"diff --git a/tests/unit/realtime/test_dictionary_applies_in_realtime.py b/tests/unit/realtime/test_dictionary_applies_in_realtime.pynew file mode 100644index 0000000000..6c8261015a--- /dev/null+++ b/tests/unit/realtime/test_dictionary_applies_in_realtime.py@@ -0,0 +1,89 @@+"""The user's STT dictionary must apply in Realtime mode, not only in Pipeline.++Live failure (2026-07-27 18:10): the user had added "claude" to the dictionary,+the realtime provider still transcribed "Cloude", and the spawn parser dropped+the whole "one Claude Code terminal" group. The dictionary was never consulted —+a realtime provider transcribes inside the model, so no ``STTProvider`` is built+and the ``DictionaryCorrectingSTT`` decorator that makes the feature work is+never in the path. The Dictionary view even said so out loud.++Correction now happens where the input transcript enters the session, which is+the single string every consumer downstream reads. What is pinned here is that+it applies at all, that it is provider-agnostic (AP-21 — it repairs what the+model heard rather than asking a provider for a bias hook), and that a broken+dictionary costs the transcript nothing.+"""+from __future__ import annotations++from typing import Any++import pytest++from jarvis.realtime import session as session_module+from jarvis.speech import stt_dictionary+++def dictionary(monkeypatch: pytest.MonkeyPatch, tmp_path: Any) -> Any:+ """Install a real corrector over a temporary sidecar — no live user data."""++ def _install(*words: str) -> None:+ store = stt_dictionary.DictionaryStore(tmp_path / "stt_dictionary.json")+ for word in words:+ store.add(word)+ corrector = stt_dictionary.TranscriptCorrector(store.list_all())+ monkeypatch.setattr(stt_dictionary, "get_corrector", lambda *a, **k: corrector)++ return _install+++def test_the_live_failures_word_is_repaired(dictionary: Any) -> None:+ dictionary("claude")+ assert (+ session_module._dictionary_corrected("one Cloude code terminal")+ == "one claude code terminal"+ )+++def test_a_word_the_user_never_added_is_left_alone(dictionary: Any) -> None:+ """The dictionary is the user's list, not a spellchecker."""+ dictionary("Veltroc")+ assert (+ session_module._dictionary_corrected("one Cloude code terminal")+ == "one Cloude code terminal"+ )+++def test_an_empty_dictionary_returns_the_transcript_untouched(dictionary: Any) -> None:+ dictionary()+ text = "Could you please open two new Codex terminals?"+ assert session_module._dictionary_corrected(text) == text+++def test_an_unreadable_dictionary_never_costs_the_turn(+ monkeypatch: pytest.MonkeyPatch,+) -> None:+ """A custom word is an add-on; a fault in it must not swallow what was said."""++ def _boom(*_a: Any, **_k: Any) -> Any:+ raise RuntimeError("sidecar is mid-write")++ monkeypatch.setattr(stt_dictionary, "get_corrector", _boom)+ assert session_module._dictionary_corrected("open one terminal") == "open one terminal"+++def test_nothing_said_stays_nothing(dictionary: Any) -> None:+ dictionary("claude")+ assert session_module._dictionary_corrected("") == ""+++def test_the_correction_sits_where_every_consumer_reads_from() -> None:+ """Routing, the tool bridge and the published transcript share ONE string.++ Correcting per consumer is how they end up disagreeing about what was said,+ so the call belongs on the transcript the receive loop derives once.+ """+ import inspect++ source = inspect.getsource(session_module.RealtimeVoiceSession._pump_transport_once)+ assert '_dictionary_corrected(str(event.text or "").strip())' in source