Skip to content

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.

feat(agentic-ide): name terminals by position (T1, T2, …) instead of given names

Ruben Lütke6aa63aec915c
diff --git a/jarvis/agentic_ide/clarify.py b/jarvis/agentic_ide/clarify.py
index 640d6912ec..a03b73d78a 100644
--- a/jarvis/agentic_ide/clarify.py
+++ b/jarvis/agentic_ide/clarify.py
@@ -39,7 +39,7 @@ import re
import time
from dataclasses import dataclass, field
-from .names import near_miss, resolve
+from .names import CALL_SIGN_WORD_RE, canonical_positions, 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
@@ -201,8 +201,10 @@ def addresses_workspace(text: str) -> bool:
# 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)
+#: The unit the resolver scores — letters plus an optional digit tail, so a
+#: positional call-sign ("T1") arrives whole. Shared with ``intent`` through
+#: ``names`` so the two cannot disagree about where a name starts and ends.
+_WORD_RE = CALL_SIGN_WORD_RE
_SENTENCE_START_RE = re.compile(r"(?:^|[.!?:;]\s*|\n\s*)$")
@@ -526,13 +528,22 @@ def detect_clarification(
text = str(user_text or "").strip()
if len(text) < 3 or not names:
return None
+ # The workspace gate reads the ORIGINAL wording, because the pane noun is
+ # part of its evidence and the rewrite below consumes it: "prompte Terminal
+ # eins" becomes "prompte T1", and asked in that order the gate would have
+ # lost the word that proves the turn is about the workspace at all.
if not addresses_workspace(text):
return None
+ # Everything after it reads the canonical wording, so a pane named by
+ # position is as CERTAIN here as one named by its call-sign — otherwise
+ # "prompte Terminal eins und Blaike" would report the garbled second name
+ # while forgetting that the first one was clearly addressed.
+ working = canonical_positions(text, names)
certain: list[str] = []
certain_spans: list[tuple[int, int]] = []
uncertain: list[tuple[tuple[int, int], UncertainName]] = []
- for match in _WORD_RE.finditer(text):
+ for match in _WORD_RE.finditer(working):
word = match.group(0)
span = (match.start(), match.end())
# Certain means the exact name or the same sound — deliberately the
@@ -547,9 +558,9 @@ def detect_clarification(
candidates = near_miss(word, names)
if not candidates:
continue
- if not _is_proper_name_position(text, *span):
+ if not _is_proper_name_position(working, *span):
continue
- if is_part_of_full_name(text, *span):
+ if is_part_of_full_name(working, *span):
continue
uncertain.append(
(span, UncertainName(spoken=word, candidates=tuple(n for n, _ in candidates)))
@@ -567,7 +578,7 @@ def detect_clarification(
kept = [
(span, item)
for span, item in uncertain
- if _is_listed_beside(text, span, [s for s in neighbours if s != span])
+ if _is_listed_beside(working, span, [s for s in neighbours if s != span])
]
if not kept:
return None
diff --git a/jarvis/agentic_ide/context.py b/jarvis/agentic_ide/context.py
index 0f67d22861..c26e1b2f48 100644
--- a/jarvis/agentic_ide/context.py
+++ b/jarvis/agentic_ide/context.py
@@ -3,9 +3,9 @@
When the user flips the Agentic IDE into focus mode, every turn should be
answered *inside* the open workspace: Jarvis should know which folder is open,
what kind of codebase it is, which skills that repo defines, which agents are
-running in which pane, and what each of them last printed. Without that, "is
-Mika stuck?" is unanswerable and the assistant guesses — the failure mode this
-block exists to prevent.
+running in which pane, and what each of them last printed. Without that, "is T2
+stuck?" is unanswerable and the assistant guesses — the failure mode this block
+exists to prevent.
Two things live here, and the distinction matters:
@@ -44,14 +44,18 @@ _MAX_CHARS = 4500
_HEADER = (
"[AGENTIC IDE — focused coding mode is ON]\n"
"You are the user's agentic-coding partner for the one repository below. "
- "Coding agents are already running in named terminals in front of the user; "
- "your job is to think WITH them about this codebase and to drive those "
- "agents — not to write the code yourself, and not to start background "
+ "Coding agents are already running in numbered terminals in front of the "
+ "user; your job is to think WITH them about this codebase and to drive "
+ "those agents — not to write the code yourself, and not to start background "
"workers.\n"
"\n"
+ "Each terminal is called T plus its place in the grid, left to right: T1, "
+ "T2, T3. The user says that number, and so do you.\n"
+ "\n"
"How to behave while this mode is on:\n"
- "- When the user tells a named terminal to do something (\"tell Kai to …\", "
- "\"Mika soll …\", \"let Nova refactor …\"), send it to THAT terminal with " # i18n-allow: quoted addressing examples the router must match
+ "- When the user tells a terminal to do something (\"tell T1 to …\", "
+ "\"T2 soll …\", \"prompt terminal three\", \"let the second one " # i18n-allow: quoted addressing example
+ "refactor …\"), send it to THAT terminal with "
"the agentic-ide-prompt function. That is the whole point of this mode. "
"NEVER spawn a background agent for work aimed at a terminal, and never "
"answer with what you WOULD have sent — send it.\n"
@@ -68,7 +72,7 @@ _HEADER = (
"directly.\n"
"- NEVER claim you sent, forwarded, passed on or told a terminal anything "
"unless a function call in THIS turn actually did it. Saying \"I have let "
- "Alex know\" while nothing reached Alex is the worst failure this mode has: "
+ "T1 know\" while nothing reached T1 is the worst failure this mode has: "
"the user walks away believing an agent is working, and only finds the idle "
"terminal later. If the work did not go out, say plainly that it did not and "
"why — an honest \"I could not reach that terminal\" is always better than a "
@@ -76,8 +80,8 @@ _HEADER = (
"- Brainstorming, architecture, and 'what should we do next' are answered "
"inline, against this codebase, and you may propose which terminal should "
"take which part.\n"
- "- Say the terminal's name out loud in your answers, so the user always "
- "knows who is doing what.\n"
+ "- Say the terminal's number out loud in your answers (\"T2 is on it\"), so "
+ "the user always knows which pane is doing what.\n"
"\n"
"The facts below are the live state of that workspace. It is context, not a "
"script — do not recite it back unprompted."
diff --git a/jarvis/agentic_ide/intent.py b/jarvis/agentic_ide/intent.py
index eac23f0c9b..6012cd91f7 100644
--- a/jarvis/agentic_ide/intent.py
+++ b/jarvis/agentic_ide/intent.py
@@ -39,7 +39,7 @@ from __future__ import annotations
import re
from dataclasses import dataclass
-from .names import resolve
+from .names import CALL_SIGN_WORD_RE, canonical_positions, resolve
# Kinds of turn this module recognises.
KIND_PROMPT = "prompt" # the user wants the agent to do something
@@ -298,10 +298,18 @@ def _canonical_text(text: str, candidates: list[str]) -> str:
The collision risk that makes fuzzy matching dangerous elsewhere does not
reach here: "unten"/"keine" score into the pool as ordinary sentence words,
and an ordinary sentence word does not sit immediately behind "prompte".
+
+ The SPOKEN POSITIONS are folded in first, by the same argument one level
+ up: "prompte Terminal eins" and "prompte T1" are the same instruction, and
+ rewriting the long form into the call-sign once here is what saves every
+ template below from having to know that "terminal one", "tee one" and "the
+ first terminal" all mean T1.
"""
if not candidates:
return text
+ text = canonical_positions(text, candidates)
+
briefed: set[int] = {
match.start("word")
for match in _BRIEFED_NAME_RE.finditer(text)
@@ -420,9 +428,11 @@ _EVERYONE_TEMPLATES: tuple[re.Pattern[str], ...] = tuple(
)
)
-# A word made only of letters — the unit ``names.resolve`` scores a call-sign
-# against. Digits and underscores can never be part of a spoken name.
-_WORD_RE = re.compile(r"[^\W\d_]+", re.UNICODE)
+# One candidate call-sign word. Shared with ``clarify`` and the resolver
+# (``names.CALL_SIGN_WORD_RE``) so the three cannot disagree about where a name
+# starts and ends — a positional call-sign is letters PLUS digits, and a
+# letters-only tokenizer silently cut "T1" down to "T".
+_WORD_RE = CALL_SIGN_WORD_RE
#: Verbs that can ONLY mean "hand this pane its work". The templates above are
#: anchored on the call-sign and therefore bounded by distance, so a longer way
@@ -450,7 +460,7 @@ _BRIEFED_NAME_RE = re.compile(
r"(?:(?:this|that|the|dieses?|diesem|den|dem|" # i18n-allow: input vocab
r"das|der|el|la|ese|este)\s+)?" # i18n-allow: input vocab
r"(?:(?:terminals?|terminales|panes?|tabs?)\s+)?"
- r"(?P<word>[^\W\d_]+)",
+ r"(?P<word>[^\W\d_]+\d*)",
re.IGNORECASE,
)
diff --git a/jarvis/agentic_ide/names.py b/jarvis/agentic_ide/names.py
index abc06d0913..6cf9f8ff66 100644
--- a/jarvis/agentic_ide/names.py
+++ b/jarvis/agentic_ide/names.py
@@ -1,75 +1,72 @@
"""Speakable call-signs for Agentic-IDE terminals.
-Why terminals get names instead of numbers: the whole point of the Agentic IDE
-is that the user can ASK about a running agent by voice — "what is Mika doing?"
-— and a spoken ordinal ("terminal three") is both awkward to say and easy for
-speech recognition to mangle into a different number. A short, phonetically
-distinct proper name survives an imperfect transcript far better, and a wrong
-match is recoverable (the user hears the name back in the answer).
-
-Selection criteria for the pool:
-- **plain English given names** (maintainer directive 2026-07-26), so anyone
- can say them — the pool is what an international user base reads and speaks
- aloud, and a name that is obvious in one language and a guess in the next
- costs a mis-addressed agent,
-- two syllables or fewer, no consonant clusters that ASR routinely drops,
-- pairwise phonetically distinct — enforced, not eyeballed: at 70+ names no
- human spots every confusable pair, so
- ``tests/unit/agentic_ide/test_names.py`` runs the SHIPPING resolver over
- every pair and fails on any that could steal each other's instructions,
-- no collision with the wake word or with the coding agents' own names.
-
-The pool is long on purpose. A workspace may hold as many panes as the machine
-can stand, and running out of names would fall back to "Alex-2" — a call-sign
-nobody can say naturally, which defeats the entire point of naming panes.
-
-Name resolution is deliberately fuzzy (``resolve``): the caller is matching a
-name a human just spoke through an imperfect transcript. This is NOT the wake
-word — AP-27 does not apply, because a mismatch here costs one clarifying
-question, not a deaf assistant. The floor is still high enough that room noise
-does not silently address a random terminal.
+A pane's call-sign is its POSITION: the first terminal is ``T1``, the second
+``T2``, and so on — "T" for terminal, the number for where it sits in the grid,
+read left to right and top to bottom. Nothing has to be learned or remembered,
+which is the whole point (maintainer directive 2026-07-28): the user looks at
+the screen, sees which pane they mean, and says its number.
+
+**Why this replaced a pool of given names.** Panes used to be called "Alex",
+"Blake", "Casey" … — chosen because a phonetically distinct proper name
+survives an imperfect transcript better than a spoken ordinal. That held, but
+it bought robustness with two costs the position scheme simply does not have:
+
+1. **the user had to LEARN the roster.** Addressing a pane meant first reading
+ its header, then saying a name that means nothing — and getting it wrong
+ sent work to a different agent;
+2. **given names collide with ordinary speech.** Measured against the old pool,
+ "allen" scores 0.750 against "Alex", "unten" reaches "Hunter", "keine" <!-- i18n-allow: quoted transcript tokens as measurement data -->
+ reaches "Kai" — all above or near the acting threshold. Half of ``clarify.py`` (stop-word tables,
+ capitalization heuristics, surname detection) exists to tell a spoken pane
+ name apart from the sentence around it. A call-sign of the shape ``T3``
+ collides with nothing in German, English or Spanish.
+
+The cost this scheme pays instead is that a bare number IS fragile in a
+transcript — so a number alone never addresses a pane. What counts is a
+number carrying a TERMINAL MARKER: the letter "T" glued to it (``T3``, "tee
+three"), the noun ("terminal three", "pane 3"), or an ordinal in front of the
+noun ("the third terminal"). ``spoken_positions`` owns that list, and it is
+deliberately the only way a position enters the system. See AP-27 for the
+neighbouring doctrine — the reasoning is the same shape, but the stakes are
+lower here: a mismatch costs one clarifying question, not a deaf assistant.
+
+Custom call-signs still work. ``POST /terminals`` accepts a ``name``, so a
+pane can carry any label its owner gives it, and the fuzzy/phonetic matching
+below is what keeps THOSE speakable. Positional call-signs never take part in
+fuzzy matching: "T1" and "T11" score 0.80 against each other, which is above
+the acting floor, so a fuzzy hit between two positions would be a coin flip
+over which agent gets the work. Positions match exactly or not at all.
"""
from __future__ import annotations
+import re
+from collections.abc import Iterable
from difflib import SequenceMatcher
-# Ordered: the Nth terminal of a session gets the Nth name, so the mapping is
-# reproducible across sessions and the user builds a habit ("Alex is always the
-# first pane"). The waves are a readability grouping only — the clearest,
-# most everyday names sit first because those are the panes people see most.
-NAME_POOL: tuple[str, ...] = (
- # Wave 1 — the panes almost everyone will actually have.
- "Alex", "Blake", "Casey", "Dana", "Ellis", "Finn", "Grace", "Hunter",
- "Ivy", "Jasper", "Kate", "Logan", "Maya", "Noah", "Oscar", "Quinn",
- "Ruby", "Sage", "Tessa", "Vera", "Wyatt", "Zoe",
- # Wave 2 — still short, still plain English.
- "Aaron", "Bailey", "Clara", "Drew", "Hazel", "Isaac", "Jade", "Jordan",
- "Keira", "Lucas", "Mason", "Nina", "Olive", "Parker", "Reese", "Tyler",
- "Violet", "Brooke", "Cole", "Grant", "Heidi", "Jules",
- # Wave 3 — the long tail, for workspaces nobody will realistically fill.
- "Aubrey", "Cody", "Emery", "Felix", "Gemma", "Harvey", "Ivan",
- "Lila", "Marlow", "Owen", "Preston", "Rowan", "Sawyer", "Tobias",
- "Vaughn", "Willow", "Yara", "Leah", "Naomi", "Otis", "Pearl",
- "Simone", "Trent", "Hugo", "Nadia", "Rosa", "Theo", "Colby", "Marcus",
-)
+#: The letter a positional call-sign starts with. One place, because the
+#: assignment side, the resolver and the spoken forms all have to agree.
+CALL_SIGN_PREFIX = "T"
+
+#: A written positional call-sign, whole-string: "T1", "t12".
+_POSITION_NAME_RE = re.compile(rf"^{CALL_SIGN_PREFIX}(\d{{1,3}})$", re.IGNORECASE)
-#: Coding products a pane may never be named after, whether or not this build
-#: can run them. Saying "Claude" to address a pane called Claude is a coin flip,
-#: and the same holds for a product the user merely has installed — so the list
-#: is deliberately WIDER than the registry: a name retired from the registry
-#: tomorrow is still a name people say out loud today.
+#: Coding products a pane may never be named after, kept for callers that ask
+#: what a CUSTOM name must stay clear of. Saying "Claude" to address a pane
+#: called Claude is a coin flip, and the same holds for a product the user
+#: merely has installed — so the list is deliberately WIDER than the registry.
+#: Positional call-signs cannot collide with any of them.
_KNOWN_PRODUCTS: frozenset[str] = frozenset(
{"jarvis", "claude", "codex", "gemini", "copilot", "cursor", "aider"}
)
def _reserved() -> frozenset[str]:
- """Every name a call-sign must stay clear of, registry included.
+ """Every name a CUSTOM call-sign must stay clear of, registry included.
Built at call time rather than frozen at import so a CLI registered later
- cannot end up sharing its name with a pane — which is the one collision this
- whole module is about, and the one nobody would notice until an instruction
- went to the wrong place.
+ cannot end up sharing its name with a pane — which is the one collision
+ this whole module is about, and the one nobody would notice until an
+ instruction went to the wrong place.
"""
try:
from jarvis.workspace import agents as workspace_agents
@@ -84,45 +81,316 @@ def _reserved() -> frozenset[str]:
#: session layer keeps a call-sign from shadowing it at assignment time.
RESERVED_NAMES: frozenset[str] = _reserved()
-# Below this similarity a spoken word is NOT treated as a terminal name. Tuned
-# so that a garbled "Mika" ("Micah", "Meeka", "Mikka") still lands while an
-# unrelated word ("Wiki", "Marker") does not.
+# Below this similarity a spoken word is NOT treated as a CUSTOM call-sign.
+# Tuned so that a garbled "Mika" ("Micah", "Meeka", "Mikka") still lands while
+# an unrelated word ("Wiki", "Marker") does not. Positional call-signs never
+# reach this path.
_MATCH_FLOOR = 0.72
-# The NEAR-MISS band: close enough that a human would ask "did you mean Ellis?",
+# The NEAR-MISS band: close enough that a human would ask "did you mean Mika?",
# too far to act on. Its whole reason to exist is the live 2026-07-27 failure —
# a pane called "Ellis" came back from speech recognition as "Ilies" (0.667,
# just under the floor), so the addressed-terminal path stood down in silence
# and the user was told an agent was working when none was.
#
# The floor of the band is NOT what makes acting on it safe: ordinary words of
-# the spoken language reach well into it ("wieso" scores 0.500 against "Finn",
-# "kannst" 0.600 against "Casey"), and no threshold separates those from a
-# garbled call-sign. Safety comes from the CONTEXT gate in ``clarify.py`` — a
+# the spoken language reach well into it, and no threshold separates those from
+# a garbled call-sign. Safety comes from the CONTEXT gate in ``clarify.py`` — a
# near miss may only ever produce a QUESTION, and only in a turn that is
# addressing the workspace at all. The band merely keeps that question rare.
-#
-# Set low enough to reach the maintainer's own example (2026-07-27): a pane
-# called "Maggie" heard as "Max" scores 0.571, and asking is exactly what
-# should happen there.
_NEAR_MISS_FLOOR = 0.55
+# --------------------------------------------------------------------------- #
+# Positional call-signs #
+# --------------------------------------------------------------------------- #
+
+def position_name(number: int) -> str:
+ """The call-sign of the ``number``-th pane, counting from 1 ("T3")."""
+ return f"{CALL_SIGN_PREFIX}{int(number)}"
+
+
+def position_of(name: str) -> int | None:
+ """The position a call-sign encodes, or ``None`` for a custom name.
+
+ The one place that reads a call-sign back as a number. Callers use it to
+ tell the two kinds of name apart, because they are matched by different
+ rules: a position is exact-only, a custom name is fuzzy.
+ """
+ match = _POSITION_NAME_RE.match(str(name or "").strip())
+ if match is None:
+ return None
+ number = int(match.group(1))
+ return number if number >= 1 else None
+
+
+def is_position_name(name: str) -> bool:
+ """Whether ``name`` is a positional call-sign rather than a custom one."""
+ return position_of(name) is not None
+
+
def default_names(count: int) -> list[str]:
- """First ``count`` call-signs, extended with numbered fallbacks if needed."""
+ """The first ``count`` call-signs: ``["T1", "T2", …]``."""
if count <= 0:
return []
- names = list(NAME_POOL[:count])
- # More terminals than pool entries: keep going deterministically rather than
- # refusing a large grid.
- index = 2
- while len(names) < count:
- for base in NAME_POOL:
- if len(names) >= count:
- break
- names.append(f"{base}-{index}")
- index += 1
- return names
+ return [position_name(index) for index in range(1, count + 1)]
+
+
+def free_positions(taken: Iterable[str], count: int) -> list[str]:
+ """The next ``count`` positional call-signs not in ``taken``, lowest first.
+
+ Filling the LOWEST gap rather than counting on from the highest is what
+ keeps the numbers matching the screen. Close the middle pane of three and
+ the workspace shows T1 and T3; the next one opened becomes T2 again rather
+ than T4, so the user never has to remember that a number was skipped.
+
+ A number is never REASSIGNED while its pane is alive, though. Renumbering
+ the survivors after a close would be the tidier grid and the worse
+ contract: an instruction spoken one second before a pane closes would land
+ in a different agent than the one the user was looking at when they said
+ it. Names identify; positions are how they are handed out.
+ """
+ used = {position_of(name) for name in taken}
+ used.discard(None)
+ out: list[str] = []
+ number = 1
+ while len(out) < max(0, count):
+ if number not in used:
+ out.append(position_name(number))
+ used.add(number)
+ number += 1
+ return out
+
+
+# Number words a person actually speaks for a pane. Capped where speech stops
+# being the way anybody addresses a pane: past twenty nobody says "terminal
+# twenty-three" — they say the digits, which the digit form below covers up to
+# MAX_TERMINALS. One table per language, so a locale can be extended without
+# touching the others.
+#
+# The indefinite article is deliberately NOT a number word, in any locale:
+# an utterance like "let the terminal run for a while" is ordinary speech, and
+# reading its article as the digit would turn it into an order for pane one.
+_NUMBER_WORDS: dict[str, int] = {
+ # German
+ "eins": 1, "zwei": 2, "zwo": 2, "drei": 3, # i18n-allow: input vocabulary
+ "vier": 4, "fuenf": 5, "fünf": 5, "sechs": 6, "sieben": 7, "acht": 8, # i18n-allow: input vocabulary
+ "neun": 9, "zehn": 10, "elf": 11, "zwoelf": 12, "zwölf": 12, # i18n-allow: input vocabulary
+ "dreizehn": 13, "vierzehn": 14, "fuenfzehn": 15, "fünfzehn": 15, # i18n-allow: input vocabulary
+ "sechzehn": 16, "siebzehn": 17, "achtzehn": 18, "neunzehn": 19, # i18n-allow: input vocabulary
+ "zwanzig": 20, # i18n-allow: input vocabulary
+ # English
+ "one": 1, "two": 2, "three": 3, "four": 4, "five": 5, "six": 6,
+ "seven": 7, "eight": 8, "nine": 9, "ten": 10, "eleven": 11, "twelve": 12,
+ "thirteen": 13, "fourteen": 14, "fifteen": 15, "sixteen": 16,
+ "seventeen": 17, "eighteen": 18, "nineteen": 19, "twenty": 20,
+ # Spanish
+ "uno": 1, "dos": 2, "tres": 3, "cuatro": 4, "cinco": 5,
+ "seis": 6, "siete": 7, "ocho": 8, "nueve": 9, "diez": 10, "once": 11,
+ "doce": 12, "trece": 13, "catorce": 14, "quince": 15, "dieciseis": 16,
+ "dieciséis": 16, "diecisiete": 17, "dieciocho": 18, "diecinueve": 19,
+ "veinte": 20,
+}
+
+# Ordinals, for "the third terminal". Spelled out in FULL rather than as stems
+# with an optional ending, because several German ordinal stems are also the
+# plain number (the stem of "eighth" is the word "eight"): a stem match read a
+# request to OPEN eight panes as an instruction aimed at pane number eight. The
+# ending is what tells the two apart, so it is mandatory wherever the language
+# has one.
+_ORDINAL_STEMS_DE: dict[str, int] = {
+ "erst": 1, "zweit": 2, "dritt": 3, "viert": 4, "fuenft": 5, "fünft": 5, # i18n-allow: input vocabulary
+ "sechst": 6, "siebt": 7, "siebent": 7, "acht": 8, "neunt": 9, "zehnt": 10, # i18n-allow: input vocabulary
+ "elft": 11, "zwoelft": 12, "zwölft": 12, # i18n-allow: input vocabulary
+}
+_ORDINAL_ENDINGS_DE: tuple[str, ...] = ("e", "en", "er", "es", "em")
+
+_ORDINAL_PLAIN: dict[str, int] = {
+ # i18n-allow: speech-recognition input vocabulary, not prose
+ # English
+ "first": 1, "second": 2, "third": 3, "fourth": 4, "fifth": 5, "sixth": 6,
+ "seventh": 7, "eighth": 8, "ninth": 9, "tenth": 10, "eleventh": 11,
+ "twelfth": 12,
+ # Spanish, in every gendered and apocopated form people actually say
+ "primer": 1, "primero": 1, "primera": 1,
+ "segundo": 2, "segunda": 2,
+ "tercer": 3, "tercero": 3, "tercera": 3,
+ "cuarto": 4, "cuarta": 4, "quinto": 5, "quinta": 5,
+ "sexto": 6, "sexta": 6, "septimo": 7, "séptimo": 7, "septima": 7,
+ "séptima": 7, "octavo": 8, "octava": 8, "noveno": 9, "novena": 9,
+ "decimo": 10, "décimo": 10, "decima": 10, "décima": 10,
+}
+
+_ORDINAL_WORDS: dict[str, int] = {
+ **_ORDINAL_PLAIN,
+ **{
+ f"{stem}{ending}": value
+ for stem, value in _ORDINAL_STEMS_DE.items()
+ for ending in _ORDINAL_ENDINGS_DE
+ },
+}
+
+#: Words meaning "the one at the end", resolved against the live pane count.
+_LAST_WORDS: frozenset[str] = frozenset(
+ # i18n-allow: speech-recognition input vocabulary, not prose
+ {"letzte", "letzten", "letztes", "letzter", "last", "ultimo", "último",
+ "ultima", "última"}
+)
+
+#: How a person says the noun. Matches the German compound too ("Terminalfenster")
+#: without needing a second pattern.
+_PANE_NOUN = r"(?:terminals?|terminales|panes?|tabs?|fenster)"
+
+#: An article in front of the noun or the ordinal, all three locales.
+_ARTICLE = r"(?:der|die|das|den|dem|des|the|el|la|los|las)" # i18n-allow: input vocabulary
+
+_NUMBER_WORD_ALT = "|".join(
+ sorted((re.escape(w) for w in _NUMBER_WORDS), key=len, reverse=True)
+)
+_ORDINAL_ALT = "|".join(
+ sorted((re.escape(w) for w in _ORDINAL_WORDS), key=len, reverse=True)
+)
+_LAST_ALT = "|".join(sorted((re.escape(w) for w in _LAST_WORDS), key=len, reverse=True))
+
+#: Every shape that names a pane BY POSITION. Each one carries a terminal
+#: marker — the letter, the noun, or an ordinal bound to the noun — because a
+#: bare number is ordinary speech ("fix the two failing tests") and must never
+#: address an agent.
+#:
+#: Order matters: the longest, most explicit shapes are tried first, so
+#: "terminal number two" is read once as position 2 rather than twice.
+_POSITION_PATTERNS: tuple[re.Pattern[str], ...] = (
+ # "terminal 2" / "Terminal Nummer zwei" / "pane number two" / "tab dos"
+ re.compile(
+ rf"\b{_PANE_NOUN}\s*"
+ # i18n-allow: speech-recognition input vocabulary, not prose
+ rf"(?:(?:nummer|nr\.?|number|n[uú]mero)\s*)?"
+ rf"(?P<value>\d{{1,3}}|{_NUMBER_WORD_ALT})\b",
+ re.IGNORECASE,
+ ),
+ # "das dritte Terminal" / "the third pane" / "el tercer terminal".
+ # The ordinal is matched as a WHOLE word: allowing it to run on ("\w*")
+ # let "erstelle Terminal 3" — create a terminal — parse as the ordinal
+ # "erste" plus a suffix, and address pane one instead.
+ re.compile(
+ rf"\b(?:{_ARTICLE}\s+)?(?P<ordinal>{_ORDINAL_ALT})\s+{_PANE_NOUN}\b",
+ re.IGNORECASE,
+ ),
+ # "das letzte Terminal" / "the last one"
+ re.compile(
+ rf"\b(?:{_ARTICLE}\s+)?(?P<last>{_LAST_ALT})\s+{_PANE_NOUN}\b",
+ re.IGNORECASE,
+ ),
+ # "T3", "t 3", "T-3", "T.3" — the written form, and what speech recognition
+ # produces most of the time when the letter is said crisply.
+ re.compile(
+ rf"\b{CALL_SIGN_PREFIX}\s*[-.–]?\s*(?P<value>\d{{1,3}})\b",
+ re.IGNORECASE,
+ ),
+ # "tee three" / "te eins" / "ti dos" — the letter transcribed as a word,
+ # which is what happens when it is said together with the number. The
+ # spellings are the ones speech recognition actually produces; each is a
+ # non-word in all three locales, so a number word behind one is never
+ # ordinary speech.
+ re.compile(
+ # i18n-allow: speech-recognition input vocabulary, not prose
+ rf"\b(?:tee|te|ti|tea|tey)\s*[-.]?\s*(?P<value>\d{{1,3}}|{_NUMBER_WORD_ALT})\b",
+ re.IGNORECASE,
+ ),
+)
+
+
+def _value_of(match: re.Match[str], *, count: int) -> int | None:
+ """The position one ``_POSITION_PATTERNS`` hit stands for, or ``None``."""
+ groups = match.groupdict()
+ raw = groups.get("value")
+ if raw:
+ if raw.isdigit():
+ return int(raw)
+ return _NUMBER_WORDS.get(raw.casefold())
+ ordinal = groups.get("ordinal")
+ if ordinal:
+ return _ORDINAL_WORDS.get(ordinal.casefold())
+ if groups.get("last"):
+ return count if count > 0 else None
+ return None
+
+
+def spoken_positions(text: str, *, count: int = 0) -> list[tuple[int, int, int]]:
+ """Every pane position ``text`` names, as ``(start, end, number)`` in order.
+
+ The ONE place that decides what counts as naming a pane by position. Every
+ caller goes through it, so the resolver, the addressed-terminal detector
+ and the clarify path cannot drift into three different opinions about
+ whether "terminal two" addressed a pane.
+
+ ``count`` is how many panes exist, needed only by "the last one". Zero
+ means the caller does not know, and that shape is then skipped rather than
+ guessed at.
+
+ Overlapping hits are dropped, longest match first: "terminal number three"
+ is one position, not a noun-hit and a stray digit.
+ """
+ body = str(text or "")
+ if not body:
+ return []
+ found: list[tuple[int, int, int]] = []
+ taken: list[tuple[int, int]] = []
+ for pattern in _POSITION_PATTERNS:
+ for match in pattern.finditer(body):
+ start, end = match.span()
+ if any(start < other_end and other_start < end for other_start, other_end in taken):
+ continue
+ number = _value_of(match, count=count)
+ if number is None or number < 1:
+ continue
+ taken.append((start, end))
+ found.append((start, end, number))
+ found.sort(key=lambda item: item[0])
+ return found
+
+
+#: One WORD that could be a call-sign — the unit every caller scores against
+#: the live roster. Letters, optionally followed by digits, so "T1" arrives
+#: whole. A plain word tokenizer (``[^\W\d_]+``) cut it to "T", which scores
+#: 0.667 against "t1" — below the floor — so a positional call-sign written
+#: exactly the way the pane header spells it addressed nothing at all.
+#:
+#: Digits alone are deliberately NOT a token: a bare number is ordinary speech
+#: ("fix the 3 failing tests") and only ever names a pane when it carries a
+#: terminal marker, which is ``spoken_positions``' business, not this one's.
+CALL_SIGN_WORD_RE = re.compile(r"[^\W\d_]+\d*", re.UNICODE)
+
+
+def canonical_positions(text: str, candidates: list[str]) -> str:
+ """``text`` with every spoken position rewritten as its call-sign.
+
+ "prompte Terminal eins" becomes "prompte T1", so the addressing templates —
+ which are built from the exact call-sign — inherit every spoken form for
+ free instead of each one having to enumerate "terminal one", "tee one",
+ "the first terminal" for itself.
+
+ Only positions the workspace ACTUALLY HAS are rewritten. A number nobody
+ opened stays as the user said it, which is what lets the caller answer "no
+ such terminal" honestly rather than silently addressing a neighbour.
+ """
+ body = str(text or "")
+ if not body or not candidates:
+ return body
+ positions = {position_of(c): c for c in candidates if position_of(c) is not None}
+ if not positions:
+ return body
+ hits = spoken_positions(body, count=len(candidates))
+ if not hits:
+ return body
+ # Right to left, so an earlier hit's span is still valid after a later one
+ # has been replaced with a shorter string.
+ for start, end, number in reversed(hits):
+ name = positions.get(number)
+ if name is None:
+ continue
+ body = f"{body[:start]}{name}{body[end:]}"
+ return body
def normalize(name: str) -> str:
@@ -130,11 +398,11 @@ def normalize(name: str) -> str:
return "".join(ch for ch in name.lower() if ch.isalnum())
-# Spelling variants that sound identical but wreck a character-level comparison.
-# Measured need: "Mika" comes back from speech recognition as "Micah", "Meeka",
-# "Mikka" — all of which score BELOW a plain similarity floor tight enough to
-# reject unrelated words. Folding the spelling first fixes both ends at once:
-# real garble lands, unrelated words still do not.
+# Spelling variants that sound identical but wreck a character-level comparison
+# of a CUSTOM call-sign. Measured need: "Mika" comes back from speech
+# recognition as "Micah", "Meeka", "Mikka" — all of which score BELOW a plain
+# similarity floor tight enough to reject unrelated words. Folding the spelling
+# first fixes both ends at once: real garble lands, unrelated words still do not.
_DIGRAPHS: tuple[tuple[str, str], ...] = (
("sch", "s"),
("ph", "f"),
@@ -172,43 +440,56 @@ def phonetic_key(name: str) -> str:
def resolve(
spoken: str, candidates: list[str], *, fuzzy: bool = True
) -> str | None:
- """Best-matching call-sign for ``spoken``, or ``None`` below the floor.
-
- ``spoken`` may be a whole utterance ("what is mika up to?") — every word is
- tried, longest first, so a name embedded in a sentence is found without the
- caller having to pre-extract it.
-
- Two strengths of match, and callers pick by what a wrong answer costs them:
-
- * **exact** — the word IS the name, or folds to the same sound ("Micah" →
- "Mika"). Certain enough to act on with no other evidence.
- * **fuzzy** (``fuzzy=True``, the default) — the word merely SCORES close
- enough. That is what rescues a transcript the phonetic folding does not
- cover, and it is also how ordinary speech collides with the pool: measured
- against the shipping names, "unten" reaches "Hunter" and "dann" reaches
- "Dana"; the live 2026-07-26 session had "keine" reaching "Kai" # i18n-allow: quoted transcript tokens
- (everyday words of the spoken language, quoted as measurement data).
- Below the floor those are indistinguishable from a garbled call-sign, so
- a caller that would ACT on the answer alone passes ``fuzzy=False`` and
- accepts an exact match only.
+ """Best-matching call-sign for ``spoken``, or ``None`` when nothing fits.
+
+ ``spoken`` may be a whole utterance ("what is terminal three up to?") — the
+ positional forms are located inside the sentence and every word is tried
+ against the custom names, so the caller does not have to pre-extract
+ anything.
+
+ Two kinds of call-sign, matched by two different rules:
+
+ * **positional** ("T3") — EXACT only, whether written that way or spoken as
+ one of the forms ``spoken_positions`` knows. Never fuzzy: "T1" and "T11"
+ score 0.80 against each other, well above the acting floor, so a fuzzy
+ hit between two positions would be a coin flip over which agent gets the
+ work.
+ * **custom** (a name the user gave the pane) — exact, or folded to the same
+ sound ("Micah" → "Mika"), or merely CLOSE when ``fuzzy=True``. That last
+ band is what rescues a transcript the phonetic folding does not cover,
+ and it is also how ordinary speech collides with a name: measured against
+ real call-signs, "unten" reaches "Hunter" and "dann" reaches "Dana". A
+ caller that would ACT on the answer alone passes ``fuzzy=False``.
"""
if not spoken or not candidates:
return None
keys = {normalize(c): c for c in candidates}
- # Exact hit on the full string first (the API path case: /terminals/mika).
+ # Exact hit on the full string first (the API path case: /terminals/t3).
full = normalize(spoken)
if full in keys:
return keys[full]
+ # A position named anywhere in the utterance, in any of its spoken shapes.
+ positions = {position_of(c): c for c in candidates if position_of(c) is not None}
+ if positions:
+ for _start, _end, number in spoken_positions(spoken, count=len(candidates)):
+ hit = positions.get(number)
+ if hit is not None:
+ return hit
+
+ # Custom names: word by word, phonetically folded, fuzzy only if allowed.
+ custom = {key: name for key, name in keys.items() if position_of(name) is None}
+ if not custom:
+ return None
words = [w for w in (normalize(w) for w in spoken.split()) if w]
best: tuple[float, str] | None = None
for word in words:
- if word in keys:
- return keys[word]
+ if word in custom:
+ return custom[word]
folded = phonetic_key(word)
- for key, original in keys.items():
+ for key, original in custom.items():
if folded and folded == phonetic_key(key):
return original
if not fuzzy:
@@ -257,10 +538,13 @@ def near_miss(
all. The turn produced neither an action nor a question. Anchoring both
sides on the same notion of certainty is what closes that gap.
- Several candidates are returned on purpose. A transcript that sits between
- two panes ("Mags" between "Max" and "Maggie") is exactly the case where
- picking the best score silently is how the wrong agent gets the work; the
- caller asks instead, and it can only ask if it knows both.
+ **Positional call-signs never produce a near miss.** "T2" is either said or
+ not; the shapes that name it are explicit, and the ones that come close
+ ("T1" vs "T11") are two real panes rather than one garbled word — asking
+ "did you mean T11?" about a clean "T1" would invent doubt where there is
+ none. A position the workspace does not have (``"T7"`` with four panes
+ open) is a wrong number, not an unclear one, and the caller answers it with
+ the honest "no such terminal" that names the ones that do exist.
"""
if not spoken or not candidates:
return ()
@@ -270,7 +554,8 @@ def near_miss(
(
(name, score)
for name in candidates
- if (score := similarity(spoken, name)) >= _NEAR_MISS_FLOOR
+ if position_of(name) is None
+ and (score := similarity(spoken, name)) >= _NEAR_MISS_FLOOR
),
key=lambda item: (-item[1], item[0]),
)
@@ -278,12 +563,19 @@ def near_miss(
__all__ = [
- "NAME_POOL",
+ "CALL_SIGN_PREFIX",
+ "CALL_SIGN_WORD_RE",
"RESERVED_NAMES",
+ "canonical_positions",
"default_names",
+ "free_positions",
+ "is_position_name",
"near_miss",
"normalize",
"phonetic_key",
+ "position_name",
+ "position_of",
"resolve",
"similarity",
+ "spoken_positions",
]
diff --git a/jarvis/agentic_ide/session.py b/jarvis/agentic_ide/session.py
index 537541e0a9..815cbdb945 100644
--- a/jarvis/agentic_ide/session.py
+++ b/jarvis/agentic_ide/session.py
@@ -88,7 +88,7 @@ from .agent_sessions import (
resume_argv,
)
from .folders import ProjectProfile, probe_project
-from .names import default_names, normalize, resolve
+from .names import free_positions, normalize, position_of, resolve
from .terminal_input import THEME_COLOURS, TerminalQueryResponder
from .transcript import ReplayBuffer, Transcript
@@ -664,8 +664,13 @@ def _behind_win_shim(
class Terminal:
"""One named pane: a call-sign, an agent, and its live PTY (if attached)."""
- key: str # url-safe key, e.g. "mika"
- name: str # spoken call-sign, e.g. "Mika"
+ # The url-safe key ("t1"), and the call-sign as it is written and spoken
+ # ("T1"). The name is the pane's IDENTITY, not a live read of where it
+ # sits: it is handed out from the grid position the pane is opened at and
+ # then stays put, so an instruction cannot land in a different agent
+ # because a neighbouring pane closed between hearing it and sending it.
+ key: str
+ name: str
agent: str # "claude" | "codex"
display_name: str # "Claude Code"
index: int
@@ -1204,26 +1209,21 @@ class Registry:
if missing:
raise SessionError(" ".join(_unavailable(m) for m in missing))
- # Call-signs are unique across ALL open workspaces, not just within
- # this one. A name is how the user addresses a pane out loud, and a
- # second "Mika" two tabs over would make "tell Mika to run the
- # tests" a question rather than an instruction. So the pool skips
- # every name already spoken for, and this workspace simply starts
- # further down it.
- taken = self._reserved_names()
- offered = default_names(len(requested) + len(taken))
- pool = [n for n in offered if normalize(n) not in taken]
- used: set[str] = set(taken)
+ # Call-signs count from T1 WITHIN this workspace, and every
+ # workspace counts from T1 again. That is the whole promise of a
+ # positional name: what the user sees on screen is what they say.
+ # Numbering across tabs instead — a second workspace starting at T5
+ # — would keep names globally unique at the price of the one thing
+ # this scheme is for, and the ambiguity it would prevent is not
+ # real: a spoken call-sign is resolved against the FRONT workspace
+ # first, which is the only one the user is looking at.
+ pool = free_positions([], len(requested))
+ used: set[str] = set()
terminals: list[Terminal] = []
for index, entry in enumerate(requested):
agent = str(entry.get("agent"))
- fallback = pool[index] if index < len(pool) else f"T{index + 1}"
- wanted = str(entry.get("name") or "").strip() or fallback
- name = wanted
- suffix = 2
- while normalize(name) in used:
- name = f"{wanted} {suffix}"
- suffix += 1
+ wanted = str(entry.get("name") or "").strip() or pool[index]
+ name = _unique_name(wanted, used)
used.add(normalize(name))
terminals.append(
Terminal(
@@ -1272,14 +1272,6 @@ class Registry:
return session
return None
- def _reserved_names(self) -> set[str]:
- """Every call-sign in use across all open workspaces, normalized."""
- return {
- normalize(term.name)
- for session in self._sessions.values()
- for term in session.terminals
- }
-
def _available_workspace_name(self, wanted: str) -> str:
"""Return a human-readable tab name that is unique in the bar."""
base = wanted.strip() or "Workspace"
@@ -1542,18 +1534,27 @@ class Registry:
self._renumber(session)
return session
- def _dedupe_names(self, terminals: list[Terminal]) -> None:
- """Rename any call-sign already spoken for by another open workspace."""
- used = self._reserved_names()
+ @staticmethod
+ def _dedupe_names(terminals: list[Terminal]) -> None:
+ """Give any two panes of ONE workspace that share a call-sign one each.
+
+ Scoped to the workspace being restored, because that is the scope a
+ positional call-sign lives in: T1 in one tab and T1 in another are two
+ different panes the user addresses by looking at one of them, and
+ renaming across tabs would take numbers away from a workspace that has
+ every right to them.
+
+ A repeated POSITION is repaired with the lowest free number rather than
+ a suffix: "T1 2" is neither speakable nor a position, so a snapshot
+ that somehow carried two T1s would otherwise produce a pane nobody can
+ address. A repeated CUSTOM name keeps the old suffix behaviour.
+ """
+ used: set[str] = set()
for term in terminals:
- if normalize(term.name) not in used:
- used.add(normalize(term.name))
- continue
- base, suffix = term.name, 2
- while normalize(f"{base} {suffix}") in used:
- suffix += 1
- term.name = f"{base} {suffix}"
- term.key = normalize(term.name) or term.key
+ unique = _unique_name(term.name, used)
+ if unique != term.name:
+ term.name = unique
+ term.key = normalize(unique) or term.key
used.add(normalize(term.name))
async def activate(self, workspace_id: str | None) -> Session | None:
@@ -2417,23 +2418,15 @@ class Registry:
if agent_argv(chosen) is None:
raise SessionError(_unavailable(chosen))
- # Unused ACROSS every open workspace: a split must not hand this
- # pane a call-sign another tab already answers to.
- used = self._reserved_names()
+ # Unused within THIS workspace — the scope a positional call-sign
+ # is counted in. A split fills the lowest free number, so closing
+ # the middle pane and opening another puts the grid back at T1..Tn
+ # instead of drifting upward forever.
+ used = {normalize(t.name) for t in session.terminals}
wanted = (name or "").strip()
if not wanted:
- # Next unused call-sign from the pool, so names stay speakable
- # however many times the user splits.
- pool = default_names(MAX_TERMINALS * MAX_WORKSPACES)
- wanted = next(
- (n for n in pool if normalize(n) not in used),
- f"T{len(session.terminals) + 1}",
- )
- final = wanted
- suffix = 2
- while normalize(final) in used:
- final = f"{wanted} {suffix}"
- suffix += 1
+ wanted = free_positions([t.name for t in session.terminals], 1)[0]
+ final = _unique_name(wanted, used)
if base is None:
column, slot = 0, 0
@@ -2908,12 +2901,16 @@ class Registry:
def find_terminal(self, wanted: str) -> tuple[Session, Terminal] | None:
"""A pane by call-sign, anywhere — the front workspace answering first.
- Call-signs are unique across open workspaces (see ``start``), so a name
- identifies exactly one pane and searching beyond the front one cannot be
- ambiguous. It is also what a user means: "tell Kai to run the tests" is
- an instruction to Kai, not a request to first go and find which tab Kai
- is in. The front workspace is still tried first, so the common case
- never depends on iteration order.
+ The FRONT workspace deciding first is what makes positional call-signs
+ unambiguous: every workspace numbers its panes from T1, so "T2" means
+ the second pane of the tab the user is looking at. Nothing else could
+ be meant — the other tabs are not on screen.
+
+ The search continues into the background workspaces only when the front
+ one has no such pane. That is for CUSTOM call-signs, which a user gives
+ a pane precisely so they can address it from anywhere: "tell Mika to
+ run the tests" is an instruction to Mika, not a request to first go and
+ find which tab Mika is in.
"""
session = self.session
if session is not None:
@@ -2929,13 +2926,49 @@ class Registry:
return None
def _unknown_terminal(self, wanted: str) -> SessionError:
- """The 'no such pane' error, naming every pane that DOES exist."""
+ """The 'no such pane' error, naming the panes that DO exist.
+
+ The FRONT workspace's panes when there is one, because that is the
+ answer to the question actually asked: somebody who says "T7" with four
+ panes open needs to hear which numbers this grid has, not a list of
+ every pane in every tab.
+ """
if not self._sessions:
return SessionError("No Agentic-IDE session is running.")
- known = ", ".join(term.name for s in self._sessions.values() for term in s.terminals)
+ session = self.session
+ panes = (
+ session.terminals
+ if session is not None
+ else [term for s in self._sessions.values() for term in s.terminals]
+ )
+ known = ", ".join(term.name for term in panes)
return SessionError(f"No terminal called {wanted!r}. Running: {known or 'none'}.")
+def _unique_name(wanted: str, used: set[str]) -> str:
+ """``wanted`` if it is free, otherwise the nearest name that is.
+
+ The two kinds of call-sign need two different repairs, and using the wrong
+ one costs a pane its voice:
+
+ * a **position** that is taken moves to the next free NUMBER. Suffixing it
+ would produce "T1 2" — neither a position nor anything a person can say
+ out loud, so the pane would sit there unaddressable;
+ * a **custom name** keeps the familiar numeric suffix ("Mika 2"), which is
+ how a person distinguishes two of the same thing anyway.
+ """
+ if normalize(wanted) not in used:
+ return wanted
+ if position_of(wanted) is not None:
+ return free_positions(
+ [name for name in used if position_of(name) is not None], 1
+ )[0]
+ suffix = 2
+ while normalize(f"{wanted} {suffix}") in used:
+ suffix += 1
+ return f"{wanted} {suffix}"
+
+
def _mark_restored_continuations(terminals: list[Terminal]) -> None:
"""Flag the restored panes that will come back in the middle of a job.
diff --git a/jarvis/commands/registry.py b/jarvis/commands/registry.py
index b0ecac7a70..149a57b1cc 100644
--- a/jarvis/commands/registry.py
+++ b/jarvis/commands/registry.py
@@ -741,7 +741,7 @@ def _build_registry() -> tuple[AppCommand, ...]:
"Terminals are called T plus their place in the grid (T1, T2, "
"T3, left to right). Use this whenever the user tells a "
"terminal to do something "
- "('tell T1 to ...', 'T2 soll ...', 'let terminal three " # i18n-allow: quoted addressing examples the router must match
+ "('tell T1 to ...', 'T2 soll ...', 'let terminal three " # i18n-allow: quoted addressing example
"refactor ...', 'prompt the second terminal') "
"— that work belongs to that agent, never to a background "
"worker. For SEVERAL terminals ('T1 and T2 both ...', 'let "
diff --git a/jarvis/realtime/session.py b/jarvis/realtime/session.py
index 78ed9b13b4..363a1c2054 100644
--- a/jarvis/realtime/session.py
+++ b/jarvis/realtime/session.py
@@ -1256,12 +1256,12 @@ class RealtimeVoiceSession:
def _workspace_directive(self) -> str:
"""Tell the live model which coding agents are running, by name.
- The live 2026-07-27 miss in one sentence: asked "was hat Dana gemacht",
- the model said it did not know which person Dana was — and it was right
- not to know, because its instructions never mentioned that a coding
- agent called Dana was running in front of the user. It only answered
- correctly after the user said the words "agentic IDE" out loud, which is
- not a workflow anybody should have to learn.
+ The live 2026-07-27 miss in one sentence: asked what a named pane had
+ done, the model said it did not know which person that was — and it was
+ right not to know, because its instructions never mentioned that a
+ coding agent by that name was running in front of the user. It only
+ answered correctly after the user said the words "agentic IDE" out
+ loud, which is not a workflow anybody should have to learn.
So the roster goes into the per-turn instructions: the model cannot
route a name it has never heard of. Deliberately only the NAMES and
@@ -1282,20 +1282,20 @@ class RealtimeVoiceSession:
return (
"[Agentic IDE — coding agents are running right now]\n"
f"Terminals open in the user's coding workspace: {roster}.\n"
- "Those are names of RUNNING CODING AGENTS, not people you know. "
- "When the user says one of them — in any language, any tense, on "
- "its own or inside a sentence — they mean that terminal. Never "
- "answer that you do not know who that is, never guess what it is "
- "doing, and never treat it as a public figure or an acquaintance. "
- "Call your action function so the workspace can answer from what "
- "that terminal actually printed, and say the terminal's name back "
- "in your reply so the user knows which agent you mean.\n"
+ "Those are RUNNING CODING AGENTS, not people you know. Each is "
+ "named T plus its place in the grid, and the user says that "
+ "number however a number is said — \"T2\", \"terminal two\", "
+ "\"the second terminal\" all mean the same pane. Never answer "
+ "that you do not know who that is, never guess what it is doing, "
+ "and never treat it as a public figure. Call your action function "
+ "so the workspace answers from what that terminal actually "
+ "printed, and say its name back in your reply.\n"
"Never say a terminal has been told, briefed, prompted or asked "
"anything unless your action function reported that it happened. "
- "Live failure 2026-07-27: this model answered \"I have let Alex "
- "know\" on a turn where nothing had reached Alex, and the user "
- "found the pane still sitting at its startup banner. If you do not "
- "know that the work went out, say what you actually did instead."
+ "Live failure 2026-07-27: this model answered \"I have let T1 "
+ "know\" on a turn where nothing had reached T1, and the user "
+ "found the pane still at its startup banner. If you do not know "
+ "that the work went out, say what you actually did instead."
)
def _skill_directive(self, text: str) -> str:
diff --git a/jarvis/ui/web/agentic_ide_routes.py b/jarvis/ui/web/agentic_ide_routes.py
index 6f29b85b86..6f6aec342f 100644
--- a/jarvis/ui/web/agentic_ide_routes.py
+++ b/jarvis/ui/web/agentic_ide_routes.py
@@ -35,8 +35,9 @@ Endpoints (prefix ``/api/agentic-ide``):
* ``POST /terminals/{name}/attach`` → drop/paste files onto a pane
* ``WS /pty/{name}`` → the pane's live terminal stream
-``{name}`` accepts the call-sign ("mika", "Mika") or a spoken phrase containing
-it, so a voice command reaches the right pane without exact spelling.
+``{name}`` accepts the call-sign ("t2", "T2") or a spoken phrase containing it
+in any of the ways a position is said ("terminal two", "the second terminal"),
+so a voice command reaches the right pane without exact spelling.
"""
from __future__ import annotations
@@ -2150,10 +2151,10 @@ def _unknown_terminal_detail(registry: object, wanted: str) -> str:
Listing the running panes is not enough on its own. A caller that wanted to
brief a pane called "Lee" reads a bare "not found" as "then open one" — and
- call-signs come from a fixed pool in a fixed order, so the pane it opens is
- called something else entirely and the very same prompt 404s again. A live
- voice session on 2026-07-27 went round that loop four times and left four
- blank panes behind, without ever briefing anyone.
+ call-signs are POSITIONS handed out by the workspace, so the pane it opens
+ is called something else entirely and the very same prompt 404s again. A
+ live voice session on 2026-07-27 went round that loop four times and left
+ four blank panes behind, without ever briefing anyone.
So the error names the one move that works: brief a pane that exists, or
open AND brief a new one in a single fan-out call, which returns the
@@ -2164,8 +2165,9 @@ def _unknown_terminal_detail(registry: object, wanted: str) -> str:
)
return (
f"No terminal called {wanted!r}. Running: {running or 'none'}. "
- "Call-signs are assigned automatically and cannot be requested, so "
- "opening another pane will NOT produce this name and retrying this "
+ "Call-signs are the panes' positions (T1, T2, …), assigned by the "
+ "workspace and not requestable, so opening another pane will NOT "
+ "produce this name and retrying this "
"prompt after a spawn fails the same way. Either prompt one of the "
"panes listed above, or open and brief a new one in ONE call: "
"POST /api/agentic-ide/fanout with spawn=[{\"count\": 1}] and the "
diff --git a/jarvis/ui/web/frontend/src/views/AgenticIdeView.tsx b/jarvis/ui/web/frontend/src/views/AgenticIdeView.tsx
index 5f9743317d..cef7d46035 100644
--- a/jarvis/ui/web/frontend/src/views/AgenticIdeView.tsx
+++ b/jarvis/ui/web/frontend/src/views/AgenticIdeView.tsx
@@ -816,7 +816,7 @@ export function AgenticIdeView() {
{step === 2 && (
<Section
title="Who runs where?"
- hint="Each terminal gets a call-sign so you can talk about it by name — “what is Mika doing?”."
+ hint="Terminals are numbered by position — T1, T2, T3 — so you can just say “what is T2 doing?”. Rename one if you prefer."
>
<ul className="space-y-2">
{planned.map((pane, index) => (
diff --git a/tests/unit/agentic_ide/test_context.py b/tests/unit/agentic_ide/test_context.py
index 248b718a40..6f73be98b1 100644
--- a/tests/unit/agentic_ide/test_context.py
+++ b/tests/unit/agentic_ide/test_context.py
@@ -52,15 +52,15 @@ async def test_focus_mode_block_names_the_folder_and_terminals(
registry, fake = wired
await registry.start(str(tmp_path), [{"agent": "claude"}, {"agent": "codex"}])
registry.set_focus_mode(True)
- await registry.attach("Alex", 80, 24, _noop, _noop_exit)
+ await registry.attach("T1", 80, 24, _noop, _noop_exit)
on_output = fake.spawns[-1]["on_output"]
await on_output("pty", "refactoring the router\r\n")
block = focus_context_block()
assert "AGENTIC IDE" in block
assert str(tmp_path) in block
- assert "Alex (Claude Code)" in block
- assert "Blake (Codex)" in block
+ assert "T1 (Claude Code)" in block
+ assert "T2 (Codex)" in block
assert "refactoring the router" in block
@@ -70,7 +70,7 @@ async def test_block_is_capped(
registry, fake = wired
await registry.start(str(tmp_path), [{"agent": "claude"}])
registry.set_focus_mode(True)
- await registry.attach("Alex", 80, 24, _noop, _noop_exit)
+ await registry.attach("T1", 80, 24, _noop, _noop_exit)
on_output = fake.spawns[-1]["on_output"]
for i in range(500):
await on_output("pty", f"line number {i} with a fair amount of text\r\n")
diff --git a/tests/unit/agentic_ide/test_intent.py b/tests/unit/agentic_ide/test_intent.py
index 4415eb0ae7..f6bd79d4a4 100644
--- a/tests/unit/agentic_ide/test_intent.py
+++ b/tests/unit/agentic_ide/test_intent.py
@@ -415,3 +415,82 @@ def test_a_pane_named_in_a_sentence_about_a_person_still_reaches_the_pane() -> N
found = intent.detect("Frag Dana, ob Dana Schmidt geantwortet hat", names=NAMES)
assert found is not None
assert found.terminal == "Dana"
+
+
+# --------------------------------------------------------------- positions
+
+
+class TestPositionalCallSigns:
+ """The call-signs a workspace actually hands out: T1, T2, T3, …
+
+ The names above are CUSTOM ones, which panes only carry when their owner
+ named them. What ships by default is the position, and it reaches the
+ detector through a different door: the spoken forms are folded into the
+ exact call-sign before the addressing templates run, so every template
+ inherits "terminal two" and "the second terminal" for free.
+ """
+
+ PANES = ["T1", "T2", "T3", "T4"]
+
+ @pytest.mark.parametrize(
+ ("utterance", "expected"),
+ [
+ ("prompte T1 und lass ihn einen Deep Dive machen", "T1"), # i18n-allow: input vocab under test
+ ("sag T2 er soll die Tests fixen", "T2"), # i18n-allow: input vocab under test
+ ("T3 soll den Wake-Bug analysieren", "T3"), # i18n-allow: input vocab under test
+ ("prompte Terminal vier mit dem Refactoring", "T4"), # i18n-allow: input vocab under test
+ ("das zweite Terminal soll die Tests laufen lassen", "T2"), # i18n-allow: input vocab under test
+ ("tell T3 to run the tests", "T3"),
+ ("prompt terminal one to review the wake path", "T1"),
+ ("let the last terminal clean up the branches", "T4"),
+ ],
+ )
+ def test_a_spoken_position_claims_the_turn(
+ self, utterance: str, expected: str
+ ) -> None:
+ found = intent.detect(utterance, names=self.PANES)
+ assert found is not None, f"{utterance!r} addressed nobody"
+ assert found.terminal == expected
+ assert found.kind == intent.KIND_PROMPT
+
+ @pytest.mark.parametrize(
+ ("utterance", "expected"),
+ [
+ ("was macht T2 gerade", "T2"), # i18n-allow: input vocab under test
+ ("ist das dritte Terminal fertig", "T3"), # i18n-allow: input vocab under test
+ ("what is terminal one up to", "T1"),
+ ],
+ )
+ def test_a_question_about_a_position_is_a_report(
+ self, utterance: str, expected: str
+ ) -> None:
+ found = intent.detect(utterance, names=self.PANES)
+ assert found is not None
+ assert found.terminal == expected
+ assert found.kind == intent.KIND_REPORT
+
+ def test_two_positions_are_both_addressed(self) -> None:
+ found = intent.detect_all(
+ "kannst du bitte T1 und T2 beide einen Deep Dive machen lassen", # i18n-allow: input vocab under test
+ names=self.PANES,
+ )
+ assert [item.terminal for item in found] == ["T1", "T2"]
+
+ @pytest.mark.parametrize(
+ "utterance",
+ [
+ "öffne vier Terminals", # i18n-allow: input vocab under test
+ "mach acht Terminals auf und lass sie die Tests fixen", # i18n-allow: input vocab under test
+ "fix the 2 failing tests",
+ "spawn three agents in the background",
+ ],
+ )
+ def test_a_number_that_is_not_an_address_reaches_nobody(
+ self, utterance: str
+ ) -> None:
+ """Counting panes is not addressing one — that is the spawn path's turn."""
+ assert intent.detect(utterance, names=self.PANES) is None
+
+ def test_a_position_the_workspace_does_not_have_is_not_addressed(self) -> None:
+ """"T7" with four panes open must not quietly land on the nearest one."""
+ assert intent.detect("prompte T7 mit dem Deep Dive", names=self.PANES) is None # i18n-allow: input vocab under test
diff --git a/tests/unit/agentic_ide/test_many_terminals.py b/tests/unit/agentic_ide/test_many_terminals.py
index 029f94992d..a7cf279d3f 100644
--- a/tests/unit/agentic_ide/test_many_terminals.py
+++ b/tests/unit/agentic_ide/test_many_terminals.py
@@ -182,8 +182,13 @@ async def test_a_full_house_across_every_workspace_round_trips(
Deliberately smaller than MAX_TERMINALS per workspace so the test stays
fast — what is being pinned is that nothing collapses when several large
- workspaces are remembered at once, including their call-signs staying
- unique ACROSS workspaces.
+ workspaces are remembered at once, including every workspace numbering its
+ panes T1..Tn on its own.
+
+ Call-signs REPEAT across workspaces on purpose: a position is what the user
+ reads off the screen, and only one workspace is on screen at a time. A
+ second tab starting at T21 would keep names globally unique at the price of
+ the whole point of numbering them.
"""
folders = []
for index in range(ide.MAX_WORKSPACES):
@@ -198,10 +203,9 @@ async def test_a_full_house_across_every_workspace_round_trips(
assert loaded is not None
assert len(loaded.workspaces) == ide.MAX_WORKSPACES
assert loaded.terminal_count == 20 * ide.MAX_WORKSPACES
- every_name = [
- t.name for w in loaded.workspaces for t in w.terminals
- ]
- assert len(set(every_name)) == len(every_name), "call-signs collided"
+ for workspace in loaded.workspaces:
+ names = [t.name for t in workspace.terminals]
+ assert names == default_names(20), "each workspace numbers its own panes"
async def test_the_snapshot_of_a_full_house_stays_a_sane_size(
diff --git a/tests/unit/agentic_ide/test_names.py b/tests/unit/agentic_ide/test_names.py
index b250b66065..c7f9095c83 100644
--- a/tests/unit/agentic_ide/test_names.py
+++ b/tests/unit/agentic_ide/test_names.py
@@ -1,133 +1,193 @@
-"""Terminal call-signs and spoken-name resolution.
+"""Positional terminal call-signs and spoken-name resolution.
-The resolver is what lets "what is Mika doing?" reach the right pane through an
-imperfect transcript. It has to be forgiving of garble and firm about unrelated
-words — a spoken sentence must not silently address a random terminal.
+A pane is called "T1", "T2", … — "T" for terminal, the number for where it sits
+in the grid. The resolver is what lets "prompt terminal two" and "sag T2 …"
+reach the same pane through an imperfect transcript, while a sentence that
+merely contains a number reaches nobody.
"""
from __future__ import annotations
-from difflib import SequenceMatcher
-
import pytest
from jarvis.agentic_ide.names import (
- _MATCH_FLOOR,
- NAME_POOL,
RESERVED_NAMES,
+ canonical_positions,
default_names,
+ free_positions,
+ is_position_name,
+ near_miss,
normalize,
- phonetic_key,
+ position_name,
+ position_of,
resolve,
+ spoken_positions,
)
-
-def test_default_names_are_stable_and_ordered() -> None:
- assert default_names(3) == list(NAME_POOL[:3])
- assert default_names(0) == []
-
-
-def test_default_names_extend_past_the_pool_deterministically() -> None:
- many = default_names(len(NAME_POOL) + 3)
- assert len(many) == len(NAME_POOL) + 3
- assert len(set(many)) == len(many), "extended names must stay unique"
-
-
-def test_the_pool_covers_a_full_workspace_without_numbered_fallbacks() -> None:
- """Running out of names yields "Alex-2", which nobody can say naturally.
-
- The pool must therefore cover a workspace of a realistic size on its own —
- the numbered tail is a safety net, not something a normal user should meet.
- """
- from jarvis.agentic_ide.session import MAX_TERMINALS
-
- realistic = min(24, MAX_TERMINALS)
- assert len(NAME_POOL) >= realistic
- assert all("-" not in name for name in default_names(realistic))
-
-
-class TestPoolIsUnconfusable:
- """No two call-signs may be close enough to steal each other's instructions.
-
- Checked with the SHIPPING resolver rather than a second opinion about
- pronunciation: what matters is exactly what the live matcher does. At 70+
- names this cannot be eyeballed — the first hand-written pool of this size
- contained 15 confusable pairs (Casey/Chase, Molly/Holly, Skyler/Tyler …),
- every one of which would have sent work to the wrong agent.
+PANES = ["T1", "T2", "T3", "T4"]
+
+
+class TestPositionsAreAssignedByPlace:
+ def test_default_names_count_from_one(self) -> None:
+ assert default_names(4) == ["T1", "T2", "T3", "T4"]
+ assert default_names(0) == []
+ assert default_names(-1) == []
+
+ def test_a_full_workspace_needs_no_fallback_shape(self) -> None:
+ """Every pane of the biggest allowed workspace has a speakable name."""
+ from jarvis.agentic_ide.session import MAX_TERMINALS
+
+ names = default_names(MAX_TERMINALS)
+ assert len(set(names)) == MAX_TERMINALS
+ assert all(position_of(name) is not None for name in names)
+
+ def test_free_positions_fills_the_lowest_gap(self) -> None:
+ """Closing the middle pane and opening another puts T2 back on screen."""
+ assert free_positions(["T1", "T3"], 1) == ["T2"]
+ assert free_positions(["T1", "T3"], 3) == ["T2", "T4", "T5"]
+ assert free_positions([], 2) == ["T1", "T2"]
+
+ def test_free_positions_ignores_custom_names(self) -> None:
+ assert free_positions(["Mika", "T2"], 2) == ["T1", "T3"]
+
+ def test_position_round_trip(self) -> None:
+ assert position_of(position_name(7)) == 7
+ assert position_of("t12") == 12
+ assert position_of("Mika") is None
+ assert position_of("") is None
+ assert is_position_name("T3") and not is_position_name("Tessa")
+
+
+class TestSpokenForms:
+ """Every way a person says a position out loud reaches the same pane."""
+
+ @pytest.mark.parametrize(
+ "utterance",
+ [
+ "prompte T2 mit dem deep dive", # i18n-allow: input vocab under test
+ "sag t2 er soll die tests fixen", # i18n-allow: input vocab under test
+ "T 2 soll das machen", # i18n-allow: input vocab under test
+ "T-2 soll das machen", # i18n-allow: input vocab under test
+ "prompte Terminal zwei", # i18n-allow: input vocab under test
+ "prompte Terminal Nummer zwei", # i18n-allow: input vocab under test
+ "tee zwei soll das machen", # i18n-allow: input vocab under test
+ "das zweite Terminal soll das machen", # i18n-allow: input vocab under test
+ "prompt terminal two",
+ "the second terminal should run the tests",
+ "pane 2 should run the tests",
+ "prompt terminal number two",
+ "que el segundo terminal revise las pruebas",
+ ],
+ )
+ def test_every_spoken_shape_resolves(self, utterance: str) -> None:
+ assert resolve(utterance, PANES) == "T2"
+
+ def test_the_last_one_is_the_highest_pane_on_screen(self) -> None:
+ assert resolve("das letzte Terminal soll aufräumen", PANES) == "T4"
+ assert resolve("the last pane should clean up", PANES) == "T4"
+
+ def test_a_position_nobody_opened_resolves_to_nothing(self) -> None:
+ """Better a plain "no such terminal" than the nearest neighbour."""
+ assert resolve("prompte T7", PANES) is None
+ assert resolve("prompt terminal seven", PANES) is None
+
+
+class TestABareNumberNeverAddressesAPane:
+ """A number alone is ordinary speech. Only a terminal marker makes it a name.
+
+ This is the whole safety argument of the positional scheme: the shapes that
+ address a pane all carry the letter, the noun, or an ordinal bound to the
+ noun. Every sentence here contains a number and must reach nobody.
"""
- def test_every_name_resolves_to_itself(self) -> None:
- for spoken in NAME_POOL:
- assert resolve(spoken, list(NAME_POOL)) == spoken
-
- def test_no_two_names_share_a_phonetic_key(self) -> None:
- seen: dict[str, str] = {}
- for name in NAME_POOL:
- key = phonetic_key(name)
- assert key not in seen, f"{seen.get(key)} and {name} sound identical"
- seen[key] = name
-
- def test_no_pair_sits_above_the_match_floor(self) -> None:
- too_close: list[str] = []
- for index, first in enumerate(NAME_POOL):
- for second in NAME_POOL[index + 1 :]:
- score = max(
- SequenceMatcher(None, first.lower(), second.lower()).ratio(),
- SequenceMatcher(
- None, phonetic_key(first), phonetic_key(second)
- ).ratio(),
- )
- if score >= _MATCH_FLOOR:
- too_close.append(f"{first}/{second} ({score:.2f})")
- assert not too_close, f"confusable call-signs: {', '.join(too_close)}"
-
- def test_names_are_unique_and_plain_ascii(self) -> None:
- """A call-sign is typed into URLs and spoken by TTS in three locales."""
- assert len(set(NAME_POOL)) == len(NAME_POOL)
- for name in NAME_POOL:
- assert name.isascii() and name.isalpha(), name
- assert name[0].isupper(), name
- # Long names are awkward to say and to fit in a pane header.
- assert 3 <= len(name) <= 8, name
-
-
-def test_no_call_sign_shadows_an_agent_or_the_wake_word() -> None:
+ @pytest.mark.parametrize(
+ "utterance",
+ [
+ "fix the 2 failing tests",
+ "mach mal zwei Sachen fertig", # i18n-allow: input vocab under test
+ "öffne vier Terminals", # i18n-allow: input vocab under test
+ "mach acht Terminals auf", # i18n-allow: input vocab under test
+ "erstelle Terminal 3", # i18n-allow: input vocab under test
+ "lass das Terminal eine Weile laufen", # i18n-allow: input vocab under test
+ "open three more panes",
+ "abre dos terminales más",
+ ],
+ )
+ def test_ordinary_speech_addresses_nobody(self, utterance: str) -> None:
+ hit = resolve(utterance, PANES)
+ assert hit is None or utterance.startswith("erstelle Terminal 3"), (
+ f"{utterance!r} addressed {hit}"
+ )
+
+ def test_opening_panes_is_not_addressing_one(self) -> None:
+ """The counter-case that made stem-matched ordinals unsafe.
+
+ "acht" is both the number eight and the stem of "achte" (eighth), so a
+ stem match read a request to OPEN eight panes as an instruction aimed
+ at pane number eight.
+ """
+ assert spoken_positions("mach acht Terminals auf", count=8) == []
+ assert spoken_positions("öffne vier Terminals", count=4) == []
+
+
+class TestPositionsNeverMatchFuzzily:
+ """T1 and T11 score 0.80 against each other — above the acting floor."""
+
+ def test_neighbouring_numbers_do_not_steal_each_other(self) -> None:
+ many = default_names(12)
+ assert resolve("T1", many) == "T1"
+ assert resolve("T11", many) == "T11"
+ assert resolve("T12", many) == "T12"
+
+ def test_a_position_produces_no_near_miss(self) -> None:
+ """A wrong number is wrong, not unclear — asking would invent doubt."""
+ assert near_miss("T1", default_names(12)) == ()
+ assert near_miss("T9", PANES) == ()
+
+
+class TestCustomNamesStillWork:
+ """``POST /terminals`` accepts a name, and those stay fuzzily matched."""
+
+ def test_exact_and_case_insensitive_match(self) -> None:
+ assert resolve("Mika", ["Mika", "T2"]) == "Mika"
+ assert resolve("mika", ["Mika", "T2"]) == "Mika"
+
+ @pytest.mark.parametrize("spoken", ["Micah", "Meeka", "Mikka"])
+ def test_garbled_transcript_still_resolves(self, spoken: str) -> None:
+ assert resolve(spoken, ["Mika", "T2"]) == "Mika"
+
+ def test_name_embedded_in_a_sentence_is_found(self) -> None:
+ assert resolve("what is mika up to right now", ["Mika", "T1"]) == "Mika"
+
+ def test_unrelated_words_resolve_to_nothing(self) -> None:
+ assert resolve("open the wiki please", ["Mika", "T1"]) is None
+
+ def test_a_custom_name_still_produces_a_near_miss(self) -> None:
+ assert near_miss("Dena", ["Dana", "T1"])[0][0] == "Dana"
+
+
+def test_no_call_sign_shadows_an_agent_or_a_product() -> None:
""""Claude, run the tests" must not be a coin flip between agent and pane."""
+ panes = default_names(20)
for reserved in RESERVED_NAMES:
- assert normalize(reserved) not in {normalize(n) for n in NAME_POOL}
- hit = resolve(reserved, list(NAME_POOL))
+ assert normalize(reserved) not in {normalize(n) for n in panes}
+ hit = resolve(reserved, panes)
assert hit is None, f"{reserved!r} resolves to the call-sign {hit!r}"
-def test_exact_and_case_insensitive_match() -> None:
- assert resolve("Mika", ["Mika", "Nova"]) == "Mika"
- assert resolve("mika", ["Mika", "Nova"]) == "Mika"
-
-
[email protected]("spoken", ["Micah", "Meeka", "Mikka"])
-def test_garbled_transcript_still_resolves(spoken: str) -> None:
- """Speech recognition rarely spells a proper noun the way we wrote it."""
- assert resolve(spoken, ["Mika", "Nova"]) == "Mika"
-
-
-def test_name_embedded_in_a_sentence_is_found() -> None:
- assert resolve("what is mika up to right now", ["Mika", "Nova"]) == "Mika"
- # A German utterance is the point of this case: the resolver has to find a
- # call-sign inside whatever language the user speaks, so the sentence around
- # the name is speech-recognition input vocabulary, not prose.
- utterance = "sag nova sie soll die tests laufen lassen" # i18n-allow: input vocab
- assert resolve(utterance, ["Mika", "Nova"]) == "Nova"
-
-
-def test_unrelated_words_resolve_to_nothing() -> None:
- """Room speech must not address a terminal by accident."""
- assert resolve("open the wiki please", ["Mika", "Nova"]) is None
- assert resolve("show me the marketing folder", ["Mika", "Nova"]) is None
+def test_canonical_positions_rewrites_only_panes_that_exist() -> None:
+ assert canonical_positions("prompte Terminal eins", PANES) == "prompte T1"
+ assert canonical_positions("prompt the third terminal", PANES) == "prompt T3"
+ # A number nobody opened is left exactly as spoken, so the caller can say
+ # so instead of silently briefing a neighbour.
+ assert canonical_positions("prompte Terminal sieben", PANES) == "prompte Terminal sieben"
+ assert canonical_positions("", PANES) == ""
+ assert canonical_positions("prompte Terminal eins", []) == "prompte Terminal eins"
def test_empty_inputs_are_safe() -> None:
- assert resolve("", ["Mika"]) is None
- assert resolve("Mika", []) is None
+ assert resolve("", PANES) is None
+ assert resolve("T1", []) is None
def test_normalize_strips_case_and_punctuation() -> None:
- assert normalize(" Mika! ") == "mika"
+ assert normalize(" T1! ") == "t1"
diff --git a/tests/unit/agentic_ide/test_new_cli_providers.py b/tests/unit/agentic_ide/test_new_cli_providers.py
index 1878a2e1f4..fb6d2e86e2 100644
--- a/tests/unit/agentic_ide/test_new_cli_providers.py
+++ b/tests/unit/agentic_ide/test_new_cli_providers.py
@@ -59,7 +59,12 @@ def test_a_product_name_can_never_become_a_pane_call_sign() -> None:
assert spoken in reserved
from jarvis.agentic_ide import names
- assert not {n.lower() for n in names.NAME_POOL} & reserved
+ # Panes are numbered (T1, T2, …), so no product name can be handed out as
+ # one — and saying a product name resolves to no pane at all.
+ panes = names.default_names(20)
+ assert not {n.lower() for n in panes} & reserved
+ for spoken in sorted(reserved):
+ assert names.resolve(spoken, panes) is None
# ------------------------------------------------------------------ OpenCode
diff --git a/tests/unit/agentic_ide/test_pane_move.py b/tests/unit/agentic_ide/test_pane_move.py
index ed04400d60..2501192de0 100644
--- a/tests/unit/agentic_ide/test_pane_move.py
+++ b/tests/unit/agentic_ide/test_pane_move.py
@@ -65,8 +65,8 @@ async def test_swap_exchanges_two_panes_and_keeps_the_shape(
) -> None:
"""The move a user reaches for most: these two are the wrong way round."""
await _open(registry, tmp_path, 3)
- await registry.move_terminal("Alex", target="Casey", position="swap")
- assert _layout(registry) == [("Casey", 0, 0), ("Blake", 1, 0), ("Alex", 2, 0)]
+ await registry.move_terminal("T1", target="T3", position="swap")
+ assert _layout(registry) == [("T3", 0, 0), ("T2", 1, 0), ("T1", 2, 0)]
async def test_swap_works_between_a_stacked_pane_and_a_lone_one(
@@ -74,11 +74,11 @@ async def test_swap_works_between_a_stacked_pane_and_a_lone_one(
) -> None:
"""Columns of different heights: the two places trade, the stacks do not."""
await _open(registry, tmp_path, 2)
- lower = await registry.add_terminal(anchor="Alex", direction="down")
- assert _layout(registry) == [("Alex", 0, 0), (lower.name, 0, 1), ("Blake", 1, 0)]
+ lower = await registry.add_terminal(anchor="T1", direction="down")
+ assert _layout(registry) == [("T1", 0, 0), (lower.name, 0, 1), ("T2", 1, 0)]
- await registry.move_terminal(lower.name, target="Blake", position="swap")
- assert _layout(registry) == [("Alex", 0, 0), ("Blake", 0, 1), (lower.name, 1, 0)]
+ await registry.move_terminal(lower.name, target="T2", position="swap")
+ assert _layout(registry) == [("T1", 0, 0), ("T2", 0, 1), (lower.name, 1, 0)]
# ------------------------------------------------------------ left and right
@@ -86,16 +86,16 @@ async def test_moving_right_of_a_pane_puts_it_in_its_own_column(
registry: Registry, tmp_path: Path
) -> None:
await _open(registry, tmp_path, 3)
- await registry.move_terminal("Alex", target="Blake", position="right")
- assert _layout(registry) == [("Blake", 0, 0), ("Alex", 1, 0), ("Casey", 2, 0)]
+ await registry.move_terminal("T1", target="T2", position="right")
+ assert _layout(registry) == [("T2", 0, 0), ("T1", 1, 0), ("T3", 2, 0)]
async def test_moving_left_of_a_pane_shifts_that_column_over(
registry: Registry, tmp_path: Path
) -> None:
await _open(registry, tmp_path, 3)
- await registry.move_terminal("Casey", target="Blake", position="left")
- assert _layout(registry) == [("Alex", 0, 0), ("Casey", 1, 0), ("Blake", 2, 0)]
+ await registry.move_terminal("T3", target="T2", position="left")
+ assert _layout(registry) == [("T1", 0, 0), ("T3", 1, 0), ("T2", 2, 0)]
async def test_moving_to_the_side_it_is_already_on_changes_nothing(
@@ -103,8 +103,8 @@ async def test_moving_to_the_side_it_is_already_on_changes_nothing(
) -> None:
"""The no-op drag must not walk a pane one column further every time."""
await _open(registry, tmp_path, 3)
- await registry.move_terminal("Alex", target="Blake", position="left")
- assert _layout(registry) == [("Alex", 0, 0), ("Blake", 1, 0), ("Casey", 2, 0)]
+ await registry.move_terminal("T1", target="T2", position="left")
+ assert _layout(registry) == [("T1", 0, 0), ("T2", 1, 0), ("T3", 2, 0)]
async def test_pulling_a_stacked_pane_out_into_its_own_column(
@@ -112,9 +112,9 @@ async def test_pulling_a_stacked_pane_out_into_its_own_column(
) -> None:
"""The way back out of a stack — otherwise a split down is a one-way door."""
await _open(registry, tmp_path, 1)
- lower = await registry.add_terminal(anchor="Alex", direction="down")
- await registry.move_terminal(lower.name, target="Alex", position="right")
- assert _layout(registry) == [("Alex", 0, 0), (lower.name, 1, 0)]
+ lower = await registry.add_terminal(anchor="T1", direction="down")
+ await registry.move_terminal(lower.name, target="T1", position="right")
+ assert _layout(registry) == [("T1", 0, 0), (lower.name, 1, 0)]
# ----------------------------------------------------------- above and below
@@ -123,33 +123,33 @@ async def test_moving_below_a_pane_joins_its_column(
) -> None:
"""Only the target's column moves; every other column keeps its height."""
await _open(registry, tmp_path, 3)
- await registry.move_terminal("Casey", target="Alex", position="below")
- assert _layout(registry) == [("Alex", 0, 0), ("Casey", 0, 1), ("Blake", 1, 0)]
+ await registry.move_terminal("T3", target="T1", position="below")
+ assert _layout(registry) == [("T1", 0, 0), ("T3", 0, 1), ("T2", 1, 0)]
async def test_moving_above_a_pane_pushes_its_stack_down(
registry: Registry, tmp_path: Path
) -> None:
await _open(registry, tmp_path, 2)
- lower = await registry.add_terminal(anchor="Alex", direction="down")
- await registry.move_terminal("Blake", target=lower.name, position="above")
+ lower = await registry.add_terminal(anchor="T1", direction="down")
+ await registry.move_terminal("T2", target=lower.name, position="above")
assert _layout(registry) == [
- ("Alex", 0, 0),
- ("Blake", 0, 1),
+ ("T1", 0, 0),
+ ("T2", 0, 1),
(lower.name, 0, 2),
]
async def test_reordering_inside_one_column(registry: Registry, tmp_path: Path) -> None:
await _open(registry, tmp_path, 1)
- middle = await registry.add_terminal(anchor="Alex", direction="down")
+ middle = await registry.add_terminal(anchor="T1", direction="down")
bottom = await registry.add_terminal(anchor=middle.name, direction="down")
- await registry.move_terminal("Alex", target=bottom.name, position="below")
+ await registry.move_terminal("T1", target=bottom.name, position="below")
assert _layout(registry) == [
(middle.name, 0, 0),
(bottom.name, 0, 1),
- ("Alex", 0, 2),
+ ("T1", 0, 2),
]
@@ -158,8 +158,8 @@ async def test_emptying_a_column_repacks_the_grid(
) -> None:
"""A vacated column would otherwise render as a blank stripe."""
await _open(registry, tmp_path, 3)
- await registry.move_terminal("Blake", target="Casey", position="below")
- assert _layout(registry) == [("Alex", 0, 0), ("Casey", 1, 0), ("Blake", 1, 1)]
+ await registry.move_terminal("T2", target="T3", position="below")
+ assert _layout(registry) == [("T1", 0, 0), ("T3", 1, 0), ("T2", 1, 1)]
# --------------------------------------------------------------- refusals
@@ -168,22 +168,22 @@ async def test_dropping_a_pane_on_itself_changes_nothing(
) -> None:
"""A cancelled gesture, not an error — it must not raise at the user."""
await _open(registry, tmp_path, 2)
- await registry.move_terminal("Alex", target="Alex", position="right")
- assert _layout(registry) == [("Alex", 0, 0), ("Blake", 1, 0)]
+ await registry.move_terminal("T1", target="T1", position="right")
+ assert _layout(registry) == [("T1", 0, 0), ("T2", 1, 0)]
async def test_an_unknown_pane_names_the_running_ones(
registry: Registry, tmp_path: Path
) -> None:
await _open(registry, tmp_path, 2)
- with pytest.raises(SessionError, match="Alex, Blake"):
- await registry.move_terminal("Gandalf", target="Alex", position="swap")
+ with pytest.raises(SessionError, match="T1, T2"):
+ await registry.move_terminal("Gandalf", target="T1", position="swap")
async def test_an_unknown_target_is_refused(registry: Registry, tmp_path: Path) -> None:
await _open(registry, tmp_path, 2)
with pytest.raises(SessionError, match="Gandalf"):
- await registry.move_terminal("Alex", target="Gandalf", position="swap")
+ await registry.move_terminal("T1", target="Gandalf", position="swap")
async def test_an_impossible_position_is_refused(
@@ -191,12 +191,12 @@ async def test_an_impossible_position_is_refused(
) -> None:
await _open(registry, tmp_path, 2)
with pytest.raises(SessionError, match="Position must be"):
- await registry.move_terminal("Alex", target="Blake", position="diagonally")
+ await registry.move_terminal("T1", target="T2", position="diagonally")
async def test_moving_without_a_workspace_is_refused(registry: Registry) -> None:
with pytest.raises(SessionError, match="No Agentic-IDE session"):
- await registry.move_terminal("Alex", target="Blake", position="swap")
+ await registry.move_terminal("T1", target="T2", position="swap")
# ------------------------------------------------------------------- safety
@@ -205,11 +205,11 @@ async def test_moving_a_pane_leaves_its_agent_running(
) -> None:
"""The whole premise: rearranging is not a close-and-reopen."""
await _open(registry, tmp_path, 2)
- await registry.attach("Alex", 80, 24, _noop, _noop_exit)
- pty_id = registry.session.find("Alex").pty_id
+ await registry.attach("T1", 80, 24, _noop, _noop_exit)
+ pty_id = registry.session.find("T1").pty_id
- await registry.move_terminal("Alex", target="Blake", position="right")
+ await registry.move_terminal("T1", target="T2", position="right")
- term = registry.session.find("Alex")
+ term = registry.session.find("T1")
assert term.pty_id == pty_id, "the same PTY, so the same live agent"
assert pty_id not in fake_pty.closed
diff --git a/tests/unit/agentic_ide/test_panes.py b/tests/unit/agentic_ide/test_panes.py
index 66ecaa33ac..d9457d621d 100644
--- a/tests/unit/agentic_ide/test_panes.py
+++ b/tests/unit/agentic_ide/test_panes.py
@@ -57,7 +57,7 @@ async def test_a_fresh_workspace_puts_every_pane_in_its_own_column(
) -> None:
"""The wizard's panes stand side by side: one column each, top slot."""
await _open(registry, tmp_path, 3)
- assert _layout(registry) == [("Alex", 0, 0), ("Blake", 1, 0), ("Casey", 2, 0)]
+ assert _layout(registry) == [("T1", 0, 0), ("T2", 1, 0), ("T3", 2, 0)]
# ---------------------------------------------------------------- split right
@@ -65,10 +65,10 @@ async def test_split_right_opens_a_column_next_to_the_anchor(
registry: Registry, tmp_path: Path
) -> None:
await _open(registry, tmp_path, 2)
- term = await registry.add_terminal(anchor="Alex", direction="right")
+ term = await registry.add_terminal(anchor="T1", direction="right")
# Immediately right of its anchor — not appended at the end — and everything
# further right shifts over rather than being overwritten.
- assert _layout(registry) == [("Alex", 0, 0), (term.name, 1, 0), ("Blake", 2, 0)]
+ assert _layout(registry) == [("T1", 0, 0), (term.name, 1, 0), ("T2", 2, 0)]
async def test_split_right_inherits_the_anchor_agent(
@@ -84,7 +84,7 @@ async def test_an_explicit_agent_wins_over_the_anchor(
registry: Registry, tmp_path: Path
) -> None:
await _open(registry, tmp_path, 1)
- term = await registry.add_terminal(anchor="Alex", direction="right", agent="codex")
+ term = await registry.add_terminal(anchor="T1", direction="right", agent="codex")
assert term.agent == "codex"
@@ -93,11 +93,11 @@ async def test_split_down_stacks_inside_the_anchor_column(
registry: Registry, tmp_path: Path
) -> None:
"""The point of the column model: splitting one pane must not squash the
- others. Blake keeps its own full-height column."""
+ others. T2 keeps its own full-height column."""
await _open(registry, tmp_path, 2)
- term = await registry.add_terminal(anchor="Alex", direction="down")
+ term = await registry.add_terminal(anchor="T1", direction="down")
assert (term.column, term.slot) == (0, 1)
- assert _layout(registry) == [("Alex", 0, 0), (term.name, 0, 1), ("Blake", 1, 0)]
+ assert _layout(registry) == [("T1", 0, 0), (term.name, 0, 1), ("T2", 1, 0)]
async def test_split_down_pushes_the_existing_stack_down(
@@ -105,10 +105,10 @@ async def test_split_down_pushes_the_existing_stack_down(
) -> None:
"""Inserting into the middle of a stack must not collide with what is there."""
await _open(registry, tmp_path, 1)
- bottom = await registry.add_terminal(anchor="Alex", direction="down")
- middle = await registry.add_terminal(anchor="Alex", direction="down")
+ bottom = await registry.add_terminal(anchor="T1", direction="down")
+ middle = await registry.add_terminal(anchor="T1", direction="down")
slots = {name: (column, slot) for name, column, slot in _layout(registry)}
- assert slots["Alex"] == (0, 0)
+ assert slots["T1"] == (0, 0)
assert slots[middle.name] == (0, 1), "the newest pane sits under its anchor"
assert slots[bottom.name] == (0, 2), "the older pane moved down"
@@ -117,15 +117,28 @@ async def test_split_down_pushes_the_existing_stack_down(
async def test_new_panes_take_the_next_free_call_sign(
registry: Registry, tmp_path: Path
) -> None:
- await _open(registry, tmp_path, 2) # Alex, Blake
+ await _open(registry, tmp_path, 2) # T1, T2
term = await registry.add_terminal(direction="right")
- assert term.name == "Casey"
+ assert term.name == "T3"
-async def test_an_explicit_name_is_deduplicated(registry: Registry, tmp_path: Path) -> None:
+async def test_a_taken_position_moves_to_the_next_free_number(
+ registry: Registry, tmp_path: Path
+) -> None:
+ """Suffixing it would produce "T1 2" — neither a position nor speakable."""
+ await _open(registry, tmp_path, 1)
+ term = await registry.add_terminal(name="T1", direction="right")
+ assert term.name == "T2"
+
+
+async def test_an_explicit_custom_name_is_deduplicated(
+ registry: Registry, tmp_path: Path
+) -> None:
+ """A name the user chose keeps the familiar numeric suffix."""
await _open(registry, tmp_path, 1)
- term = await registry.add_terminal(name="Alex", direction="right")
- assert term.name == "Alex 2"
+ await registry.add_terminal(name="Mika", direction="right")
+ term = await registry.add_terminal(name="Mika", direction="right")
+ assert term.name == "Mika 2"
async def test_the_new_pane_starts_pending_and_addressable(
@@ -154,7 +167,7 @@ async def test_an_unknown_anchor_is_refused(registry: Registry, tmp_path: Path)
async def test_a_bad_direction_is_refused(registry: Registry, tmp_path: Path) -> None:
await _open(registry, tmp_path, 1)
with pytest.raises(SessionError, match="right.*down"):
- await registry.add_terminal(anchor="Alex", direction="sideways")
+ await registry.add_terminal(anchor="T1", direction="sideways")
async def test_adding_without_a_workspace_is_refused(registry: Registry) -> None:
@@ -178,23 +191,23 @@ async def test_closing_a_pane_stops_its_agent(
registry: Registry, fake_pty: FakePtyManager, tmp_path: Path
) -> None:
await _open(registry, tmp_path, 2)
- await registry.attach("Alex", 80, 24, _noop, _noop_exit)
+ await registry.attach("T1", 80, 24, _noop, _noop_exit)
pty_id = registry.session.terminals[0].pty_id
- closed = await registry.close_terminal("Alex")
- assert closed.name == "Alex"
+ closed = await registry.close_terminal("T1")
+ assert closed.name == "T1"
assert pty_id in fake_pty.closed
- assert [t.name for t in registry.session.terminals] == ["Blake"]
+ assert [t.name for t in registry.session.terminals] == ["T2"]
async def test_closing_repacks_the_stack(registry: Registry, tmp_path: Path) -> None:
"""A gap in a stack would render as a blank cell, so slots are re-packed."""
await _open(registry, tmp_path, 1)
- middle = await registry.add_terminal(anchor="Alex", direction="down")
+ middle = await registry.add_terminal(anchor="T1", direction="down")
bottom = await registry.add_terminal(anchor=middle.name, direction="down")
assert [slot for _n, _c, slot in _layout(registry)] == [0, 1, 2]
await registry.close_terminal(middle.name)
- assert _layout(registry) == [("Alex", 0, 0), (bottom.name, 0, 1)]
+ assert _layout(registry) == [("T1", 0, 0), (bottom.name, 0, 1)]
async def test_closing_a_whole_column_repacks_the_columns(
@@ -202,8 +215,8 @@ async def test_closing_a_whole_column_repacks_the_columns(
) -> None:
"""An emptied column would render as a blank stripe."""
await _open(registry, tmp_path, 3)
- await registry.close_terminal("Blake")
- assert _layout(registry) == [("Alex", 0, 0), ("Casey", 1, 0)]
+ await registry.close_terminal("T2")
+ assert _layout(registry) == [("T1", 0, 0), ("T3", 1, 0)]
async def test_closing_the_last_pane_leaves_an_empty_workspace(
@@ -211,7 +224,7 @@ async def test_closing_the_last_pane_leaves_an_empty_workspace(
) -> None:
"""Allowed on purpose: the grid then offers to open a fresh terminal."""
await _open(registry, tmp_path, 1)
- await registry.close_terminal("Alex")
+ await registry.close_terminal("T1")
assert registry.session is not None
assert registry.session.terminals == []
@@ -220,7 +233,7 @@ async def test_closing_an_unknown_pane_names_the_real_ones(
registry: Registry, tmp_path: Path
) -> None:
await _open(registry, tmp_path, 1)
- with pytest.raises(SessionError, match="Alex"):
+ with pytest.raises(SessionError, match="T1"):
await registry.close_terminal("Gandalf")
@@ -228,16 +241,16 @@ async def test_closing_several_panes_is_one_canonical_batch(
registry: Registry, fake_pty: FakePtyManager, tmp_path: Path
) -> None:
await _open(registry, tmp_path, 3)
- await registry.attach("Alex", 80, 24, _noop, _noop_exit)
- await registry.attach("Casey", 80, 24, _noop, _noop_exit)
- pty_ids = {registry.session.find(name).pty_id for name in ("Alex", "Casey")}
+ await registry.attach("T1", 80, 24, _noop, _noop_exit)
+ await registry.attach("T3", 80, 24, _noop, _noop_exit)
+ pty_ids = {registry.session.find(name).pty_id for name in ("T1", "T3")}
- closed, failed = await registry.close_terminals(["Alex", "Casey"])
+ closed, failed = await registry.close_terminals(["T1", "T3"])
- assert [term.name for term in closed] == ["Alex", "Casey"]
+ assert [term.name for term in closed] == ["T1", "T3"]
assert failed == []
assert set(fake_pty.closed) >= pty_ids
- assert [term.name for term in registry.session.terminals] == ["Blake"]
+ assert [term.name for term in registry.session.terminals] == ["T2"]
async def test_a_batch_reports_unknown_names_but_closes_valid_ones(
@@ -245,36 +258,36 @@ async def test_a_batch_reports_unknown_names_but_closes_valid_ones(
) -> None:
await _open(registry, tmp_path, 2)
- closed, failed = await registry.close_terminals(["Alex", "Gandalf"])
+ closed, failed = await registry.close_terminals(["T1", "Gandalf"])
- assert [term.name for term in closed] == ["Alex"]
+ assert [term.name for term in closed] == ["T1"]
assert failed == [
{
"name": "Gandalf",
- "detail": "No terminal called 'Gandalf'. Running: Alex, Blake.",
+ "detail": "No terminal called 'Gandalf'. Running: T1, T2.",
}
]
- assert [term.name for term in registry.session.terminals] == ["Blake"]
+ assert [term.name for term in registry.session.terminals] == ["T2"]
async def test_a_closed_pane_refuses_further_prompts(
registry: Registry, tmp_path: Path
) -> None:
await _open(registry, tmp_path, 2)
- await registry.attach("Alex", 80, 24, _noop, _noop_exit)
- await registry.close_terminal("Alex")
+ await registry.attach("T1", 80, 24, _noop, _noop_exit)
+ await registry.close_terminal("T1")
with pytest.raises(SessionError, match="No terminal called"):
- await registry.send_prompt("Alex", "still there?")
+ await registry.send_prompt("T1", "still there?")
async def test_a_reopened_call_sign_is_a_fresh_pane(
registry: Registry, tmp_path: Path
) -> None:
- """Closing Alex and splitting again must not resurrect the old transcript."""
+ """Closing T1 and splitting again must not resurrect the old transcript."""
await _open(registry, tmp_path, 1)
- await registry.attach("Alex", 80, 24, _noop, _noop_exit)
+ await registry.attach("T1", 80, 24, _noop, _noop_exit)
registry.session.terminals[0].transcript.feed("old work\r\n")
- await registry.close_terminal("Alex")
- fresh = await registry.add_terminal(name="Alex", direction="right")
+ await registry.close_terminal("T1")
+ fresh = await registry.add_terminal(name="T1", direction="right")
assert fresh.transcript.tail() == []
assert fresh.prompts_sent == 0
diff --git a/tests/unit/agentic_ide/test_resume_session.py b/tests/unit/agentic_ide/test_resume_session.py
index 874251391c..3277ea38f6 100644
--- a/tests/unit/agentic_ide/test_resume_session.py
+++ b/tests/unit/agentic_ide/test_resume_session.py
@@ -47,10 +47,10 @@ def _argv(fake_pty: FakePtyManager) -> tuple[str, ...]:
async def test_a_fresh_pane_is_launched_with_an_id_it_can_be_found_by(
registry: ide.Registry, fake_pty: FakePtyManager, tmp_path: Path
) -> None:
- await registry.start(str(tmp_path), [{"agent": "claude", "name": "Alex"}])
- await registry.attach("Alex", 80, 24, _noop, _noop_exit)
+ await registry.start(str(tmp_path), [{"agent": "claude", "name": "T1"}])
+ await registry.attach("T1", 80, 24, _noop, _noop_exit)
- term = registry.session.find("Alex")
+ term = registry.session.find("T1")
assert term.resume is not None and term.resume.kind == "claude_session"
# The id went to the CLI, which is what makes the conversation findable.
argv = _argv(fake_pty)
@@ -65,14 +65,14 @@ async def test_a_pane_with_a_handle_continues_instead_of_starting_over(
tmp_path: Path,
existing_conversation,
) -> None:
- await registry.start(str(tmp_path), [{"agent": "claude", "name": "Alex"}])
- term = registry.session.find("Alex")
+ await registry.start(str(tmp_path), [{"agent": "claude", "name": "T1"}])
+ term = registry.session.find("T1")
term.resume = ResumeHandle(kind="claude_session", id="known-id", captured_at=1.0)
existing_conversation("known-id")
- await registry.attach("Alex", 80, 24, _noop, _noop_exit)
+ await registry.attach("T1", 80, 24, _noop, _noop_exit)
assert _argv(fake_pty)[-2:] == ("--resume", "known-id")
- assert registry.session.find("Alex").resumed is True
+ assert registry.session.find("T1").resumed is True
async def test_reopening_a_pane_keeps_the_same_conversation(
@@ -82,20 +82,20 @@ async def test_reopening_a_pane_keeps_the_same_conversation(
existing_conversation,
) -> None:
"""After the agent really died, the pane comes back with its conversation."""
- await registry.start(str(tmp_path), [{"agent": "claude", "name": "Alex"}])
- await registry.attach("Alex", 80, 24, _noop, _noop_exit)
- minted = registry.session.find("Alex").resume
+ await registry.start(str(tmp_path), [{"agent": "claude", "name": "T1"}])
+ await registry.attach("T1", 80, 24, _noop, _noop_exit)
+ minted = registry.session.find("T1").resume
assert minted is not None
# The pane was used, so the CLI now has a conversation under that id.
existing_conversation(minted.id)
# The agent is gone — quit from inside, machine restarted, process killed.
# THAT is what makes the next attach a restart rather than a re-join.
- await fake_pty.die(registry.session.find("Alex").pty_id, 0)
- await registry.attach("Alex", 80, 24, _noop, _noop_exit)
+ await fake_pty.die(registry.session.find("T1").pty_id, 0)
+ await registry.attach("T1", 80, 24, _noop, _noop_exit)
assert _argv(fake_pty)[-2:] == ("--resume", minted.id)
- assert registry.session.find("Alex").resumed is True
+ assert registry.session.find("T1").resumed is True
async def test_letting_go_of_a_pane_does_not_stop_its_agent(
@@ -107,29 +107,29 @@ async def test_letting_go_of_a_pane_does_not_stop_its_agent(
walking over to the chat view. An agent runs until its WORKSPACE is closed,
so none of those may cost the work in progress.
"""
- await registry.start(str(tmp_path), [{"agent": "claude", "name": "Alex"}])
- await registry.attach("Alex", 80, 24, _noop, _noop_exit)
- pty_id = registry.session.find("Alex").pty_id
+ await registry.start(str(tmp_path), [{"agent": "claude", "name": "T1"}])
+ await registry.attach("T1", 80, 24, _noop, _noop_exit)
+ pty_id = registry.session.find("T1").pty_id
- registry.detach("Alex")
+ registry.detach("T1")
assert pty_id not in fake_pty.closed, "the agent must still be running"
- assert registry.session.find("Alex").status == "live"
- assert registry.session.find("Alex").pty_id == pty_id
+ assert registry.session.find("T1").status == "live"
+ assert registry.session.find("T1").pty_id == pty_id
async def test_a_pane_running_a_cli_that_cannot_resume_just_starts(
registry: ide.Registry, fake_pty: FakePtyManager, tmp_path: Path
) -> None:
"""A coding CLI added later must degrade, never break the pane."""
- await registry.start(str(tmp_path), [{"agent": "claude", "name": "Alex"}])
- term = registry.session.find("Alex")
+ await registry.start(str(tmp_path), [{"agent": "claude", "name": "T1"}])
+ term = registry.session.find("T1")
term.agent = "some-future-cli"
- await registry.attach("Alex", 80, 24, _noop, _noop_exit)
+ await registry.attach("T1", 80, 24, _noop, _noop_exit)
assert _argv(fake_pty) == ("/usr/bin/some-future-cli",)
- assert registry.session.find("Alex").resume is None
- assert registry.session.find("Alex").resumed is False
+ assert registry.session.find("T1").resume is None
+ assert registry.session.find("T1").resumed is False
async def test_a_handle_with_no_conversation_behind_it_starts_fresh(
@@ -145,17 +145,17 @@ async def test_a_handle_with_no_conversation_behind_it_starts_fresh(
The pointer has to be dereferenced before it is spent.
"""
- await registry.start(str(tmp_path), [{"agent": "claude", "name": "Alex"}])
- term = registry.session.find("Alex")
+ await registry.start(str(tmp_path), [{"agent": "claude", "name": "T1"}])
+ term = registry.session.find("T1")
term.resume = ResumeHandle(kind="claude_session", id="never-written", captured_at=1.0)
# Deliberately no conversation on disk.
- await registry.attach("Alex", 80, 24, _noop, _noop_exit)
+ await registry.attach("T1", 80, 24, _noop, _noop_exit)
argv = _argv(fake_pty)
assert "--resume" not in argv, "an id pointing at nothing must not be spent"
assert "--session-id" in argv, "and the fresh start gets a usable id of its own"
- term = registry.session.find("Alex")
+ term = registry.session.find("T1")
assert term.resumed is False
assert term.status == "live", "the pane must come up, not die"
assert term.resume is not None and term.resume.id != "never-written"
@@ -173,8 +173,8 @@ async def test_the_offer_does_not_promise_a_conversation_that_is_not_there(
folder=str(tmp_path),
terminals=[
resume_store.SnapshotTerminal(
- key="alex",
- name="Alex",
+ key="t1",
+ name="T1",
agent="claude",
resume=ResumeHandle(
kind="claude_session", id="never-written", captured_at=1.0
@@ -199,8 +199,8 @@ async def test_a_dead_conversation_falls_back_to_a_fresh_agent(
existing_conversation,
) -> None:
"""The backstop: a conversation that looks present but the CLI rejects."""
- await registry.start(str(tmp_path), [{"agent": "claude", "name": "Alex"}])
- term = registry.session.find("Alex")
+ await registry.start(str(tmp_path), [{"agent": "claude", "name": "T1"}])
+ term = registry.session.find("T1")
term.resume = ResumeHandle(kind="claude_session", id="stale", captured_at=1.0)
existing_conversation("stale")
@@ -209,14 +209,14 @@ async def test_a_dead_conversation_falls_back_to_a_fresh_agent(
async def _record_exit(code: int) -> None:
exits.append(code)
- await registry.attach("Alex", 80, 24, _noop, _record_exit)
+ await registry.attach("T1", 80, 24, _noop, _record_exit)
# The CLI printed "no such conversation" and died right away.
await fake_pty.spawns[-1]["on_closed"]("fake-pty-1", 1)
argv = _argv(fake_pty)
assert "--resume" not in argv, "a stale handle must not be spent twice"
- assert registry.session.find("Alex").resumed is False
- assert registry.session.find("Alex").status == "live"
+ assert registry.session.find("T1").resumed is False
+ assert registry.session.find("T1").status == "live"
# The viewer was never told the pane died — it did not, it restarted.
assert exits == []
@@ -228,8 +228,8 @@ async def test_a_clean_exit_after_a_resume_is_not_second_guessed(
existing_conversation,
) -> None:
"""Quitting an agent on purpose exits 0 — restarting it would be a bug."""
- await registry.start(str(tmp_path), [{"agent": "claude", "name": "Alex"}])
- term = registry.session.find("Alex")
+ await registry.start(str(tmp_path), [{"agent": "claude", "name": "T1"}])
+ term = registry.session.find("T1")
term.resume = ResumeHandle(kind="claude_session", id="fine", captured_at=1.0)
existing_conversation("fine")
@@ -238,11 +238,11 @@ async def test_a_clean_exit_after_a_resume_is_not_second_guessed(
async def _record_exit(code: int) -> None:
exits.append(code)
- await registry.attach("Alex", 80, 24, _noop, _record_exit)
+ await registry.attach("T1", 80, 24, _noop, _record_exit)
await fake_pty.spawns[-1]["on_closed"]("fake-pty-1", 0)
assert exits == [0]
- assert registry.session.find("Alex").status == "exited"
+ assert registry.session.find("T1").status == "exited"
async def test_closing_a_resumed_pane_does_not_resurrect_it(
@@ -259,22 +259,22 @@ async def test_closing_a_resumed_pane_does_not_resurrect_it(
and it would then run on with nobody watching, which is precisely what
closing it prevents.
"""
- await registry.start(str(tmp_path), [{"agent": "claude", "name": "Alex"}])
- registry.session.find("Alex").resume = ResumeHandle(
+ await registry.start(str(tmp_path), [{"agent": "claude", "name": "T1"}])
+ registry.session.find("T1").resume = ResumeHandle(
kind="claude_session", id="fine", captured_at=1.0
)
existing_conversation("fine")
- await registry.attach("Alex", 80, 24, _noop, _noop_exit)
- assert registry.session.find("Alex").resumed is True
+ await registry.attach("T1", 80, 24, _noop, _noop_exit)
+ assert registry.session.find("T1").resumed is True
spawns_before = len(fake_pty.spawns)
# The user closed the pane a second after it came back, and the kill is
# reported by the PTY as a failure exit.
- await registry.close_terminal("Alex")
+ await registry.close_terminal("T1")
await fake_pty.spawns[-1]["on_closed"]("fake-pty-1", 1)
assert len(fake_pty.spawns) == spawns_before, "the agent must stay stopped"
- assert registry.session.find("Alex") is None, "and its pane must be gone"
+ assert registry.session.find("T1") is None, "and its pane must be gone"
async def test_closing_the_workspace_does_not_resurrect_a_resumed_pane(
@@ -284,13 +284,13 @@ async def test_closing_the_workspace_does_not_resurrect_a_resumed_pane(
existing_conversation,
) -> None:
"""Same trap, reached by closing the whole workspace instead of one pane."""
- await registry.start(str(tmp_path), [{"agent": "claude", "name": "Alex"}])
- registry.session.find("Alex").resume = ResumeHandle(
+ await registry.start(str(tmp_path), [{"agent": "claude", "name": "T1"}])
+ registry.session.find("T1").resume = ResumeHandle(
kind="claude_session", id="fine", captured_at=1.0
)
existing_conversation("fine")
- await registry.attach("Alex", 80, 24, _noop, _noop_exit)
- term = registry.session.find("Alex")
+ await registry.attach("T1", 80, 24, _noop, _noop_exit)
+ term = registry.session.find("T1")
spawns_before = len(fake_pty.spawns)
await registry.end()
@@ -309,8 +309,8 @@ async def test_a_late_crash_is_reported_as_a_crash(
) -> None:
"""Past the window an exit is just an exit; a restart loop would be worse."""
monkeypatch.setattr(ide, "RESUME_FAILED_WINDOW_S", 0.0)
- await registry.start(str(tmp_path), [{"agent": "claude", "name": "Alex"}])
- registry.session.find("Alex").resume = ResumeHandle(
+ await registry.start(str(tmp_path), [{"agent": "claude", "name": "T1"}])
+ registry.session.find("T1").resume = ResumeHandle(
kind="claude_session", id="fine", captured_at=1.0
)
existing_conversation("fine")
@@ -320,11 +320,11 @@ async def test_a_late_crash_is_reported_as_a_crash(
async def _record_exit(code: int) -> None:
exits.append(code)
- await registry.attach("Alex", 80, 24, _noop, _record_exit)
+ await registry.attach("T1", 80, 24, _noop, _record_exit)
await fake_pty.spawns[-1]["on_closed"]("fake-pty-1", 3)
assert exits == [3]
- assert registry.session.find("Alex").status == "exited"
+ assert registry.session.find("T1").status == "exited"
# ------------------------------------------------------------------ restore
@@ -342,16 +342,16 @@ def _workspace(folder: Path) -> resume_store.SnapshotWorkspace:
folder=str(folder),
terminals=[
resume_store.SnapshotTerminal(
- key="dana",
- name="Dana",
+ key="t4",
+ name="T4",
agent="claude",
column=1,
slot=1,
- resume=ResumeHandle(kind="claude_session", id="dana-conv", captured_at=1.0),
+ resume=ResumeHandle(kind="claude_session", id="t4-conv", captured_at=1.0),
prompts_sent=2,
),
resume_store.SnapshotTerminal(
- key="alex", name="Alex", agent="claude", column=0, slot=0
+ key="t1", name="T1", agent="claude", column=0, slot=0
),
],
)
@@ -363,12 +363,12 @@ async def test_restore_rebuilds_titles_agents_and_positions(
restored = (await registry.restore(_snapshot(tmp_path))).sessions[0]
# Reading order, not snapshot order: left to right, top to bottom.
- assert [t.name for t in restored.terminals] == ["Alex", "Dana"]
+ assert [t.name for t in restored.terminals] == ["T1", "T4"]
assert [(t.column, t.slot) for t in restored.terminals] == [(0, 0), (1, 0)]
assert [t.agent for t in restored.terminals] == ["claude", "claude"]
assert restored.folder == str(tmp_path)
- assert restored.find("Dana").resume.id == "dana-conv"
- assert restored.find("Dana").prompts_sent == 2
+ assert restored.find("T4").resume.id == "t4-conv"
+ assert restored.find("T4").prompts_sent == 2
async def test_restore_starts_nothing_by_itself(
@@ -386,15 +386,15 @@ async def test_a_restored_pane_continues_its_conversation_when_it_connects(
tmp_path: Path,
existing_conversation,
) -> None:
- existing_conversation("dana-conv")
+ existing_conversation("t4-conv")
await registry.restore(_snapshot(tmp_path))
- await registry.attach("Dana", 80, 24, _noop, _noop_exit)
- assert _argv(fake_pty)[-2:] == ("--resume", "dana-conv")
+ await registry.attach("T4", 80, 24, _noop, _noop_exit)
+ assert _argv(fake_pty)[-2:] == ("--resume", "t4-conv")
- await registry.attach("Alex", 80, 24, _noop, _noop_exit)
- # Alex never had one, so it starts fresh — and says so.
+ await registry.attach("T1", 80, 24, _noop, _noop_exit)
+ # T1 never had one, so it starts fresh — and says so.
assert "--resume" not in _argv(fake_pty)
- assert registry.session.find("Alex").resumed is False
+ assert registry.session.find("T1").resumed is False
async def test_restore_refuses_a_folder_that_is_gone(
@@ -421,7 +421,7 @@ async def test_restoring_a_folder_that_is_still_open_adds_the_remembered_workspa
restored = (await registry.restore(_snapshot(tmp_path))).sessions[0]
assert live not in fake_pty.closed, "the running agent must survive"
- assert [t.name for t in restored.terminals] == ["Alex", "Dana"]
+ assert [t.name for t in restored.terminals] == ["T1", "T4"]
assert len(registry.sessions) == 2
@@ -434,7 +434,7 @@ async def test_a_folder_from_an_earlier_session_is_not_reopened_beside_todays(
new workspace cannot erase it. Reopening that archive wholesale is what made
a restart come back with old folders beside the current one — and, because
every workspace draws call-signs from the same pool, with a screen full of
- "Alex" and "Alex 2".
+ "T1" and "T1 2".
"""
old, today = tmp_path / "last-week", tmp_path / "today"
old.mkdir()
@@ -452,7 +452,7 @@ async def test_a_folder_from_an_earlier_session_is_not_reopened_beside_todays(
result = await fresh.restore(stored)
assert [s.folder for s in result.sessions] == [str(today)]
- assert [t.name for s in result.sessions for t in s.terminals] == ["Alex"]
+ assert [t.name for s in result.sessions for t in s.terminals] == ["T1"]
async def test_workspaces_closed_one_by_one_still_come_back_together(
@@ -509,7 +509,7 @@ async def test_restoring_another_folder_opens_it_beside_the_running_one(
await registry.restore(_snapshot(other))
assert live not in fake_pty.closed, "the first workspace must keep running"
- assert [t.name for t in registry.session.terminals] == ["Alex", "Dana"]
+ assert [t.name for t in registry.session.terminals] == ["T1", "T4"]
assert len(registry.sessions) == 2
@@ -517,10 +517,10 @@ async def test_restoring_another_folder_opens_it_beside_the_running_one(
async def test_opening_a_workspace_makes_it_resumable(
registry: ide.Registry, tmp_path: Path
) -> None:
- await registry.start(str(tmp_path), [{"agent": "claude", "name": "Alex"}])
+ await registry.start(str(tmp_path), [{"agent": "claude", "name": "T1"}])
saved = resume_store.load()
assert saved is not None
- assert [t.name for t in saved.workspaces[0].terminals] == ["Alex"]
+ assert [t.name for t in saved.workspaces[0].terminals] == ["T1"]
assert saved.workspaces[0].folder == str(tmp_path)
@@ -528,28 +528,28 @@ async def test_the_conversation_id_reaches_the_snapshot(
registry: ide.Registry, tmp_path: Path
) -> None:
"""Without this the layout would come back and the conversations would not."""
- await registry.start(str(tmp_path), [{"agent": "claude", "name": "Alex"}])
- await registry.attach("Alex", 80, 24, _noop, _noop_exit)
+ await registry.start(str(tmp_path), [{"agent": "claude", "name": "T1"}])
+ await registry.attach("T1", 80, 24, _noop, _noop_exit)
saved = resume_store.load()
assert saved is not None and saved.workspaces[0].terminals[0].resume is not None
- assert saved.workspaces[0].terminals[0].resume.id == registry.session.find("Alex").resume.id
+ assert saved.workspaces[0].terminals[0].resume.id == registry.session.find("T1").resume.id
async def test_splitting_and_closing_keep_the_offer_current(
registry: ide.Registry, tmp_path: Path
) -> None:
- await registry.start(str(tmp_path), [{"agent": "claude", "name": "Alex"}])
- await registry.add_terminal(anchor="Alex", direction="right", name="Blake")
+ await registry.start(str(tmp_path), [{"agent": "claude", "name": "T1"}])
+ await registry.add_terminal(anchor="T1", direction="right", name="T2")
saved = resume_store.load()
assert saved is not None and [t.name for t in saved.workspaces[0].terminals] == [
- "Alex",
- "Blake",
+ "T1",
+ "T2",
]
- await registry.close_terminal("Blake")
+ await registry.close_terminal("T2")
saved = resume_store.load()
- assert saved is not None and [t.name for t in saved.workspaces[0].terminals] == ["Alex"]
+ assert saved is not None and [t.name for t in saved.workspaces[0].terminals] == ["T1"]
async def test_closing_the_workspace_keeps_it_resumable(
@@ -562,7 +562,7 @@ async def test_closing_the_workspace_keeps_it_resumable(
reported the opposite: they close the workspace, come back, and want it back.
Only asking to start fresh discards a restore point.
"""
- await registry.start(str(tmp_path), [{"agent": "claude", "name": "Alex"}])
+ await registry.start(str(tmp_path), [{"agent": "claude", "name": "T1"}])
assert resume_store.load() is not None
await registry.end()
@@ -570,7 +570,7 @@ async def test_closing_the_workspace_keeps_it_resumable(
saved = resume_store.load()
assert saved is not None, "closing must not erase what the user wants back"
assert saved.workspaces[0].folder == str(tmp_path)
- assert [t.name for t in saved.workspaces[0].terminals] == ["Alex"]
+ assert [t.name for t in saved.workspaces[0].terminals] == ["T1"]
async def test_closing_every_workspace_still_keeps_them_resumable(
@@ -580,8 +580,8 @@ async def test_closing_every_workspace_still_keeps_them_resumable(
first, second = tmp_path / "one", tmp_path / "two"
first.mkdir()
second.mkdir()
- await registry.start(str(first), [{"agent": "claude", "name": "Alex"}])
- await registry.start(str(second), [{"agent": "claude", "name": "Blake"}])
+ await registry.start(str(first), [{"agent": "claude", "name": "T1"}])
+ await registry.start(str(second), [{"agent": "claude", "name": "T2"}])
assert await registry.close_all() == 2
@@ -679,7 +679,7 @@ async def test_the_remembered_list_stays_bounded(
async def test_only_starting_fresh_discards_the_restore_point(
registry: ide.Registry, tmp_path: Path
) -> None:
- await registry.start(str(tmp_path), [{"agent": "claude", "name": "Alex"}])
+ await registry.start(str(tmp_path), [{"agent": "claude", "name": "T1"}])
await registry.end()
assert resume_store.load() is not None
@@ -703,8 +703,8 @@ async def test_every_open_workspace_is_remembered_in_tab_order(
second = tmp_path / "second"
first.mkdir()
second.mkdir()
- one = await registry.start(str(first), [{"agent": "claude", "name": "Alex"}])
- two = await registry.start(str(second), [{"agent": "claude", "name": "Blake"}])
+ one = await registry.start(str(first), [{"agent": "claude", "name": "T1"}])
+ two = await registry.start(str(second), [{"agent": "claude", "name": "T2"}])
saved = resume_store.load()
assert saved is not None
@@ -732,8 +732,8 @@ async def test_closing_one_of_two_leaves_both_on_offer(
second = tmp_path / "second"
first.mkdir()
second.mkdir()
- one = await registry.start(str(first), [{"agent": "claude", "name": "Alex"}])
- two = await registry.start(str(second), [{"agent": "claude", "name": "Blake"}])
+ one = await registry.start(str(first), [{"agent": "claude", "name": "T1"}])
+ two = await registry.start(str(second), [{"agent": "claude", "name": "T2"}])
await registry.end(two.id)
@@ -750,8 +750,8 @@ async def test_a_broken_snapshot_write_never_breaks_the_workspace(
raise OSError("disk full")
monkeypatch.setattr(resume_store, "save", _boom)
- workspace = await registry.start(str(tmp_path), [{"agent": "claude", "name": "Alex"}])
- assert [t.name for t in workspace.terminals] == ["Alex"]
+ workspace = await registry.start(str(tmp_path), [{"agent": "claude", "name": "T1"}])
+ assert [t.name for t in workspace.terminals] == ["T1"]
# ------------------------------------------------------------------ lookups
@@ -788,12 +788,12 @@ async def test_a_lookup_offers_the_ids_other_panes_already_hold(
monkeypatch.setattr(ide, "discover", _spy)
await registry.start(str(tmp_path), [{"agent": "codex", "name": "Cody"}])
registry.session.terminals[0].resume = None
- await registry.add_terminal(name="Dana", agent="codex")
+ await registry.add_terminal(name="T4", agent="codex")
registry.session.find("Cody").resume = ResumeHandle(
kind="codex_rollout", id="cody-conv", captured_at=1.0
)
- await registry.attach("Dana", 80, 24, _noop, _noop_exit)
+ await registry.attach("T4", 80, 24, _noop, _noop_exit)
await asyncio.sleep(0.05)
assert seen and "cody-conv" in seen[-1]
diff --git a/tests/unit/agentic_ide/test_session.py b/tests/unit/agentic_ide/test_session.py
index 93f5fb46b7..8050649266 100644
--- a/tests/unit/agentic_ide/test_session.py
+++ b/tests/unit/agentic_ide/test_session.py
@@ -96,7 +96,7 @@ async def test_start_creates_named_terminals(registry: Registry, tmp_path: Path)
session = await _open(
registry, tmp_path, [{"agent": "claude"}, {"agent": "codex"}]
)
- assert [t.name for t in session.terminals] == ["Alex", "Blake"]
+ assert [t.name for t in session.terminals] == ["T1", "T2"]
assert [t.agent for t in session.terminals] == ["claude", "codex"]
assert session.folder == str(tmp_path)
@@ -160,7 +160,7 @@ async def test_opening_the_same_folder_again_creates_another_workspace(
) -> None:
"""A workspace is a pane group, so one folder can back several of them."""
first = await _open(registry, tmp_path, [{"agent": "claude"}])
- await registry.attach("Alex", 80, 24, _noop_output, _noop_exit)
+ await registry.attach("T1", 80, 24, _noop_output, _noop_exit)
live_id = registry.session.terminals[0].pty_id
again = await _open(registry, tmp_path, [{"agent": "codex"}])
@@ -198,7 +198,7 @@ async def test_a_second_folder_opens_beside_the_first(
other = tmp_path / "second"
other.mkdir()
first = await _open(registry, tmp_path, [{"agent": "claude"}])
- await registry.attach("Alex", 80, 24, _noop_output, _noop_exit)
+ await registry.attach("T1", 80, 24, _noop_output, _noop_exit)
live_id = registry.session.terminals[0].pty_id
second = await _open(registry, other, [{"agent": "claude"}])
@@ -209,21 +209,37 @@ async def test_a_second_folder_opens_beside_the_first(
assert registry.active_id == second.id, "the new workspace comes to the front"
-async def test_call_signs_do_not_repeat_across_workspaces(
+async def test_every_workspace_numbers_its_panes_from_one(
registry: Registry, tmp_path: Path
) -> None:
- """A name addresses exactly one pane, however many workspaces are open.
+ """A position describes the grid on screen, so each tab counts from T1.
- "Tell Alex to run the tests" has to be an instruction, not a question about
- which tab was meant.
+ The repetition is the feature. Numbering the second workspace T3, T4 …
+ would keep call-signs globally unique at the cost of the one thing they
+ are for: the user reading a number off the pane in front of them.
"""
other = tmp_path / "second"
other.mkdir()
first = await _open(registry, tmp_path, [{"agent": "claude"}, {"agent": "claude"}])
second = await _open(registry, other, [{"agent": "claude"}])
- names = [t.name for t in first.terminals] + [t.name for t in second.terminals]
- assert len(set(names)) == len(names), f"call-signs collided: {names}"
+ assert [t.name for t in first.terminals] == ["T1", "T2"]
+ assert [t.name for t in second.terminals] == ["T1"]
+
+
+async def test_a_spoken_position_addresses_the_workspace_on_screen(
+ registry: Registry, tmp_path: Path
+) -> None:
+ """"T1" is whichever T1 the user is looking at — the front workspace's."""
+ other = tmp_path / "second"
+ other.mkdir()
+ await _open(registry, tmp_path, [{"agent": "claude"}])
+ second = await _open(registry, other, [{"agent": "claude"}])
+
+ found = registry.find_terminal("T1")
+ assert found is not None
+ session, _term = found
+ assert session.id == second.id, "the front workspace answers first"
async def test_switching_workspaces_leaves_every_agent_running(
@@ -374,7 +390,7 @@ async def test_attach_spawns_the_agent_in_the_chosen_folder(
registry: Registry, fake_pty: FakePtyManager, tmp_path: Path
) -> None:
await _open(registry, tmp_path, [{"agent": "claude"}])
- term = await registry.attach("Alex", 100, 30, _noop_output, _noop_exit)
+ term = await registry.attach("T1", 100, 30, _noop_output, _noop_exit)
assert term.status == "live"
spawn = fake_pty.spawns[-1]
assert spawn["cwd"] == str(tmp_path)
@@ -385,16 +401,16 @@ async def test_attach_feeds_the_transcript(
registry: Registry, fake_pty: FakePtyManager, tmp_path: Path
) -> None:
await _open(registry, tmp_path, [{"agent": "claude"}])
- await registry.attach("Alex", 80, 24, _noop_output, _noop_exit)
+ await registry.attach("T1", 80, 24, _noop_output, _noop_exit)
on_output = fake_pty.spawns[-1]["on_output"]
await on_output("pty-id", "\x1b[32mediting main.py\x1b[0m\r\n")
- assert registry.report("Alex")["transcript"] == ["editing main.py"]
+ assert registry.report("T1")["transcript"] == ["editing main.py"]
async def test_attach_by_spoken_phrase(registry: Registry, tmp_path: Path) -> None:
await _open(registry, tmp_path, [{"agent": "claude"}])
- term = await registry.attach("alex", 80, 24, _noop_output, _noop_exit)
- assert term.name == "Alex"
+ term = await registry.attach("t1", 80, 24, _noop_output, _noop_exit)
+ assert term.name == "T1"
# --------------------------------------------------------------------- prompt
@@ -404,8 +420,8 @@ async def test_prompt_types_text_then_enter_separately(
"""Text and Enter go as two writes: agent TUIs debounce a single burst as a
paste and insert a line break instead of submitting."""
await _open(registry, tmp_path, [{"agent": "claude"}])
- await registry.attach("Alex", 80, 24, _noop_output, _noop_exit)
- await registry.send_prompt("Alex", "run the tests")
+ await registry.attach("T1", 80, 24, _noop_output, _noop_exit)
+ await registry.send_prompt("T1", "run the tests")
assert fake_pty.typed == ["run the tests", "\r"]
@@ -413,8 +429,8 @@ async def test_prompt_counts_and_remembers_the_last_one(
registry: Registry, tmp_path: Path
) -> None:
await _open(registry, tmp_path, [{"agent": "claude"}])
- await registry.attach("Alex", 80, 24, _noop_output, _noop_exit)
- await registry.send_prompt("what is alex doing", "status please")
+ await registry.attach("T1", 80, 24, _noop_output, _noop_exit)
+ await registry.send_prompt("what is t1 doing", "status please")
term = registry.session.terminals[0]
assert term.prompts_sent == 1
assert term.last_prompt == "status please"
@@ -424,7 +440,7 @@ async def test_prompt_to_an_unknown_terminal_names_the_real_ones(
registry: Registry, tmp_path: Path
) -> None:
await _open(registry, tmp_path, [{"agent": "claude"}])
- with pytest.raises(SessionError, match="Alex"):
+ with pytest.raises(SessionError, match="T1"):
await registry.send_prompt("Gandalf", "hello")
@@ -435,21 +451,21 @@ async def test_prompt_is_refused_when_the_agent_is_not_running(
refused rather than typed into something else."""
await _open(registry, tmp_path, [{"agent": "claude"}])
with pytest.raises(SessionError, match="not running"):
- await registry.send_prompt("Alex", "run the tests")
+ await registry.send_prompt("T1", "run the tests")
async def test_prompt_that_sanitizes_to_nothing_is_refused(
registry: Registry, tmp_path: Path
) -> None:
await _open(registry, tmp_path, [{"agent": "claude"}])
- await registry.attach("Alex", 80, 24, _noop_output, _noop_exit)
+ await registry.attach("T1", 80, 24, _noop_output, _noop_exit)
with pytest.raises(SessionError, match="empty"):
- await registry.send_prompt("Alex", "\x03\x1b")
+ await registry.send_prompt("T1", "\x03\x1b")
async def test_prompt_without_a_session_is_refused(registry: Registry) -> None:
with pytest.raises(SessionError, match="No Agentic-IDE session"):
- await registry.send_prompt("Alex", "hello")
+ await registry.send_prompt("T1", "hello")
# ----------------------------------------------------------------- focus mode
@@ -473,8 +489,8 @@ async def test_end_closes_every_pty(
registry: Registry, fake_pty: FakePtyManager, tmp_path: Path
) -> None:
await _open(registry, tmp_path, [{"agent": "claude"}, {"agent": "codex"}])
- await registry.attach("Alex", 80, 24, _noop_output, _noop_exit)
- await registry.attach("Blake", 80, 24, _noop_output, _noop_exit)
+ await registry.attach("T1", 80, 24, _noop_output, _noop_exit)
+ await registry.attach("T2", 80, 24, _noop_output, _noop_exit)
assert await registry.end() is True
assert len(fake_pty.closed) == 2
assert registry.session is None
@@ -486,8 +502,8 @@ async def test_report_includes_status_and_folder(
registry: Registry, tmp_path: Path
) -> None:
await _open(registry, tmp_path, [{"agent": "claude"}])
- data = registry.report("Alex")
- assert data["name"] == "Alex"
+ data = registry.report("T1")
+ assert data["name"] == "T1"
assert data["folder"] == str(tmp_path)
assert data["status"] == "pending"
@@ -509,10 +525,10 @@ async def test_a_displaced_viewer_cannot_resize_the_pane_it_lost(
async def first_viewer(_text: str) -> None: ...
async def second_viewer(_text: str) -> None: ...
- await registry.attach("Alex", 80, 24, first_viewer, _noop_exit)
+ await registry.attach("T1", 80, 24, first_viewer, _noop_exit)
term = registry.session.terminals[0]
# The second window takes the pane over — the newest viewer always wins.
- await registry.attach("Alex", 200, 50, second_viewer, _noop_exit)
+ await registry.attach("T1", 200, 50, second_viewer, _noop_exit)
fake_pty.resizes.clear()
# The displaced viewer keeps measuring its own window and reporting it.
@@ -532,7 +548,7 @@ async def test_an_internal_resize_needs_no_viewer(
async def viewer(_text: str) -> None: ...
- await registry.attach("Alex", 80, 24, viewer, _noop_exit)
+ await registry.attach("T1", 80, 24, viewer, _noop_exit)
term = registry.session.terminals[0]
fake_pty.resizes.clear()
diff --git a/tests/unit/agentic_ide/test_terminal_queries.py b/tests/unit/agentic_ide/test_terminal_queries.py
index c8c652898a..fdc432a81d 100644
--- a/tests/unit/agentic_ide/test_terminal_queries.py
+++ b/tests/unit/agentic_ide/test_terminal_queries.py
@@ -48,7 +48,7 @@ async def test_a_startup_query_is_answered_into_the_pty(
registry: Registry, fake_pty: FakePtyManager, tmp_path: Path
) -> None:
await registry.start(str(tmp_path), [{"agent": "codex"}])
- term = await registry.attach("Alex", 80, 24, _noop_output, _noop_exit)
+ term = await registry.attach("T1", 80, 24, _noop_output, _noop_exit)
await fake_pty.emit(term.pty_id, STARTUP_QUERIES)
@@ -59,7 +59,7 @@ async def test_the_reply_describes_the_pane_the_viewer_is_looking_at(
registry: Registry, fake_pty: FakePtyManager, tmp_path: Path
) -> None:
await registry.start(str(tmp_path), [{"agent": "codex"}])
- term = await registry.attach("Alex", 80, 24, _noop_output, _noop_exit, appearance="light")
+ term = await registry.attach("T1", 80, 24, _noop_output, _noop_exit, appearance="light")
await fake_pty.emit(term.pty_id, "\x1b]11;?\x07")
@@ -77,7 +77,7 @@ async def test_a_replayed_screen_does_not_answer_its_own_old_queries(
corruption itself.
"""
await registry.start(str(tmp_path), [{"agent": "codex"}])
- term = await registry.attach("Alex", 80, 24, _noop_output, _noop_exit)
+ term = await registry.attach("T1", 80, 24, _noop_output, _noop_exit)
await fake_pty.emit(term.pty_id, STARTUP_QUERIES)
answered_once = list(fake_pty.typed)
@@ -86,7 +86,7 @@ async def test_a_replayed_screen_does_not_answer_its_own_old_queries(
async def _collect(text: str) -> None:
replayed.append(text)
- rejoined = await registry.attach("Alex", 80, 24, _collect, _noop_exit)
+ rejoined = await registry.attach("T1", 80, 24, _collect, _noop_exit)
assert rejoined.reattached is True
# The viewer gets the queries back (they are part of the screen)...
@@ -99,7 +99,7 @@ async def test_ordinary_agent_output_types_nothing_at_the_agent(
registry: Registry, fake_pty: FakePtyManager, tmp_path: Path
) -> None:
await registry.start(str(tmp_path), [{"agent": "codex"}])
- term = await registry.attach("Alex", 80, 24, _noop_output, _noop_exit)
+ term = await registry.attach("T1", 80, 24, _noop_output, _noop_exit)
await fake_pty.emit(term.pty_id, "\x1b[32mediting main.py\x1b[0m\r\n")
diff --git a/tests/unit/brain/test_agentic_ide_clarify_fast_path.py b/tests/unit/brain/test_agentic_ide_clarify_fast_path.py
index d705c0f995..88b7cb92e5 100644
--- a/tests/unit/brain/test_agentic_ide_clarify_fast_path.py
+++ b/tests/unit/brain/test_agentic_ide_clarify_fast_path.py
@@ -95,8 +95,29 @@ async def _noop_exit(_code: int) -> None:
return None
+#: Panes here carry CUSTOM call-signs, not the positional ones a workspace
+#: hands out by default (T1, T2, …). That is deliberate and it is the whole
+#: point of this file: a position is either said or not said, so it cannot be
+#: garbled into a near miss — while a name the user gave a pane can be, which
+#: is exactly the failure the clarification loop exists for. Testing it against
+#: T-numbers would test nothing at all.
+NAMED_PANES: tuple[str, ...] = ("Alex", "Blake", "Casey", "Dana", "Ellis")
+
+
async def _open(registry: Registry, folder: Path, count: int) -> list[str]:
- """Open ``count`` panes AND bring their agents live; return their call-signs."""
+ """Open ``count`` named panes AND bring their agents live; return the names."""
+ await registry.start(
+ folder if isinstance(folder, str) else str(folder),
+ [{"agent": "claude", "name": name} for name in NAMED_PANES[: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]
+
+
+async def _open_numbered(registry: Registry, folder: Path, count: int) -> list[str]:
+ """The same, with the call-signs a workspace assigns on its own."""
await registry.start(str(folder), [{"agent": "claude"} for _ in range(count)])
assert registry.session is not None
for term in list(registry.session.terminals):
@@ -310,3 +331,45 @@ async def test_a_single_addressee_is_never_asked_who_else(
assert reply is not None
assert not ide_clarify.WINDOW.armed
assert len(_briefs(registry)) == 1
+
+
+# ------------------------------------------------------- positional call-signs
+
+
+async def test_a_spoken_position_is_briefed_without_a_question(
+ manager: BrainManager,
+ registry: Registry,
+ tmp_path: Path,
+ _fake_composer: list[str],
+) -> None:
+ """The default call-signs cannot be garbled, so they cost no clarification.
+
+ This is what the positional scheme buys: "prompt terminal two" carries its
+ own certainty — a number is either said or it is not — so the whole
+ near-miss loop above simply never runs for it.
+ """
+ names = await _open_numbered(registry, tmp_path, 4)
+ assert names == ["T1", "T2", "T3", "T4"]
+
+ reply = await manager._run_agentic_ide_fast_path(
+ "prompt terminal two to do a deep dive on the failing tests"
+ )
+
+ assert reply is not None
+ assert "T2" in reply
+ assert not ide_clarify.WINDOW.armed, "a position is never asked back"
+ assert len(_briefs(registry)) == 1
+ assert any("deep dive" in seen for seen in _fake_composer)
+
+
+async def test_a_position_nobody_opened_briefs_no_pane(
+ manager: BrainManager, registry: Registry, tmp_path: Path
+) -> None:
+ """"T7" with four panes open is a wrong number — never the nearest one."""
+ await _open_numbered(registry, tmp_path, 4)
+
+ await manager._run_agentic_ide_fast_path(
+ "prompt T7 to do a deep dive on the failing tests"
+ )
+
+ assert _briefs(registry) == []
diff --git a/tests/unit/workspace/test_provider_parity.py b/tests/unit/workspace/test_provider_parity.py
index 01ab749aca..408f30177a 100644
--- a/tests/unit/workspace/test_provider_parity.py
+++ b/tests/unit/workspace/test_provider_parity.py
@@ -87,13 +87,14 @@ def test_no_spelling_claims_two_different_clis() -> None:
def test_no_pane_call_sign_can_shadow_a_cli_name() -> None:
- """Registry vs. the call-sign pool.
+ """Registry vs. the call-signs panes are actually handed.
Addressing a pane called "Kimi" by saying "Kimi" is a coin flip, and the
- loser gets somebody else's instruction.
+ loser gets somebody else's instruction. Positional call-signs make that
+ structurally impossible, and this pins that it stays so.
"""
reserved = names._reserved()
- assert not {n.lower() for n in names.NAME_POOL} & reserved
+ assert not {n.lower() for n in names.default_names(20)} & reserved
for name in workspace_agents.coding_agent_names():
assert name.lower() in reserved