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): keep every addressed pane when a call-sign is garbled
Ruben Lütked83025277383
diff --git a/jarvis/agentic_ide/clarify.py b/jarvis/agentic_ide/clarify.pynew file mode 100644index 0000000000..640d6912ec--- /dev/null+++ b/jarvis/agentic_ide/clarify.py@@ -0,0 +1,742 @@+"""Ask which terminal was meant, instead of guessing or going silent.++A call-sign arrives through speech recognition, and the resolver has to draw a+line somewhere: above it a word IS a pane's name, below it the word is ordinary+speech. Both sides of that line have now failed in production, on the same day,+in opposite directions:++* **Silent miss** (2026-07-27 16:18) — a pane called "Ellis" came back as+ "Ilies", scoring 0.667 against a 0.72 floor. The addressed-terminal path stood+ down without a word, no prompt ever reached the pane, and the live model —+ which never learns any of this — told the user an agent was working on it.+* **Silent false hit** — ordinary words of the spoken language reach the pool+ from below: "allen" scores 0.750 against "Alex", i.e. ABOVE the same floor.+ A sentence about the outside world ("what is Elon Musk up to?") must never+ become an instruction typed into somebody's coding agent.++No threshold fixes both, because the two failures overlap on the score axis —+the maintainer's directive (2026-07-27) is therefore to decide by CONTEXT and,+when context says "this is about the panes" but the name is uncertain, to ASK:++ "Did you mean Ellis?"++That is what this module decides. It answers one question — "is this turn+addressing the workspace, and if so, which pane did the user probably mean?" —+and, like ``intent``, it is a detector, not a policy: the caller decides what to+do with the answer.++The asymmetry that shapes every rule below: a needless question costs the user+one word ("yes"), while a wrong guess types a stranger's task into an agent that+then works for minutes on it. So the gate is deliberately hard to pass, and+whatever it is unsure about becomes a question rather than an action.++Cost: pure regex over the utterance, no IO and no LLM (AP-9 / AP-11), so it is+safe on the voice hot path.+"""+from __future__ import annotations++import re+import time+from dataclasses import dataclass, field++from .names import near_miss, resolve++# How long a pending question stays answerable. Voice turns arrive within+# seconds; two minutes covers a slow "uh... yes, Ellis" without letting a+# forgotten question deliver work much later in the session. Same bound as the+# delegation offer window, for the same reason.+_WINDOW_TTL_S = 120.0++# A short answer is an ANSWER to the question ("yes", "Ellis", "the second+# one"); a long sentence is the user moving on and must never deliver the old+# task. Same bound the spawn gate uses for its confirmation.+_ANSWER_MAX_WORDS = 6+++# --------------------------------------------------------------------------- #+# Is this turn about the workspace at all? #+# --------------------------------------------------------------------------- #+# The gate that separates "prompt Max" from "what is Elon Musk doing". Evidence+# has to be POSITIVE and explicit: the default answer is no, because that is the+# answer that cannot type a stranger's sentence into a running coding agent.++#: Words that only ever mean the coding workspace. Naming a pane, or the act of+#: handing one work, is the strongest evidence there is.+_WORKSPACE_NOUN_RE = re.compile(+ r"\b(?:terminals?|terminales|panes?|workspaces?|"+ r"arbeitsbereich\w*|instanz\w*|instances?|" # i18n-allow: input vocab+ r"prompte?\w*|prompting|anprompt\w*|" # i18n-allow: input vocab+ r"beauftrag\w*|briefe?\w*|briefing)\b", # i18n-allow: input vocab+ re.IGNORECASE,+)++#: The work coding agents actually do. A sentence carrying this vocabulary is+#: about the user's own codebase, which is what the panes are for — as opposed+#: to a question about the world, which never contains it.+_CODING_WORK_RE = re.compile(+ r"\b(?:"+ # investigation / analysis+ r"deep[\s-]?dive|root[\s-]?cause|debug\w*|analysier\w*|analyz\w*|analis\w*|"+ r"untersuch\w*|investigate\w*|diagnos\w*|" # i18n-allow: input vocab+ # change+ # i18n-allow: input vocab+ r"fix\w*|behebe?\w*|repariere?\w*|refactor\w*|implementier\w*|implement\w*|"+ r"commit\w*|merge\w*|rebase\w*|deploy\w*|"+ # artifacts+ r"bugs?|fehler\w*|tests?|teste\w*|repo\w*|branch\w*|" # i18n-allow: input vocab+ r"code\w*|datei\w*|files?|funktion\w*|functions?|" # i18n-allow: input vocab+ r"pull[\s-]?request|pr\b|"+ # Spanish work vocabulary, kept level with the other two locales+ r"arregl\w*|revis\w*|prueba\w*|archivo\w*|rama\w*"+ r")\b",+ re.IGNORECASE,+)++#: Handing work to somebody — "sag X …", "lass X …", "tell X to …". Reused from+#: the same vocabulary ``intent`` addresses panes with, kept here as a flat verb+#: scan because at this point the NAME is exactly what we are unsure about, so a+#: name-anchored template cannot be built yet.+_HANDOVER_VERB_RE = re.compile(+ # Stems, not fixed forms: the maintainer's own phrasing is "… machen+ # LASSEN", and a `lass\b` alternative silently misses every separable and+ # infinitive form German actually hands work over in.+ r"\b(?:sag\w*|schick\w*|gib|geb\w*|frag\w*|lass\w*|l[aä]sst|" # i18n-allow: input vocab+ r"beauftrag\w*|[uü]bergib|[uü]bergeb\w*|weiterleit\w*|" # i18n-allow: input vocab+ r"tell|send|give|ask|hand|forward|assign|let|have|"+ r"dile|d[ií]gale|env[ií]a|manda|preg[uú]nta|pasa|asigna|encarga)\b", # i18n-allow: input vocab+ re.IGNORECASE,+)+++#: "X SOLL das fixen" — an order aimed at a third party, carried by the modal+#: rather than by a handover verb. This is the other half of how work is+#: assigned in speech, and ``intent`` matches it name-anchored; here the name is+#: precisely what is uncertain, so the modal is scanned on its own and paired+#: with coding work to keep it honest.+_DIRECTIVE_MODAL_RE = re.compile(+ r"\b(?:soll|sollen|sollte|sollten|m[uü]ssen|muss|" # i18n-allow: input vocab+ r"should|must|shall|"+ r"deber[ií]an?|debe|deben)\b", # i18n-allow: input vocab+ re.IGNORECASE,+)+++#: "What has X done?" / "How far is X?" — asking a NAMED worker for a status+#: report. The shape carries no coding vocabulary at all, which is why it+#: needed its own rule: "was hat Dana gemacht" names no repo, no test, no bug+#: and no branch, so the coding-work pairings below never saw it.+#:+#: Each locale gets both word orders, and the German alternation carries the+#: optional perfect prefix ("gemacht", "getan", "gearbeitet") — the tense+#: spoken German actually uses to ask about work that has already happened, and+#: the exact form the live 2026-07-27 turn was lost on.+_REPORT_QUESTION_RE = re.compile(+ # A progress opener is a status question on its own — "wie weit ist Ellis?"+ # carries no verb of doing at all, and nothing else is ever asked with it.+ r"\b(?:wie\s+weit|wie\s+l[aä]uft|wie\s+steht|how\s+far|" # i18n-allow: input vocab+ r"c[oó]mo\s+va)\b|"+ r"\bwas\b[^.!?]{0,40}?" # i18n-allow: input vocab+ r"\b(?:ge)?(?:macht|machen|tut|tun|tan|treibt|treiben|arbeitet|" # i18n-allow: input vocab+ r"arbeiten|schafft|geschafft|erledigt|rausgefunden|" # i18n-allow: input vocab+ r"herausgefunden|gebaut|geschrieben|ge[aä]ndert)\b|" # i18n-allow: input vocab+ r"\b(?:ist|sind)\b[^.!?]{0,30}?\b(?:fertig|durch|soweit)\b|" # i18n-allow: input vocab+ r"\b(?:what|how)\b[^.!?]{0,40}?"+ r"\b(?:doing|done|do|did|up\s+to|going|built|found|changed|"+ r"working\s+on|progress\w*)\b|"+ r"\b(?:is|are)\b[^.!?]{0,30}?\b(?:done|finished|ready|stuck)\b|"+ r"\b(?:qu[eé]|c[oó]mo)\b[^.!?]{0,40}?"+ r"\b(?:hacen?|haciendo|hecho|hizo|hicieron|va|van|"+ r"encontr\w*|cambi\w*)\b|"+ r"\b(?:est[aá]|est[aá]n)\b[^.!?]{0,30}?\b(?:listo\w*|terminad\w*)\b|"+ r"\b(?:status|fortschritt|estado|progreso)\b", # i18n-allow: input vocab+ re.IGNORECASE,+)+++def addresses_workspace(text: str) -> bool:+ """Whether this turn is plausibly about the open coding workspace.++ Four independent kinds of evidence, any one of which is enough:++ 1. the utterance NAMES the workspace or the act of prompting a pane+ ("prompt Max", "beauftrage Max") — unambiguous on its own;+ 2. it hands work over AND that work is coding work ("tell Max to fix the+ tests");+ 3. it gives a third-party order AND that order is coding work ("Ellis soll+ einen Deep Dive machen") — the shape that carries no handover verb;+ 4. it asks a named worker for a STATUS REPORT ("was hat Ellis gemacht?").++ In 2 and 3 the pairing is what does the work. A handover verb alone+ deliberately does NOT qualify: "tell me what Elon Musk is doing" is a+ handover verb plus a name and nothing else, and that sentence must never+ reach a coding agent.++ 4 stands alone without a coding-work pairing, and it may, because of what+ it can and cannot cause. This module only ever produces a QUESTION — "did+ you mean Ellis?" — and only for a turn where no pane was certainly named+ and exactly one word came close. A status question about somebody the user+ really did mean as a person therefore costs one "no"; without the rule, a+ call-sign that speech recognition garbled inside the single most common+ workspace question there is went silently nowhere, which is the failure+ this whole module exists to end.+ """+ body = str(text or "")+ if _WORKSPACE_NOUN_RE.search(body):+ return True+ # A status question about a FULL personal name is about that person: "sag+ # mir was Elon Musk gerade macht" has the identical shape to "sag mir was+ # Ellis gerade macht" and the opposite meaning, and the surname is the only+ # thing that tells them apart. Same rule the collective address uses, so+ # the two cannot drift into disagreeing about one sentence.+ if _REPORT_QUESTION_RE.search(body) and not is_outside_world_talk(body):+ return True+ if not _CODING_WORK_RE.search(body):+ return False+ return bool(+ _HANDOVER_VERB_RE.search(body) or _DIRECTIVE_MODAL_RE.search(body)+ )+++# --------------------------------------------------------------------------- #+# Is this word a call-sign at all? #+# --------------------------------------------------------------------------- #++#: Word characters only — the unit the resolver scores. Mirrors ``intent``.+_WORD_RE = re.compile(r"[^\W\d_]+", re.UNICODE)++_SENTENCE_START_RE = re.compile(r"(?:^|[.!?:;]\s*|\n\s*)$")++#: Function words that are never a call-sign, however close they score. This is+#: matching *input vocabulary*, not prose.+#:+#: Needed because similarity alone cannot tell them apart from a garbled name —+#: measured against the shipping pool, "kannst" reaches "Casey" at 0.600,+#: "macht" reaches "Max" at 0.571, and "allen" reaches "Alex" at 0.750, which is+#: ABOVE the acting threshold. That last one is the maintainer's own+#: counter-example (2026-07-27): a sentence about the outside world must never+#: become a prompt typed into every open pane.+#:+#: Deliberately only the closed class (pronouns, articles, modals, question+#: words, common auxiliaries). Content words are left out: they are what a+#: person's name competes with legitimately, and the capitalization signal plus+#: the workspace gate already cover them.+#: Kept as one tuple per language rather than one merged literal: the locales+#: overlap ("no", "me", "es", "a" are each two languages' function words), and a+#: single set literal would both hide that and read as a mistake.+_STOPWORDS_DE: tuple[str, ...] = ( # i18n-allow: input vocabulary+ "alle", "allen", "aller", "alles", "als", "am", "an", "auch", "auf",+ "aus", "bei", "bin", "bis", "bist", "bitte", "da", "dann", "das",+ "dass", "dein", "deine", "dem", "den", "denn", "der", "des", "die",+ "dir", "doch", "du", "ein", "eine", "einen", "einer", "eines", "er",+ "es", "etwas", "euch", "für", "gerade", "gib", "hab", "habe", "haben",+ "hast", "hat", "hier", "ich", "ihm", "ihn", "ihr", "im", "in", "ist",+ "ja", "kann", "kannst", "können", "könnte", "lass", "lassen", "mach",+ "machen", "macht", "mal", "man", "mein", "meine", "mir", "mit", "muss",+ "müssen", "nach", "nein", "nicht", "noch", "nur", "ob", "oder", "sag",+ "sage", "schon", "sein", "seine", "sich", "sie", "sind", "so", "soll",+ "sollen", "über", "um", "und", "uns", "unser", "von", "vor", "war",+ "was", "wenn", "wer", "werde", "werden", "wie", "wieso", "will",+ "wir", "wird", "wo", "zu", "zum", "zur",+)+_STOPWORDS_EN: tuple[str, ...] = (+ "a", "all", "am", "an", "and", "are", "as", "ask", "at", "be", "been",+ "but", "by", "can", "could", "did", "do", "does", "for", "from", "get",+ "give", "had", "has", "have", "he", "her", "him", "his", "how", "i",+ "if", "in", "into", "is", "it", "its", "just", "let", "make", "makes",+ "me", "my", "no", "not", "now", "of", "on", "one", "or", "our", "out",+ "please", "put", "say", "she", "should", "so", "some", "tell", "that",+ "the", "their", "them", "then", "there", "these", "they", "this",+ "to", "up", "us", "was", "we", "were", "what", "when", "where",+ "which", "who", "why", "will", "with", "would", "yes", "you", "your",+)+_STOPWORDS_ES: tuple[str, ...] = ( # i18n-allow: input vocabulary+ "a", "al", "algo", "aqui", "así", "como", "con", "cual", "cuando",+ "de", "del", "dile", "donde", "el", "ella", "ellos", "en", "era",+ "es", "esa", "ese", "eso", "esta", "este", "esto", "está", "están",+ "haz", "la", "las", "le", "les", "lo", "los", "mas", "me", "mi",+ "no", "nos", "o", "para", "pero", "por", "que", "qué", "quien",+ "se", "ser", "si", "sí", "sobre", "solo", "son", "su", "sus", "te",+ "tu", "un", "una", "uno", "y", "ya", "yo",+)+_STOPWORDS: frozenset[str] = frozenset(+ _STOPWORDS_DE + _STOPWORDS_EN + _STOPWORDS_ES+)+++def _capitalization_is_informative(text: str) -> bool:+ """Whether this transcript capitalizes at all, i.e. whether case can rule.++ An all-lowercase transcript is a provider quirk, not evidence that the+ utterance contains no names.+ """+ body = str(text or "")+ return any(ch.isupper() for ch in body)+++def _is_proper_name_position(text: str, start: int, end: int) -> bool:+ """Whether the word at ``[start:end)`` reads as a proper name.++ Two filters, in this order, because they fail differently:++ 1. **a function word is never a name** — decisive in every transcript,+ including one with no capitals at all;+ 2. **otherwise capitalization decides**, when the transcript capitalizes at+ all. Position is deliberately NOT considered: a call-sign opening the+ sentence is the most natural way to address a pane ("Ellis, schau dir+ das an"), and excluding sentence-initial words would blind the check to+ exactly that shape.+ """+ word = text[start:end]+ if word.casefold() in _STOPWORDS:+ return False+ if _is_vocabulary_word(word):+ return False+ if not _capitalization_is_informative(text):+ return True+ return word[:1].isupper()+++#: What somebody ASKS FOR about a pane, as a noun: "Alex Status?", "Dana+#: Fortschritt", "Casey progress". German capitalizes every noun, so without+#: this these read as surnames and the pane is disowned as a person out in the+#: world — which is how "Alex Status?", a textbook status question, matched+#: nothing at all.+_STATUS_NOUN_RE = re.compile(+ r"\b(?:status|fortschritt\w*|stand|update\w*|progress|" # i18n-allow: input vocab+ r"bericht\w*|report\w*|estado|progreso|informe\w*)\b", # i18n-allow: input vocab+ re.IGNORECASE,+)+++def _is_vocabulary_word(word: str) -> bool:+ """Whether the word is one this module already reads as something else.++ A word that names the WORK cannot also name the worker. Without this, an+ all-lowercase transcript — where capitalization cannot rule anything out —+ let "fixen" stand in for the pane "Finn" (0.667) and ask about a sentence+ that names no pane at all.++ Anchored so only a WHOLE word counts: the vocabulary patterns are written+ to find their stems anywhere in a sentence, and reused unanchored they+ would reject any call-sign that merely contains one.+ """+ for pattern in (+ _WORKSPACE_NOUN_RE,+ _CODING_WORK_RE,+ _HANDOVER_VERB_RE,+ _DIRECTIVE_MODAL_RE,+ _STATUS_NOUN_RE,+ ):+ match = pattern.match(word)+ if match is not None and match.end() == len(word):+ return True+ return False+++#: A second capitalized word directly after the candidate — "Elon MUSK", "Max+#: MUSTERMANN". Panes carry exactly one given name (see ``names.NAME_POOL``), so+#: a surname is positive evidence that a PERSON is meant, not a terminal. This+#: is the maintainer's own criterion (2026-07-27): "when I only say a first+#: name" is the case that should ask.+_SURNAME_FOLLOWS_RE = re.compile(r"^[\s,]*[A-ZÄÖÜ][^\W\d_]+")+_SURNAME_PRECEDES_RE = re.compile(r"[A-ZÄÖÜ][^\W\d_]+[\s,]*$")+++def is_part_of_full_name(text: str, start: int, end: int) -> bool:+ """Whether the candidate is part of a longer proper name ("Elon Musk").++ Public because ``intent`` needs exactly this answer too: a call-sign is a+ single given name, so a first name carrying a surname is a PERSON out in+ the world and never the pane. Two copies of that rule would be two chances+ to disagree about one sentence, which is how "what has Dana Schmidt done"+ ends up read as a question about a terminal.+ """+ if not _capitalization_is_informative(text):+ return False+ following = _SURNAME_FOLLOWS_RE.match(text[end:])+ if following is not None:+ # German capitalizes every noun, so the word after a call-sign is+ # capitalized whether it is a surname or the thing being asked about.+ # A word this module already reads as work, a workspace or a status is+ # therefore never the surname: "Alex Status?" is a question about the+ # pane, and reading "Status" as a family name struck the pane out of+ # its own status question. Same reasoning for "sag Dana Bescheid".+ if not _is_vocabulary_word(following.group(0).strip(" ,")):+ return True+ preceding = text[:start]+ leading = _SURNAME_PRECEDES_RE.search(preceding)+ if leading is None:+ return False+ if _is_vocabulary_word(leading.group(0).strip(" ,")):+ return False+ # A capitalized word in FRONT only makes this a surname when that word is+ # not itself the one opening the sentence. The sentence-start test has to+ # be aimed at THAT word, not at the candidate: aimed at the candidate it+ # read "Ist Blake fertig?" as a person called Ist Blake, because "Ist" is+ # capitalized for grammar and stands at the very beginning — which silently+ # withdrew the pane from every question opening with a verb.+ return not _SENTENCE_START_RE.search(preceding[: leading.start()])+++#: Two capitalized words in a row, the second not opening a sentence — a person+#: or organisation out in the world ("Elon Musk", "Barack Obama"). Panes carry a+#: single given name, so this shape never describes one.+_MULTIWORD_NAME_RE = re.compile(+ r"(?<![.!?:;\n])\s[A-ZÄÖÜ][^\W\d_]+\s+[A-ZÄÖÜ][^\W\d_]+"+)+++def is_outside_world_talk(text: str) -> bool:+ """Whether this turn is about the world rather than the user's codebase.++ Guards the COLLECTIVE address ("sag allen …"), which reaches every open+ pane at once and is therefore the most expensive thing a misheard word can+ trigger. The maintainer's counter-example (2026-07-27): a question about a+ public figure that speech recognition turns into "sag allen …" must not+ become an instruction typed into every running coding agent.++ Deliberately narrow — it answers yes only for a full personal name with no+ coding work anywhere in the sentence. "Tell everyone to stop" carries no+ such name and stays a perfectly good collective instruction.+ """+ body = str(text or "")+ if not _capitalization_is_informative(body):+ return False+ return bool(+ _MULTIWORD_NAME_RE.search(body) and not _CODING_WORK_RE.search(body)+ )+++# --------------------------------------------------------------------------- #+# The detector #+# --------------------------------------------------------------------------- #+++@dataclass(frozen=True, slots=True)+class UncertainName:+ """One word that came close to a call-sign, and the panes it might be."""++ spoken: str+ """The word as the transcript spelled it ("Ilies")."""++ candidates: tuple[str, ...]+ """Panes it could mean, best first. Never empty."""+++@dataclass(frozen=True, slots=True)+class ClarificationNeeded:+ """Everything one turn addressed that could not simply be acted on.++ A turn addresses a FLEET, not a pane — "Alex und Blaike, macht beide einen+ Deep Dive" is one instruction for two agents — so this carries a list on+ both axes. The single-name shape it started as could not represent that+ turn at all, and the resulting behaviour was the worst of the three+ possible ones: Alex was briefed, Blaike was dropped without a word, and the+ user watched one agent work believing two were (live 2026-07-27 19:07).+ """++ uncertain: tuple[UncertainName, ...]+ """The words that need a question. Never empty."""++ utterance: str+ """The original turn, kept verbatim so the confirmed pane gets the REAL+ task and not a paraphrase assembled from fragments."""++ certain: tuple[str, ...] = ()+ """Panes the SAME turn named beyond doubt. They are not in question and+ must be briefed whatever the answer is; they travel with the question only+ so the caller can tell "one pane is uncertain" from "everything is"."""++ @property+ def spoken(self) -> str:+ """The first uncertain word — the one a single-name question names."""+ return self.uncertain[0].spoken++ @property+ def candidates(self) -> tuple[str, ...]:+ """Panes the first uncertain word could mean."""+ return self.uncertain[0].candidates++ @property+ def offered(self) -> tuple[str, ...]:+ """Every pane any of the uncertain words could mean, in order."""+ seen: list[str] = []+ for item in self.uncertain:+ for name in item.candidates:+ if name not in seen:+ seen.append(name)+ return tuple(seen)+++#: What may stand between two names that are being listed together. Only+#: enumeration punctuation and the supported languages' "and" — anything else+#: means the two words are in different clauses and say nothing about each+#: other. Matching *input vocabulary*, not prose.+_ENUMERATION_GAP_RE = re.compile(+ r"^[\s,;&]*"+ # i18n-allow: input vocabulary — the supported languages' "and"+ r"(?:und|and|y|e|sowie|plus|as\s+well\s+as|together\s+with|junto\s+con)?"+ r"[\s,;&]*$",+ re.IGNORECASE,+)+++def _is_listed_beside(text: str, span: tuple[int, int], others: list[tuple[int, int]]) -> bool:+ """Whether the word at ``span`` is enumerated next to one of ``others``.++ "Alex und Blaike" lists two call-signs; "Alex, look at what Blaike wrote"+ does not, and the difference is exactly what sits between them. Used only+ where a word would otherwise be too weak to ask about on its own, so it+ buys reach without widening what a lone stray capital can trigger.+ """+ start, end = span+ for other_start, other_end in others:+ if other_end <= start and _ENUMERATION_GAP_RE.match(text[other_end:start]):+ return True+ if end <= other_start and _ENUMERATION_GAP_RE.match(text[end:other_start]):+ return True+ return False+++def detect_clarification(+ user_text: str, *, names: list[str]+) -> ClarificationNeeded | None:+ """What this turn addressed but did not clearly name, or ``None``.++ Every condition below removes one way of being wrong:++ 1. **the turn addresses the workspace** — otherwise a question about the+ world could put words into a coding agent;+ 2. **the word reads as a proper name** — capitalized, not just first in+ its sentence;+ 3. **it is not part of a longer proper name** — "Elon Musk" is a person;+ 4. **a word that stands alone in its uncertainty** may only ask when it is+ the turn's ONLY unclear name and no pane was certainly named. Beyond+ that single case the word has to be ENUMERATED beside another name+ ("Alex und Blaike") — that is what separates a garbled member of a list+ from a stray capital in a sentence that already works.++ A certainly-named pane no longer ENDS the search, which is the change that+ matters. It used to: any certain name returned ``None``, so "Alex und+ Blaike" produced a question about nothing, Alex was briefed alone, and the+ second agent the user had just addressed was dropped in silence. The+ certain panes now travel with the answer instead (``certain``) — the caller+ briefs them immediately and asks only about the rest.+ """+ text = str(user_text or "").strip()+ if len(text) < 3 or not names:+ return None+ if not addresses_workspace(text):+ return None++ certain: list[str] = []+ certain_spans: list[tuple[int, int]] = []+ uncertain: list[tuple[tuple[int, int], UncertainName]] = []+ for match in _WORD_RE.finditer(text):+ word = match.group(0)+ span = (match.start(), match.end())+ # Certain means the exact name or the same sound — deliberately the+ # same bar ``near_miss`` uses, so no utterance can fall between the two+ # paths and produce neither an action nor a question.+ sure = resolve(word, names, fuzzy=False)+ if sure is not None:+ if sure not in certain:+ certain.append(sure)+ certain_spans.append(span)+ continue+ candidates = near_miss(word, names)+ if not candidates:+ continue+ if not _is_proper_name_position(text, *span):+ continue+ if is_part_of_full_name(text, *span):+ continue+ uncertain.append(+ (span, UncertainName(spoken=word, candidates=tuple(n for n, _ in candidates)))+ )++ if not uncertain:+ return None++ if len(uncertain) > 1 or certain:+ # More than one unclear word, or one standing beside a certain name:+ # only the ones being LISTED with another name survive. A single stray+ # near miss elsewhere in the sentence is noise, and asking about it+ # would tax every turn that already works.+ neighbours = certain_spans + [span for span, _ in uncertain]+ kept = [+ (span, item)+ for span, item in uncertain+ if _is_listed_beside(text, span, [s for s in neighbours if s != span])+ ]+ if not kept:+ return None+ uncertain = kept++ return ClarificationNeeded(+ uncertain=tuple(item for _, item in uncertain),+ utterance=text,+ certain=tuple(certain),+ )+++# --------------------------------------------------------------------------- #+# The answer window #+# --------------------------------------------------------------------------- #+++@dataclass(slots=True)+class _Pending:+ uncertain: tuple[UncertainName, ...]+ utterance: str+ asked_at: float+ question: str = ""++ @property+ def candidates(self) -> tuple[str, ...]:+ """Every pane on offer, in the order they were spoken."""+ seen: list[str] = []+ for item in self.uncertain:+ for name in item.candidates:+ if name not in seen:+ seen.append(name)+ return tuple(seen)+++@dataclass(slots=True)+class ClarificationWindow:+ """A question waiting for its answer.++ Without this the question would be theatre: "did you mean Ellis?" followed+ by "yes" has to actually deliver the ORIGINAL task, or the user has simply+ been made to repeat themselves — which is worse than the silent miss it+ replaces, because it also cost them a turn.+ """++ _pending: _Pending | None = field(default=None)++ def arm(+ self, need: ClarificationNeeded, *, question: str = "", now: float | None = None+ ) -> None:+ self._pending = _Pending(+ uncertain=need.uncertain,+ utterance=need.utterance,+ asked_at=time.monotonic() if now is None else now,+ question=question,+ )++ def disarm(self) -> None:+ self._pending = None++ @property+ def armed(self) -> bool:+ return self._pending is not None++ def resolve_answer(+ self, answer: str, *, language: str = "de", now: float | None = None+ ) -> tuple[tuple[str, ...], str] | None:+ """``(panes, original_utterance)`` for a clear answer, else ``None``.++ A tuple of panes rather than one, because the question can be about a+ fleet: "did you mean Alex and Blake?" is answered by one "yes" and both+ agents have to be briefed by it. Answering it with one pane was how the+ second agent of an addressed pair got lost.++ Consumed exactly once either way — a question that has been answered,+ declined or ignored must never deliver work on a later turn.++ Three shapes count as an answer, in falling directness:++ 1. the user NAMES offered panes ("Ellis", "Alex and Blake") — decisive+ even when several were offered;+ 2. a short affirmative — it confirms every uncertain word that has only+ ONE candidate, because "yes" cannot choose between two;+ 3. anything else: the window closes and the turn proceeds normally.+ """+ pending = self._pending+ if pending is None:+ return None+ current = time.monotonic() if now is None else now+ if (current - pending.asked_at) > _WINDOW_TTL_S:+ self._pending = None+ return None++ text = str(answer or "").strip()+ if not text:+ return None++ offered = list(pending.candidates)+ named = [+ hit+ for hit in (+ resolve(match.group(0), offered, fuzzy=False)+ for match in _WORD_RE.finditer(text)+ )+ if hit is not None+ ]+ if not named:+ # The whole answer as one token, which is how a one-word reply and+ # a two-word call-sign both arrive.+ single = resolve(text, offered)+ if single is not None:+ named = [single]+ if named:+ self._pending = None+ return tuple(dict.fromkeys(named)), pending.utterance++ # Only a SHORT turn is an answer at all; a full sentence is the user+ # moving on, and delivering the old task then would be a surprise. The+ # bound grows with the number of names on offer: confirming a fleet+ # costs more words than confirming one pane.+ if len(text.split()) > _ANSWER_MAX_WORDS + len(pending.uncertain) - 1:+ self._pending = None+ return None++ verdict = _classify(text, language)+ self._pending = None+ if verdict != "confirm":+ return None+ decided = tuple(+ dict.fromkeys(+ item.candidates[0] for item in pending.uncertain if len(item.candidates) == 1+ )+ )+ return (decided, pending.utterance) if decided else None+++def _classify(text: str, language: str) -> str:+ """Yes/no verdict for a short answer, across every supported language.++ The per-turn language tag cannot be trusted (STT mislabels are a known+ class), so the answer is classified under all supported languages and a+ veto keeps its safety priority — exactly what ``spawn_gate`` does.+ """+ try:+ from jarvis.voice.echo_confirmation import classify_response # noqa: PLC0415+ except Exception: # noqa: BLE001 — a classifier fault is simply "no answer"+ return "unknown"+ verdicts = {+ classify_response(text, language=lang)+ for lang in {"de", "en", "es", str(language or "de")}+ }+ if "veto" in verdicts:+ return "veto"+ return "confirm" if "confirm" in verdicts else "unknown"+++#: ONE conversation per process (desktop app / headless session), so ONE shared+#: window — the same reasoning as ``spawn_gate.OFFER_WINDOW``. Tests reset it+#: via ``disarm()``.+WINDOW = ClarificationWindow()+++__all__ = [+ "WINDOW",+ "ClarificationNeeded",+ "ClarificationWindow",+ "UncertainName",+ "addresses_workspace",+ "detect_clarification",+ "is_outside_world_talk",+ "is_part_of_full_name",+]diff --git a/jarvis/agentic_ide/intent.py b/jarvis/agentic_ide/intent.pyindex 5eaf5faf9f..1cf7fa84cf 100644--- a/jarvis/agentic_ide/intent.py+++ b/jarvis/agentic_ide/intent.py@@ -874,6 +874,45 @@ def wants_split(user_text: str) -> bool:)+#: "both of you", "you two", "all three of them", "die zwei Terminals". What+#: these have in common is a COUNT the utterance states out loud, which is the+#: only evidence that survives a call-sign speech recognition mangled beyond+#: recognition. Matching *input vocabulary*, not prose.+_PLURAL_ADDRESS_RE = re.compile(+ r"\b(?:"+ # explicit "both" / "all of you", in every supported language+ r"beide[nsr]?|alle\s+beide|ihr\s+(?:beide[nr]?|zwei|drei|vier)|euch\s+beide[nr]?|"+ r"both(?:\s+of\s+(?:you|them))?|all\s+(?:of\s+)?(?:you|them)|you\s+(?:two|three|four)|"+ r"ambos|ambas|los\s+dos|las\s+dos|ustedes\s+dos|"+ # a spoken count next to what is being counted+ r"(?:zwei|drei|vier|f[üu]nf|two|three|four|five|dos|tres|cuatro|cinco|[2-9])\s+"+ r"(?:der\s+|die\s+|von\s+den\s+|of\s+the\s+|de\s+los\s+)?"+ r"(?:terminals?|terminales|panes?|agent(?:s|en)?|instanz\w*|instances?)"+ r")\b",+ re.IGNORECASE,+)+++def expects_several(user_text: str) -> bool:+ """True when the utterance says out loud that MORE THAN ONE pane is meant.++ The one signal that outlives a garbled call-sign. Live 2026-07-27 19:07:+ "Alexa and Dave should both do a deep dive" — "Alexa" was recoverable as+ Alex, "Dave" matched no pane at any threshold, and the turn quietly briefed+ one agent while the user watched for two. Nothing in the name resolver can+ fix that; the word "both" can, because it says the count independently of+ whether either name survived transcription.++ Deliberately narrow: an explicit "both/all of you/you two", or a spoken+ number standing next to the thing being counted. A bare plural noun does+ NOT qualify — "look at the terminals" states no count.+ """+ text = (user_text or "").strip()+ if len(text) < 6:+ return False+ return bool(_PLURAL_ADDRESS_RE.search(text))++def owns_turn(user_text: str, *, names: list[str] | None = None) -> bool:"""True when the open workspace should handle this turn instead of a spawn.@@ -907,12 +946,18 @@ def owns_turn(user_text: str, *, names: list[str] | None = None) -> bool:__all__ = ["KIND_PROMPT","KIND_REPORT",+ "CloseTerminalsRequest","SpawnGroup","SpawnTerminalsRequest","TerminalIntent","detect","detect_all",+ "detect_close_fleet","detect_spawn",+ "expects_several","owns_turn",+ "references_recent_fleet",+ "spawn_instruction",+ "spawn_includes_task","wants_split",]diff --git a/jarvis/brain/manager.py b/jarvis/brain/manager.pyindex 4c0febf532..52eb80c298 100644--- a/jarvis/brain/manager.py+++ b/jarvis/brain/manager.py@@ -5810,6 +5810,48 @@ class BrainManager:conversation_language=self._conversation_language,)+ # A clarified pane is briefed with the ORIGINAL utterance — the sentence+ # that actually carried the work — not with the "yes" that confirmed it.+ if answered is not None:+ panes, original = answered+ # Every pane the answer confirmed, not the first one: "Alex und+ # Blaike, macht beide …" is ONE instruction for two agents, and a+ # single "yes" has to brief both of them. Answering it with one+ # pane is how the second agent of an addressed pair was lost (live+ # 2026-07-27 19:07).+ live = [name for name in panes if session.find(name) is not None]+ if live:+ log.info(+ "Agentic IDE: clarified call-sign(s) resolved to %s",+ ", ".join(live),+ )+ return await self._deliver_agentic_ide_prompt(+ session=session,+ names=live,+ utterance=original,+ instruction="",+ language=out_lang,+ )++ if not addressed:+ # No pane was named with certainty — but the turn may still have+ # MEANT one. A call-sign arrives through speech recognition, and the+ # live 2026-07-27 failure was exactly this: "Ellis" came back as+ # "Ilies", scored just under the acting threshold, and this path+ # returned None without a word. Nothing reached the pane, nothing+ # was said, and the live model — which never learns any of this —+ # filled the silence by claiming an agent was working.+ #+ # Asking costs the user one word and cannot type a stranger's+ # sentence into a coding agent, so uncertainty resolves to a+ # question. ``detect_clarification`` decides when there is one to+ # ask; it stands down for anything that is not addressing the+ # workspace.+ return self._ask_which_agentic_ide_terminal(+ user_text, candidates=candidates, language=out_lang+ )+ found = addressed[0]+# A question about a pane is read-only: answer it from what that pane# printed, and let the normal brain path phrase the answer with the# focus-context block (which already carries the transcript tail).@@ -5818,6 +5860,17 @@ class BrainManager:names = [item.terminal for item in addressed]+ # A turn addresses a FLEET, and speech recognition may have carried+ # only part of it across. "Alex und Blaike, macht beide einen Deep+ # Dive" resolves Alex and mangles Blake, and this path used to brief+ # Alex and say nothing at all about the rest — so the user heard one+ # agent confirmed and believed two were working (live 2026-07-27+ # 19:07). The pane that WAS understood still gets its brief; the one+ # that was not becomes a question appended to the same answer.+ leftover = self._agentic_ide_leftover_question(+ user_text, candidates=candidates, claimed=names, language=out_lang+ )+# NOTHING is spoken between here and the delivery verdict below, and that# silence is the feature. A bridge line lived here for a few hours on# 2026-07-27 to fill the prompt writer's 10-21 s, and it produced the@@ -5860,28 +5913,334 @@ class BrainManager:log.warning("Agentic IDE work split failed", exc_info=True)assignments = None- # No brain is pinned for the composer on purpose. An earlier version- # handed it this turn's FAST router model to save 4-5 s, but that- # optimised the wrong axis: the prompt is what the coding agent then- # works from for minutes, and the maintainer's decision on 2026-07-25- # was explicitly for the better prompt over the quicker handoff. The- # composer resolves a quality-tier model itself and degrades to its- # deterministic prompt when none is reachable.+ verdict = await self._deliver_agentic_ide_prompt(+ session=session,+ names=names,+ utterance=user_text,+ instruction=found.instruction,+ language=out_lang,+ assignments=assignments,+ )+ if leftover is not None:+ # Armed only now: a question about the rest of the fleet is worth+ # asking once the panes that WERE understood are actually briefed,+ # and a delivery that failed on the way there should not leave a+ # question standing about work nobody received.+ need, question = leftover+ ide_clarify.WINDOW.arm(need, question=question)+ log.info(+ "Agentic IDE: briefed %s, asking about %s",+ ", ".join(names),+ " / ".join(need.offered),+ )+ return f"{verdict} {question}" if verdict else question+ return verdict++ async def _deliver_agentic_ide_prompt(+ self,+ *,+ session: Any,+ names: list[str],+ utterance: str,+ instruction: str,+ language: str,+ assignments: dict[str, str] | None = None,+ ) -> str | None:+ """Compose and type one instruction into the addressed panes.++ Shared by the addressed-terminal path and by the answer to a "did you+ mean …?" question, so a clarified pane is briefed through exactly the+ same composer and reported by exactly the same verdict line. A second+ delivery site would be free to drift into announcing something it did+ not do, which is the failure class this whole area exists to prevent.++ No brain is pinned for the composer on purpose. An earlier version+ handed it this turn's FAST router model to save 4-5 s, but that+ optimised the wrong axis: the prompt is what the coding agent then+ works from for minutes, and the maintainer's decision on 2026-07-25+ was explicitly for the better prompt over the quicker handoff. The+ composer resolves a quality-tier model itself and degrades to its+ deterministic prompt when none is reachable.+ """+ from jarvis.agentic_ide import fanout as ide_fanout++ # Returning None here would hand the turn to the model with nothing to+ # go on, and a model asked about a pane it cannot see answers from the+ # user's own question — which is precisely how "I have let Alex know"+ # was spoken over a terminal that had received nothing (2026-07-27).+ # A delivery that did not happen is a fact worth saying out loud, so+ # every exit below carries one; ``deliver`` itself never raises for a+ # single pane, so reaching these means the whole fan-out fell over.try:result = await ide_fanout.deliver(session=session,terminals=names,- utterance=user_text,- instruction=found.instruction,+ utterance=utterance,+ instruction=instruction,assignments=assignments,)except Exception: # noqa: BLE001 - never crash the turn over a panelog.warning("Agentic IDE fast-path failed", exc_info=True)- return None+ return action_phrase(+ "ide_prompt_sent_nobody", language, failed=_join_names(names, language)+ )if not result.deliveries:+ log.warning(+ "Agentic IDE fast-path: fan-out returned no verdicts for %s",+ ", ".join(names),+ )+ return action_phrase(+ "ide_prompt_sent_nobody", language, failed=_join_names(names, language)+ )+ return _fanout_reply_line(result, language)++ def _ask_which_agentic_ide_terminal(+ self,+ user_text: str,+ *,+ candidates: list[str],+ language: str,+ ) -> str | None:+ """Ask which pane was meant, or ``None`` when there is nothing to ask.++ The question is armed as a one-shot window: the user's next turn ("ja",+ "Ellis") delivers the ORIGINAL instruction to the confirmed pane, so+ clarifying costs one word rather than a repeated sentence.+ """+ try:+ from jarvis.agentic_ide import clarify as ide_clarify+ except Exception: # noqa: BLE001 - optional surface+ return None+ try:+ need = ide_clarify.detect_clarification(user_text, names=candidates)+ except Exception: # noqa: BLE001 - a detector fault stays silent+ return None+ if need is None:+ return None++ question = self._agentic_ide_clarify_question(need, language)+ ide_clarify.WINDOW.arm(need, question=question)+ log.info(+ "Agentic IDE: heard %r, asking whether %s was meant",+ " / ".join(item.spoken for item in need.uncertain),+ " / ".join(need.offered),+ )+ return question++ @staticmethod+ def _agentic_ide_clarify_question(+ need: Any, language: str, *, also: bool = False+ ) -> str:+ """The spoken question for one uncertain call-sign, or for a list.++ Three shapes, because they mean three different things and a user has+ to be able to answer each with one word: one pane offered ("did you+ mean Blake?"), one word that could be several panes ("Max OR+ Maggie?"), and several garbled names in one list ("Alex AND Blake?").+ Joining the last one with "or" would ask the user to pick between two+ agents they had just addressed together.+ """+ spoken = need.spoken+ if len(need.uncertain) > 1:+ heard = [item.spoken for item in need.uncertain]+ spoken = action_phrase("join_and", language).join(+ (", ".join(heard[:-1]), heard[-1])+ )++ offered = need.offered+ if len(need.uncertain) == 1 and len(offered) == 1:+ if also:+ return action_phrase(+ "ide_terminal_clarify_also",+ language,+ spoken=spoken,+ names=offered[0],+ )+ return action_phrase(+ "ide_terminal_clarify_one", language, spoken=spoken, name=offered[0]+ )+ # Alternatives for ONE word are offered with "or"; a list of separate+ # names is joined with "and", because both were meant.+ joiner = "join_and" if len(need.uncertain) > 1 else "join_or"+ joined = action_phrase(joiner, language).join(+ (", ".join(offered[:-1]), offered[-1])+ )+ return action_phrase(+ "ide_terminal_clarify_also" if also else "ide_terminal_clarify_many",+ language,+ spoken=spoken,+ names=joined,+ )++ def _agentic_ide_leftover_question(+ self,+ user_text: str,+ *,+ candidates: list[str],+ claimed: list[str],+ language: str,+ ) -> tuple[Any, str] | None:+ """A question about the addressees this turn named but did not resolve.++ Returns ``(need, question)`` when the utterance addressed panes BEYOND+ the ones about to be briefed, else ``None``. The caller arms it after+ the delivery, so the user hears which agents really got the work before+ being asked about the rest.++ Nothing is asked when every uncertain word points at a pane that is+ already being briefed — that is the same addressee reached twice, not a+ second one.+ """+ try:+ from jarvis.agentic_ide import clarify as ide_clarify+ from jarvis.agentic_ide import intent as ide_intent++ need = ide_clarify.detect_clarification(user_text, names=candidates)+ except Exception: # noqa: BLE001 - a detector fault stays silent+ return None++ already = {name.casefold() for name in claimed}+ if need is not None and not all(+ all(name.casefold() in already for name in item.candidates)+ for item in need.uncertain+ ):+ return need, self._agentic_ide_clarify_question(need, language, also=True)++ # No word came close enough to name a pane — and a call-sign can be+ # mangled past every threshold there is ("Dave" for a pool that holds+ # none). What survives that is the COUNT the user stated out loud:+ # "both of you" says two agents were addressed however badly the names+ # travelled. Briefing one and saying nothing is the failure this+ # catches — the user hears one name confirmed and believes two are+ # working (live 2026-07-27 19:07).+ try:+ if not ide_intent.expects_several(user_text):+ return None+ except Exception: # noqa: BLE001 - a detector fault stays silent+ return None+ if len(claimed) > 1:+ return None+ rest = tuple(name for name in candidates if name.casefold() not in already)+ if not rest:return None- return _fanout_reply_line(result, out_lang)+ # Armed over every OTHER pane, so the next word ("Blake") delivers the+ # original task. A bare "yes" decides nothing here and must not: there+ # is no candidate to confirm, only panes to choose between.+ unresolved = ide_clarify.ClarificationNeeded(+ uncertain=(ide_clarify.UncertainName(spoken="", candidates=rest),),+ utterance=user_text,+ certain=tuple(claimed),+ )+ return unresolved, action_phrase(+ "ide_terminal_who_else", language, names=", ".join(claimed)+ )++ async def _brief_spawned_agentic_ide_fleet(+ self,+ session: Any,+ names: list[str],+ user_text: str,+ ) -> None:+ """Brief newly mounted Codex panes once their real input lines exist."""+ from jarvis.agentic_ide import fanout as ide_fanout+ from jarvis.agentic_ide import intent as ide_intent+ from jarvis.agentic_ide.fleet_actions import wait_for_prompt_ready++ instruction = ide_intent.spawn_instruction(user_text)+ assignments: dict[str, str] | None = None+ if len(names) > 1 and ide_intent.wants_split(user_text):+ try:+ from jarvis.agentic_ide import work_split as ide_split++ plan = await ide_split.split(+ instruction,+ session=session,+ count=len(names),+ )+ assignments = {+ name: item.task+ for name, item in zip(names, plan.assignments, strict=False)+ }+ except Exception: # noqa: BLE001 - the common brief is still usable+ log.warning("Agentic IDE spawned-fleet split failed", exc_info=True)++ ready = await wait_for_prompt_ready(session, names)+ missing = [name for name in names if name not in ready]+ if missing:+ log.warning(+ "Agentic IDE spawned-fleet briefing: panes never became ready: %s",+ ", ".join(missing),+ )+ if not ready:+ return++ result = await ide_fanout.deliver(+ session=session,+ terminals=ready,+ utterance=user_text,+ instruction=instruction,+ assignments=assignments,+ )+ log.info(+ "Agentic IDE spawned-fleet briefing: %d of %d prompts delivered",+ len(result.delivered),+ len(names),+ )++ async def _run_agentic_ide_close_fast_path(+ self,+ user_text: str,+ *,+ trace_id: UUID | None = None,+ ) -> str | None:+ """Close an explicitly requested terminal fleet without model routing."""+ try:+ from jarvis.agentic_ide import intent as ide_intent+ from jarvis.agentic_ide.fleet_actions import (+ close_agent_terminals,+ terminals_closed_event,+ )+ from jarvis.agentic_ide.session import get_registry++ request = ide_intent.detect_close_fleet(user_text)+ except Exception: # noqa: BLE001 - optional surface+ return None+ if request is None:+ return None++ out_lang = resolve_output_language(+ self._reply_language,+ "unknown",+ user_text,+ default=DEFAULT_LOCALE,+ conversation_language=self._conversation_language,+ )+ registry = get_registry()+ session = registry.session+ if session is None:+ return action_phrase("ide_terminals_none_to_close", out_lang)+ closed = await close_agent_terminals(registry, request.agent)+ if not closed:+ return action_phrase("ide_terminals_none_to_close", out_lang)+ if self._bus is not None:+ try:+ await self._bus.publish(+ terminals_closed_event(+ session,+ closed,+ source_layer="brain.agentic_ide_close",+ )+ )+ except Exception: # noqa: BLE001 - the terminals are already closed+ log.warning("Agentic IDE close: UI notification failed", exc_info=True)+ names = [term.name for term in closed]+ return action_phrase(+ "ide_terminals_closed",+ out_lang,+ count=len(names),+ names=_join_names(names, out_lang),+ )async def _run_agentic_ide_spawn_fast_path(self,diff --git a/jarvis/commands/registry.py b/jarvis/commands/registry.pyindex 5045addaea..89f6bc53c1 100644--- a/jarvis/commands/registry.py+++ b/jarvis/commands/registry.py@@ -89,6 +89,24 @@ def _provider_ids(tier: str, *, brain_switchable_only: bool = False) -> list[strreturn sorted(ids)+def _coding_agent_ids() -> list[str]:+ """Coding CLIs a workspace pane can run, from the ONE agent registry.++ Never a literal list. A registered CLI that the voice schema does not know+ about is unreachable by voice while being fully supported everywhere else —+ the pane opens from the UI, resumes, accepts prompts, and is simply absent+ from the one surface that is supposed to drive it. Reading the registry is+ what lets a newly registered agent be spawned the day it lands, without a+ second table remembering to agree (the same rule §5 sets for providers:+ gate on the capability, never on a name someone typed twice).+ """+ try:+ from jarvis.workspace.agents import coding_agent_names+ except Exception: # pragma: no cover - defensive: registry must not crash+ return []+ return sorted(coding_agent_names())++def _all_provider_ids() -> list[str]:try:from jarvis.ui.web.provider_spec import PROVIDERS@@ -718,17 +736,105 @@ def _build_registry() -> tuple[AppCommand, ...]:"es": ("dile a mika que ejecute las pruebas",), # i18n-allow: input vocab},),+ AppCommand(+ id="agentic-ide-fanout",+ title="Open and brief Agentic-IDE terminals in one step",+ description=(+ "Give ONE task to coding terminals — existing ones, brand-new "+ "ones, or both — in a single call. This is the ONLY correct way "+ "to handle 'if no terminal is called that, open one and prompt "+ "it' and 'spawn N terminals and let them do X': pass the work as "+ "'instruction', the panes to brief as 'terminals', and the panes "+ "to open first as 'spawn'. Never emulate it by opening panes and "+ "then prompting — call-signs are assigned automatically, so a "+ "pane you open is NOT called the name you had in mind, and "+ "re-spawning after a failed prompt just leaves blank panes "+ "behind. Set 'split' true only when the user asked for the work "+ "to be DIVIDED between the agents. "+ "CHECK THE REPLY: 'delivered' names the agents that really got "+ "the task and 'undelivered' those that did not — report both, "+ "and use the call-signs the reply gives you."+ ),+ method="POST",+ path="/api/agentic-ide/fanout",+ params={+ "type": "object",+ "properties": {+ "instruction": _str_param(+ "The work the agents should do, in plain words.",+ min_length=1,+ max_length=4000,+ ),+ "terminals": {+ "type": "array",+ "items": {"type": "string"},+ "description": (+ "Call-signs of running terminals to brief. Leave "+ "empty to brief only the newly opened panes."+ ),+ },+ "spawn": {+ "type": "array",+ "items": {+ "type": "object",+ "properties": {+ "count": {+ "type": "integer",+ "description": "Panes to open in this group.",+ },+ "agent": {+ "type": "string",+ "enum": _coding_agent_ids() or None,+ "description": (+ "Coding agent for this group; omit to "+ "inherit the last pane's."+ ),+ },+ },+ "required": ["count"],+ },+ "description": (+ "Panes to open before briefing, group by group. "+ "Only the newly opened panes are briefed, so agents "+ "already working are not interrupted."+ ),+ },+ "split": {+ "type": "boolean",+ "default": False,+ "description": (+ "Divide the instruction into one distinct assignment "+ "per agent instead of giving all of them the same "+ "brief."+ ),+ },+ },+ "required": ["instruction"],+ },+ ui_section="agentic-ide",+ voice_aliases={+ # i18n-allow: input vocab+ "de": ("spawne ein terminal und lass es die tests fixen",),+ "en": ("open a terminal and have it fix the tests",),+ "es": ("abre una terminal y que arregle las pruebas",), # i18n-allow: input vocab+ },+ ),AppCommand(id="agentic-ide-spawn-terminals",title="Open more Agentic-IDE terminals",description=("Open one or more additional coding terminals in the open "- "workspace. Use this when the user asks for MORE TERMINALS / "- "panes ('spawn five new Claude Code terminals', 'open two more "- "Codex terminals') — that is a request for workspace panes, "- "never for a background worker. Pass count, and agent only when "- "the user named one ('claude' or 'codex'); omitted, the new "- "panes run whatever the last pane runs. "+ "workspace, WITHOUT giving them work. Use this only when the "+ "user asks for bare panes ('spawn five new Claude Code "+ "terminals', 'open two more Codex terminals') — that is a "+ "request for workspace panes, never for a background worker. "+ "When the new panes are also meant to DO something, use "+ "'agentic-ide-fanout' instead, which opens and briefs them in "+ "one step. Pass count, and agent only when the user named one "+ "('claude' or 'codex'); omitted, the new panes run whatever the "+ "last pane runs. Their call-signs are assigned automatically — "+ "the reply's names are the only way to address them, and calling "+ "this again never produces a name you picked. ""CHECK THE REPLY: 'capped' true means the workspace maximum cut ""the request short — say how many actually opened and name them, ""never report the full number as done."@@ -745,7 +851,7 @@ def _build_registry() -> tuple[AppCommand, ...]:},"agent": {"type": "string",- "enum": ["claude", "codex"],+ "enum": _coding_agent_ids() or None,"description": ("Coding agent for the new panes; omit to inherit ""the last pane's."@@ -819,7 +925,7 @@ def _build_registry() -> tuple[AppCommand, ...]:"properties": {"agent": _str_param("Coding agent whose terminals should be closed.",- enum=["claude", "codex"],+ enum=_coding_agent_ids() or None,),},"required": ["agent"],diff --git a/jarvis/voice/action_phrases.py b/jarvis/voice/action_phrases.pyindex d55f92d60d..a420a810c0 100644--- a/jarvis/voice/action_phrases.py+++ b/jarvis/voice/action_phrases.py@@ -398,6 +398,52 @@ _PHRASES: dict[str, dict[str, str]] = {"en": "I opened {folder}: {names}.","es": "Abrí {folder}: {names}.",},+ # A call-sign the transcript almost matched. Both variants REPEAT what was+ # heard: the user's own word is the only thing that lets them tell a+ # misheard name from a wrong pane, and hearing "I understood Ilies" is what+ # makes "no, Ellis" the obvious next thing to say.+ "ide_terminal_clarify_one": {+ "de": "Ich habe {spoken} verstanden — meinst du {name}?", # i18n-allow+ "en": "I heard {spoken} — did you mean {name}?",+ "es": "Entendí {spoken}: ¿te refieres a {name}?",+ },+ "ide_terminal_clarify_many": {+ "de": "Ich habe {spoken} verstanden — meinst du {names}?", # i18n-allow+ "en": "I heard {spoken} — did you mean {names}?",+ "es": "Entendí {spoken}: ¿te refieres a {names}?",+ },+ # The separator for the final pair of an alternative list ("Maggie or Max").+ # A phrase entry rather than a literal, so the choice is offered in the+ # turn's language like every other spoken word.+ "join_or": {+ "de": " oder ", # i18n-allow+ "en": " or ",+ "es": " o ",+ },+ # The separator for the final pair of a LIST ("Alex and Blake"). Distinct+ # from ``join_or`` because the two questions mean opposite things: "Max or+ # Maggie" offers a choice between panes, "Alex and Blake" asks about both.+ "join_and": {+ "de": " und ", # i18n-allow+ "en": " and ",+ "es": " y ",+ },+ # Panes were briefed AND one call-sign of the same breath stayed unclear.+ # The two halves are said in one sentence on purpose: the user has to hear+ # which agents actually got the work before being asked about the rest.+ "ide_terminal_clarify_also": {+ "de": "Ich habe außerdem {spoken} verstanden — meinst du {names}?", # i18n-allow+ "en": "I also heard {spoken} — did you mean {names}?",+ "es": "También entendí {spoken}: ¿te refieres a {names}?",+ },+ # The user addressed several panes and only one call-sign survived speech+ # recognition. Saying which one was placed is the load-bearing half: it is+ # what stops the user believing a second agent is working when none is.+ "ide_terminal_who_else": {+ "de": "Ich konnte nur {names} zuordnen — wer sollte noch ran?", # i18n-allow+ "en": "I could only place {names} — who else did you mean?",+ "es": "Solo pude identificar a {names}: ¿quién más?",+ },"ide_terminals_nowhere": {"de": ( # i18n-allow"Es ist kein Workspace offen und ich habe keinen letzten. " # i18n-allowdiff --git a/jarvis/workspace/agents.py b/jarvis/workspace/agents.pyindex efbe4ab950..7e4c18f296 100644--- a/jarvis/workspace/agents.py+++ b/jarvis/workspace/agents.py@@ -29,7 +29,9 @@ rather than handing the PTY an argv that cannot start.from __future__ import annotationsimport logging-from dataclasses import dataclass+from collections.abc import Callable, Mapping+from dataclasses import dataclass, field+from typing import Any, Literalfrom jarvis.clis.prober import CliStatusProberfrom jarvis.clis.spec import AuthConfig, CliSpec, InstallMethods, RiskConfig@@ -41,6 +43,15 @@ log = logging.getLogger(__name__)# "2.1.195 (Claude Code)" and "codex-cli 0.142.3"._SEMVER_RE = r"(\d+\.\d+\.\d+)"+# The same, with the patch component optional. Not every CLI ships three parts:+# the Python-generation Kimi answers ``kimi, version 1.3``, which the strict+# pattern above misses entirely — and a missed version is not a cosmetic loss.+# It reads downstream as ``version=None``, which the wizard and the resume offer+# render as a blank field next to an installed binary, i.e. exactly what a+# broken install looks like. Entries whose CLI numbers itself in two parts opt+# into this instead.+_LOOSE_SEMVER_RE = r"(\d+\.\d+(?:\.\d+)?)"+# The registry key of the plain-shell entry. A name rather than a literal# everywhere, because several layers (the IDE session registry, the pane split# menu, the tests) have to agree on it.@@ -163,9 +174,28 @@ def register_agent(agent: WorkspaceAgent, *, replace: bool = False) -> Workspaceif agent.name in _AGENTS and not replace:raise ValueError(f"A workspace agent called {agent.name!r} is already registered.")_AGENTS[agent.name] = agent+ _forget_command_catalog()return agent+def _forget_command_catalog() -> None:+ """Drop the cached command catalog, which spells this registry out.++ The voice/LLM schema for "open a pane running X" lists the registered+ coding CLIs by name, and that catalog is built once and cached. An agent+ registered after the first build would therefore be openable from the UI,+ resumable, promptable — and invisible to the one surface meant to drive it.+ Never raises: the catalog is optional to this module, and a registration+ that fails because of it would be the worse outcome.+ """+ try:+ from jarvis.commands.registry import get_registry++ get_registry.cache_clear()+ except Exception: # noqa: BLE001 - the catalog is not this module's job+ return++def list_agents() -> list[WorkspaceAgent]:"""Every registered entry, in registration order."""return list(_AGENTS.values())diff --git a/tests/unit/agentic_ide/test_clarify.py b/tests/unit/agentic_ide/test_clarify.pynew file mode 100644index 0000000000..884f12ca46--- /dev/null+++ b/tests/unit/agentic_ide/test_clarify.py@@ -0,0 +1,351 @@+"""A misheard call-sign must ask, and only ever ask about the workspace.++Two live failures of 2026-07-27 meet in this module, and they pull in opposite+directions — which is why the cases below are written as two lists that must+BOTH hold, rather than as one threshold:++* the pane "Ellis" came back from speech recognition as "Ilies" and the+ addressed-terminal path stood down in silence, so nothing was typed anywhere+ and the live model claimed an agent was working;+* ordinary speech reaches the same pool from the other side ("allen" scores+ 0.750 against "Alex", above the acting threshold), so a sentence about the+ outside world must never be typed into somebody's coding agent.++The maintainer's own examples are pinned verbatim, including the counter-example+("what is Elon Musk up to?") — they are the specification.+"""++from __future__ import annotations++import pytest++from jarvis.agentic_ide import intent+from jarvis.agentic_ide.clarify import (+ ClarificationWindow,+ addresses_workspace,+ detect_clarification,+ is_outside_world_talk,+)++PANES = ["Alex", "Blake", "Casey", "Dana", "Ellis", "Finn"]+++def _outcome(text: str, names: list[str] | None = None) -> str:+ """What the workspace does with this turn: act, ask, or stay out of it.++ Deliberately routed through BOTH detectors in the order the brain calls+ them. A case that acts must not also ask, and a case that neither acts nor+ asks must be silent for a reason — the three outcomes are only meaningful+ together.+ """+ panes = names or PANES+ if intent.detect_all(text, names=panes):+ return "act"+ return "ask" if detect_clarification(text, names=panes) else "silent"+++# --------------------------------------------------------------------------- #+# A turn addresses a FLEET (live 2026-07-27 19:07) #+# --------------------------------------------------------------------------- #+++def test_a_garbled_name_beside_a_certain_one_is_still_asked_about() -> None:+ """The 19:07 failure: two panes addressed, one briefed, one dropped silent.++ A certainly-named pane used to end the search, so the second addressee —+ whose call-sign speech recognition had mangled — produced no action and no+ question. The user heard that Alex was working and believed both were.+ """+ need = detect_clarification(+ "Alex und Blaike sollen beide einen Deep Dive machen", names=PANES+ )+ assert need is not None, "the second addressee must not vanish"+ assert need.certain == ("Alex",), "the pane that WAS understood is carried"+ assert need.candidates == ("Blake",)+ assert need.spoken == "Blaike"+++def test_two_garbled_names_in_one_list_both_get_asked_about() -> None:+ """"Alexa und Blaike" is one instruction for two agents, not noise."""+ need = detect_clarification(+ "Alexa und Blaike sollen beide einen Deep Dive machen", names=PANES+ )+ assert need is not None+ assert [item.spoken for item in need.uncertain] == ["Alexa", "Blaike"]+ assert need.offered == ("Alex", "Blake")++ window = ClarificationWindow()+ window.arm(need)+ # ONE "yes" confirms the whole list — that is the point of asking once.+ assert window.resolve_answer("ja") == (("Alex", "Blake"), need.utterance)+++def test_naming_both_panes_answers_for_both() -> None:+ need = detect_clarification(+ "Alexa und Blaike sollen beide einen Deep Dive machen", names=PANES+ )+ assert need is not None+ window = ClarificationWindow()+ window.arm(need)+ resolved = window.resolve_answer("Alex and Blake")+ assert resolved is not None+ assert resolved[0] == ("Alex", "Blake")+++def test_a_stray_near_miss_beside_a_working_turn_stays_silent() -> None:+ """The cost of the change must not be a question on every good turn.++ "Alex" is certain and the sentence works; "Kannst" scores against "Casey"+ without being listed beside anything, so it is noise and must not produce+ a question the user then has to say "no" to.+ """+ need = detect_clarification(+ "Alex soll bitte die Tests reparieren, Kannst das laufen", names=PANES+ )+ assert need is None+++# --------------------------------------------------------------------------- #+# The live failure #+# --------------------------------------------------------------------------- #+++def test_the_live_transcript_asks_instead_of_going_silent() -> None:+ """The 2026-07-27 16:18 turn, verbatim from the session transcript."""+ spoken = (+ "kannst du bitte Ilies ein Deep Dive machen lassen und sie soll "+ "gucken, wieso wenn man aus dem Agentic IDE Mode rausgeht"+ )+ need = detect_clarification(spoken, names=PANES)+ assert need is not None, "the turn that started this must not be silent"+ assert need.candidates == ("Ellis",)+ assert need.spoken == "Ilies"+ # The ORIGINAL wording is carried, because it holds the actual task.+ assert need.utterance == spoken+++def test_the_answer_delivers_the_original_task() -> None:+ """A question is only worth asking if "yes" still does the work."""+ window = ClarificationWindow()+ spoken = "kannst du bitte Ilies das Deep Dive machen lassen"+ need = detect_clarification(spoken, names=PANES)+ assert need is not None+ window.arm(need)++ assert window.resolve_answer("ja") == (("Ellis",), spoken)+ # One question, one answer: the window is spent.+ assert not window.armed+ assert window.resolve_answer("ja") is None+++def test_naming_the_pane_answers_even_with_several_offered() -> None:+ """"Maggie" decides what a bare "yes" cannot."""+ window = ClarificationWindow()+ panes = ["Alex", "Max", "Maggie"]+ need = detect_clarification("Kannst du bitte Mags prompten?", names=panes)+ assert need is not None+ assert set(need.candidates) == {"Max", "Maggie"}+ window.arm(need)++ resolved = window.resolve_answer("Maggie")+ assert resolved is not None+ assert resolved[0] == ("Maggie",)+++def test_a_bare_yes_cannot_choose_between_two_panes() -> None:+ window = ClarificationWindow()+ need = detect_clarification(+ "Kannst du bitte Mags prompten?", names=["Alex", "Max", "Maggie"]+ )+ assert need is not None+ window.arm(need)+ assert window.resolve_answer("ja") is None+++def test_a_declined_question_delivers_nothing() -> None:+ window = ClarificationWindow()+ need = detect_clarification("Kannst du bitte Ilies prompten?", names=PANES)+ assert need is not None+ window.arm(need)+ assert window.resolve_answer("nein") is None+ assert not window.armed+++def test_moving_on_closes_the_question_instead_of_answering_it() -> None:+ """A full sentence is the user moving on, not an answer."""+ window = ClarificationWindow()+ need = detect_clarification("Kannst du bitte Ilies prompten?", names=PANES)+ assert need is not None+ window.arm(need)+ assert (+ window.resolve_answer(+ "ach lass mal, erzähl mir lieber wie das Wetter morgen wird"+ )+ is None+ )+ assert not window.armed+++def test_a_stale_question_never_delivers_work() -> None:+ window = ClarificationWindow()+ need = detect_clarification("Kannst du bitte Ilies prompten?", names=PANES)+ assert need is not None+ window.arm(need, now=0.0)+ assert window.resolve_answer("ja", now=10_000.0) is None+++# --------------------------------------------------------------------------- #+# The maintainer's specification (2026-07-27) #+# --------------------------------------------------------------------------- #++# "If I only say a first name that could be roughly the same, it should check+# that I mean the right one."+ASKS = [+ ("kannst du bitte Ilies ein Deep Dive machen lassen", None),+ ("Ilies soll mal einen Deep Dive machen", None),+ ("Kannst du bitte Mags prompten?", ["Alex", "Max", "Maggie"]),+ ("Dena soll die Tests fixen", None),+ ("Kannst du Ellice beauftragen, den Bug zu fixen", None),+]++# "But not, for example: 'can you tell me what Elon Musk is doing right now?'+# … and then it prompts everyone. That must of course not happen."+STAYS_OUT = [+ "Kannst du bitte mir sagen, was Elon Musk gerade macht?",+ "Sag mir was Elon Musk gerade macht",+ "Was macht Elon gerade?",+ "Wer ist Elon Musk?",+ "kannst du mir sagen was Barack Obama gerade macht",+ "Erzähl mir was über Elias Canetti",+ "wie ist das Wetter heute",+ "kannst du bitte den Bug fixen",+ "mach mal einen Deep Dive in den Code",+ "Ilies ist ein schöner Name",+ "schick das an Alexander Müller weiter",+ "lass die Tests laufen und fixe die Fehler",+ "Das soll man mal fixen",+]++[email protected](("spoken", "panes"), ASKS)+def test_an_uncertain_call_sign_asks(spoken: str, panes: list[str] | None) -> None:+ assert _outcome(spoken, panes) == "ask", spoken++[email protected]("spoken", STAYS_OUT)+def test_the_outside_world_never_reaches_a_pane(spoken: str) -> None:+ assert _outcome(spoken) == "silent", spoken+++# --------------------------------------------------------------------------- #+# Certainty still acts — asking must not become the new normal #+# --------------------------------------------------------------------------- #++ACTS = [+ "sag Ellis, sie soll die Tests fixen",+ # Same sound, different spelling: certain, and therefore acted on. This is+ # the gap the canonicalization in ``intent`` closed — the templates are+ # built from the exact spelling and used to match none of these.+ "Sag Elis, sie soll die Tests fixen",+ "beauftrage Ellys mit dem Bug",+ "Kannst du Elliss beauftragen, den Bug zu fixen",+ "Was macht Ellis gerade?",+ "sag allen, sie sollen die Tests fixen",+]++[email protected]("spoken", ACTS)+def test_a_certain_call_sign_is_still_acted_on(spoken: str) -> None:+ assert _outcome(spoken) == "act", spoken+++def test_a_misheard_collective_address_cannot_brief_the_whole_workspace() -> None:+ """The costliest thing a garbled word can do is reach EVERY pane at once."""+ assert is_outside_world_talk("sag allen was Elon Musk gerade macht")+ assert intent.detect_all(+ "sag allen was Elon Musk gerade macht", names=PANES+ ) == []+ # A genuine collective instruction still reaches everyone.+ assert len(intent.detect_all("sag allen, sie sollen aufhören", names=PANES)) == len(+ PANES+ )+++# --------------------------------------------------------------------------- #+# The gate itself #+# --------------------------------------------------------------------------- #+++ ("spoken", "expected"),+ [+ ("Kannst du bitte Max prompten?", True),+ ("beauftrage Max mit dem Bug", True),+ ("sag Max, er soll die Tests fixen", True),+ ("Max soll die Tests fixen", True),+ # A handover verb and a name and nothing else is NOT workspace evidence.+ ("Sag mir was Elon Musk gerade macht", False),+ ("wie ist das Wetter", False),+ ],+)+def test_workspace_gate(spoken: str, expected: bool) -> None:+ assert addresses_workspace(spoken) is expected+++def test_an_all_lowercase_transcript_still_refuses_function_words() -> None:+ """Case cannot rule when the provider capitalizes nothing; stopwords still do."""+ need = detect_clarification(+ "kannst du bitte den bug fixen lassen", names=PANES+ )+ assert need is None+++# --------------------------------------------------------------------------- #+# Asking a pane for a status report #+# --------------------------------------------------------------------------- #+# The 16:53 half of the same day: "Was hat Dana gemacht?" carries no repo, no+# test, no bug and no branch, so the coding-work pairings never saw it — a+# garbled call-sign inside the single most common workspace question there is+# went silently nowhere.+++ "spoken",+ [+ "Was hat Ellis gemacht?",+ "Was macht Ellis gerade?", # i18n-allow: German speech input under test+ "Wie weit ist Ellis?", # i18n-allow: German speech input under test+ "What has Ellis done?",+ "How far is Ellis?",+ "Que ha hecho Ellis?",+ ],+)+def test_a_status_question_addresses_the_workspace(spoken: str) -> None:+ assert addresses_workspace(spoken) is True+++def test_a_garbled_call_sign_in_a_status_question_asks() -> None:+ """The live 16:53 shape, with the name mangled the way 16:18 mangled it."""+ need = detect_clarification("Was hat Ilies gemacht?", names=PANES)+ assert need is not None+ assert need.candidates == ("Ellis",)+ # And the confirmed pane is briefed with the ORIGINAL question, not "yes".+ window = ClarificationWindow()+ window.arm(need)+ assert window.resolve_answer("ja") == (("Ellis",), "Was hat Ilies gemacht?")+++ "spoken",+ [+ # A full personal name turns the identical shape into a question about+ # a human being — the surname is the only thing that tells them apart.+ "Sag mir was Elon Musk gerade macht",+ "Was hat Angela Merkel gemacht?",+ ],+)+def test_a_status_question_about_a_person_stays_out_of_the_workspace(+ spoken: str,+) -> None:+ assert addresses_workspace(spoken) is False+ assert _outcome(spoken) == "silent"diff --git a/tests/unit/brain/test_agentic_ide_clarify_fast_path.py b/tests/unit/brain/test_agentic_ide_clarify_fast_path.pynew file mode 100644index 0000000000..d705c0f995--- /dev/null+++ b/tests/unit/brain/test_agentic_ide_clarify_fast_path.py@@ -0,0 +1,312 @@+"""A call-sign the transcript garbled is asked about, then delivered on.++The live failure of 2026-07-27 16:18, end to end: the pane "Ellis" came back+from speech recognition as "Ilies", scoring just under the acting threshold. The+addressed-terminal path returned ``None`` without a word — no prompt was typed,+nothing was said, and the realtime model, which is never told any of this, filled+the silence by announcing that an agent was on it. The maintainer spent the next+two turns being told a lie.++What this file pins is the whole repaired loop, because each half is worthless+alone:++* an uncertain call-sign produces a QUESTION rather than silence, and types+ nothing into any pane while it is unanswered;+* the answer delivers the ORIGINAL sentence — the one that carried the task — so+ clarifying costs the user one word instead of repeating themselves;+* a sentence about the outside world still reaches no pane at all, which is the+ failure the question must not buy at the price of.+"""+from __future__ import annotations++from pathlib import Path++import pytest++from jarvis.agentic_ide import clarify as ide_clarify+from jarvis.agentic_ide import prompt_composer+from jarvis.agentic_ide import session as session_mod+from jarvis.agentic_ide.prompt_composer import ComposedPrompt+from jarvis.agentic_ide.session import Registry+from jarvis.brain.manager import BrainManager+from jarvis.core.bus import EventBus+from jarvis.core.config import JarvisConfig+from tests.fakes.fake_pty_manager import FakePtyManager++[email protected](autouse=True)+def _isolated_recents(+ tmp_path_factory: pytest.TempPathFactory, monkeypatch: pytest.MonkeyPatch+) -> None:+ """Never rewrite the developer's real recent-workspace list from a test."""+ from jarvis.agentic_ide import recents++ store = tmp_path_factory.mktemp("recents") / "recents.json"+ monkeypatch.setattr(recents, "_store_path", lambda: store)++[email protected](autouse=True)+def _clean_window() -> None:+ """The clarification window is process-wide; no test may inherit one."""+ ide_clarify.WINDOW.disarm()+ yield+ ide_clarify.WINDOW.disarm()+++def registry(monkeypatch: pytest.MonkeyPatch) -> Registry:+ monkeypatch.setattr(session_mod, "agent_argv", lambda name: (f"/usr/bin/{name}",))+ reg = Registry(pty_manager=FakePtyManager())+ monkeypatch.setattr(session_mod, "get_registry", lambda: reg)+ return reg+++def manager() -> BrainManager:+ cfg = JarvisConfig()+ cfg.brain.primary = "fake"+ mgr = BrainManager(config=cfg, bus=EventBus(), tools={})+ # Pinned so the wording assertions never depend on the host's own locale+ # (AP-23: never test against the maintainer's configuration).+ mgr._reply_language = "en"+ return mgr++[email protected](autouse=True)+def _fake_composer(monkeypatch: pytest.MonkeyPatch) -> list[str]:+ """A deterministic stand-in for the quality-tier prompt writer."""+ seen: list[str] = []++ async def fake_compose(utterance: str, **kwargs: object) -> ComposedPrompt:+ seen.append(str(kwargs.get("instruction") or utterance))+ return ComposedPrompt(+ text=f"## Task\n{utterance}", files=[], composed_by="llm"+ )++ monkeypatch.setattr(prompt_composer, "compose", fake_compose)+ return seen+++async def _noop(_text: str) -> None:+ return None+++async def _noop_exit(_code: int) -> None:+ return None+++async def _open(registry: Registry, folder: Path, count: int) -> list[str]:+ """Open ``count`` panes AND bring their agents live; return their call-signs."""+ await registry.start(str(folder), [{"agent": "claude"} for _ in range(count)])+ assert registry.session is not None+ for term in list(registry.session.terminals):+ await registry.attach(term.name, 100, 30, _noop, _noop_exit)+ return [t.name for t in registry.session.terminals]+++def _typed(registry: Registry) -> list[str]:+ """Everything the panes were actually sent this test."""+ return list(registry._pty.typed) # noqa: SLF001 - the fake's recording surface+++def _briefs(registry: Registry) -> list[str]:+ """Just the prompts, without the Enter that submits each one."""+ return [text for text in _typed(registry) if text.strip()]+++# --------------------------------------------------------------------------- #+++async def test_a_garbled_call_sign_asks_instead_of_silently_doing_nothing(+ manager: BrainManager, registry: Registry, tmp_path: Path+) -> None:+ """The regression: 'Ilies' must not vanish into a silent ``None``."""+ names = await _open(registry, tmp_path, 5)+ assert "Ellis" in names, "the fifth pane of the pool is the one that was misheard"++ reply = await manager._run_agentic_ide_fast_path(+ "can you have Ilies do a deep dive and find out why the tests fail"+ )++ assert reply is not None, "the turn that started all of this must not be silent"+ assert "Ellis" in reply+ assert "Ilies" in reply, "the user hears what was understood, not just a guess"+ assert ide_clarify.WINDOW.armed+++async def test_nothing_is_typed_into_a_pane_while_the_question_is_open(+ manager: BrainManager, registry: Registry, tmp_path: Path+) -> None:+ """Asking must not also act — that would be guessing with extra steps."""+ await _open(registry, tmp_path, 5)++ await manager._run_agentic_ide_fast_path(+ "can you have Ilies do a deep dive and find out why the tests fail"+ )++ assert _typed(registry) == []+++async def test_the_answer_delivers_the_original_task(+ manager: BrainManager,+ registry: Registry,+ tmp_path: Path,+ _fake_composer: list[str],+) -> None:+ """"Yes" must do the work the FIRST sentence described, not repeat itself."""+ await _open(registry, tmp_path, 5)+ task = "can you have Ilies do a deep dive and find out why the tests fail"++ question = await manager._run_agentic_ide_fast_path(task)+ assert question is not None++ verdict = await manager._run_agentic_ide_fast_path("yes")++ assert verdict is not None+ assert "Ellis" in verdict+ # The composer saw the original sentence, never the bare confirmation.+ assert any("deep dive" in seen for seen in _fake_composer)+ assert not any(seen.strip().casefold() == "yes" for seen in _fake_composer)+ assert not ide_clarify.WINDOW.armed+++async def test_declining_delivers_nothing(+ manager: BrainManager, registry: Registry, tmp_path: Path+) -> None:+ await _open(registry, tmp_path, 5)+ await manager._run_agentic_ide_fast_path(+ "can you have Ilies do a deep dive and find out why the tests fail"+ )++ assert await manager._run_agentic_ide_fast_path("no") is None+ assert _typed(registry) == []+ assert not ide_clarify.WINDOW.armed+++async def test_a_question_about_the_outside_world_neither_asks_nor_types(+ manager: BrainManager, registry: Registry, tmp_path: Path+) -> None:+ """The maintainer's counter-example, pinned as a hard negative."""+ await _open(registry, tmp_path, 5)++ reply = await manager._run_agentic_ide_fast_path(+ "can you tell me what Elon Musk is doing right now?"+ )++ assert reply is None+ assert _typed(registry) == []+ assert not ide_clarify.WINDOW.armed+++async def test_a_certain_call_sign_still_acts_without_asking(+ manager: BrainManager, registry: Registry, tmp_path: Path+) -> None:+ """Clarifying must not become the new normal for names that ARE clear."""+ names = await _open(registry, tmp_path, 5)++ reply = await manager._run_agentic_ide_fast_path(+ f"tell {names[0]} to fix the failing tests"+ )++ assert reply is not None+ assert not ide_clarify.WINDOW.armed+ assert _typed(registry), "a certain call-sign is delivered, not questioned"+++# --------------------------------------------------------------------------- #+# A turn addresses a FLEET (live 2026-07-27 19:07) #+# --------------------------------------------------------------------------- #+++async def test_two_garbled_call_signs_are_asked_about_together(+ manager: BrainManager, registry: Registry, tmp_path: Path+) -> None:+ """Two mangled names in one list used to produce nothing at all.++ The detector stood down above one uncertain word, so "Alexa und Blaike,+ macht beide ..." reached neither pane and asked nothing — the silent miss+ this whole area exists to end, only for a pair instead of a single pane.+ """+ await _open(registry, tmp_path, 5)++ reply = await manager._run_agentic_ide_fast_path(+ "Alexa and Blaike should both do a deep dive on the failing tests"+ )++ assert reply is not None+ assert "Alex" in reply and "Blake" in reply+ assert _typed(registry) == [], "nothing is typed while the question is open"+ assert ide_clarify.WINDOW.armed+++async def test_one_yes_briefs_the_whole_addressed_pair(+ manager: BrainManager, registry: Registry, tmp_path: Path+) -> None:+ """One question, one word, both agents working."""+ await _open(registry, tmp_path, 5)+ task = "Alexa and Blaike should both do a deep dive on the failing tests"+ assert await manager._run_agentic_ide_fast_path(task) is not None++ verdict = await manager._run_agentic_ide_fast_path("yes")++ assert verdict is not None+ assert "Alex" in verdict and "Blake" in verdict+ assert len(_briefs(registry)) == 2, "both addressees are briefed, not the first"+ assert all("deep dive" in text for text in _briefs(registry))+++async def test_a_pane_that_was_understood_is_briefed_before_the_question(+ manager: BrainManager, registry: Registry, tmp_path: Path+) -> None:+ """A name past every threshold ("Dave") must not cost the one that worked.++ The live shape: Alex resolves, "Dave" matches no pane at any threshold, and+ the turn said "Alex is on it" while the user was waiting for two agents.+ The count the user stated out loud is what survives that, so the work goes+ out AND the gap is named in the same breath.+ """+ await _open(registry, tmp_path, 5)++ reply = await manager._run_agentic_ide_fast_path(+ "Alex and Dave should both do a deep dive on the failing tests"+ )++ assert reply is not None+ assert "Alex" in reply+ assert len(_briefs(registry)) == 1, "the pane that WAS understood is briefed"+ assert ide_clarify.WINDOW.armed, "and the second addressee is asked about"+++async def test_naming_the_missing_pane_delivers_the_original_task(+ manager: BrainManager,+ registry: Registry,+ tmp_path: Path,+ _fake_composer: list[str],+) -> None:+ """"Blake" answers "who else?" with the work the first sentence carried."""+ await _open(registry, tmp_path, 5)+ await manager._run_agentic_ide_fast_path(+ "Alex and Dave should both do a deep dive on the failing tests"+ )++ verdict = await manager._run_agentic_ide_fast_path("Blake")++ assert verdict is not None+ assert "Blake" in verdict+ assert len(_briefs(registry)) == 2+ assert all("deep dive" in text for text in _briefs(registry))+++async def test_a_single_addressee_is_never_asked_who_else(+ manager: BrainManager, registry: Registry, tmp_path: Path+) -> None:+ """The plural check must not tax the ordinary one-pane turn."""+ names = await _open(registry, tmp_path, 5)++ reply = await manager._run_agentic_ide_fast_path(+ f"tell {names[0]} to do a deep dive on the failing tests"+ )++ assert reply is not None+ assert not ide_clarify.WINDOW.armed+ assert len(_briefs(registry)) == 1diff --git a/tests/unit/commands/test_registry_parity.py b/tests/unit/commands/test_registry_parity.pyindex 14db91f913..a5be81624c 100644--- a/tests/unit/commands/test_registry_parity.py+++ b/tests/unit/commands/test_registry_parity.py@@ -137,6 +137,41 @@ def test_brain_switch_enum_excludes_subagent_only_providers() -> None:assert "antigravity" not in enum+def test_spawn_agent_enum_follows_the_agent_registry() -> None:+ """A newly registered coding CLI must be spawnable by voice the same day.++ The enum used to be the literal ``["claude", "codex"]`` in two schemas, so+ an agent added to ``jarvis.workspace.agents`` opened from the UI, resumed+ and accepted prompts while being absent from the one surface meant to drive+ it. Registering one now invalidates the cached catalog.+ """+ from jarvis.commands.registry import get_registry as catalog+ from jarvis.workspace import agents as workspace_agents++ def spawn_enum() -> list[str]:+ cmd = get_command("agentic-ide-spawn-terminals")+ assert cmd is not None+ return list(cmd.params["properties"]["agent"].get("enum") or [])++ assert set(spawn_enum()) == set(workspace_agents.coding_agent_names())++ added = workspace_agents.make_cli_agent(+ "test-cli", "Test CLI", binary="test-cli"+ )+ try:+ workspace_agents.register_agent(added)+ assert "test-cli" in spawn_enum()+ fanout = get_command("agentic-ide-fanout")+ assert fanout is not None+ group = fanout.params["properties"]["spawn"]["items"]["properties"]["agent"]+ assert "test-cli" in (group.get("enum") or [])+ finally:+ workspace_agents._AGENTS.pop("test-cli", None) # noqa: SLF001 - test cleanup+ catalog.cache_clear()++ assert "test-cli" not in spawn_enum()++def test_registry_served_over_rest() -> None:from jarvis.core.bus import EventBusfrom jarvis.core.config import JarvisConfig