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): a brief for a pane whose call-sign was garbled no longer opens one
rubenluetke10-beepd3f6d61ed087
diff --git a/jarvis/agentic_ide/intent.py b/jarvis/agentic_ide/intent.pyindex 7cfc0ffc5f..778515e1a7 100644--- a/jarvis/agentic_ide/intent.py+++ b/jarvis/agentic_ide/intent.py@@ -1554,13 +1554,15 @@ def _spoken_count(text: str) -> int:# Read the FIRST number in speech order. Searching all digits before number# words contradicted this function's contract and turned "five terminals;# each may start 50 workers" into a request for 50 terminals.+ #+ # An article that sizes nothing is skipped rather than read (``_count_at``),+ # so a task word behind the fleet ("… und mach einen Deep Dive") cannot+ # become the fleet's size. The default of one still stands behind it: a+ # request with no number at all ("mach das Terminal auf") is one pane.for match in re.finditer(r"\b(?:\d{1,3}|[^\W\d_]+)\b", text, re.UNICODE):- raw = match.group(0).casefold()- if raw.isdigit():- return max(1, min(int(raw), MAX_TERMINALS))- cleaned = "".join(ch for ch in raw if ch.isalpha())- if cleaned in _NUMBER_WORDS:- return max(1, min(_NUMBER_WORDS[cleaned], MAX_TERMINALS))+ value = _count_at(text, match)+ if value is not None:+ return max(1, min(value, MAX_TERMINALS))return 1@@ -1592,6 +1594,45 @@ _COUNT_TOKEN_RE = re.compile(r"\b(?:\d{1,3}|[^\W\d_]+)\b", re.UNICODE)_COUNT_AGENT_MAX_GAP = 40+#: Number words that are ALSO the indefinite article, in all three locales.+#:+#: They have to be counted — "mach noch ein Terminal auf" is a real request for+#: one pane, and dropping them cost the user that pane. They also occur in+#: ordinary speech constantly, attached to nothing this parser cares about:+#: "also ein Deep Dive machen soll" is the live 2026-08-13 failure, where the+#: article sitting behind a mis-transcribed call-sign became the size of a+#: fleet nobody asked for.+#:+#: ``names._NUMBER_WORDS`` refuses the article outright and says why. It cannot+#: be refused here, because sizing a fleet with it is a real request — so it+#: has to EARN the reading instead, from what it stands in front of. "eins" and+#: "uno" are absent on purpose: those are the bare numbers, never articles.+_ARTICLE_ONES: frozenset[str] = frozenset(+ # i18n-allow: speech-recognition input vocabulary, not prose+ {"ein", "eine", "einen", "a", "an", "un", "una"}+)++#: How many words may sit between the article and the thing it sizes. Two, the+#: same bound ``_COUNT_AGENT_RE`` allows between a count and its CLI: enough for+#: "ein weiteres neues Terminal", too few to reach across into another clause.+_ARTICLE_FILLER_WORDS = 2++#: What an article must be sizing to count as a number: panes, or a coding CLI+#: standing in for them ("mach noch einen Codex auf"). Anchored at the article+#: and bounded by the filler above, so the evidence has to be adjacent — an+#: article whose noun is a Deep Dive sizes nothing here.+_ARTICLE_SIZES_RE = re.compile(+ rf"\s*(?:[^\W\d_]+\s+){{0,{_ARTICLE_FILLER_WORDS}}}"+ rf"(?:{_PANE_NOUN_RE.pattern}|{_AGENT_RE.pattern})",+ re.IGNORECASE,+)+++def _article_sizes_something(text: str, end: int) -> bool:+ """Whether the article ending at ``end`` is sizing panes rather than prose."""+ return _ARTICLE_SIZES_RE.match(text, end) is not None++def _count_of(raw: str) -> int | None:"""The number a token means, or None when it is not a number at all."""token = raw.casefold()@@ -1601,6 +1642,23 @@ def _count_of(raw: str) -> int | None:return _NUMBER_WORDS.get(cleaned)+def _count_at(text: str, match: re.Match[str]) -> int | None:+ """``_count_of`` with the sentence around the token taken into account.++ The one place that knows an article is only a number when it sizes+ something. Every reader of a count goes through it, so the group parser and+ the fallback cannot drift into two different opinions about whether "ein"+ was a one.+ """+ value = _count_of(match.group(0))+ if value is None:+ return None+ cleaned = "".join(ch for ch in match.group(0).casefold() if ch.isalpha())+ if cleaned in _ARTICLE_ONES and not _article_sizes_something(text, match.end()):+ return None+ return value++def _count_tokens(text: str) -> list[tuple[int, int, int]]:"""Every number in ``text`` as ``(start, end, value)``, spoken forms joined.@@ -1614,7 +1672,7 @@ def _count_tokens(text: str) -> list[tuple[int, int, int]]:raw = [(match.start(), match.end(), value)for match in _COUNT_TOKEN_RE.finditer(text)- if (value := _count_of(match.group(0))) is not None+ if (value := _count_at(text, match)) is not None]joined: list[tuple[int, int, int]] = []for start, end, value in raw:diff --git a/jarvis/agentic_ide/names.py b/jarvis/agentic_ide/names.pyindex 4d69a689d6..6f3ae65687 100644--- a/jarvis/agentic_ide/names.py+++ b/jarvis/agentic_ide/names.py@@ -268,11 +268,20 @@ _POSITION_PATTERNS: tuple[re.Pattern[str], ...] = (# layer up as a fleet size — two fresh panes opened for a brief aimed at# T2). Consonants only, so a real word ("Typ", "ten", "the") that happens# to start with t never smuggles a number into a position.+ #+ # The cluster may also sit GLUED to the number, which is the same garble+ # one space tighter: "Terminal T1" came back as "Terminal TR1" live on+ # 2026-08-13, the repair above needed the space it did not have, and the+ # turn fell through to the spawn path — a fresh Codex pane opened and was+ # briefed while T1 sat idle. Requiring the space was the whole bug; the+ # consonant class is what keeps the branch honest either way, and a+ # number word behind the cluster still wins by backtracking ("terminal+ # two" is two, never a "tw" cluster in front of a number that is not there).re.compile(rf"\b{_PANE_NOUN}\s*"# i18n-allow: speech-recognition input vocabulary, not proserf"(?:(?:nummer|nr\.?|number|n[uú]mero)\s*)?"- rf"(?:t[bcdfghjklmnpqrstvwxz]{{0,3}}\s+)?"+ rf"(?:t[bcdfghjklmnpqrstvwxz]{{0,3}}\s*)?"rf"(?P<value>\d{{1,3}}|{_NUMBER_WORD_ALT})\b",re.IGNORECASE,),diff --git a/jarvis/agentic_ide/session.py b/jarvis/agentic_ide/session.pyindex c52a072745..1d70301680 100644--- a/jarvis/agentic_ide/session.py+++ b/jarvis/agentic_ide/session.py@@ -3739,6 +3739,8 @@ class Registry:The agent defaults to the anchor's, because splitting a Claude Code paneusually means "another one of these" — but a caller may name anyinstalled agent, which is how the UI offers a choice of coding CLI.+ Without an anchor there is no "these" to copy, so the workspace's+ prevailing CLI decides instead (``_prevailing_agent``).``account`` names which subscription of that agent to run on. Withoutone, every new pane opens on the workspace's active account@@ -3766,7 +3768,15 @@ class Registry:if base is None:base = session.terminals[-1] if session.terminals else None- chosen = agent or (base.agent if base else "claude")+ # A named CLI wins; a SPLIT inherits its anchor ("another one of+ # these"); everything else takes the workspace's prevailing CLI+ # rather than the last pane's — see ``_prevailing_agent``.+ if agent:+ chosen = agent+ elif anchor and base is not None:+ chosen = base.agent+ else:+ chosen = _prevailing_agent(session)if not is_runnable(chosen):raise SessionError(f"Unknown agent: {chosen}")if agent_argv(chosen) is None:@@ -4558,6 +4568,43 @@ class Registry:return SessionError(f"No terminal called {wanted!r}. Running: {known or 'none'}.")+def _prevailing_agent(session: Session) -> str:+ """The coding CLI an anchor-less new pane should run.++ An add with NO anchor is the batch behind "open five more", the voice spawn+ path, and the empty grid's button. None of them points at a pane, so none of+ them says which CLI is meant — and the answer has to come from the workspace+ itself.++ Copying the LAST pane was the old answer and the wrong one. ``_renumber``+ sorts the list into the grid's reading order, so "last" means the pane+ furthest bottom-right — whatever happened to be opened most recently, which+ is exactly the pane a user is least likely to mean. Live 2026-08-13: five+ Claude panes and ONE Codex pane opened minutes earlier for an unrelated+ errand, and a spoken order produced a sixth pane running Codex.++ The majority is what "another one of these" means for a workspace as a+ whole, and it is stable under the gesture that caused the surprise — one odd+ pane cannot flip it. A tie falls to the first pane in reading order, so the+ answer is deterministic rather than dependent on how the dict happened to+ iterate, and an empty grid falls back to the default CLI.++ A SPLIT is deliberately not routed through here: it names its anchor, and+ splitting a Claude pane really does mean "another one of these".+ """+ counts: dict[str, int] = {}+ for term in session.terminals:+ if term.agent:+ counts[term.agent] = counts.get(term.agent, 0) + 1+ if not counts:+ return "claude"+ most = max(counts.values())+ for term in session.terminals:+ if term.agent and counts[term.agent] == most:+ return term.agent+ return "claude"++def _unique_name(wanted: str, used: set[str]) -> str:"""``wanted`` if it is free, otherwise the nearest name that is.diff --git a/tests/unit/agentic_ide/test_briefed_pane_is_not_a_fleet.py b/tests/unit/agentic_ide/test_briefed_pane_is_not_a_fleet.pynew file mode 100644index 0000000000..f6cd34878d--- /dev/null+++ b/tests/unit/agentic_ide/test_briefed_pane_is_not_a_fleet.py@@ -0,0 +1,191 @@+"""One spoken brief for one existing pane must never open a new one.++The live 2026-08-13 failure, end to end. The maintainer said, of a workspace+holding five Claude panes and one Codex pane:++ "prompten, bitte Terminal TR1, also ein Deep Dive machen soll und mal+ gucken, wo wir aktuell mit dem Jarvis Marketplace stehen"++T1 sat idle. A sixth pane opened, running CODEX, and the composed brief was+typed into it. Three independent layers each failed open in the same direction,+and it took all three to produce that outcome:++1. **The call-sign was unreadable.** Speech recognition wrote "TR1" for "T1".+ The 2026-08-12 repair for exactly this garble required a SPACE between the+ consonant debris and the number ("terminal tft zwei"), so the glued form+ matched nothing and no pane was addressed.+2. **The article became the fleet size.** With no pane addressed, the spawn+ path read the first number-ish word in the clause — "also **ein** Deep Dive"+ — as a request for one terminal. ``names`` refuses the indefinite article as+ a number and says why; the spawn parser did not.+3. **The new pane copied the wrong CLI.** No CLI was named, so the pane+ inherited the agent of the LAST pane in reading order — a Codex pane opened+ minutes earlier for an unrelated errand.++Each layer is pinned separately below, because each one is independently+wrong and any of them could regress on its own.+"""+from __future__ import annotations++from pathlib import Path++import pytest++from jarvis.agentic_ide import session as session_mod+from jarvis.agentic_ide.intent import detect, detect_spawn+from jarvis.agentic_ide.session import Registry+from tests.fakes.fake_pty_manager import FakePtyManager++#: The workspace as it stood: T5 and T7 had been closed, so the free position+#: the new pane took was T5 — the numbers are not contiguous, which is normal.+PANES = ["T1", "T2", "T3", "T4", "T6", "T8"]++#: The transcript as recorded, trimmed to the sentence that carried the order.+LIVE = (+ # i18n-allow: verbatim spoken transcript under test+ "prompten, bitte Terminal TR1, also ein Deep Dive machen soll und mal "+ "gucken, wo wir aktuell mit dem Jarvis Marketplace stehen"+)+++class TestTheGarbledCallSignStillAddressesItsPane:+ """Layer 1: "TR1" is T1, however tightly the debris is glued on."""++ def test_the_live_utterance_addresses_t1(self) -> None:+ found = detect(LIVE, names=PANES)+ assert found is not None+ assert found.terminal == "T1"+ assert found.kind == "prompt"++ @pytest.mark.parametrize(+ "utterance",+ [+ "prompte Terminal TR1, mach einen Deep Dive", # i18n-allow: input vocab under test+ "prompte Terminal TF1, mach einen Deep Dive", # i18n-allow: input vocab under test+ "prompte Terminal TT1, mach einen Deep Dive", # i18n-allow: input vocab under test+ "prompt terminal tr1 to do a deep dive",+ ],+ )+ def test_every_glued_garble_reaches_the_same_pane(self, utterance: str) -> None:+ found = detect(utterance, names=PANES)+ assert found is not None+ assert found.terminal == "T1"+++class TestABriefIsNotAFleetOrder:+ """Layer 2: the sentence asks one pane for work, so nothing may open."""++ def test_the_live_utterance_opens_nothing(self) -> None:+ assert detect_spawn(LIVE, names=PANES) is None++ @pytest.mark.parametrize(+ "utterance",+ [+ "prompte Terminal TR1, mach einen Deep Dive", # i18n-allow: input vocab under test+ "prompte Terminal T1, mach einen Deep Dive", # i18n-allow: input vocab under test+ "prompte Terminal tft zwei, mach einen Deep Dive", # i18n-allow: input vocab under test+ ],+ )+ def test_a_briefed_pane_never_opens_a_fleet(self, utterance: str) -> None:+ assert detect_spawn(utterance, names=PANES) is None+++class TestTheArticleMustSizeSomething:+ """Layer 2, the half that survives an unreadable call-sign.++ An article is the number one only in front of the thing it sizes. Both+ directions matter: dropping it entirely would cost the user the pane they+ asked for in the most ordinary phrasing there is.+ """++ @pytest.mark.parametrize(+ ("utterance", "expected"),+ [+ ("mach noch ein Terminal auf", 1), # i18n-allow: input vocab under test+ ("öffne ein weiteres Terminal", 1), # i18n-allow: input vocab under test+ ("mach noch einen Codex auf", 1), # i18n-allow: input vocab under test+ ("open a terminal", 1),+ ("abre una terminal", 1),+ # No number at all still means one pane — the default stands.+ ("mach das Terminal auf", 1), # i18n-allow: input vocab under test+ # Counts that are real numbers are untouched by any of this.+ ("öffne zwei Terminals", 2), # i18n-allow: input vocab under test+ ("spawn 5 Codex terminals", 5),+ # i18n-allow: input vocab under test+ ("öffne drei Claude Code Terminals und zwei Codex", 5),+ ],+ )+ def test_a_sizing_article_still_counts(self, utterance: str, expected: int) -> None:+ request = detect_spawn(utterance, names=PANES)+ assert request is not None+ assert request.count == expected++ def test_an_article_in_the_task_half_is_not_a_count(self) -> None:+ """"… und mach einen Deep Dive" sizes nothing and must add no pane."""+ request = detect_spawn(+ # i18n-allow: input vocab under test+ "öffne zwei Terminals und mach einen Deep Dive",+ names=PANES,+ )+ assert request is not None+ assert request.count == 2+++class TestANewPaneRunsTheWorkspacesCli:+ """Layer 3: an anchor-less pane follows the majority, not the last pane."""++ @pytest.fixture(autouse=True)+ def _isolated_recents(+ self,+ tmp_path_factory: pytest.TempPathFactory,+ monkeypatch: pytest.MonkeyPatch,+ ) -> None:+ """Keep the recents file out of the developer's real data directory."""+ from jarvis.agentic_ide import recents++ store = tmp_path_factory.mktemp("recents") / "recents.json"+ monkeypatch.setattr(recents, "_store_path", lambda: store)++ @pytest.fixture+ def registry(self, monkeypatch: pytest.MonkeyPatch) -> Registry:+ monkeypatch.setattr(session_mod, "agent_argv", lambda name: (f"/usr/bin/{name}",))+ return Registry(pty_manager=FakePtyManager())++ async def test_the_odd_pane_at_the_end_does_not_decide(+ self, registry: Registry, tmp_path: Path+ ) -> None:+ """The live grid: five Claude panes, then one Codex pane, then a batch."""+ await registry.start(+ str(tmp_path),+ [{"agent": "claude"} for _ in range(5)] + [{"agent": "codex"}],+ )+ created, _capped = await registry.add_terminals(1)+ assert [t.agent for t in created] == ["claude"]++ async def test_a_named_cli_still_wins(+ self, registry: Registry, tmp_path: Path+ ) -> None:+ """Asking for Codex in a Claude workspace opens Codex."""+ await registry.start(str(tmp_path), [{"agent": "claude"} for _ in range(3)])+ created, _capped = await registry.add_terminals(2, agent="codex")+ assert [t.agent for t in created] == ["codex", "codex"]++ async def test_a_split_still_inherits_its_anchor(+ self, registry: Registry, tmp_path: Path+ ) -> None:+ """Splitting a pane means "another one of these", majority or not."""+ session = await registry.start(+ str(tmp_path),+ [{"agent": "claude"} for _ in range(3)] + [{"agent": "codex"}],+ )+ codex_pane = next(t for t in session.terminals if t.agent == "codex")+ split = await registry.add_terminal(anchor=codex_pane.name, direction="down")+ assert split.agent == "codex"++ async def test_a_uniform_workspace_is_unchanged(+ self, registry: Registry, tmp_path: Path+ ) -> None:+ """The common case — every pane the same CLI — behaves as it always did."""+ await registry.start(str(tmp_path), [{"agent": "codex"} for _ in range(2)])+ created, _capped = await registry.add_terminals(2)+ assert [t.agent for t in created] == ["codex", "codex"]diff --git a/tests/unit/agentic_ide/test_names.py b/tests/unit/agentic_ide/test_names.pyindex 954b6ea923..a7b96bf438 100644--- a/tests/unit/agentic_ide/test_names.py+++ b/tests/unit/agentic_ide/test_names.py@@ -74,6 +74,12 @@ class TestSpokenForms:# The live 2026-08-12 transcript: "Terminal T2" mangled into a# t-led consonant cluster in front of the number word."prompt wird du terminal tft zwei", # i18n-allow: input vocab under test+ # The live 2026-08-13 transcript: the same garble one space+ # tighter, glued straight onto the digit. The 08-12 repair required+ # the space, so this addressed nothing and opened a pane instead.+ "prompte Terminal TR2 mit dem deep dive", # i18n-allow: input vocab under test+ "prompte terminal tf2 mit dem deep dive", # i18n-allow: input vocab under test+ "prompt terminal tt2 to do a deep dive","das zweite Terminal soll das machen", # i18n-allow: input vocab under test"prompt terminal two","the second terminal should run the tests",@@ -143,6 +149,14 @@ class TestABareNumberNeverAddressesAPane:assert spoken_positions("Terminal Typ zwei", count=4) == [] # i18n-allow: input vocabassert spoken_positions("terminal the two", count=4) == []assert resolve("das tolle zwei", PANES) is None # i18n-allow: input vocab+ # Admitting the GLUED cluster (2026-08-13) must not admit vocabulary+ # either: a number word behind a real t-word is still ordinary speech,+ # and a number word whose own spelling starts with the debris letters+ # ("two", "three", "tres") must keep winning as the number it is.+ assert spoken_positions("Terminal Typ2", count=4) == [] # i18n-allow: input vocab+ assert [n for *_, n in spoken_positions("terminal two", count=4)] == [2]+ assert [n for *_, n in spoken_positions("terminal three", count=4)] == [3]+ assert [n for *_, n in spoken_positions("terminal tres", count=4)] == [3]def test_a_dictated_variable_is_not_a_pane(self) -> None:""""t eins" / "t two" without a pane noun is a variable, not a pane.