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.

refactor(agentic-ide): refuse duplicate fleet spawns, retire the spoken deck reports

rubenluetke10-beep4bdcedd18709
diff --git a/jarvis/agentic_ide/fanout.py b/jarvis/agentic_ide/fanout.py
index 2fdd42f77c..66db1c8ddc 100644
--- a/jarvis/agentic_ide/fanout.py
+++ b/jarvis/agentic_ide/fanout.py
@@ -26,10 +26,15 @@ path (AP-9). No LLM call is made here directly — the composer owns that, and
degrades to its deterministic prompt when no provider is reachable, so a
downloader with no API key still gets every agent briefed (§3).
"""
+
from __future__ import annotations
import asyncio
+import difflib
import logging
+import re
+import time
+from collections import deque
from collections.abc import Awaitable, Callable, Mapping, Sequence
from dataclasses import dataclass
from typing import Any
@@ -43,6 +48,106 @@ log = logging.getLogger(__name__)
#: (3-8 panes) in a single wave while staying polite.
DEFAULT_CONCURRENCY = 5
+#: How long one fleet order shadows a repeat of itself. The live 2026-08-11
+#: 16:38 double-spawn arrived 37 s after the original order; ten minutes covers
+#: the window in which the first fleet is still visibly working on it while
+#: staying short enough that a genuine "run it again" later the same day works
+#: without ceremony.
+DUPLICATE_WINDOW_S = 600.0
+
+#: Orders shorter than this never count as duplicates. Fleet-wide steering
+#: strokes ("continue", "run the tests again") repeat legitimately within
+#: minutes; a real task brief is always longer than this.
+DUPLICATE_MIN_CHARS = 40
+
+#: How similar two instructions must be to count as the same order. The router
+#: brain re-dictating an order rarely reproduces it byte-for-byte (the live
+#: duplicate differed by one corrected typo), so equality is the wrong test —
+#: and 0.9 is far above what two genuinely different tasks reach.
+DUPLICATE_SIMILARITY = 0.9
+
+
+@dataclass(frozen=True, slots=True)
+class RecentFanOut:
+ """One fleet order a workspace has already accepted, for duplicate checks."""
+
+ workspace_id: str
+ instruction: str
+ terminals: tuple[str, ...]
+ at: float
+ """``time.monotonic()`` when the delivery STARTED — not when it finished.
+
+ Composition runs 10-30 s per pane, and the live duplicate arrived while the
+ first fleet was still composing; a record written only on completion would
+ have missed exactly the case this exists for."""
+
+
+_RECENT_FANOUTS: deque[RecentFanOut] = deque(maxlen=8)
+
+
+def _normalized(text: str) -> str:
+ return re.sub(r"\s+", " ", str(text or "").strip().casefold())
+
+
+def record_fanout(
+ session: Any, instruction: str, terminals: Sequence[str], *, now: float | None = None
+) -> None:
+ """Remember that this workspace just accepted a fleet order.
+
+ Called at the START of a delivery so a duplicate arriving mid-composition
+ is already visible to :func:`find_duplicate_fanout`.
+ """
+ workspace_id = str(getattr(session, "id", "") or "")
+ text = _normalized(instruction)
+ if not workspace_id or len(text) < DUPLICATE_MIN_CHARS:
+ return
+ _RECENT_FANOUTS.append(
+ RecentFanOut(
+ workspace_id=workspace_id,
+ instruction=instruction,
+ terminals=tuple(terminals),
+ at=time.monotonic() if now is None else now,
+ )
+ )
+
+
+def find_duplicate_fanout(
+ session: Any, instruction: str, *, now: float | None = None
+) -> RecentFanOut | None:
+ """The recent fleet order this one repeats, or ``None``.
+
+ A match needs the same workspace, a fresh-enough record, an essentially
+ identical instruction, and at least one of the originally addressed panes
+ still open — panes that are gone make a re-run legitimate, not a duplicate.
+ The returned record's ``terminals`` are narrowed to the panes still alive,
+ so the caller can name who is already working on it.
+ """
+ workspace_id = str(getattr(session, "id", "") or "")
+ text = _normalized(instruction)
+ if not workspace_id or len(text) < DUPLICATE_MIN_CHARS:
+ return None
+ moment = time.monotonic() if now is None else now
+ for record in reversed(_RECENT_FANOUTS):
+ if record.workspace_id != workspace_id:
+ continue
+ if moment - record.at > DUPLICATE_WINDOW_S:
+ continue
+ earlier = _normalized(record.instruction)
+ if len(earlier) < DUPLICATE_MIN_CHARS:
+ continue
+ if difflib.SequenceMatcher(None, earlier, text).ratio() < DUPLICATE_SIMILARITY:
+ continue
+ alive = tuple(name for name in record.terminals if session.find(name) is not None)
+ if not alive:
+ continue
+ return RecentFanOut(
+ workspace_id=record.workspace_id,
+ instruction=record.instruction,
+ terminals=alive,
+ at=record.at,
+ )
+ return None
+
@dataclass(frozen=True, slots=True)
class Delivery:
@@ -139,18 +244,12 @@ async def _reserve_prompt_attachments(term: Any) -> tuple[tuple[Any, ...], tuple
for batch in term.pending_prompt_attachment_batches
if batch.batch_id not in term.pending_prompt_attachment_reservations
)
- term.pending_prompt_attachment_reservations.update(
- batch.batch_id for batch in batches
- )
- attachments = tuple(
- attachment for batch in batches for attachment in batch.attachments
- )
+ term.pending_prompt_attachment_reservations.update(batch.batch_id for batch in batches)
+ attachments = tuple(attachment for batch in batches for attachment in batch.attachments)
return batches, attachments
-async def _finish_prompt_attachments(
- term: Any, batches: Sequence[Any], *, consume: bool
-) -> None:
+async def _finish_prompt_attachments(term: Any, batches: Sequence[Any], *, consume: bool) -> None:
"""Commit or release reservations without touching later drops."""
if not batches:
return
@@ -171,9 +270,7 @@ async def _finish_prompt_attachments_shielded(
"""Settle a reservation even when its delivery task is being cancelled."""
if not batches:
return
- cleanup = asyncio.create_task(
- _finish_prompt_attachments(term, batches, consume=consume)
- )
+ cleanup = asyncio.create_task(_finish_prompt_attachments(term, batches, consume=consume))
try:
await asyncio.shield(cleanup)
except asyncio.CancelledError:
@@ -239,8 +336,7 @@ def note_detached_delivery(work: asyncio.Future[Any], *, describe: str) -> None:
_DETACHED_DELIVERIES.discard(task)
if task.cancelled():
log.warning(
- "Agentic IDE (detached): %s was cancelled before it finished — "
- "nothing was typed",
+ "Agentic IDE (detached): %s was cancelled before it finished — nothing was typed",
describe,
)
return
@@ -318,6 +414,11 @@ async def deliver(
if not wanted:
return FanOutResult()
+ # Registered before composing, not after: the whole delivery runs 10-30 s
+ # per pane, and the one duplicate that actually happened (2026-08-11 16:38)
+ # arrived inside that window.
+ record_fanout(session, instruction or utterance, wanted)
+
compose_fn = compose or _default_compose
send_fn = send or _default_send
gate = asyncio.Semaphore(max(1, int(limit)))
@@ -384,9 +485,7 @@ async def deliver(
# Reserve after acquiring the concurrency slot so cancellation
# while waiting cannot leave an invisible batch stuck as reserved.
if include_pending_attachments:
- pending_batches, pending_attachments = (
- await _reserve_prompt_attachments(term)
- )
+ pending_batches, pending_attachments = await _reserve_prompt_attachments(term)
try:
from .session import AGENT_DISPLAY
@@ -400,16 +499,13 @@ async def deliver(
attachments=pending_attachments,
)
except asyncio.CancelledError:
- await _finish_prompt_attachments_shielded(
- term, pending_batches, consume=False
- )
+ await _finish_prompt_attachments_shielded(term, pending_batches, consume=False)
raise
except Exception as exc: # noqa: BLE001 - one pane must not sink the fleet
- await _finish_prompt_attachments_shielded(
- term, pending_batches, consume=False
- )
+ await _finish_prompt_attachments_shielded(term, pending_batches, consume=False)
log.warning(
- "Agentic IDE fan-out: composing for %s failed", term.name,
+ "Agentic IDE fan-out: composing for %s failed",
+ term.name,
exc_info=True,
)
return Delivery(
@@ -421,9 +517,7 @@ async def deliver(
text = getattr(composed, "text", "") or ""
if not text.strip():
- await _finish_prompt_attachments_shielded(
- term, pending_batches, consume=False
- )
+ await _finish_prompt_attachments_shielded(term, pending_batches, consume=False)
# An empty prompt would submit a bare Enter into the agent, which
# reads as "the user pressed return" and can re-run its last task.
return Delivery(
@@ -436,14 +530,10 @@ async def deliver(
try:
sent = await send_fn(term.name, text)
except asyncio.CancelledError:
- await _finish_prompt_attachments_shielded(
- term, pending_batches, consume=False
- )
+ await _finish_prompt_attachments_shielded(term, pending_batches, consume=False)
raise
except Exception as exc: # noqa: BLE001 - report, never propagate
- await _finish_prompt_attachments_shielded(
- term, pending_batches, consume=False
- )
+ await _finish_prompt_attachments_shielded(term, pending_batches, consume=False)
log.info("Agentic IDE fan-out: could not send to %s: %s", term.name, exc)
return Delivery(
terminal=term.name,
@@ -452,9 +542,7 @@ async def deliver(
reason=f"it did not accept the prompt ({exc})",
)
- await _finish_prompt_attachments_shielded(
- term, pending_batches, consume=True
- )
+ await _finish_prompt_attachments_shielded(term, pending_batches, consume=True)
# The sender reports whether the agent actually STARTED. A sender that
# says nothing leaves it None (unknown) rather than claiming success —
@@ -488,9 +576,7 @@ async def deliver(
# ends the CONVERSATION — the spoken verdict is dropped — but the
# briefs still land; the receipt (`last_prompt_at`) stays the proof.
_DETACHED_DELIVERIES.add(work)
- work.add_done_callback(
- lambda task, names=tuple(wanted): _finish_detached(task, names)
- )
+ work.add_done_callback(lambda task, names=tuple(wanted): _finish_detached(task, names))
log.warning(
"Agentic IDE fan-out: caller cancelled mid-delivery — finishing "
"the briefs for %s detached",
@@ -522,4 +608,15 @@ async def deliver(
return out
-__all__ = ["DEFAULT_CONCURRENCY", "Delivery", "FanOutResult", "deliver"]
+__all__ = [
+ "DEFAULT_CONCURRENCY",
+ "DUPLICATE_MIN_CHARS",
+ "DUPLICATE_SIMILARITY",
+ "DUPLICATE_WINDOW_S",
+ "Delivery",
+ "FanOutResult",
+ "RecentFanOut",
+ "deliver",
+ "find_duplicate_fanout",
+ "record_fanout",
+]
diff --git a/jarvis/agentic_ide/fleet_actions.py b/jarvis/agentic_ide/fleet_actions.py
index 43f7fbad9c..72e62b9004 100644
--- a/jarvis/agentic_ide/fleet_actions.py
+++ b/jarvis/agentic_ide/fleet_actions.py
@@ -134,53 +134,10 @@ def terminals_closed_event(
)
-def free_agents(session: Any, *, now: float | None = None) -> list[Any]:
- """Panes that could take a job right now, in the order they should get one.
-
- "Somebody get the wake-path tests green" has to land somewhere, and the
- Command Deck is where the user stops naming a pane for every order. This is
- what turns that into a specific terminal.
-
- Four things disqualify a pane, and each one is a promise that would
- otherwise be broken:
-
- * **It is not an agent.** A plain shell would run the sentence as a command.
- * **It is working.** Typing a second job into a busy agent does not queue
- it — the CLI takes it as an interruption of the first.
- * **The user took it over** (``deck_hold``). That is the whole point of the
- hold: Jarvis stops using this one.
- * **It is not alive.** A pane whose agent exited cannot be briefed, and
- telling the user it was is the lie this surface cannot afford.
-
- Ordered oldest-idle first so a fleet is used evenly rather than the same
- pane taking every order while the rest sit there — with the pane's own
- position as the tiebreak, so an answer is stable when nothing has run yet.
- """
- from .activity import observed
- from .session import accepts_prompts
-
- moment = time.time() if now is None else now
- free: list[tuple[float, int, Any]] = []
- for term in getattr(session, "terminals", []):
- if not accepts_prompts(str(getattr(term, "agent", "") or "")):
- continue
- if bool(getattr(term, "deck_hold", False)):
- continue
- if str(getattr(term, "status", "")) != "live":
- continue
- reading = observed(term, now=moment)
- if reading.activity != "waiting":
- continue
- free.append((float(reading.since or 0.0), int(getattr(term, "index", 0)), term))
- free.sort(key=lambda item: (item[0], item[1]))
- return [term for _since, _index, term in free]
-
-
__all__ = [
"READY_POLL_S",
"READY_TIMEOUT_S",
"close_agent_terminals",
- "free_agents",
"ready_for_prompt",
"terminals_closed_event",
"wait_for_prompt_ready",
diff --git a/jarvis/agentic_ide/intent.py b/jarvis/agentic_ide/intent.py
index ba60904d48..046dc3437e 100644
--- a/jarvis/agentic_ide/intent.py
+++ b/jarvis/agentic_ide/intent.py
@@ -2655,85 +2655,6 @@ def owns_turn(user_text: str, *, names: list[str] | None = None) -> bool:
return names is None and detect_visible(text) is not None
-# --------------------------------------------------------------------------- #
-# Work with nobody's name on it #
-# --------------------------------------------------------------------------- #
-# Everything above answers "which pane is this turn about". The Command Deck
-# asks a different question: the user there is a team lead who has stopped
-# naming a pane per order, and "somebody get the wake-path tests green" has to
-# land on an agent rather than on the floor.
-#
-# This is deliberately NOT wired into ``detect``: outside the deck an
-# unaddressed sentence must keep meaning what it has always meant, or every
-# open workspace would start swallowing ordinary conversation. The deck's fast
-# path asks for it by name, and only after ``detect_all`` has come back empty.
-#
-# The bar is set high on purpose, because the failure is expensive in one
-# direction only. A false negative costs one clearer sentence. A false positive
-# types "what time is it" into a coding agent as a task, and the user finds out
-# minutes later.
-
-#: Turns that ASK rather than instruct. A question about the workspace is
-#: answered by the normal path with the focus-context block; handing it to an
-#: agent as a job is the single worst thing this detector could do.
-_ASKS_RE = re.compile(
- r"^\s*(?:"
- r"what|which|who|when|where|why|how|is|are|do|does|did|can|could|would|"
- r"should|will|has|have|"
- r"was|welche\w*|wer|wann|wo|warum|wieso|wie|" # i18n-allow: input vocab
- r"ist|sind|kann|k[oö]nn\w*|" # i18n-allow: input vocab
- r"h[aä]st|hat|haben|soll\w*|w[uü]rde\w*|" # i18n-allow: input vocab
- r"qu[eé]|cu[aá]l\w*|qui[eé]n|cu[aá]ndo|d[oó]nde|" # i18n-allow: input vocab
- r"por\s+qu[eé]|c[oó]mo|es|son|puede\w*|deber[ií]a\w*" # i18n-allow: input vocab
- r")\b",
- re.IGNORECASE,
-)
-
-
-def unaddressed_work(user_text: str, *, names: list[str] | None = None) -> str | None:
- """The job in a turn that names no pane, or ``None`` if it is not one.
-
- Answers only for the Command Deck (see the note above). The caller is
- expected to have established three things already, because each is somebody
- else's rule and a second copy here would drift from it:
-
- 1. no pane is addressed (``detect_all`` came back empty);
- 2. the turn does not name a spawn vehicle
- (``spawn_vehicle_outranks_workspace``);
- 3. the workspace is actually being read as a deck.
-
- What is left to decide is whether this sentence is WORK. Four ways it is
- not, in the order they are cheapest to rule out.
- """
- text = (user_text or "").strip()
- if not text:
- return None
- # A question is answered, never delegated. Checked before anything else
- # because "how do I fix the wake path" contains a perfectly good
- # instruction verb and is not an instruction at all.
- if _ASKS_RE.match(text) or text.rstrip().endswith("?"):
- return None
- # Talk about the world rather than the workspace — the same guard the
- # collective address uses, so the two cannot disagree about what "everyone"
- # means in a sentence about people.
- if _is_outside_world_talk(text):
- return None
- # Asking what the agents are DOING is a status question even without a
- # question mark ("status on the tests"), and the deck answers those from
- # the panes rather than by starting more work.
- if _VISIBLE_REPORT_RE.match(text):
- return None
- if not _looks_like_instruction(text):
- return None
- # A pane WAS named, just not in an addressing shape ("Mika die Tests"). The
- # caller's detector stood down for a reason, and quietly re-routing the
- # order to whichever agent happens to be free would send it to the wrong
- # one — with the right one's name still in the sentence.
- if names and _mentions(text, list(names)):
- return None
- return text
-
-
__all__ = [
"KIND_PROMPT",
"KIND_REPORT",
@@ -2753,6 +2674,5 @@ __all__ = [
"spawn_includes_task",
"spawn_instruction",
"spawn_vehicle_outranks_workspace",
- "unaddressed_work",
"wants_split",
]
diff --git a/jarvis/agentic_ide/notifications.py b/jarvis/agentic_ide/notifications.py
index 2c4cee46ce..2beb7439ff 100644
--- a/jarvis/agentic_ide/notifications.py
+++ b/jarvis/agentic_ide/notifications.py
@@ -94,7 +94,6 @@ from typing import TYPE_CHECKING, Any, Literal, NamedTuple
from loguru import logger
-from . import standup
from .activity import (
RESIZE_SHADOW_S,
STILL_S,
@@ -867,17 +866,9 @@ async def _run(registry: Registry) -> None:
# Resume evidence is independent of the optional bell. Even
# with notifications disabled, restored panes must not be
# offered a blind Continue merely because history exists.
- filed = _WATCHER.poll(registry, emit=await _enabled_off_loop())
+ _WATCHER.poll(registry, emit=await _enabled_off_loop())
if _WATCHER.take_resume_dirty():
await registry.persist_resume_activity()
- # The Command Deck speaks what the bell only counts. It hangs
- # off this sweep rather than polling for itself: the panes are
- # already being looked at every two seconds, and a second loop
- # asking the same question would be pure cost on the event loop
- # that also carries the wake microphone (AP-9). It is a no-op
- # unless a workspace is actually being read as a deck, and it
- # never raises — see `standup.pump`.
- await standup.pump(registry, filed)
except Exception as exc: # noqa: BLE001 - one bad pane must not end the sweep
logger.warning("Agentic IDE: pane notification sweep failed: {}", exc)
except asyncio.CancelledError: # pragma: no cover - shutdown
diff --git a/jarvis/agentic_ide/session.py b/jarvis/agentic_ide/session.py
index 214026b294..58f168cf9e 100644
--- a/jarvis/agentic_ide/session.py
+++ b/jarvis/agentic_ide/session.py
@@ -99,7 +99,6 @@ from .terminal_input import (
from .transcript import ReplayBuffer, Transcript
from .workspace_view import (
VIEW_CHAT,
- VIEW_DECK,
VIEW_GRID,
coerce_view,
)
@@ -213,41 +212,55 @@ def _unavailable(agent: str) -> str:
# Nobody reaches 100 deliberately; anyone who mistypes their way past it gets a
# sentence instead of a frozen desktop.
MAX_TERMINALS = 100
+# How deep a wizard-opened column is filled before the next one is started.
+#
+# The workspace is exactly one screenful, so its columns share the window's
+# width: one row of columns — what this used to be — spends the whole window on
+# a single line, and the sixth terminal then left every pane about 410 px wide
+# on the maintainer's own display. A pane narrower than its agent's minimum
+# grid (see MIN_VIEWER_COLS) is clipped at the tile edge, which is how six panes
+# each came to show two thirds of themselves and read as overlapping one
+# another (reported 2026-08-11).
+#
+# Two deep halves the column count and so doubles every pane's width, which is
+# the axis the clipping is on. Only the OPENING shape: the user's own splits,
+# drags and closes rearrange the workspace freely afterwards, and no count is
+# refused or quietly reshaped — thirty columns is theirs to build.
+#
+# Mirrored by `WIZARD_COLUMN_HEIGHT` in the frontend's layout module, which
+# draws the preview. The two must agree or the workspace that opens is not the
+# one the wizard showed.
+WIZARD_COLUMN_HEIGHT = 2
# How long a pane's call-sign may be. Half the workspace tab's 80, and for a
# different reason: a workspace name is read, a call-sign is SAID — it is how a
# user addresses one agent among several out loud, and it also has to fit in a
# pane header that may be a quarter of a screen wide. Long enough for "Frontend
# rewrite", short enough that it stays a name rather than a description.
MAX_TERMINAL_NAME = 40
-# The narrowest geometry the shared PTY may be asked to work in.
-#
-# A floor on what a coding CLI can still lay its interface out in — NOT a
-# plausibility check on the viewer's measurement, which is the question these
-# floors used to answer at 8x2 and the reason they never fired. A grid of a
-# dozen panes measures 17 columns per cell entirely correctly, clears a floor
-# of 8, and squeezes the agent into a strip it cannot draw in.
+# The narrowest geometry the shared PTY may be asked to work in — a CRASH
+# GUARD, not an opinion about what a coding CLI deserves.
#
-# Measured on the maintainer's own workspace (2026-08-09, thirteen panes): one
-# pane had printed its whole answer ONE CHARACTER PER LINE, and six more had
-# simply stopped drawing — a Claude Code holding "Discombobulating…" on screen,
-# its process visibly burning CPU, with not one byte reaching the app for five
-# minutes. Their last outputs shared a millisecond, which is a single layout
-# change squeezing every pane at once rather than agents falling quiet.
+# The rule it serves is the viewer's (see MIN_REAL_COLS in
+# ``AgenticTerminal.tsx``): a terminal is exactly as wide as the tile showing
+# it, and every character in that tile is visible. The agent is therefore told
+# what the tile MEASURES, and this only refuses a measurement that cannot be
+# real — a tile mid-layout reports 0, a hidden one reports nothing, and a PTY
+# resized to zero columns permanently wrecks the agent's drawing.
#
-# That silence is also what made the status badge lie. The badge reads whether
-# a pane's screen MOVES (:mod:`.activity`), so an agent squeezed out of drawing
-# reads as one that finished — the "working panes shown as done" reported over
-# and over. The detector was honest; this floor is what gives it something
-# honest to read.
+# It used to be 60x15, and it used to mean something else: the width below
+# which both installed CLIs stop rendering a usable frame. Enforcing that here
+# did keep the agents alive — measured on 2026-08-09, thirteen panes, where a
+# squeezed workspace left one pane printing ONE CHARACTER PER LINE and six
+# others silently stuck — but it paid for it by drawing every narrow pane wider
+# than the window showing it, which the maintainer read as terminals shoved
+# behind one another (2026-08-11). The comfort question moved to where it can
+# be answered honestly: the launcher warns from twenty terminals up and opens
+# as many as the user confirms.
#
-# 60x15 is where both installed coding CLIs still render a usable frame, under
-# the 80x24 a viewer already falls back to before it has measured anything.
-# Sizes below are REFUSED rather than clamped: the PTY keeps its last honest
-# geometry and the narrow viewer shows as much of it as fits, which costs a
-# clipped line and keeps the agent alive. Clamping would instead hand the agent
-# a geometry no window is showing.
-MIN_VIEWER_COLS = 60
-MIN_VIEWER_ROWS = 15
+# Below the floor a size is REFUSED rather than clamped — the PTY keeps its
+# last real geometry rather than being handed one no window is showing.
+MIN_VIEWER_COLS = 10
+MIN_VIEWER_ROWS = 4
# Where a pane may land when it is dragged onto another one, in the same two
# axes the grid is built from (columns of stacked panes). "swap" is listed first
# because it is the one a user reaches for most: two panes are the wrong way
@@ -1115,21 +1128,6 @@ class Terminal:
# every cold start behind the slowest one.
attach_lock: asyncio.Lock = field(default_factory=asyncio.Lock, repr=False, compare=False)
- # "I'll take this one" — the Command Deck's per-pane hold.
- #
- # The deck's whole promise is that Jarvis runs the floor, and the honest
- # limit on that promise is a pane the user has decided to drive themselves:
- # a permission prompt to answer, a password, a question only they can settle.
- # While this is on, the deck neither assigns work to the pane nor reports it
- # — both would be talking over somebody who is already there.
- #
- # Ephemeral and per pane rather than a workspace mode: the interesting case
- # is one agent out of eight, and the other seven should carry on. It is not
- # persisted for the same reason `surface_view` is not — a restart lands the
- # user back in the ordinary state rather than in a hold they set an hour ago
- # and have long forgotten.
- deck_hold: bool = False
-
def to_dict(self) -> dict[str, Any]:
# Read the replayed screen ONCE. `lines()` walks the whole scrollback,
# and both the line count below and the recap want it — asking twice per
@@ -1155,9 +1153,6 @@ class Terminal:
# the voice path both have to know, or they would offer a target
# that refuses every instruction sent to it.
"accepts_prompts": accepts_prompts(self.agent),
- # Has the user taken this pane over in the Command Deck? Reported
- # so the card can show it and the deck can leave the pane alone.
- "deck_hold": self.deck_hold,
"index": self.index,
"column": self.column,
"slot": self.slot,
@@ -1274,10 +1269,10 @@ class Session:
# reported by the mounted frontend and deliberately excluded from resume
# snapshots: after a restart the UI reports what it actually shows again.
#
- # Which of the three reading modes is on screen — see
- # ``agentic_ide.workspace_view``. It replaced a ``chat_view`` boolean once a
- # third mode existed, and it is read for more than deixis now: the Command
- # Deck is the one surface allowed to speak a finished pane out loud.
+ # Which reading mode is on screen — see ``agentic_ide.workspace_view``. It
+ # travels as a name rather than the ``chat_view`` boolean it replaced, so a
+ # further mode reads correctly here without re-deriving what "not chat" was
+ # supposed to mean.
surface_view: str = VIEW_GRID
surface_terminal: str = ""
# The written prompt bar and the voice orb share one explicit pane target.
@@ -1329,12 +1324,11 @@ class Session:
def contextual_terminal(self) -> Terminal | None:
"""The one pane the visible surface puts in front of the user.
- Two of the three views can answer this. Chat view stages exactly one
- pane; the Command Deck stages one whenever a card has been unfolded to
- read its terminal. The grid never answers — a dozen panes are visible
- there, and picking one of them would be a guess dressed as a fact.
+ Chat view stages exactly one pane and can answer. The grid never
+ does — a dozen panes are visible there, and picking one of them would
+ be a guess dressed as a fact.
"""
- if self.surface_view not in (VIEW_CHAT, VIEW_DECK):
+ if self.surface_view != VIEW_CHAT:
return None
if not self.surface_terminal:
return None
@@ -1342,7 +1336,7 @@ class Session:
def stages_one_pane(self) -> bool:
"""Does the visible view show a single pane, rather than the wall?"""
- return self.surface_view in (VIEW_CHAT, VIEW_DECK)
+ return self.surface_view == VIEW_CHAT
def prompt_target_terminal(self) -> Terminal | None:
"""The pane selected by the visible prompt bar and voice orb."""
@@ -1802,9 +1796,12 @@ class Registry:
agent=agent,
display_name=agent_display(agent),
index=index,
- # A wizard-opened workspace is one row of columns; the
- # user's own "split down" is what creates a stack.
- column=index,
+ # Columns of WIZARD_COLUMN_HEIGHT, filled top to bottom
+ # before the next one opens — the same arithmetic the
+ # preview draws with (frontend `layout.ts`), so the
+ # workspace that appears is the one that was shown.
+ column=index // WIZARD_COLUMN_HEIGHT,
+ slot=index % WIZARD_COLUMN_HEIGHT,
account=resolve_account(agent, _requested_account(entry)),
)
)
@@ -2378,30 +2375,6 @@ class Registry:
logger.info("Agentic IDE focus mode {}", "on" if enabled else "off")
return session.focus_mode
- def set_deck_hold(self, name: str, held: bool, *, workspace_id: str | None = None) -> bool:
- """"I'll take this one" — stop the Command Deck using this pane.
-
- While held, the deck neither assigns work to the pane nor reports it,
- and the pane's own editor is unlocked in the UI. Everything else about
- the pane is unchanged: it keeps running, keeps its recap, keeps its
- place, and the bell still counts it like every other pane.
-
- Raises for a pane that is not there rather than answering False — the
- two outcomes are "it is now held" and "it is now not", and a silent
- no-op for a mistyped call-sign looks exactly like the first.
- """
- located = self._locate(name, workspace_id)
- if located is None:
- raise SessionError(f"No terminal called '{name}'.")
- _session, term = located
- term.deck_hold = bool(held)
- logger.info(
- "Agentic IDE: {} {} by the user in the Command Deck",
- term.name,
- "taken over" if term.deck_hold else "handed back",
- )
- return term.deck_hold
-
def set_surface_context(
self,
*,
@@ -2418,9 +2391,9 @@ class Registry:
selections clear the default rather than leaving a believable old one.
An off-screen section reports the grid regardless of what it was last
- showing. That is not cosmetic: the deck speaks finished panes out loud,
- and a section the user navigated away from must not keep talking from
- behind whatever they are looking at now.
+ showing. That is not cosmetic: a section the user navigated away from
+ must not keep answering "this terminal" with a pane that is behind
+ whatever they are looking at now.
"""
session = self.session
if session is None or session.id != workspace_id:
@@ -3884,6 +3857,61 @@ class Registry:
)
return moved
+ async def refold(self, depth: int) -> Session:
+ """Re-deal every pane into columns ``depth`` deep, in reading order.
+
+ The workspace is exactly one screenful and never scrolls, so a pane can
+ only be given room that is taken from somewhere else. When the panes are
+ too NARROW — the width a coding agent needs for its interface is a hard
+ floor, ``MIN_REAL_COLS`` in the frontend's terminal — the only room left
+ to spend is height, and folding the row is how it is spent: half as many
+ columns are twice as wide. Six panes in a row at the maintainer's text
+ size were ~410 px each where ~660 was needed, so every terminal drew a
+ third of itself past its own tile edge (reported 2026-08-11, and read as
+ the panes overlapping one another).
+
+ Deliberately a whole-workspace operation rather than a run of
+ ``move_terminal`` calls. Six moves are six persists and six pushes to
+ every viewer, and each intermediate shape is a real arrangement the
+ panes would refit to — the grid would visibly thrash through five wrong
+ layouts on the way to the right one, and an interruption anywhere in
+ that run leaves the workspace in one of them for good.
+
+ Reading order is the order ``_renumber`` already keeps the list in (left
+ to right, top to bottom), so folding preserves what the user sees as the
+ sequence of their panes. Re-folding to the depth a workspace already has
+ changes nothing and is not an error: it is what the grid asks for on
+ every measurement once the shape is right, and answering it with the
+ unchanged session is what lets the caller stop.
+
+ No agent is started or stopped, no PTY is resized here and no pane is
+ remounted — only the two numbers that say where a pane is drawn. That is
+ what makes re-folding safe to do on the app's own initiative at all.
+ """
+ async with self._lock:
+ session = self.session
+ if session is None:
+ raise SessionError("No Agentic-IDE session is running.")
+ if depth < 1:
+ raise SessionError("Column depth must be at least 1.")
+ # A depth past the pane count is the same shape as one column, and
+ # accepting it rather than refusing keeps the caller from having to
+ # clamp: the grid asks with a number it derived from a measurement.
+ depth = min(depth, max(1, len(session.terminals)))
+
+ for index, term in enumerate(session.terminals):
+ term.column = index // depth
+ term.slot = index % depth
+
+ self._renumber(session)
+ await self._persist()
+ logger.info(
+ "Agentic IDE: re-folded {} panes into columns of {}",
+ len(session.terminals),
+ depth,
+ )
+ return session
+
async def rename_terminal(self, wanted: str, name: str) -> tuple[Session, Terminal]:
"""Give one pane a new call-sign, without touching what runs in it.
diff --git a/jarvis/agentic_ide/workspace_view.py b/jarvis/agentic_ide/workspace_view.py
index cd3f639462..d00ac8457d 100644
--- a/jarvis/agentic_ide/workspace_view.py
+++ b/jarvis/agentic_ide/workspace_view.py
@@ -1,16 +1,10 @@
"""Which way the user is reading the open workspace right now.
-The Agentic IDE renders one set of panes three different ways, and the backend
-has to know which one is on screen — not for looks, but because two behaviours
-depend on it:
-
-* **Deictic reference.** "This terminal" is only answerable when exactly one
- pane fills the screen. Chat view puts one there; the grid puts a dozen, and
- guessing among them is less honest than asking for a call-sign.
-* **Speaking unasked.** The Command Deck is the one surface where Jarvis
- reports finished work out loud (see :mod:`.standup`). In the other two the
- same events reach the header bell and stay silent, which is what they have
- always done.
+The Agentic IDE renders one set of panes two different ways, and the backend
+has to know which one is on screen — not for looks, but because deictic
+reference depends on it: "this terminal" is only answerable when exactly one
+pane fills the screen. Chat view puts one there; the grid puts a dozen, and
+guessing among them is less honest than asking for a call-sign.
This module is layer 0 of the five-layer enum pattern
(``docs/anti-drift-three-layer.md``). The value crosses from this package into
@@ -31,17 +25,15 @@ from __future__ import annotations
VIEW_GRID = "grid"
#: One pane on a calm stage, the rest on a rail, read like a conversation.
VIEW_CHAT = "chat"
-#: The Command Deck: the orb is the subject, Jarvis briefs and reports back.
-VIEW_DECK = "deck"
#: Every value the contract allows, in the order the toolbar offers them.
-WORKSPACE_VIEWS: tuple[str, ...] = (VIEW_GRID, VIEW_CHAT, VIEW_DECK)
+WORKSPACE_VIEWS: tuple[str, ...] = (VIEW_GRID, VIEW_CHAT)
#: What an unreadable or absent value falls back to.
#:
#: The grid, deliberately: it is the view that promises the least. A surface
-#: report that arrives garbled must not be able to switch a workspace INTO the
-#: deck, because the deck is the one that starts talking on its own.
+#: report that arrives garbled must not be able to switch a workspace into a
+#: mode that answers "this terminal" with a pane the user is not looking at.
VIEW_DEFAULT = VIEW_GRID
@@ -62,7 +54,6 @@ def view_from_legacy_chat_flag(chat_view: object) -> str:
The desktop shell is an embedded WebView holding a bundle that reloads
itself, so for a few seconds after an update a window can still be posting
the old ``chat_view: true|false`` body. Those two values map cleanly onto
- two of the three views, and an old client can never mean the third — it
- does not know the deck exists.
+ the two views.
"""
return VIEW_CHAT if bool(chat_view) else VIEW_GRID
diff --git a/jarvis/commands/registry.py b/jarvis/commands/registry.py
index 3d52d79af7..59c79cc1d6 100644
--- a/jarvis/commands/registry.py
+++ b/jarvis/commands/registry.py
@@ -1003,7 +1003,10 @@ def _build_registry() -> tuple[AppCommand, ...]:
"to be DIVIDED between the agents. "
"CHECK THE REPLY: 'delivered' names the agents that really got "
"the task and 'undelivered' those that did not — report both, "
- "and use the call-signs the reply gives you."
+ "and use the call-signs the reply gives you. A spawn repeating "
+ "an instruction that recently went to panes still open is "
+ "refused as a duplicate; the refusal names who is already on "
+ "it — tell the user that fleet is working, do not retry."
),
method="POST",
path="/api/agentic-ide/fanout",
@@ -1058,6 +1061,18 @@ def _build_registry() -> tuple[AppCommand, ...]:
"brief."
),
},
+ "force": {
+ "type": "boolean",
+ "default": False,
+ "description": (
+ "Leave this out. A spawn whose instruction recently "
+ "went to panes that are still open is refused as a "
+ "duplicate, and the refusal names the panes already "
+ "working on it — report those instead of retrying. "
+ "Set true ONLY when the user explicitly asked to run "
+ "the same task again on a fresh fleet."
+ ),
+ },
},
"required": ["instruction"],
},
diff --git a/jarvis/ui/web/agentic_ide_routes.py b/jarvis/ui/web/agentic_ide_routes.py
index 685a4d344a..41f5fa644e 100644
--- a/jarvis/ui/web/agentic_ide_routes.py
+++ b/jarvis/ui/web/agentic_ide_routes.py
@@ -57,6 +57,7 @@ import asyncio
import logging
import mimetypes
import re
+import time
from dataclasses import asdict
from pathlib import Path
from typing import Literal, get_args
@@ -86,7 +87,6 @@ from jarvis.agentic_ide import (
recap_engine,
recents,
resume_store,
- standup,
)
from jarvis.agentic_ide.activity import has_work_behind_it
from jarvis.agentic_ide.agent_sessions import has_conversation
@@ -296,6 +296,20 @@ class MoveTerminalRequest(BaseModel):
)
+class RefoldRequest(BaseModel):
+ """How deep the workspace's columns should be from now on."""
+
+ depth: int = Field(
+ ge=1,
+ le=MAX_TERMINALS,
+ description=(
+ "Panes stacked per column. 1 is the single row a workspace opens "
+ "in; 2 folds it into two rows, which is what a row too narrow for "
+ "the agents' own interface needs."
+ ),
+ )
+
+
class CloseTerminalsRequest(BaseModel):
"""The terminal panes one destructive batch action should stop."""
@@ -317,7 +331,7 @@ class ModeRequest(BaseModel):
#: again here and the assertion below makes that duplication safe: any drift
#: from layer 0 fails at import, which means pytest collection fails, rather
#: than producing an HTTP 422 for one specific body weeks later.
-WorkspaceViewName = Literal["grid", "chat", "deck"]
+WorkspaceViewName = Literal["grid", "chat"]
if set(get_args(WorkspaceViewName)) != set(WORKSPACE_VIEWS): # pragma: no cover - guard
raise RuntimeError(
"WorkspaceViewName drifted from WORKSPACE_VIEWS — update both "
@@ -331,13 +345,13 @@ class SurfaceContextRequest(BaseModel):
workspace_id: str = Field(description="Workspace currently rendered by this view.")
view: WorkspaceViewName | None = Field(
default=None,
- description="Which reading mode is on screen: grid, chat, or deck.",
+ description="Which reading mode is on screen: grid or chat.",
)
chat_view: bool | None = Field(
default=None,
description=(
"Deprecated — superseded by `view`. Still read so a desktop WebView "
- "still holding the pre-deck bundle keeps reporting its surface "
+ "still holding an older bundle keeps reporting its surface "
"correctly for the seconds before it reloads itself."
),
)
@@ -355,38 +369,6 @@ class SurfaceContextRequest(BaseModel):
)
-#: Layer 3 for the report actions, guarded the same way as the view enum above.
-DeckAction = Literal["next", "later", "drop"]
-if set(get_args(DeckAction)) != set(get_args(standup.Action)): # pragma: no cover - guard
- raise RuntimeError(
- "DeckAction drifted from standup.Action — update both "
- "(jarvis/agentic_ide/standup.py is the source of truth)."
- )
-
-
-class DeckHoldRequest(BaseModel):
- """Whether the user is driving this pane themselves for now."""
-
- held: bool = Field(
- description=(
- "True takes the pane over: the Command Deck stops assigning work to "
- "it and stops reporting it. False hands it back."
- )
- )
-
-
-class DeckAckRequest(BaseModel):
- """What the user said about one Command Deck report."""
-
- id: str = Field(description="The report being answered.")
- action: DeckAction = Field(
- description=(
- "`next` reports this one now, `later` puts the queue to sleep "
- "without losing anything, `drop` takes this report away."
- )
- )
-
-
class TerminalTextSizeRequest(BaseModel):
"""How large the text in the workspace's terminals should be, in pixels."""
@@ -524,6 +506,15 @@ class FanOutRequest(BaseModel):
"Plan the division of labour and return it WITHOUT typing anything into any agent."
),
)
+ force: bool = Field(
+ default=False,
+ description=(
+ "Spawn a second fleet even though the same instruction recently "
+ "went to panes that are still open. Set it ONLY when the user "
+ "explicitly asked to run the same task again — a repeated order "
+ "without it is refused with the call-signs already working on it."
+ ),
+ )
class PromptAttachment(BaseModel):
@@ -2082,49 +2073,6 @@ async def clear_notification(notification_id: str) -> NotificationsChangedRespon
return NotificationsChangedResponse(changed=dropped, unread=center.unread)
[email protected]("/deck/queue", summary="What the Command Deck still has to report")
-async def get_deck_queue() -> dict:
- """The report lane: what is waiting, and what is being reported right now.
-
- Only the Command Deck renders this — the same events reach the bell in the
- other two views and are never spoken there. `sleeping` is true once a line
- has gone unanswered: the deck says so rather than looking broken, because
- "nothing new" and "it has stopped talking to you" are very different and
- were indistinguishable from the outside in the first version.
- """
- return standup.queue().state()
-
-
[email protected]("/deck/hold/{name}", summary="Take a pane over from the Command Deck")
-async def set_deck_hold(name: str, req: DeckHoldRequest) -> dict:
- """ "I'll take this one" — and handing it back.
-
- The honest limit on the deck's promise. A pane can hold a question only the
- user can settle, and while they are dealing with it the deck must stop
- assigning work to it and stop reporting it. Per pane rather than a mode:
- the interesting case is one agent out of eight, and the other seven carry
- on being run by Jarvis.
- """
- try:
- held = get_registry().set_deck_hold(name, req.held)
- except SessionError as exc:
- raise HTTPException(status_code=404, detail=str(exc)) from exc
- return {"terminal": name, "deck_hold": held}
-
-
[email protected]("/deck/ack", summary="Answer a Command Deck report")
-async def ack_deck_report(req: DeckAckRequest) -> dict:
- """ "Tell me that one" / "later" / "drop it", from voice or from the lane.
-
- Not a 404 for an unknown id: a report goes away when its pane does, and a
- click that lands a moment after that got the outcome it wanted. `found`
- says which happened, so a caller that cares can tell.
- """
- queue = standup.queue()
- report = queue.acknowledge(req.id, req.action)
- return {"found": report is not None, **queue.state()}
-
-
@router.post(
"/terminals/close-batch",
summary="Close several terminals",
@@ -2214,9 +2162,9 @@ async def set_surface_context(req: SurfaceContextRequest) -> dict:
because several terminals are visible there and guessing one would be less
honest than asking for a call-sign.
- Two ways in, one meaning: `view` is the contract, `chat_view` is what the
- pre-deck bundle sends. A body carrying neither reports the grid, which is
- the view that promises the least — see `workspace_view.VIEW_DEFAULT`.
+ Two ways in, one meaning: `view` is the contract, `chat_view` is what an
+ older bundle sends. A body carrying neither reports the grid, which is the
+ view that promises the least — see `workspace_view.VIEW_DEFAULT`.
"""
view = req.view if req.view is not None else view_from_legacy_chat_flag(req.chat_view)
accepted = get_registry().set_surface_context(
@@ -2379,6 +2327,37 @@ async def add_terminals(request: Request, req: AddTerminalsRequest) -> dict:
}
[email protected]("/terminals/refold", summary="Re-fold the workspace into columns of a given depth")
+async def refold_workspace(req: RefoldRequest) -> dict:
+ """Re-deal every pane into columns ``depth`` deep, keeping their order.
+
+ The workspace is always exactly one screenful, so a pane can only be given
+ room taken from somewhere else. When a row holds so many panes that each is
+ narrower than the terminal it draws, the agents' output is clipped at the
+ tile edge — and the only room left to spend is height. Folding the row in
+ two halves the column count and so doubles every pane's width, at the text
+ size the user chose rather than a smaller one.
+
+ Nothing is started, stopped, resized or remounted: only the two numbers
+ saying where each pane is drawn change, exactly as for a move. Re-folding to
+ the depth the workspace already has succeeds and changes nothing.
+ """
+ try:
+ session = await get_registry().refold(req.depth)
+ except SessionError as exc:
+ message = str(exc)
+ # A depth this grid cannot express is the caller's arithmetic; a
+ # workspace that is not open is a conflict nothing here can fix.
+ status = 409 if "No Agentic-IDE session" in message else 422
+ raise HTTPException(status_code=status, detail=message) from exc
+ return {
+ "ok": True,
+ "depth": req.depth,
+ "terminals": [t.to_dict() for t in session.terminals],
+ "state": get_registry().state(),
+ }
+
+
@router.post("/terminals/{name}/move", summary="Move a terminal to another place in the grid")
async def move_terminal(name: str, req: MoveTerminalRequest) -> dict:
"""Rearrange the workspace: put the pane ``name`` at ``target``'s place.
@@ -3195,6 +3174,30 @@ async def fanout(request: Request, req: FanOutRequest) -> dict:
if registry.session is None:
raise HTTPException(status_code=409, detail="No Agentic-IDE session is running.")
+ # A spawn for an instruction that JUST went to panes still open is a
+ # duplicate, not a new order — the router brain re-issued a live 2026-08-11
+ # order 37 s later because the first fleet's success was not yet visible in
+ # its context, and four agents ended up racing on the same task in one
+ # shared working tree. Checked before any pane opens so a refusal leaves
+ # nothing behind. Re-briefing EXISTING panes stays allowed: those repeats
+ # are visible to the user and cheap to make deliberately.
+ if req.spawn and not req.dry_run and not req.force:
+ from jarvis.agentic_ide import fanout as fanout_guard
+
+ duplicate = fanout_guard.find_duplicate_fanout(registry.session, req.instruction)
+ if duplicate is not None:
+ age_s = int(max(0.0, time.monotonic() - duplicate.at))
+ names = ", ".join(duplicate.terminals)
+ raise HTTPException(
+ status_code=409,
+ detail=(
+ f"This instruction already went to {names} {age_s}s ago and "
+ "those panes are still open. Report that fleet instead of "
+ "spawning a second one; pass force=true only when the user "
+ "explicitly asked to run the same task again."
+ ),
+ )
+
# Bound once, up here: the announcements at the end of this route apply to
# every fan-out, and the fleet path that briefs EXISTING panes never enters
# the spawn branch below.
diff --git a/jarvis/ui/web/frontend/src/__tests__/i18nNameInterpolation.test.tsx b/jarvis/ui/web/frontend/src/__tests__/i18nNameInterpolation.test.tsx
index 29c91cb7bc..24a8633c15 100644
--- a/jarvis/ui/web/frontend/src/__tests__/i18nNameInterpolation.test.tsx
+++ b/jarvis/ui/web/frontend/src/__tests__/i18nNameInterpolation.test.tsx
@@ -31,11 +31,11 @@ function RestartHintProbe() {
return <span data-testid="hint">{t("topbar.restart_hint")}</span>;
}
-function CommandDeckProbe() {
+function WorkspaceCopyProbe() {
const t = useT();
return (
- <span data-testid="command-deck-copy">
- {t("workspace_launcher.wizard.views.deck.description")}
+ <span data-testid="workspace-copy">
+ {t("agentic_grid.history.description")}
</span>
);
}
@@ -75,13 +75,13 @@ describe("useT name substitution", () => {
});
it.each(["en", "de", "es"] as const)(
- "brands the %s Command Deck wizard with a nonstandard assistant name",
+ "brands the %s workspace copy with a nonstandard assistant name",
(language) => {
useI18nStore.getState().setUi(language, { push: false });
useEventStore.setState({ assistantName: "Athena" });
- render(<CommandDeckProbe />);
+ render(<WorkspaceCopyProbe />);
- const text = screen.getByTestId("command-deck-copy").textContent ?? "";
+ const text = screen.getByTestId("workspace-copy").textContent ?? "";
expect(text).toContain("Athena");
expect(text).not.toContain("{name}");
expect(text).not.toContain("Jarvis");
diff --git a/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.test.tsx b/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.test.tsx
index 40d4032cb5..fd1aa24a8b 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.test.tsx
@@ -106,24 +106,6 @@ vi.mock("@/lib/agenticIdeApi", () => ({
default: 13,
})),
syncAgenticIdeSurface: vi.fn(async () => undefined),
- // The Command Deck's report lane. Polled only while the deck is the view on
- // screen, so the grid and chat suites never reach it — it answers "nothing
- // waiting" by default and the deck tests give it real rows.
- fetchDeckQueue: vi.fn(async () => ({
- sleeping: false,
- in_conversation: false,
- on_air: null,
- pending: [],
- reports: [],
- })),
- ackDeckReport: vi.fn(async () => ({
- sleeping: false,
- in_conversation: false,
- on_air: null,
- pending: [],
- reports: [],
- })),
- setDeckHold: vi.fn(async (_name: string, held: boolean) => held),
}));
// The grid follows the app theme for its terminal colours; these tests render
@@ -2848,8 +2830,6 @@ describe("chat view", () => {
toChat();
expect(screen.getByTestId("pane-Nova")).toBe(before);
- fireEvent.click(screen.getByTestId("agentic-view-mode-deck"));
- expect(screen.getByTestId("pane-Nova")).toBe(before);
toGrid();
expect(screen.getByTestId("pane-Nova")).toBe(before);
@@ -2983,32 +2963,32 @@ describe("chat view", () => {
});
/*
- * The view travels to the backend by NAME, and the backend acts on more than
- * deixis with it: the Command Deck is the only surface allowed to speak a
- * finished pane out loud. A wrong name here is a wrong answer about whether
- * Jarvis talks, which is why this is pinned separately from the pane above.
+ * The view travels to the backend by NAME rather than as a boolean, so that
+ * a third mode added later reads correctly everywhere without re-deriving
+ * what "not chat" was supposed to mean. Pinned separately from the pane
+ * above because it is a separate claim.
*/
- it("tells the backend which of the three modes is on screen", async () => {
+ it("tells the backend which mode is on screen", async () => {
renderGrid(FOUR);
- fireEvent.click(screen.getByTestId("agentic-view-mode-deck"));
+ toChat();
await waitFor(() =>
expect(api.syncAgenticIdeSurface).toHaveBeenLastCalledWith(
- expect.objectContaining({ view: "deck", onScreen: true }),
+ expect.objectContaining({ view: "chat", onScreen: true }),
),
);
});
it("reports the grid while the section is off screen, whatever it shows", async () => {
- // The deck speaks; a deck nobody is looking at must not. This grid stays
- // mounted behind another section, so "on screen" is the only thing that
- // can stop it — see the matching backend test.
+ // A workspace nobody is looking at must not answer "this terminal". This
+ // grid stays mounted behind another section, so "on screen" is the only
+ // thing that can stop it — see the matching backend test.
const { rerender } = renderGrid(FOUR);
- fireEvent.click(screen.getByTestId("agentic-view-mode-deck"));
+ toChat();
await waitFor(() =>
expect(api.syncAgenticIdeSurface).toHaveBeenLastCalledWith(
- expect.objectContaining({ view: "deck" }),
+ expect.objectContaining({ view: "chat" }),
),
);
diff --git a/jarvis/ui/web/frontend/src/components/agentic/WorkspaceLauncher.crowded.test.tsx b/jarvis/ui/web/frontend/src/components/agentic/WorkspaceLauncher.crowded.test.tsx
new file mode 100644
index 0000000000..8cf325247c
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/agentic/WorkspaceLauncher.crowded.test.tsx
@@ -0,0 +1,145 @@
+import { cleanup, fireEvent, render, screen } from "@testing-library/react";
+import { afterEach, describe, expect, it, vi } from "vitest";
+import { CROWDED_TERMINAL_COUNT } from "./layout";
+import {
+ WorkspaceLauncher,
+ type WorkspaceLauncherProps,
+} from "./WorkspaceLauncher";
+
+/**
+ * A crowded workspace is WARNED about, never refused.
+ *
+ * The maintainer's rule for this screen (2026-08-11): how many terminals are
+ * worth watching at once is the user's call, and the app has no idea how big
+ * the display in front of it is — thirty side by side may be perfectly readable
+ * on a video wall. So nothing here caps the count, reshapes it, or opens fewer
+ * panes than were asked for.
+ *
+ * What it does do is make sure the decision was deliberate, and the tests below
+ * pin both halves of that: the warning BLOCKS until it is answered, and
+ * answering it opens exactly the workspace that was asked for.
+ */
+
+vi.mock("@/i18n", () => ({
+ useT: () => (key: string) => key,
+}));
+
+// Nothing in these tests touches the folder picker, and rendering the real one
+// reaches for the backend.
+vi.mock("./FolderPicker", () => ({
+ FolderPicker: () => <div data-testid="folder-picker" />,
+}));
+
+afterEach(cleanup);
+
+function props(
+ count: number,
+ overrides: Partial<WorkspaceLauncherProps> = {},
+): WorkspaceLauncherProps {
+ const planned = Array.from({ length: count }, (_, index) => ({
+ name: `T${index + 1}`,
+ agent: "claude",
+ account: null,
+ }));
+ return {
+ addingNew: false,
+ busy: false,
+ folder: "/work/app",
+ onSelectFolder: () => {},
+ onSelectRecent: () => {},
+ count,
+ maxTerminals: 100,
+ suggestedNames: planned.map((pane) => pane.name),
+ workspaceWidthPx: 2560,
+ onCount: () => {},
+ planned,
+ onPlanned: () => {},
+ agents: [
+ {
+ name: "claude",
+ display_name: "Claude Code",
+ installed: true,
+ version: "2.1",
+ install_command: null,
+ },
+ ],
+ accountsFor: () => [],
+ terminalAvailable: true,
+ nothingInstalled: false,
+ onOpenClis: () => {},
+ offer: null,
+ onResume: () => {},
+ onDismissOffer: () => {},
+ view: "grid",
+ onView: () => {},
+ onStart: () => {},
+ ...overrides,
+ } as WorkspaceLauncherProps;
+}
+
+/** Walk to the layout step, where the count is chosen. */
+function openLayoutStep(count: number, overrides = {}) {
+ render(<WorkspaceLauncher {...props(count, overrides)} />);
+ fireEvent.click(screen.getByText("workspace_launcher.wizard.continue_layout"));
+}
+
+const nextStep = () =>
+ screen.getByText(
+ "workspace_launcher.wizard.continue_agents",
+ ) as HTMLElement & { closest: (s: string) => HTMLButtonElement | null };
+
+describe("a crowded workspace has to be confirmed", () => {
+ it("says nothing at all below the threshold", () => {
+ // A question asked every time is a question nobody reads. Six terminals is
+ // an ordinary workspace and must open without a word.
+ openLayoutStep(6);
+ expect(screen.queryByTestId("workspace-crowded-warning")).toBeNull();
+ expect(nextStep().closest("button")?.disabled).toBe(false);
+ });
+
+ it("blocks the wizard until the warning is answered", () => {
+ openLayoutStep(CROWDED_TERMINAL_COUNT);
+ expect(screen.getByTestId("workspace-crowded-warning")).toBeTruthy();
+ // A warning that can be walked past without being read is decoration.
+ expect(nextStep().closest("button")?.disabled).toBe(true);
+ });
+
+ it("lets the user overrule it and carry on", () => {
+ // The whole point: the count is never refused. Thirty terminals is a thing
+ // somebody may want, and this is them saying so.
+ openLayoutStep(30);
+ fireEvent.click(screen.getByTestId("workspace-crowded-accept"));
+ expect(nextStep().closest("button")?.disabled).toBe(false);
+ // The warning stays visible as a statement of what was agreed to, with the
+ // button gone — it has been answered and cannot be answered twice.
+ expect(screen.getByTestId("workspace-crowded-warning")).toBeTruthy();
+ expect(screen.queryByTestId("workspace-crowded-accept")).toBeNull();
+ });
+
+ it("opens exactly the count that was asked for", () => {
+ // Nothing about the acknowledgement changes the workspace: it opens with
+ // the panes the user planned, all of them.
+ const onStart = vi.fn();
+ const planned = Array.from({ length: 24 }, (_, i) => ({
+ name: `T${i + 1}`,
+ agent: "claude",
+ account: undefined,
+ }));
+ render(
+ <WorkspaceLauncher {...props(24, { onStart, planned })} />,
+ );
+ fireEvent.click(
+ screen.getByText("workspace_launcher.wizard.continue_layout"),
+ );
+ fireEvent.click(screen.getByTestId("workspace-crowded-accept"));
+ for (const step of [
+ "workspace_launcher.wizard.continue_agents",
+ "workspace_launcher.wizard.choose_view",
+ "workspace_launcher.wizard.review_workspace",
+ ]) {
+ fireEvent.click(screen.getByText(step));
+ }
+ fireEvent.click(screen.getByText("workspace_launcher.wizard.open_workspace"));
+ expect(onStart).toHaveBeenCalledTimes(1);
+ });
+});
diff --git a/jarvis/ui/web/frontend/src/components/agentic/WorkspaceLauncher.tsx b/jarvis/ui/web/frontend/src/components/agentic/WorkspaceLauncher.tsx
index 63f49f7c69..f9fd1013d2 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/WorkspaceLauncher.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/WorkspaceLauncher.tsx
@@ -9,9 +9,10 @@
*/
import { useEffect, useMemo, useState, type ReactNode } from "react";
import {
+ AlertTriangle,
ArrowLeft,
ArrowRight,
- AudioLines,
+ Check,
LayoutGrid,
Loader2,
MessagesSquare,
@@ -23,6 +24,7 @@ import { ResumeCard } from "./ResumeCard";
import { AgentAllocation, type PlannedTerminal } from "./AgentAllocation";
import { Button, Notice, SectionLabel } from "./controls";
import { CountStepper, CountTrack, WorkspaceShape } from "./WorkspaceShape";
+import { CROWDED_TERMINAL_COUNT } from "./layout";
import type { WorkspaceView } from "./AgenticGrid";
import type { AgentAccount } from "@/lib/agentAccountsApi";
import type {
@@ -146,14 +148,32 @@ export function WorkspaceLauncher({
}: WorkspaceLauncherProps) {
const t = useT();
const [step, setStep] = useState<LauncherStep>(0);
+ /*
+ * Has the user said yes to a crowded workspace?
+ *
+ * The count itself is never refused — see CROWDED_TERMINAL_COUNT. This is
+ * only the acknowledgement that the warning was read, and it is dropped
+ * again the moment the count returns below the threshold, so a user who
+ * stepped up to 24, agreed, and then came back down to 6 is not carrying a
+ * silent yes into a workspace that no longer needs one.
+ */
+ const [crowdAccepted, setCrowdAccepted] = useState(false);
+ const crowded = count >= CROWDED_TERMINAL_COUNT;
+ useEffect(() => {
+ if (!crowded && crowdAccepted) setCrowdAccepted(false);
+ }, [crowded, crowdAccepted]);
+ const countSettled = count > 0 && (!crowded || crowdAccepted);
+
const planReady =
planned.length > 0 &&
planned.every((pane) => pane.name.trim() && pane.agent);
- const ready = Boolean(folder) && planReady;
+ // The acknowledgement gates the START, not just the step — the launcher can
+ // also be fired with the keyboard shortcut from anywhere in the wizard.
+ const ready = Boolean(folder) && planReady && countSettled;
const canLeaveCurrent =
(step === 0 && Boolean(folder)) ||
- (step === 1 && count > 0) ||
+ (step === 1 && countSettled) ||
(step === 2 && planReady) ||
// The view step always carries a preselected answer, and review is last.
step >= 3;
@@ -317,6 +337,13 @@ export function WorkspaceLauncher({
max={maxTerminals}
onChange={onCount}
/>
+ {crowded && (
+ <CrowdedWarning
+ count={count}
+ accepted={crowdAccepted}
+ onAccept={() => setCrowdAccepted(true)}
+ />
+ )}
</div>
)}
@@ -397,6 +424,75 @@ export function WorkspaceLauncher({
);
}
+/**
+ * The yes a crowded workspace has to be given before it opens.
+ *
+ * It does NOT refuse the count, and that is the point. How many agents are
+ * worth watching at once is the user's call — thirty terminals on a video wall
+ * is a reasonable thing to want, and this app has no way of knowing how big the
+ * display in front of it is. So the one thing it can honestly do is make sure
+ * the decision was made deliberately: the warning names the consequence, and
+ * the button is the user overruling it.
+ *
+ * Shown from {@link CROWDED_TERMINAL_COUNT} up, and it BLOCKS — the wizard's
+ * next step stays out of reach until this is answered. A warning that can be
+ * walked past without being read is decoration, and the count it is warning
+ * about is the one thing in this wizard that cannot be undone from inside the
+ * workspace without closing panes one at a time.
+ */
+function CrowdedWarning({
+ count,
+ accepted,
+ onAccept,
+}: {
+ count: number;
+ accepted: boolean;
+ onAccept: () => void;
+}) {
+ const t = useT();
+ return (
+ <div
+ data-testid="workspace-crowded-warning"
+ role="group"
+ className={cn(
+ "mt-3 flex items-start gap-3 rounded-control border px-3 py-2.5 transition-colors",
+ accepted
+ ? "border-border/70 bg-muted/30"
+ : "border-destructive/50 bg-destructive/[0.07]",
+ )}
+ >
+ {accepted ? (
+ <Check className="mt-0.5 h-4 w-4 shrink-0 text-muted-foreground" />
+ ) : (
+ <AlertTriangle className="mt-0.5 h-4 w-4 shrink-0 text-destructive" />
+ )}
+ <div className="min-w-0 flex-1">
+ <p
+ className={cn(
+ "text-xs leading-relaxed",
+ accepted ? "text-muted-foreground" : "text-foreground",
+ )}
+ >
+ {(accepted
+ ? t("workspace_launcher.crowded.accepted")
+ : t("workspace_launcher.crowded.warning")
+ ).replace("{0}", String(count))}
+ </p>
+ {!accepted && (
+ <Button
+ variant="subtle"
+ onClick={onAccept}
+ className="mt-2"
+ data-testid="workspace-crowded-accept"
+ >
+ {t("workspace_launcher.crowded.accept")}
+ </Button>
+ )}
+ </div>
+ </div>
+ );
+}
+
function StepNavigation({
step,
folder,
@@ -484,15 +580,10 @@ function StepNavigation({
/**
* The last decision before review: how the workspace is read.
*
- * Three ways of looking at the SAME panes (see WorkspaceView in AgenticGrid) —
+ * Two ways of looking at the SAME panes (see WorkspaceView in AgenticGrid) —
* the grid shows every terminal at once, chat puts one agent on a stage like a
- * conversation, and the deck hands the floor to Jarvis. A choice of
- * presentation, not of substance, which is why the step needs no gate: every
- * answer is valid and one is preselected.
- *
- * The deck's card says what it DOES differently rather than what it looks
- * like, because it is the one option that changes the assistant's behaviour:
- * pick it and Jarvis starts speaking finished work back to you.
+ * conversation. A choice of presentation, not of substance, which is why the
+ * step needs no gate: every answer is valid and one is preselected.
*/
function ViewChoice({
view,
@@ -508,7 +599,7 @@ function ViewChoice({
<div
role="radiogroup"
aria-label={t("workspace_launcher.wizard.reading_mode_label")}
- className="mt-4 grid gap-4 sm:grid-cols-3"
+ className="mt-4 grid gap-4 sm:grid-cols-2"
>
<ViewOption
selected={view === "grid"}
@@ -528,15 +619,6 @@ function ViewChoice({
description={t("workspace_launcher.wizard.views.chat.description")}
preview={<ChatPreview />}
/>
- <ViewOption
- selected={view === "deck"}
- onSelect={() => onView("deck")}
- testId="view-choice-deck"
- icon={<AudioLines className="h-4 w-4 shrink-0" />}
- title={t("workspace_launcher.wizard.views.deck.title")}
- description={t("workspace_launcher.wizard.views.deck.description")}
- preview={<DeckPreview />}
- />
</div>
<p className="mt-5 max-w-2xl text-xs leading-relaxed text-muted-foreground">
{t("workspace_launcher.wizard.view_hint")}
@@ -649,43 +731,6 @@ function ChatPreview() {
);
}
-/*
- * The deck miniature is the odd one out on purpose.
- *
- * The other two draw their layout, because their layout IS the difference. The
- * deck's difference is that the conversation is at the centre and the
- * terminals have receded to cards around it — so it draws a ring with the
- * agents arranged about it, which is the one glance that distinguishes it from
- * "chat view with bigger panes".
- */
-function DeckPreview() {
- return (
- <span aria-hidden className="flex h-[4.875rem] items-center justify-center gap-2">
- <span className="flex flex-col gap-1.5">
- {[0, 1].map((i) => (
- <span
- key={i}
- data-view-preview-pane
- className={cn("block h-6 w-8 border", VIEW_PREVIEW_PANE)}
- />
- ))}
- </span>
- <span className="flex h-10 w-10 shrink-0 items-center justify-center rounded-full border border-primary/60 bg-primary/10">
- <span className="block h-4 w-4 rounded-full border border-primary/70 bg-primary/25" />
- </span>
- <span className="flex flex-col gap-1.5">
- {[0, 1].map((i) => (
- <span
- key={i}
- data-view-preview-pane
- className={cn("block h-6 w-8 border", VIEW_PREVIEW_PANE)}
- />
- ))}
- </span>
- </span>
- );
-}
-
function WorkspaceReview({
folder,
planned,
diff --git a/jarvis/ui/web/frontend/src/components/agentic/WorkspaceShape.tsx b/jarvis/ui/web/frontend/src/components/agentic/WorkspaceShape.tsx
index 318d696046..16808fc3ac 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/WorkspaceShape.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/WorkspaceShape.tsx
@@ -32,11 +32,17 @@
* create, at the measured width the grid will occupy — so the preview cannot
* describe a workspace that will not appear.
*/
-import { useEffect, useMemo, useRef, useState } from "react";
+import { useEffect, useMemo, useRef, useState, type CSSProperties } from "react";
import { Minus, Plus } from "lucide-react";
import { cn } from "@/lib/utils";
import { IconButton } from "./controls";
-import { paneGrid, paneWidthAt, panesAreComfortable, wizardPanes } from "./layout";
+import {
+ paneGrid,
+ paneWidthAt,
+ panesAreComfortable,
+ wizardPanes,
+ type PanePlacement,
+} from "./layout";
/**
* Steps a labelled tick is allowed to land on, coarsest last.
@@ -173,6 +179,7 @@ export function WorkspaceShape({
<WorkspaceStage
columns={grid.columns}
rows={grid.rows}
+ placements={grid.placements}
count={count}
names={names}
/>
@@ -415,6 +422,12 @@ export function CountTrack({
* — over the panes the backend will actually create (`wizardPanes`). The two
* cannot drift apart without the running grid changing too.
*
+ * Placed by those coordinates, not by document order. The two agreed only while
+ * every terminal got a column of its own: a wizard workspace now opens as
+ * columns of two (see `WIZARD_COLUMN_HEIGHT`), and left to CSS's own row-first
+ * flow the preview would show T1 and T2 side by side where the workspace puts
+ * one under the other.
+ *
* The stage is the whole workspace AND the whole window, because those are the
* same thing now: every column is drawn inside the frame, however many there
* are, and more terminals make each one narrower. It used to draw the grid
@@ -425,11 +438,13 @@ export function CountTrack({
function WorkspaceStage({
columns,
rows,
+ placements,
count,
names,
}: {
columns: number;
rows: number;
+ placements: PanePlacement[];
count: number;
names: string[];
}) {
@@ -494,17 +509,31 @@ function WorkspaceStage({
gridTemplateRows: `repeat(${safeRows}, minmax(0, 1fr))`,
}}
>
- {Array.from({ length: count }).map((_, index) => (
- <StagePane
- key={index}
- name={names[index] ?? `T${index + 1}`}
- detail={detail}
- /* The workspace opens with the first pane selected — the prompt bar
- types into it. Showing that here means the stage is not just the
- right shape, it is the right state. */
- focused={index === 0}
- />
- ))}
+ {Array.from({ length: count }).map((_, index) => {
+ const at = placements[index];
+ return (
+ <StagePane
+ key={index}
+ name={names[index] ?? `T${index + 1}`}
+ detail={detail}
+ /* The workspace opens with the first pane selected — the prompt
+ bar types into it. Showing that here means the stage is not
+ just the right shape, it is the right state. */
+ focused={index === 0}
+ /* A short column's panes are TALLER, exactly as in the running
+ grid: `rowSpan` is how three terminals draw one full column
+ beside a single pane that reaches the same bottom edge. */
+ style={
+ at
+ ? {
+ gridColumn: at.column,
+ gridRow: `${at.row} / span ${at.rowSpan}`,
+ }
+ : undefined
+ }
+ />
+ );
+ })}
</div>
</div>
);
@@ -517,13 +546,17 @@ function StagePane({
name,
detail,
focused,
+ style,
}: {
name: string;
detail: PaneDetail;
focused: boolean;
+ /** Where this pane sits in the stage grid — see `WorkspaceStage`. */
+ style?: CSSProperties;
}) {
return (
<div
+ style={style}
/*
* Dark, like the terminals it stands for — not a tile of brand colour.
* Colour marks ONE thing here: which pane the prompt bar will type into.
diff --git a/jarvis/ui/web/frontend/src/components/agentic/layout.test.ts b/jarvis/ui/web/frontend/src/components/agentic/layout.test.ts
index 2a0d84c31f..6149e21100 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/layout.test.ts
+++ b/jarvis/ui/web/frontend/src/components/agentic/layout.test.ts
@@ -2,6 +2,7 @@ import { describe, expect, it } from "vitest";
import {
COMFORTABLE_PANE_WIDTH_PX,
GRID_HORIZONTAL_PADDING_PX,
+ columnDepthFor,
paneGrid,
paneWidthAt,
panesAreComfortable,
@@ -67,16 +68,88 @@ describe("panesAreComfortable", () => {
});
});
+describe("columnDepthFor", () => {
+ /*
+ * The workspace from the report, at the numbers it was actually measured at:
+ * a 2560 px window, six panes, and a terminal that needs ~660 px to show its
+ * 60-column grid at the maintainer's text size. Six in a row gave each ~410,
+ * so every pane drew a third of itself past its own edge.
+ */
+ const REPORTED = {
+ paneCount: 6,
+ canvasWidthPx: 2560,
+ canvasHeightPx: 900,
+ neededPaneWidthPx: 660,
+ minPaneHeightPx: 380,
+ };
+
+ it("folds the reported workspace into two rows, and no deeper", () => {
+ // 2560 px carries three 660 px columns, so six panes need two per column —
+ // 3x2, each pane ~850 px, every terminal fully visible at the SAME text size.
+ expect(columnDepthFor(REPORTED)).toBe(2);
+ });
+
+ it("leaves a workspace alone when one row already fits", () => {
+ // The same six panes on a display wide enough for six full columns. Folding
+ // here would be a rearrangement behind the user's back for no gain at all.
+ expect(columnDepthFor({ ...REPORTED, canvasWidthPx: 6 * 660 + 100 })).toBe(1);
+ });
+
+ it("does not fold on a guess when no pane reported being clipped", () => {
+ // `neededPaneWidthPx` is 0 exactly when every terminal already shows itself.
+ // That is evidence of health, not a missing measurement.
+ expect(columnDepthFor({ ...REPORTED, neededPaneWidthPx: 0 })).toBe(1);
+ });
+
+ it("stays put while the canvas is still unmeasured", () => {
+ // A first paint reports 0. Folding on it would reshape every workspace once
+ // on open, before anything had been measured at all.
+ expect(columnDepthFor({ ...REPORTED, canvasWidthPx: 0 })).toBe(1);
+ expect(columnDepthFor({ ...REPORTED, canvasWidthPx: Number.NaN })).toBe(1);
+ });
+
+ it("stops folding once the panes would be too short to hold an agent", () => {
+ // Twelve panes on a laptop want six deep on width alone. A 900 px canvas
+ // carries two panes of 380 px, so the fold stops at two: a pane wide enough
+ // to read but too short to show the agent's input box is the worse half of
+ // the same trade (see MIN_REAL_ROWS in ./AgenticTerminal).
+ expect(
+ columnDepthFor({ ...REPORTED, paneCount: 12, canvasWidthPx: 1440 }),
+ ).toBe(2);
+ });
+
+ it("lets height cap nothing while height is unknown", () => {
+ // Width has been measured and height has not — capping at 1 there would
+ // silently refuse the fold the width evidence already justifies.
+ expect(
+ columnDepthFor({ ...REPORTED, paneCount: 12, canvasWidthPx: 1440, canvasHeightPx: 0 }),
+ ).toBe(Math.ceil(12 / Math.max(1, Math.floor((1440 - GRID_HORIZONTAL_PADDING_PX) / 660))));
+ });
+
+ it("has nothing to fold below two panes", () => {
+ expect(columnDepthFor({ ...REPORTED, paneCount: 1 })).toBe(1);
+ expect(columnDepthFor({ ...REPORTED, paneCount: 0 })).toBe(1);
+ });
+
+ it("keeps a single pane per column when even one will not fit", () => {
+ // A window narrower than one usable terminal cannot be repaired by folding.
+ // It must still answer with a real depth rather than dividing by zero.
+ const depth = columnDepthFor({ ...REPORTED, canvasWidthPx: 300 });
+ expect(depth).toBe(2);
+ expect(Number.isFinite(depth)).toBe(true);
+ });
+});
+
describe("wizardPanes", () => {
- it("is the one row of columns the backend opens a workspace with", () => {
- // Mirrors agentic_ide/session.py, which sets column=index and slot=0 for a
- // wizard-opened workspace. The preview feeds these to the same `paneGrid`
- // the running workspace uses, so it cannot describe a layout the backend
- // would never build.
+ it("is the columns of two the backend opens a workspace with", () => {
+ // Mirrors agentic_ide/session.py, which fills a column to
+ // WIZARD_COLUMN_HEIGHT before opening the next one. The preview feeds these
+ // to the same `paneGrid` the running workspace uses, so it cannot describe
+ // a layout the backend would never build.
expect(wizardPanes(3)).toEqual([
{ column: 0, slot: 0 },
+ { column: 0, slot: 1 },
{ column: 1, slot: 0 },
- { column: 2, slot: 0 },
]);
});
@@ -85,12 +158,33 @@ describe("wizardPanes", () => {
expect(wizardPanes(-4)).toEqual([]);
});
- it("lays out exactly like the workspace it stands for, at any window size", () => {
- // 8 terminals are 8 columns — on a 4K display and on a laptop alike. The
- // window decides how many are ON SCREEN, never how they are arranged.
+ it("halves the columns a count is spread over, which is what pane width is", () => {
+ // The 2026-08-11 report: six terminals in one row left every pane about
+ // 410 px on the maintainer's display, well under the width its agent needs,
+ // so each pane was clipped at its tile edge and the six read as overlapping.
+ // Opened two deep the same six are three columns — double the width each.
+ const grid = paneGrid(wizardPanes(6));
+ expect(grid.columns).toBe(3);
+ expect(grid.rows).toBe(2);
+ });
+
+ it("stands the odd one out at full height beside a filled column", () => {
+ // Three terminals: a column of two, and a third that reaches the same
+ // bottom edge rather than leaving a hole under itself.
+ const grid = paneGrid(wizardPanes(3));
+ expect(grid.placements).toEqual([
+ { column: 1, row: 1, rowSpan: 1 },
+ { column: 1, row: 2, rowSpan: 1 },
+ { column: 2, row: 1, rowSpan: 2 },
+ ]);
+ });
+
+ it("arranges the same way at any window size", () => {
+ // 8 terminals are 4 columns of 2 — on a 4K display and on a laptop alike.
+ // The window decides how much room each pane gets, never the arrangement.
const grid = paneGrid(wizardPanes(8));
- expect(grid.columns).toBe(8);
- expect(grid.rows).toBe(1);
+ expect(grid.columns).toBe(4);
+ expect(grid.rows).toBe(2);
});
});
@@ -156,11 +250,16 @@ describe("paneGrid", () => {
});
it("never moves an existing column when one more is opened", () => {
- // The user-facing contract, pinned directly: for any count, adding a column
+ // The user-facing contract, pinned directly: for any count, splitting RIGHT
// changes no existing placement. It used to hold only below the wrap.
+ // Deliberately built from split panes rather than `wizardPanes` — the
+ // wizard opens columns of two now, so it is no longer a stand-in for
+ // "one more column", which is what this contract is about.
+ const columns = (n: number) =>
+ Array.from({ length: n }, (_, i) => pane(i, 0));
for (let count = 1; count < 40; count += 1) {
- const before = paneGrid(wizardPanes(count)).placements;
- const after = paneGrid(wizardPanes(count + 1)).placements;
+ const before = paneGrid(columns(count)).placements;
+ const after = paneGrid(columns(count + 1)).placements;
expect(after.slice(0, count)).toEqual(before);
}
});
diff --git a/jarvis/ui/web/frontend/src/components/agentic/layout.ts b/jarvis/ui/web/frontend/src/components/agentic/layout.ts
index 0778c8267a..cff8dd9162 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/layout.ts
+++ b/jarvis/ui/web/frontend/src/components/agentic/layout.ts
@@ -35,10 +35,15 @@
* only ever a change of numbers on each pane. Nothing is re-parented, so
* nothing remounts.
*
- * ## One line of columns, however many there are — and ALWAYS one screenful
+ * ## However many columns there are — and ALWAYS one screenful
*
* The workspace never wraps. Opening a column always puts it beside the last
- * one, and a workspace of twenty columns is twenty columns across.
+ * one, and a workspace of twenty columns is twenty columns across. Nothing here
+ * refuses a count or rearranges one behind the user's back: thirty columns on a
+ * laptop is a thing they may build, and on a wall display it is a reasonable
+ * thing to want. The only shape this module decides is the one a workspace
+ * OPENS in (see `wizardPanes`), and every later split, drag and close is the
+ * user's.
*
* It also never scrolls. The whole workspace is exactly the area it is given:
* open a pane and every pane gets a little smaller, on whichever axis the split
@@ -79,6 +84,27 @@
*/
export const COMFORTABLE_PANE_WIDTH_PX = 380;
+/**
+ * The count from which opening a workspace has to be confirmed out loud.
+ *
+ * NOT a limit, and deliberately not derived from the window either. The
+ * maintainer's rule for this screen (2026-08-11) is that the number of
+ * terminals is the user's call — thirty side by side is a thing somebody may
+ * want, and on a wall display it is even readable. What the app does not know
+ * is how big that display is, so it may not decide FOR them.
+ *
+ * What it can do is make sure the decision was made. Twenty is where a
+ * workspace stops being roomy on any ordinary screen, so from here the wizard
+ * says so and waits for a yes. Below it nothing is asked, because a question
+ * asked every time is a question nobody reads.
+ *
+ * Distinct from `COMFORTABLE_PANE_WIDTH_PX` on purpose: that one is measured
+ * against the window and phrased as advice, this one is a fixed count and
+ * blocks until it is acknowledged. A user on a laptop meets the advice long
+ * before this, and a user on a video wall meets only this.
+ */
+export const CROWDED_TERMINAL_COUNT = 20;
+
/**
* Horizontal padding of the rendered grid — 4 px on each side.
*
@@ -126,44 +152,162 @@ export interface Positioned {
slot: number;
}
+/**
+ * How deep a wizard-opened column is filled before the next one is started.
+ *
+ * Two, because the workspace is always one screenful (see the header) and the
+ * column is the only axis that can absorb a pane without taking width from
+ * every other one. One row of columns — what this used to be — spends the whole
+ * window on a single line, so the sixth terminal left every pane about 410 px
+ * wide at the maintainer's own text size: well under the ~650 px a 60-column
+ * agent grid needs there, and therefore six panes each showing two thirds of
+ * themselves with the rest clipped at the tile edge (reported 2026-08-11, and
+ * read as the panes overlapping one another).
+ *
+ * Two deep halves the column count and so doubles the width every pane gets,
+ * which is the axis the clipping is on. Deliberately not "as square as
+ * possible": past four terminals a squarer grid starts paying in HEIGHT
+ * instead, and a coding CLI anchors its input box to its bottom row — a pane
+ * wide enough to read but too short to hold the agent's interface is the worse
+ * half of the same trade.
+ *
+ * Only the OPENING shape. Nothing holds a workspace at two deep afterwards: the
+ * user's own splits, drags and closes rearrange it freely, and a wall of thirty
+ * columns is theirs to build if they want one.
+ */
+export const WIZARD_COLUMN_HEIGHT = 2;
+
/**
* The panes a wizard-opened workspace of ``count`` terminals starts with.
*
- * One row of columns — `column = index`, `slot = 0` — which is literally what
- * the backend writes when it opens a session from the wizard
- * (`agentic_ide/session.py`: "A wizard-opened workspace is one row of columns").
+ * Columns of {@link WIZARD_COLUMN_HEIGHT}, each filled top to bottom before the
+ * next is opened — which is literally what the backend writes when it opens a
+ * session from the wizard (`agentic_ide/session.py`, the same arithmetic). Two
+ * terminals stand one above the other; three are a full column plus one beside
+ * it; six are three columns of two.
*
* It exists so the preview cannot describe a workspace the backend would never
* build. An earlier preview took a shortcut and derived its dots from the raw
- * terminal COUNT, which happens to agree here only because every terminal gets
- * its own column at the start. Feed `paneGrid` the same panes the grid will
- * receive and the preview stops being a second opinion.
+ * terminal COUNT, which happened to agree only while every terminal got a
+ * column of its own. Feed `paneGrid` the same panes the grid will receive and
+ * the preview stops being a second opinion.
*/
export function wizardPanes(count: number): Positioned[] {
return Array.from({ length: Math.max(0, Math.trunc(count)) }, (_, index) => ({
- column: index,
- slot: 0,
+ column: Math.floor(index / WIZARD_COLUMN_HEIGHT),
+ slot: index % WIZARD_COLUMN_HEIGHT,
}));
}
/**
- * Is ``count`` panes comfortable on a window this wide, or merely possible?
+ * Is a workspace ``columns`` across comfortable on a window this wide, or
+ * merely possible?
*
- * Every count fits — the workspace is always one screenful — so the only thing
- * left to say is how much room each pane gets, and this is where that turns
- * into a yes or no. Deliberately about the PANE rather than the count: the same
- * eight terminals are roomy on a 4K display and cramped on a laptop.
+ * Every arrangement fits — the workspace is always one screenful — so the only
+ * thing left to say is how much room each pane gets, and this is where that
+ * turns into a yes or no. Deliberately about the PANE rather than the terminal
+ * count: the same eight terminals are roomy on a 4K display and cramped on a
+ * laptop, and eight opened as four columns of two are twice the width of eight
+ * in a row (see {@link WIZARD_COLUMN_HEIGHT}). Callers pass the COLUMN count
+ * for that reason — the number of panes across, not the number of panes.
*/
export function panesAreComfortable(
- count: number,
+ columns: number,
containerWidthPx: number,
): boolean {
- const width = paneWidthAt(count, containerWidthPx);
+ const width = paneWidthAt(columns, containerWidthPx);
// An unmeasured container says nothing yet — and "we have not measured" must
// not render as a warning, or the wizard opens shouting at every user once.
return width === 0 || width >= COMFORTABLE_PANE_WIDTH_PX;
}
+/** What `columnDepthFor` needs to know about the workspace on screen. */
+export interface RefoldMeasurements {
+ /** How many panes the workspace holds. */
+ paneCount: number;
+ /** The canvas all of them share, in px. */
+ canvasWidthPx: number;
+ canvasHeightPx: number;
+ /**
+ * The width ONE pane needs to show the whole terminal it is drawing.
+ *
+ * Measured by the panes themselves and reported upwards, never estimated
+ * here. Only a pane knows the reader's
+ * chosen text size, and the figure that matters is `MIN_REAL_COLS` cells at
+ * exactly that size plus its own frame — arithmetic this module would have to
+ * duplicate, and would then get subtly wrong on the day a padding changes.
+ *
+ * Zero means nothing is clipped, which is the answer "one row is fine".
+ */
+ neededPaneWidthPx: number;
+ /**
+ * Below this a pane is too SHORT to be worth the width it just bought.
+ *
+ * A coding CLI anchors its input box to its bottom row, so a pane that has
+ * been folded until it can no longer hold the agent's interface has traded
+ * one unreadable pane for another (the same trade `MIN_REAL_ROWS` refuses in
+ * `./AgenticTerminal`). This is what stops the fold before that point.
+ */
+ minPaneHeightPx: number;
+}
+
+/**
+ * How deep the workspace's columns have to be for every pane to show itself.
+ *
+ * The workspace is always exactly one screenful — it never scrolls and never
+ * grows (see the header) — so the only room a pane can be given is room taken
+ * from somewhere else. Width is the axis that is failing: at the maintainer's
+ * text size six panes in a row are ~410 px each where a 60-column agent grid
+ * needs ~660, so a third of every terminal is drawn past its own tile edge and
+ * clipped (reported 2026-08-11, and read as the panes overlapping each other).
+ *
+ * Height is the axis that can pay for it. Folding the row in two halves the
+ * column count, and half as many columns are twice as wide — the panes get the
+ * width they were short of, and the text size the user chose is untouched. That
+ * ordering is the whole decision: shrinking the font instead was tried and
+ * withdrawn the same day it shipped (2026-08-11), because it silently overrode
+ * the toolbar's own size control.
+ *
+ * So: the smallest depth at which every pane clears `neededPaneWidthPx`, and
+ * never deeper than the height can carry. Depth 1 — one row, the shape the
+ * workspace has always opened in — whenever that already fits, because a fold
+ * nobody needs is a rearrangement behind the user's back.
+ *
+ * Returns a DEPTH (panes stacked per column), not a column count: that is what
+ * both `wizardPanes` and the backend's re-fold are expressed in.
+ */
+export function columnDepthFor(measurements: RefoldMeasurements): number {
+ const panes = Math.max(0, Math.trunc(measurements.paneCount));
+ const needed = measurements.neededPaneWidthPx;
+ if (panes <= 1) return 1;
+ // Nothing measured, or nothing clipped — either way there is no evidence the
+ // workspace is too narrow, and this must never fold on a guess.
+ if (!Number.isFinite(needed) || needed <= 0) return 1;
+ if (!Number.isFinite(measurements.canvasWidthPx) || measurements.canvasWidthPx <= 0) {
+ return 1;
+ }
+
+ const content = Math.max(0, measurements.canvasWidthPx - GRID_HORIZONTAL_PADDING_PX);
+ // How many columns still leave each one wide enough. At least one: a window
+ // too narrow for a single pane cannot be fixed by folding, and zero columns
+ // would divide by zero on the way to an infinite depth.
+ const affordable = Math.max(1, Math.floor(content / needed));
+ if (affordable >= panes) return 1;
+
+ const wanted = Math.ceil(panes / affordable);
+
+ // The ceiling the other axis imposes. An unmeasured height must not cap
+ // anything — during the first frames the canvas reports 0, and a cap of 1
+ // there would decide "one row" for a workspace nobody has measured yet.
+ const height = measurements.canvasHeightPx;
+ const floorPx = measurements.minPaneHeightPx;
+ if (!Number.isFinite(height) || height <= 0 || !Number.isFinite(floorPx) || floorPx <= 0) {
+ return wanted;
+ }
+ const bearable = Math.max(1, Math.floor(height / floorPx));
+ return Math.min(wanted, bearable);
+}
+
/** Where one pane sits in the CSS grid. All values are 1-based, as CSS wants. */
export interface PanePlacement {
column: number;
diff --git a/jarvis/ui/web/frontend/src/components/agentic/layout.width.test.ts b/jarvis/ui/web/frontend/src/components/agentic/layout.width.test.ts
index 2d9f640fe3..ad204552b9 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/layout.width.test.ts
+++ b/jarvis/ui/web/frontend/src/components/agentic/layout.width.test.ts
@@ -60,13 +60,27 @@ describe("the workspace never grows past its window", () => {
});
describe("splitting never re-deals the workspace", () => {
+ /**
+ * Panes as SPLITTING RIGHT leaves them — one column each.
+ *
+ * Written out here rather than taken from `wizardPanes`, which is no longer
+ * the same shape: a wizard workspace opens as columns of two now (see the
+ * suite below). The distinction is the whole point of these two suites. A
+ * count the user chose in advance, and watched the preview draw, may open in
+ * any shape it says it will. A pane added to a workspace already on screen
+ * may not move the panes already being read — which is what the reports below
+ * were about, and what this suite still pins.
+ */
+ const splits = (count: number) =>
+ Array.from({ length: count }, (_, index) => ({ column: index, slot: 0 }));
+
it("keeps splits side by side however many there are", () => {
// Reported 2026-07-31 as a re-wrap at the fourth split, and again
// 2026-08-03 at the sixth. Both had one cause: the layout decided how many
// panes may share a line. It does not any more — the split buttons ARE the
// user's arrangement, and the window is simply divided between them.
for (const count of [4, 6, 7, 12, 30]) {
- const grid = paneGrid(wizardPanes(count));
+ const grid = paneGrid(splits(count));
expect(grid.columns).toBe(count);
expect(grid.placements.every((p) => p.row === 1)).toBe(true);
}
@@ -75,8 +89,49 @@ describe("splitting never re-deals the workspace", () => {
it("puts the seventh terminal beside the sixth on a five-column window", () => {
// The exact case reported on 2026-08-03, with the maintainer's screenshot:
// five panes across, and the sixth landing on a row of its own below.
- const grid = paneGrid(wizardPanes(7));
+ const grid = paneGrid(splits(7));
expect(grid.placements[5]).toEqual({ column: 6, row: 1, rowSpan: 1 });
expect(grid.placements[6]).toEqual({ column: 7, row: 1, rowSpan: 1 });
});
});
+
+/**
+ * A workspace OPENS two panes deep — the answer to the 2026-08-11 report.
+ *
+ * Six terminals in a single row left each pane about 410 px on the maintainer's
+ * display. A pane narrower than the 60-column grid its agent draws in is clipped
+ * at the tile edge, so all six showed roughly two thirds of themselves and read
+ * as terminals shoved behind one another.
+ *
+ * The count itself is untouched: nothing here refuses a number or reshapes one
+ * after the fact. Thirty terminals still open as thirty — as fifteen columns of
+ * two, which is simply twice the width of thirty in a row.
+ */
+describe("a wizard workspace opens two panes deep", () => {
+ it("halves the columns the same count is spread over", () => {
+ for (const count of [4, 6, 12, 30]) {
+ const grid = paneGrid(wizardPanes(count));
+ expect(grid.columns).toBe(count / 2);
+ }
+ });
+
+ it("doubles the width every pane gets, which is what was being clipped", () => {
+ // The maintainer's own case: six terminals, and the width each one has to
+ // draw its agent's interface in.
+ const window = 2560;
+ const inARow = paneWidthAt(6, window);
+ const twoDeep = paneWidthAt(paneGrid(wizardPanes(6)).columns, window);
+ expect(twoDeep).toBeCloseTo(inARow * 2, 6);
+ });
+
+ it("carries the same shape into the comfort advice", () => {
+ // The readout quotes the COLUMN count, so the warning follows the panes'
+ // real width rather than the terminal count. Six on a laptop were cramped
+ // in a row and are not in three columns of two.
+ const laptop = 1440;
+ expect(panesAreComfortable(6, laptop)).toBe(false);
+ expect(panesAreComfortable(paneGrid(wizardPanes(6)).columns, laptop)).toBe(
+ true,
+ );
+ });
+});
diff --git a/jarvis/ui/web/frontend/src/components/agentic/useVoiceCall.ts b/jarvis/ui/web/frontend/src/components/agentic/useVoiceCall.ts
index 098f49d121..11f7c46259 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/useVoiceCall.ts
+++ b/jarvis/ui/web/frontend/src/components/agentic/useVoiceCall.ts
@@ -21,8 +21,8 @@ export function isVoiceActive(state: VoiceState): boolean {
* The one start/stop path shared by every Agentic IDE voice surface.
*
* Keeping the request and its user-visible failure handling here prevents the
- * command deck and floating bubble from becoming two controls that look alike
- * but behave differently.
+ * toolbar button and the floating bubble from becoming two controls that look
+ * alike but behave differently.
*/
export function useVoiceCall() {
const t = useT();
diff --git a/jarvis/ui/web/frontend/src/lib/agenticIdeApi.ts b/jarvis/ui/web/frontend/src/lib/agenticIdeApi.ts
index c919d9b7b6..813e41c22d 100644
--- a/jarvis/ui/web/frontend/src/lib/agenticIdeApi.ts
+++ b/jarvis/ui/web/frontend/src/lib/agenticIdeApi.ts
@@ -139,15 +139,6 @@ export interface TerminalState {
* refuses everything sent to it.
*/
accepts_prompts?: boolean;
- /**
- * Has the user taken this pane over in the Command Deck?
- *
- * While true the deck neither assigns work to it nor reports it — the honest
- * limit on "Jarvis runs the floor", for a pane holding a question only the
- * user can settle. Absent on a backend that predates the deck, which reads
- * as "not held" rather than as an error.
- */
- deck_hold?: boolean;
index: number;
/** Grid column, left to right. Each column is its own stack of panes. */
column: number;
@@ -1294,88 +1285,6 @@ export async function setFocusMode(enabled: boolean): Promise<boolean> {
return body.focus_mode;
}
-/**
- * One agent's news, waiting in the Command Deck's report lane.
- *
- * `headline` is the same clause the header bell shows, on purpose: the spoken
- * line, the card and the notification panel must not be able to disagree about
- * what happened. `kind` is a claim about the TERMINAL — "completed" means the
- * pane went quiet, never that the work is any good.
- */
-export interface DeckReport {
- id: string;
- workspace_id: string;
- pane_key: string;
- pane: string;
- agent: string;
- kind: "completed" | "needs_input" | "exited" | "failed";
- headline: string;
- detail: string;
- at: number;
- state: "pending" | "on_air" | "reported" | "dropped";
- spoken: boolean;
-}
-
-export interface DeckQueue {
- /** True once a line went unanswered — the deck has stopped offering. */
- sleeping: boolean;
- in_conversation: boolean;
- on_air: DeckReport | null;
- pending: DeckReport[];
- reports: DeckReport[];
-}
-
-const EMPTY_QUEUE: DeckQueue = {
- sleeping: false,
- in_conversation: false,
- on_air: null,
- pending: [],
- reports: [],
-};
-
-export async function fetchDeckQueue(): Promise<DeckQueue> {
- const res = await fetch("/api/agentic-ide/deck/queue", { cache: "no-store" });
- if (!res.ok) throw new Error(await detail(res));
- return { ...EMPTY_QUEUE, ...((await res.json()) as Partial<DeckQueue>) };
-}
-
-/**
- * Answer one report: hear it now, put the lane to sleep, or drop it.
- *
- * The same route the spoken answer takes — "tell me about Nova" and pressing
- * Nova's card are one instruction, and a second path for the second one is a
- * second thing to keep in step.
- */
-export async function ackDeckReport(
- id: string,
- action: "next" | "later" | "drop",
-): Promise<DeckQueue> {
- const res = await fetch("/api/agentic-ide/deck/ack", {
- method: "POST",
- headers: { "Content-Type": "application/json" },
- body: JSON.stringify({ id, action }),
- });
- if (!res.ok) throw new Error(await detail(res));
- return { ...EMPTY_QUEUE, ...((await res.json()) as Partial<DeckQueue>) };
-}
-
-/**
- * "I'll take this one" — and handing it back.
- *
- * While held, the deck stops assigning work to the pane and stops reporting
- * it, and the pane's own editor is unlocked. Everything else about it is
- * unchanged: it keeps running, keeps its recap, keeps its place.
- */
-export async function setDeckHold(name: string, held: boolean): Promise<boolean> {
- const res = await fetch(`/api/agentic-ide/deck/hold/${encodeURIComponent(name)}`, {
- method: "POST",
- headers: { "Content-Type": "application/json" },
- body: JSON.stringify({ held }),
- });
- if (!res.ok) throw new Error(await detail(res));
- return Boolean((await res.json()).deck_hold);
-}
-
/**
* Tell the backend which view is on screen, which pane it stages, and which
* one owns the next prompt.
@@ -1385,13 +1294,12 @@ export async function setDeckHold(name: string, held: boolean): Promise<boolean>
* chip remains an explicit target for the prompt bar, voice orb, and file drops.
*
* The view travels as a NAME rather than the `chat_view` boolean it replaced:
- * there are three of them now, and the backend reads this to decide more than
- * deixis — the Command Deck is the one surface allowed to speak a finished pane
- * out loud, so a wrong answer here is a wrong answer about whether Jarvis talks.
+ * a name keeps reading correctly when a third mode is added, where a boolean
+ * would have to be re-interpreted everywhere it is read.
*/
export async function syncAgenticIdeSurface(payload: {
workspaceId: string;
- view: "grid" | "chat" | "deck";
+ view: "grid" | "chat";
onScreen: boolean;
terminal: string | null;
promptTarget: string | null;
diff --git a/jarvis/ui/web/frontend/src/views/AgenticIdeView.test.tsx b/jarvis/ui/web/frontend/src/views/AgenticIdeView.test.tsx
index be2b1ff6c1..22ac9c110b 100644
--- a/jarvis/ui/web/frontend/src/views/AgenticIdeView.test.tsx
+++ b/jarvis/ui/web/frontend/src/views/AgenticIdeView.test.tsx
@@ -39,7 +39,6 @@ const launcherEnglish = vi.hoisted<Record<string, string>>(() => ({
"workspace_launcher.wizard.open_clis": "Open CLIs",
"workspace_launcher.wizard.views.grid.title": "Terminal grid",
"workspace_launcher.wizard.views.chat.title": "Chat view",
- "workspace_launcher.wizard.views.deck.title": "Command Deck",
}));
vi.mock("@/i18n", () => ({
useT: () => (key: string) => launcherEnglish[key] ?? key,
@@ -528,7 +527,7 @@ describe("Agentic IDE launcher", () => {
fireEvent.click(screen.getAllByText("workspace_launcher.agents.all")[0]);
fireEvent.click(screen.getByRole("button", { name: /choose the view/i }));
- for (const view of ["grid", "chat", "deck"] as const) {
+ for (const view of ["grid", "chat"] as const) {
const panes = screen
.getByTestId(`view-choice-${view}`)
.querySelectorAll("[data-view-preview-pane]");
diff --git a/jarvis/voice/action_phrases.py b/jarvis/voice/action_phrases.py
index ff111aaa86..dad71e1ab3 100644
--- a/jarvis/voice/action_phrases.py
+++ b/jarvis/voice/action_phrases.py
@@ -361,22 +361,6 @@ _PHRASES: dict[str, dict[str, str]] = {
"en": "I could not reach {failed}, so nothing is running.",
"es": "No pude llegar a {failed}, así que no hay nada en marcha.",
},
- # The Command Deck was handed work with nobody's name on it and has no
- # agent free to take it. Said rather than queued: a silently held order is
- # how a user ends up waiting on work that was never started.
- "ide_deck_nobody_free": {
- "de": "Alle arbeiten noch. Soll ich einen dazuholen?", # i18n-allow
- "en": "Nobody is free right now — they are all still working. Shall I open one?",
- "es": "Ahora mismo no hay nadie libre, todos siguen trabajando. ¿Abro uno?",
- },
- # No agent pane at all: an empty workspace, or one holding only plain
- # shells. A different sentence from the one above, because the answer the
- # user needs is different.
- "ide_deck_no_agents": {
- "de": "In diesem Workspace läuft noch kein Agent. Soll ich einen öffnen?", # i18n-allow
- "en": "There is no agent running in this workspace yet. Shall I open one?",
- "es": "Todavía no hay ningún agente en este espacio. ¿Abro uno?",
- },
# Typed into the input box but never submitted — looks identical to a
# running agent until you ask it something (the 2026-07-25 popup trap).
"ide_prompt_typed_not_started": {
diff --git a/tests/unit/agentic_ide/test_fanout.py b/tests/unit/agentic_ide/test_fanout.py
index 10f1b23618..d621d78ac5 100644
--- a/tests/unit/agentic_ide/test_fanout.py
+++ b/tests/unit/agentic_ide/test_fanout.py
@@ -16,6 +16,7 @@ takes the quality tier 10-21 s, and a voice turn is abandoned after 20 s. Eight
panes composed one after another cannot be delivered inside any turn at all, so
the peak-concurrency guard below pins the behaviour the feature depends on.
"""
+
from __future__ import annotations
import asyncio
@@ -97,9 +98,7 @@ class Recorder:
self.sent[name] = text
# Mirrors Registry.send_prompt, which returns the Terminal carrying the
# submitted flag.
- return SimpleNamespace(
- name=name, submitted=name not in self.not_submitted_for
- )
+ return SimpleNamespace(name=name, submitted=name not in self.not_submitted_for)
def _session(*names: str) -> FakeSession:
@@ -578,3 +577,93 @@ async def test_only_a_live_pane_with_a_pty_is_written_to(status: str) -> None:
)
assert rec.sent == {}
assert result.undelivered[0].terminal == "Iris"
+
+
+# ------------------------------------------------------- the duplicate memory
+# Live failure 2026-08-11 16:38: the same spoken order was fanned out twice,
+# 37 s apart, because the second caller (the router brain) could not see that
+# the first fleet was already composing. The memory below is what the /fanout
+# route consults before opening a second fleet for the same order.
+
+ORDER = "fix all bugs on macOS and check the git history on GitHub for anomalies"
+
+
[email protected](autouse=True)
+def _fresh_duplicate_memory() -> None:
+ fanout._RECENT_FANOUTS.clear()
+ yield
+ fanout._RECENT_FANOUTS.clear()
+
+
+def _workspace(workspace_id: str, *names: str) -> FakeSession:
+ session = _session(*names)
+ session.id = workspace_id # FakeSession carries no id by default
+ return session
+
+
+async def test_a_delivery_is_visible_to_the_guard_while_still_composing() -> None:
+ """The record is written at delivery START — the live duplicate arrived
+ mid-composition, when a completion-time record would not have existed."""
+ session = _workspace("ide_1", "T5", "T6")
+ rec = Recorder(delay=0.05)
+ task = asyncio.ensure_future(
+ fanout.deliver(
+ session=session,
+ terminals=["T5", "T6"],
+ utterance=ORDER,
+ compose=rec.compose,
+ send=rec.send,
+ )
+ )
+ await asyncio.sleep(0.01) # composing, nowhere near done
+ try:
+ duplicate = fanout.find_duplicate_fanout(session, ORDER)
+ assert duplicate is not None
+ assert duplicate.terminals == ("T5", "T6")
+ finally:
+ await task
+
+
+async def test_the_match_survives_a_rephrased_word() -> None:
+ session = _workspace("ide_1", "T5")
+ fanout.record_fanout(session, ORDER.replace("GitHub", "GitHuib"), ["T5"])
+ assert fanout.find_duplicate_fanout(session, ORDER) is not None
+
+
+async def test_a_different_task_is_no_duplicate() -> None:
+ session = _workspace("ide_1", "T5")
+ fanout.record_fanout(session, ORDER, ["T5"])
+ other = "write end-to-end tests for the wake-word pipeline and fix the flaky ones"
+ assert fanout.find_duplicate_fanout(session, other) is None
+
+
+async def test_the_memory_is_bound_to_its_workspace() -> None:
+ """Names are grid positions: another workspace's T5 is a different pane."""
+ first = _workspace("ide_1", "T5")
+ second = _workspace("ide_2", "T5")
+ fanout.record_fanout(first, ORDER, ["T5"])
+ assert fanout.find_duplicate_fanout(second, ORDER) is None
+
+
+async def test_an_old_order_no_longer_shadows_a_new_one() -> None:
+ session = _workspace("ide_1", "T5")
+ fanout.record_fanout(session, ORDER, ["T5"], now=1000.0)
+ late = 1000.0 + fanout.DUPLICATE_WINDOW_S + 1.0
+ assert fanout.find_duplicate_fanout(session, ORDER, now=late) is None
+
+
+async def test_closed_panes_make_the_rerun_legitimate() -> None:
+ session = _workspace("ide_1", "T5", "T6")
+ fanout.record_fanout(session, ORDER, ["T5", "T6"])
+ session.terminals = [t for t in session.terminals if t.name == "T6"]
+ duplicate = fanout.find_duplicate_fanout(session, ORDER)
+ assert duplicate is not None and duplicate.terminals == ("T6",)
+ session.terminals = []
+ assert fanout.find_duplicate_fanout(session, ORDER) is None
+
+
+async def test_a_sessionless_delivery_records_nothing() -> None:
+ """FakeSession has no id here — exactly like a caller outside a workspace."""
+ session = _session("T5")
+ fanout.record_fanout(session, ORDER, ["T5"])
+ assert not fanout._RECENT_FANOUTS
diff --git a/tests/unit/agentic_ide/test_fanout_route.py b/tests/unit/agentic_ide/test_fanout_route.py
index 397edeea56..2991f6054c 100644
--- a/tests/unit/agentic_ide/test_fanout_route.py
+++ b/tests/unit/agentic_ide/test_fanout_route.py
@@ -37,6 +37,16 @@ def _isolated_recents(
monkeypatch.setattr(recents, "_store_path", lambda: store)
[email protected](autouse=True)
+def _fresh_duplicate_memory() -> None:
+ """The duplicate guard's memory is module-level; tests must not share it."""
+ from jarvis.agentic_ide import fanout
+
+ fanout._RECENT_FANOUTS.clear()
+ yield
+ fanout._RECENT_FANOUTS.clear()
+
+
@pytest.fixture(autouse=True)
def _offline_planner(monkeypatch: pytest.MonkeyPatch) -> None:
"""No provider: the deterministic split carries every test here.
@@ -384,6 +394,121 @@ async def test_fanout_opens_and_briefs_a_pane_in_one_call(
assert body["undelivered"] == []
+# ---------------------------------------------------------- duplicate spawns
+# Live failure 2026-08-11 16:38: a spoken "open two terminals and have them fix
+# the macOS bugs" was executed once, and 37 s later the router brain — whose
+# context did not yet show the first fleet's success — issued the same order
+# again with spawn. Four agents ended up racing on one task in one shared
+# working tree. The route now refuses the repeat while the first fleet's panes
+# are still open, BEFORE any pane is created.
+
+
+async def test_a_repeated_spawn_for_the_same_order_is_refused(
+ mounting_client: TestClient, registry: Registry, tmp_path: Path
+) -> None:
+ await _live_workspace(registry, tmp_path, 1)
+ first = mounting_client.post(
+ "/api/agentic-ide/fanout",
+ json={
+ "instruction": "fix all bugs on macOS and check the git history on GitHub",
+ "spawn": [{"count": 2}],
+ },
+ )
+ assert first.status_code == 200
+ briefed = [d["terminal"] for d in first.json()["delivered"]]
+ assert registry.session is not None
+ panes_before = len(registry.session.terminals)
+
+ # The router re-dictating an order is not byte-identical — the live
+ # duplicate had corrected a transcription typo. Near-identical must match.
+ second = mounting_client.post(
+ "/api/agentic-ide/fanout",
+ json={
+ "instruction": "fix all bugs on macOS and check the Git history on GitHub",
+ "spawn": [{"count": 2}],
+ },
+ )
+
+ assert second.status_code == 409
+ detail = second.json()["detail"]
+ assert all(name in detail for name in briefed), "the working panes are named"
+ assert "force" in detail, "the deliberate-repeat escape hatch is named"
+ assert len(registry.session.terminals) == panes_before, "no pane was opened"
+
+
+async def test_force_spawns_the_same_order_again(
+ mounting_client: TestClient, registry: Registry, tmp_path: Path
+) -> None:
+ """An explicit "run it again" stays possible — it just has to be explicit."""
+ await _live_workspace(registry, tmp_path, 1)
+ instruction = "fix all bugs on macOS and check the git history on GitHub"
+ mounting_client.post(
+ "/api/agentic-ide/fanout", json={"instruction": instruction, "spawn": [{"count": 2}]}
+ )
+
+ repeat = mounting_client.post(
+ "/api/agentic-ide/fanout",
+ json={"instruction": instruction, "spawn": [{"count": 2}], "force": True},
+ )
+
+ assert repeat.status_code == 200
+ assert len(repeat.json()["opened"]) == 2
+
+
+async def test_rebriefing_existing_panes_is_never_a_duplicate(
+ mounting_client: TestClient, registry: Registry, tmp_path: Path
+) -> None:
+ """Only a SPAWN repeat is refused.
+
+ Re-briefing panes the user can see is cheap and often deliberate ("tell
+ them again"); the guard exists for the invisible second fleet, not for it.
+ """
+ names = await _live_workspace(registry, tmp_path, 2)
+ instruction = "fix all bugs on macOS and check the git history on GitHub"
+ first = mounting_client.post(
+ "/api/agentic-ide/fanout", json={"instruction": instruction, "terminals": names}
+ )
+ assert first.status_code == 200
+
+ again = mounting_client.post(
+ "/api/agentic-ide/fanout", json={"instruction": instruction, "terminals": names}
+ )
+
+ assert again.status_code == 200
+
+
+async def test_a_repeat_after_the_first_fleet_closed_is_legitimate(
+ mounting_client: TestClient, registry: Registry, tmp_path: Path
+) -> None:
+ """Gone panes make a re-run a fresh order, not a duplicate."""
+ await _live_workspace(registry, tmp_path, 1)
+ instruction = "fix all bugs on macOS and check the git history on GitHub"
+ first = mounting_client.post(
+ "/api/agentic-ide/fanout", json={"instruction": instruction, "spawn": [{"count": 2}]}
+ )
+ briefed = [d["terminal"] for d in first.json()["delivered"]]
+ await registry.close_terminals(briefed)
+
+ second = mounting_client.post(
+ "/api/agentic-ide/fanout", json={"instruction": instruction, "spawn": [{"count": 2}]}
+ )
+
+ assert second.status_code == 200
+
+
+async def test_short_steering_strokes_are_never_duplicates(
+ mounting_client: TestClient, registry: Registry, tmp_path: Path
+) -> None:
+ """Fleet-wide "continue" twice in a row is normal steering, not a repeat."""
+ await _live_workspace(registry, tmp_path, 1)
+ for _ in range(2):
+ response = mounting_client.post(
+ "/api/agentic-ide/fanout",
+ json={"instruction": "continue", "spawn": [{"count": 1}]},
+ )
+ assert response.status_code == 200
+
+
async def test_opening_panes_brings_the_workspace_forward(
mounting_client: TestClient, registry: Registry, tmp_path: Path
) -> None:
diff --git a/tests/unit/agentic_ide/test_pane_move.py b/tests/unit/agentic_ide/test_pane_move.py
index 2501192de0..920cb4ff35 100644
--- a/tests/unit/agentic_ide/test_pane_move.py
+++ b/tests/unit/agentic_ide/test_pane_move.py
@@ -46,6 +46,21 @@ async def _open(registry: Registry, folder: Path, count: int = 2):
return await registry.start(str(folder), [{"agent": "claude"} for _ in range(count)])
+async def _open_in_a_row(registry: Registry, folder: Path, count: int):
+ """``count`` panes side by side — one column each, every slot 0.
+
+ The starting arrangement of nearly every test here, and stated rather than
+ inherited: a wizard workspace OPENS as columns of two now
+ (``WIZARD_COLUMN_HEIGHT``), and these tests are about what a drop does to an
+ arrangement, not about which one the wizard produces. Built the way a user
+ builds a row — open one pane, split it rightwards.
+ """
+ session = await _open(registry, folder, 1)
+ for _ in range(max(0, count - 1)):
+ await registry.add_terminal(direction="right")
+ return session
+
+
def _layout(registry: Registry) -> list[tuple[str, int, int]]:
"""(name, column, slot) in render order — the shape the grid draws."""
return [(t.name, t.column, t.slot) for t in registry.session.terminals]
@@ -64,7 +79,7 @@ async def test_swap_exchanges_two_panes_and_keeps_the_shape(
registry: Registry, tmp_path: Path
) -> None:
"""The move a user reaches for most: these two are the wrong way round."""
- await _open(registry, tmp_path, 3)
+ await _open_in_a_row(registry, tmp_path, 3)
await registry.move_terminal("T1", target="T3", position="swap")
assert _layout(registry) == [("T3", 0, 0), ("T2", 1, 0), ("T1", 2, 0)]
@@ -73,7 +88,7 @@ async def test_swap_works_between_a_stacked_pane_and_a_lone_one(
registry: Registry, tmp_path: Path
) -> None:
"""Columns of different heights: the two places trade, the stacks do not."""
- await _open(registry, tmp_path, 2)
+ await _open_in_a_row(registry, tmp_path, 2)
lower = await registry.add_terminal(anchor="T1", direction="down")
assert _layout(registry) == [("T1", 0, 0), (lower.name, 0, 1), ("T2", 1, 0)]
@@ -85,7 +100,7 @@ async def test_swap_works_between_a_stacked_pane_and_a_lone_one(
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 _open_in_a_row(registry, tmp_path, 3)
await registry.move_terminal("T1", target="T2", position="right")
assert _layout(registry) == [("T2", 0, 0), ("T1", 1, 0), ("T3", 2, 0)]
@@ -93,7 +108,7 @@ async def test_moving_right_of_a_pane_puts_it_in_its_own_column(
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 _open_in_a_row(registry, tmp_path, 3)
await registry.move_terminal("T3", target="T2", position="left")
assert _layout(registry) == [("T1", 0, 0), ("T3", 1, 0), ("T2", 2, 0)]
@@ -102,7 +117,7 @@ async def test_moving_to_the_side_it_is_already_on_changes_nothing(
registry: Registry, tmp_path: Path
) -> None:
"""The no-op drag must not walk a pane one column further every time."""
- await _open(registry, tmp_path, 3)
+ await _open_in_a_row(registry, tmp_path, 3)
await registry.move_terminal("T1", target="T2", position="left")
assert _layout(registry) == [("T1", 0, 0), ("T2", 1, 0), ("T3", 2, 0)]
@@ -122,7 +137,7 @@ async def test_moving_below_a_pane_joins_its_column(
registry: Registry, tmp_path: Path
) -> None:
"""Only the target's column moves; every other column keeps its height."""
- await _open(registry, tmp_path, 3)
+ await _open_in_a_row(registry, tmp_path, 3)
await registry.move_terminal("T3", target="T1", position="below")
assert _layout(registry) == [("T1", 0, 0), ("T3", 0, 1), ("T2", 1, 0)]
@@ -130,7 +145,7 @@ async def test_moving_below_a_pane_joins_its_column(
async def test_moving_above_a_pane_pushes_its_stack_down(
registry: Registry, tmp_path: Path
) -> None:
- await _open(registry, tmp_path, 2)
+ await _open_in_a_row(registry, tmp_path, 2)
lower = await registry.add_terminal(anchor="T1", direction="down")
await registry.move_terminal("T2", target=lower.name, position="above")
assert _layout(registry) == [
@@ -157,7 +172,7 @@ async def test_emptying_a_column_repacks_the_grid(
registry: Registry, tmp_path: Path
) -> None:
"""A vacated column would otherwise render as a blank stripe."""
- await _open(registry, tmp_path, 3)
+ await _open_in_a_row(registry, tmp_path, 3)
await registry.move_terminal("T2", target="T3", position="below")
assert _layout(registry) == [("T1", 0, 0), ("T3", 1, 0), ("T2", 1, 1)]
@@ -167,7 +182,7 @@ async def test_dropping_a_pane_on_itself_changes_nothing(
registry: Registry, tmp_path: Path
) -> None:
"""A cancelled gesture, not an error — it must not raise at the user."""
- await _open(registry, tmp_path, 2)
+ await _open_in_a_row(registry, tmp_path, 2)
await registry.move_terminal("T1", target="T1", position="right")
assert _layout(registry) == [("T1", 0, 0), ("T2", 1, 0)]
@@ -175,13 +190,13 @@ async def test_dropping_a_pane_on_itself_changes_nothing(
async def test_an_unknown_pane_names_the_running_ones(
registry: Registry, tmp_path: Path
) -> None:
- await _open(registry, tmp_path, 2)
+ await _open_in_a_row(registry, tmp_path, 2)
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)
+ await _open_in_a_row(registry, tmp_path, 2)
with pytest.raises(SessionError, match="Gandalf"):
await registry.move_terminal("T1", target="Gandalf", position="swap")
@@ -189,7 +204,7 @@ async def test_an_unknown_target_is_refused(registry: Registry, tmp_path: Path)
async def test_an_impossible_position_is_refused(
registry: Registry, tmp_path: Path
) -> None:
- await _open(registry, tmp_path, 2)
+ await _open_in_a_row(registry, tmp_path, 2)
with pytest.raises(SessionError, match="Position must be"):
await registry.move_terminal("T1", target="T2", position="diagonally")
@@ -204,7 +219,7 @@ async def test_moving_a_pane_leaves_its_agent_running(
registry: Registry, fake_pty: FakePtyManager, tmp_path: Path
) -> None:
"""The whole premise: rearranging is not a close-and-reopen."""
- await _open(registry, tmp_path, 2)
+ await _open_in_a_row(registry, tmp_path, 2)
await registry.attach("T1", 80, 24, _noop, _noop_exit)
pty_id = registry.session.find("T1").pty_id
diff --git a/tests/unit/agentic_ide/test_pane_refold.py b/tests/unit/agentic_ide/test_pane_refold.py
new file mode 100644
index 0000000000..ef1ac7e3ae
--- /dev/null
+++ b/tests/unit/agentic_ide/test_pane_refold.py
@@ -0,0 +1,198 @@
+"""Re-folding a whole workspace into columns of a given depth.
+
+`test_pane_move.py` pins what ONE drop does; this pins what the app does on its
+own initiative when a row has become too narrow to show the agents in it. The
+two share an axis and nothing else: a move is a gesture the user made, a re-fold
+is the grid answering a measurement.
+
+Every failure mode here is silent on screen, which is why the arithmetic is
+pinned rather than trusted. A fold that loses the reading order shuffles panes
+the user knows by position; a fold that is not idempotent walks the workspace
+one column further on every measurement; and a fold that touched a PTY would
+resize a working agent's terminal for a layout change it has no part in.
+"""
+from __future__ import annotations
+
+from pathlib import Path
+
+import pytest
+
+from jarvis.agentic_ide import session as session_mod
+from jarvis.agentic_ide.session import Registry, SessionError
+from tests.fakes.fake_pty_manager import FakePtyManager
+
+
[email protected](autouse=True)
+def _isolated_recents(
+ tmp_path_factory: pytest.TempPathFactory, monkeypatch: pytest.MonkeyPatch
+) -> None:
+ """Keep the recents file out of the developer's real data directory."""
+ from jarvis.agentic_ide import recents
+
+ store = tmp_path_factory.mktemp("recents") / "recents.json"
+ monkeypatch.setattr(recents, "_store_path", lambda: store)
+
+
+def fake_pty() -> FakePtyManager:
+ return FakePtyManager()
+
+
+def registry(fake_pty: FakePtyManager, monkeypatch: pytest.MonkeyPatch) -> Registry:
+ monkeypatch.setattr(session_mod, "agent_argv", lambda name: (f"/usr/bin/{name}",))
+ return Registry(pty_manager=fake_pty)
+
+
+async def _open_in_a_row(registry: Registry, folder: Path, count: int) -> None:
+ """``count`` panes side by side — the shape a re-fold exists to repair.
+
+ Built the way a user builds a row (open one, split it rightwards) rather
+ than through the wizard, which opens columns of two of its own accord.
+ """
+ await registry.start(str(folder), [{"agent": "claude"}])
+ for _ in range(max(0, count - 1)):
+ await registry.add_terminal(direction="right")
+
+
+def _layout(registry: Registry) -> list[tuple[str, int, int]]:
+ """(name, column, slot) in render order — the shape the grid draws."""
+ return [(t.name, t.column, t.slot) for t in registry.session.terminals]
+
+
+# ------------------------------------------------------------------ the fold
+async def test_folds_a_row_of_six_into_three_columns_of_two(
+ registry: Registry, tmp_path: Path
+) -> None:
+ """The reported workspace, at the depth its measurement asks for.
+
+ Six panes in a row at the maintainer's text size were ~410 px each where a
+ 60-column agent grid needs ~660, so every terminal drew a third of itself
+ past its own tile edge (2026-08-11). Three columns of two is twice the
+ width, at the same text size.
+ """
+ await _open_in_a_row(registry, tmp_path, 6)
+ await registry.refold(2)
+ assert _layout(registry) == [
+ ("T1", 0, 0),
+ ("T2", 0, 1),
+ ("T3", 1, 0),
+ ("T4", 1, 1),
+ ("T5", 2, 0),
+ ("T6", 2, 1),
+ ]
+
+
+async def test_keeps_reading_order_across_the_fold(
+ registry: Registry, tmp_path: Path
+) -> None:
+ """Panes stay in the sequence the user knows them by.
+
+ A fold is not a shuffle: the pane that was fourth from the left is still the
+ fourth pane, it has simply moved onto the second row. Losing that is how a
+ layout repair turns into "the app moved my agents around".
+ """
+ await _open_in_a_row(registry, tmp_path, 5)
+ before = [name for name, _, _ in _layout(registry)]
+ await registry.refold(2)
+ assert [name for name, _, _ in _layout(registry)] == before
+
+
+async def test_an_odd_count_leaves_the_last_column_short(
+ registry: Registry, tmp_path: Path
+) -> None:
+ """Five panes at depth two is two full columns and a lone one.
+
+ The grid gives a short column the same total height (`paneGrid` spans its
+ rows), so the odd pane is tall rather than leaving a hole.
+ """
+ await _open_in_a_row(registry, tmp_path, 5)
+ await registry.refold(2)
+ assert _layout(registry) == [
+ ("T1", 0, 0),
+ ("T2", 0, 1),
+ ("T3", 1, 0),
+ ("T4", 1, 1),
+ ("T5", 2, 0),
+ ]
+
+
+async def test_folding_back_to_one_returns_the_single_row(
+ registry: Registry, tmp_path: Path
+) -> None:
+ """The fold is reversible — a wider window undoes it.
+
+ Without this the repair would be a one-way door: plugging in a big display
+ would leave the workspace folded for a narrowness that is over.
+ """
+ await _open_in_a_row(registry, tmp_path, 4)
+ await registry.refold(2)
+ await registry.refold(1)
+ assert _layout(registry) == [("T1", 0, 0), ("T2", 1, 0), ("T3", 2, 0), ("T4", 3, 0)]
+
+
+# ------------------------------------------------------------- not a ratchet
+async def test_refolding_to_the_current_depth_changes_nothing(
+ registry: Registry, tmp_path: Path
+) -> None:
+ """Idempotent, because the grid asks on every measurement.
+
+ Once the shape is right the grid keeps arriving at the same answer, and a
+ fold that moved something each time would walk the workspace apart one
+ measurement at a time.
+ """
+ await _open_in_a_row(registry, tmp_path, 6)
+ await registry.refold(2)
+ settled = _layout(registry)
+ await registry.refold(2)
+ await registry.refold(2)
+ assert _layout(registry) == settled
+
+
+async def test_a_depth_past_the_pane_count_is_one_column_not_an_error(
+ registry: Registry, tmp_path: Path
+) -> None:
+ """The caller derives the depth from a measurement; it may overshoot.
+
+ Clamping here rather than refusing keeps that arithmetic out of the browser,
+ where it would drift from this one.
+ """
+ await _open_in_a_row(registry, tmp_path, 3)
+ await registry.refold(99)
+ assert _layout(registry) == [("T1", 0, 0), ("T2", 0, 1), ("T3", 0, 2)]
+
+
+async def test_a_depth_below_one_is_refused(registry: Registry, tmp_path: Path) -> None:
+ """Zero deep is not a shape. It would also divide by zero on the way in."""
+ await _open_in_a_row(registry, tmp_path, 2)
+ with pytest.raises(SessionError, match="at least 1"):
+ await registry.refold(0)
+
+
+async def test_refolding_without_a_workspace_is_refused(registry: Registry) -> None:
+ with pytest.raises(SessionError, match="No Agentic-IDE session"):
+ await registry.refold(2)
+
+
+# ------------------------------------------------------- nothing else moves
+async def test_folding_starts_and_stops_no_agent(
+ registry: Registry, fake_pty: FakePtyManager, tmp_path: Path
+) -> None:
+ """The property that makes folding safe to do on the app's own initiative.
+
+ A re-fold changes the two numbers that say where a pane is DRAWN. If it ever
+ reached the pty layer it would be spawning or resizing working agents'
+ terminals from the backend — geometry the panes themselves own and measure
+ — so the pty manager is asserted to have seen nothing at all.
+ """
+ await _open_in_a_row(registry, tmp_path, 4)
+ spawns = len(fake_pty.spawns)
+ resizes = len(fake_pty.resizes)
+ before = {t.key: t.name for t in registry.session.terminals}
+
+ await registry.refold(2)
+
+ assert len(fake_pty.spawns) == spawns
+ assert len(fake_pty.resizes) == resizes
+ # Same panes, same agents, same keys — only their coordinates moved.
+ assert {t.key: t.name for t in registry.session.terminals} == before
diff --git a/tests/unit/agentic_ide/test_panes.py b/tests/unit/agentic_ide/test_panes.py
index d9457d621d..b3bbd1e53c 100644
--- a/tests/unit/agentic_ide/test_panes.py
+++ b/tests/unit/agentic_ide/test_panes.py
@@ -34,6 +34,23 @@ async def _open(registry: Registry, folder: Path, count: int = 2):
)
+async def _open_in_a_row(registry: Registry, folder: Path, count: int):
+ """A workspace of ``count`` panes side by side — one column each.
+
+ The wizard opens COLUMNS OF TWO now (``WIZARD_COLUMN_HEIGHT``), so a row is
+ built here the way a user builds one: open a pane, then split it rightwards.
+
+ Stated rather than inherited on purpose. The tests that use this are about
+ what a split button does to an arrangement, so the arrangement they start
+ from is part of the test — taking it from whatever shape the wizard happens
+ to open in is how they came to fail when that shape changed.
+ """
+ session = await _open(registry, folder, 1)
+ for _ in range(max(0, count - 1)):
+ await registry.add_terminal(direction="right")
+ return session
+
+
def _layout(registry: Registry) -> list[tuple[str, int, int]]:
"""(name, column, slot) in render order — the shape the grid draws.
@@ -52,19 +69,34 @@ async def _noop_exit(_code: int) -> None:
# --------------------------------------------------------------- initial rows
-async def test_a_fresh_workspace_puts_every_pane_in_its_own_column(
+async def test_a_fresh_workspace_fills_columns_two_deep(
registry: Registry, tmp_path: Path
) -> None:
- """The wizard's panes stand side by side: one column each, top slot."""
+ """The wizard's panes stack two to a column before a new one is opened.
+
+ A row of columns shares the window's width between every pane, so six
+ terminals left each about 410 px on the maintainer's display — under the
+ width their agent needs, so each pane was clipped at its tile edge and the
+ six read as overlapping (2026-08-11). Two deep halves the columns and so
+ doubles each pane's width. The odd third pane opens a column of its own.
+ """
await _open(registry, tmp_path, 3)
- assert _layout(registry) == [("T1", 0, 0), ("T2", 1, 0), ("T3", 2, 0)]
+ assert _layout(registry) == [("T1", 0, 0), ("T2", 0, 1), ("T3", 1, 0)]
+
+
+async def test_a_single_terminal_still_opens_alone(
+ registry: Registry, tmp_path: Path
+) -> None:
+ """Nothing is stacked that has nothing to stack with."""
+ await _open(registry, tmp_path, 1)
+ assert _layout(registry) == [("T1", 0, 0)]
# ---------------------------------------------------------------- split right
async def test_split_right_opens_a_column_next_to_the_anchor(
registry: Registry, tmp_path: Path
) -> None:
- await _open(registry, tmp_path, 2)
+ await _open_in_a_row(registry, tmp_path, 2)
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.
@@ -94,7 +126,7 @@ async def test_split_down_stacks_inside_the_anchor_column(
) -> None:
"""The point of the column model: splitting one pane must not squash the
others. T2 keeps its own full-height column."""
- await _open(registry, tmp_path, 2)
+ await _open_in_a_row(registry, tmp_path, 2)
term = await registry.add_terminal(anchor="T1", direction="down")
assert (term.column, term.slot) == (0, 1)
assert _layout(registry) == [("T1", 0, 0), (term.name, 0, 1), ("T2", 1, 0)]
@@ -214,7 +246,7 @@ async def test_closing_a_whole_column_repacks_the_columns(
registry: Registry, tmp_path: Path
) -> None:
"""An emptied column would render as a blank stripe."""
- await _open(registry, tmp_path, 3)
+ await _open_in_a_row(registry, tmp_path, 3)
await registry.close_terminal("T2")
assert _layout(registry) == [("T1", 0, 0), ("T3", 1, 0)]
diff --git a/tests/unit/agentic_ide/test_session.py b/tests/unit/agentic_ide/test_session.py
index d31a46329d..f3c020a47f 100644
--- a/tests/unit/agentic_ide/test_session.py
+++ b/tests/unit/agentic_ide/test_session.py
@@ -357,23 +357,22 @@ async def test_a_geometry_change_rebases_an_intact_replay_and_repaints(
async def test_a_crowded_grid_never_squeezes_the_agent_out_of_drawing(
registry: Registry, fake_pty: FakePtyManager, tmp_path: Path
) -> None:
- """A dozen panes side by side must not shrink the PTY below working size.
-
- The failure this pins is the one behind "working panes are shown as done"
- (maintainer, 2026-08-09, thirteen panes open). A crowded grid measures ~17
- columns per cell — a perfectly CORRECT measurement, which is why the old
- 8x2 plausibility floor let it straight through. The agent, handed a strip
- it cannot lay its interface out in, stops drawing: one pane printed its
- whole answer a character per line, six others fell silent for five minutes
- while their processes visibly burned CPU.
-
- The status badge then reads that silence as a finished job, because it
- reads screen MOVEMENT (:mod:`jarvis.agentic_ide.activity`) and there is
- none. So the badge cannot be fixed where it is wrong — the geometry has to
- stop lying to the agent first, which is what this test holds.
-
- Refused, not clamped: the PTY keeps the last size a viewer really measured,
- so the agent goes on drawing a frame some window is actually showing.
+ """The agent is told what the pane really shows, however narrow that is.
+
+ This test used to pin the opposite, and the reason it flipped is worth
+ keeping. A crowded grid measures ~17 columns per cell — a perfectly CORRECT
+ measurement — and the floor here used to refuse it, so the agent went on
+ drawing at a width no window had. That kept the CLI's interface intact at
+ the price of a pane rendering wider than the tile showing it, with the
+ remainder cut off at the edge. The maintainer read the result exactly as it
+ looked: terminals shoved behind one another (2026-08-11).
+
+ So a real measurement is now always passed through. A pane too narrow to be
+ useful stays visibly too narrow, which is information the user can act on —
+ the launcher warns from twenty terminals up and opens as many as they
+ confirm. The floor survives only for measurements that cannot be real (a
+ tile mid-layout reports 0), because a PTY at zero columns permanently
+ wrecks the agent's drawing.
"""
session = await _open(registry, tmp_path, [{"agent": "claude"}])
term = session.terminals[0]
@@ -382,45 +381,44 @@ async def test_a_crowded_grid_never_squeezes_the_agent_out_of_drawing(
fake_pty.resizes.clear()
# Thirteen panes across a laptop screen. Nothing here is an artifact — this
- # is what the cell honestly measures.
- assert registry.resize(term.name, 17, 6) is False
+ # is what the cell honestly measures, so it is what the agent hears.
+ assert registry.resize(term.name, 17, 6) is True
+ assert (pty, 17, 6) in fake_pty.resizes
+ assert (term.transcript.cols, term.transcript.rows) == (17, 6)
- assert fake_pty.resizes == [], "the agent must never be told it has 17 columns"
- assert (term.transcript.cols, term.transcript.rows) == (120, 40), (
- "the pane keeps the last geometry a viewer really had"
- )
+ # A size that cannot have been measured is still refused, and the pane keeps
+ # the last geometry a viewer really had.
+ assert registry.resize(term.name, 0, 0) is False
+ assert (term.transcript.cols, term.transcript.rows) == (17, 6)
- # And a size the agent CAN work in still gets through, or the floor would
- # have replaced a broken pane with a frozen one.
assert registry.resize(term.name, 90, 30) is True
assert (pty, 90, 30) in fake_pty.resizes
-async def test_a_pane_already_squeezed_is_lifted_back_to_a_workable_size(
+async def test_a_pane_under_the_crash_guard_is_lifted_off_it(
registry: Registry, fake_pty: FakePtyManager, tmp_path: Path
) -> None:
- """A pane stuck under the floor must not be trapped there by the floor.
+ """A pane stuck below the guard must not be trapped there by the guard.
- The state a crowded grid leaves behind, and the one nothing else gets a
- pane out of: the PTY is already a strip, so every later measurement of that
- same small tile is refused for keeping "the last honest geometry" — which
- here is the broken one. The pane stays silent and the badge goes on reading
- that silence as a finished job.
+ However it got under — an older client, a session that predates the change
+ — every later measurement of that same tile would be refused for keeping
+ "the last honest geometry", which here is a broken one. The pane would stay
+ silent and the status badge would go on reading that silence as a finished
+ job (:mod:`jarvis.agentic_ide.activity`).
"""
session = await _open(registry, tmp_path, [{"agent": "claude"}])
term = session.terminals[0]
await registry.attach(term.name, 120, 40, _noop_output, _noop_exit)
pty = term.pty_id
- # However it got there — an older client, a session that predates the floor.
- term.transcript.resize(20, 5)
+ term.transcript.resize(3, 2)
fake_pty.resizes.clear()
- assert registry.resize(term.name, 17, 6) is True
+ assert registry.resize(term.name, 0, 0) is True
- assert (term.transcript.cols, term.transcript.rows) == (60, 15), (
- "a pane below the floor is lifted to it, not left there"
+ assert (term.transcript.cols, term.transcript.rows) == (10, 4), (
+ "a pane below the guard is lifted to it, not left there"
)
- assert (pty, 60, 15) in fake_pty.resizes, "the agent must be told it has room again"
+ assert (pty, 10, 4) in fake_pty.resizes, "the agent must be told it has room again"
async def test_closing_a_workspace_stops_only_its_own_agents(
diff --git a/tests/unit/agentic_ide/test_surface_context_route.py b/tests/unit/agentic_ide/test_surface_context_route.py
index 8b25f2327a..9cf9623102 100644
--- a/tests/unit/agentic_ide/test_surface_context_route.py
+++ b/tests/unit/agentic_ide/test_surface_context_route.py
@@ -129,10 +129,10 @@ async def test_stale_workspace_cannot_replace_the_active_surface(
# --------------------------------------------------------------- named views
#
-# The boolean above became a three-value enum when the Command Deck arrived.
-# Both spellings are served: `view` is the contract, `chat_view` is what a
-# desktop WebView still holding the pre-deck bundle posts for the seconds
-# before it reloads itself.
+# The boolean above became a named enum once the view had to survive a third
+# mode being added. Both spellings are served: `view` is the contract,
+# `chat_view` is what a desktop WebView still holding an older bundle posts
+# for the seconds before it reloads itself.
def test_the_pydantic_literal_still_matches_the_source_of_truth() -> None:
@@ -150,17 +150,17 @@ def test_the_pydantic_literal_still_matches_the_source_of_truth() -> None:
assert set(get_args(agentic_ide_routes.WorkspaceViewName)) == set(WORKSPACE_VIEWS)
-async def test_the_deck_stages_one_pane_like_chat_does(
+async def test_a_named_chat_view_stages_one_pane(
client: TestClient, registry: Registry, tmp_path: Path
) -> None:
- """An unfolded deck card is a visible single pane, so "this one" resolves."""
+ """Chat view puts exactly one pane on screen, so "this one" resolves."""
session = await registry.start(str(tmp_path), [{"agent": "claude"}, {"agent": "codex"}])
response = client.put(
"/api/agentic-ide/surface-context",
json={
"workspace_id": session.id,
- "view": "deck",
+ "view": "chat",
"on_screen": True,
"terminal": "T2",
"prompt_target": "T2",
@@ -168,7 +168,7 @@ async def test_the_deck_stages_one_pane_like_chat_does(
)
assert response.status_code == 200
- assert session.surface_view == "deck"
+ assert session.surface_view == "chat"
assert session.contextual_terminal() is session.find("T2")
@@ -178,7 +178,7 @@ async def test_a_named_grid_view_clears_the_staged_pane(
session = await registry.start(str(tmp_path), [{"agent": "claude"}])
body = {
"workspace_id": session.id,
- "view": "deck",
+ "view": "chat",
"on_screen": True,
"terminal": "T1",
}
@@ -193,22 +193,22 @@ async def test_a_named_grid_view_clears_the_staged_pane(
async def test_a_hidden_section_reports_the_grid_however_it_was_left(
client: TestClient, registry: Registry, tmp_path: Path
) -> None:
- """The deck speaks; a deck nobody is looking at must not.
+ """A workspace nobody is looking at must not answer "this terminal".
Navigating to another section leaves this grid mounted behind it, so
- without this the workspace would still be filed as "deck on screen" and
- would go on reporting finished panes out loud from behind whatever the
- user actually switched to.
+ without this the workspace would still be filed as "chat on screen" and
+ would go on resolving "this one" to a pane hidden behind whatever the user
+ actually switched to.
"""
session = await registry.start(str(tmp_path), [{"agent": "claude"}])
body = {
"workspace_id": session.id,
- "view": "deck",
+ "view": "chat",
"on_screen": True,
"terminal": "T1",
}
client.put("/api/agentic-ide/surface-context", json=body)
- assert session.surface_view == "deck"
+ assert session.surface_view == "chat"
client.put("/api/agentic-ide/surface-context", json={**body, "on_screen": False})
@@ -216,7 +216,7 @@ async def test_a_hidden_section_reports_the_grid_however_it_was_left(
assert session.contextual_terminal() is None
-async def test_a_pre_deck_bundle_is_still_understood(
+async def test_an_older_bundle_is_still_understood(
client: TestClient, registry: Registry, tmp_path: Path
) -> None:
"""`chat_view` with no `view` is an old window, not a malformed request."""
diff --git a/tests/unit/web/test_agentic_ide_grid.py b/tests/unit/web/test_agentic_ide_grid.py
index e19907a37e..4417bb96e1 100644
--- a/tests/unit/web/test_agentic_ide_grid.py
+++ b/tests/unit/web/test_agentic_ide_grid.py
@@ -33,6 +33,21 @@ async def _workspace(tmp_path, panes: int = 3) -> Registry:
return registry
+async def _row(tmp_path, panes: int = 3) -> Registry:
+ """``panes`` side by side — one column each, every slot 0.
+
+ A workspace no longer OPENS in this shape: the wizard fills columns two
+ deep (``WIZARD_COLUMN_HEIGHT``). So a row is built the way a user builds
+ one, by splitting rightwards, and the split tests below say out loud which
+ arrangement they are splitting rather than inheriting whichever one the
+ wizard happens to produce.
+ """
+ registry = await _workspace(tmp_path, 1)
+ for _ in range(max(0, panes - 1)):
+ await registry.add_terminal(direction="right")
+ return registry
+
+
def grid(registry: Registry) -> list[tuple[str, int, int]]:
"""The workspace as (name, column, slot), in the order the UI renders it."""
session = registry.session
@@ -40,13 +55,27 @@ def grid(registry: Registry) -> list[tuple[str, int, int]]:
return [(t.name, t.column, t.slot) for t in session.terminals]
-async def test_wizard_opens_one_row_of_columns(tmp_path) -> None:
+async def test_wizard_opens_columns_of_two(tmp_path) -> None:
+ """Four terminals are two columns of two, not four columns of one.
+
+ The workspace is one screenful, so a row of columns divides the window
+ between every pane: six terminals left each about 410 px on the
+ maintainer's display, under the width their agent needs to draw in, so
+ every pane was clipped at its tile edge and the six read as overlapping
+ one another (2026-08-11). Filling columns two deep halves the column count
+ and so doubles each pane's width.
+ """
registry = await _workspace(tmp_path, 4)
- assert [(c, s) for _, c, s in grid(registry)] == [(0, 0), (1, 0), (2, 0), (3, 0)]
+ assert [(c, s) for _, c, s in grid(registry)] == [(0, 0), (0, 1), (1, 0), (1, 1)]
-async def test_split_down_stacks_inside_the_anchors_own_column(tmp_path) -> None:
+async def test_wizard_stands_an_odd_pane_in_a_column_of_its_own(tmp_path) -> None:
registry = await _workspace(tmp_path, 3)
+ assert [(c, s) for _, c, s in grid(registry)] == [(0, 0), (0, 1), (1, 0)]
+
+
+async def test_split_down_stacks_inside_the_anchors_own_column(tmp_path) -> None:
+ registry = await _row(tmp_path, 3)
names = [name for name, _, _ in grid(registry)]
await registry.add_terminal(anchor=names[1], direction="down")
@@ -58,7 +87,7 @@ async def test_split_down_stacks_inside_the_anchors_own_column(tmp_path) -> None
async def test_split_right_opens_a_column_beside_the_anchor(tmp_path) -> None:
- registry = await _workspace(tmp_path, 3)
+ registry = await _row(tmp_path, 3)
names = [name for name, _, _ in grid(registry)]
added = await registry.add_terminal(anchor=names[0], direction="right")
@@ -71,7 +100,7 @@ async def test_split_right_opens_a_column_beside_the_anchor(tmp_path) -> None:
async def test_a_stacked_column_survives_a_split_right_elsewhere(tmp_path) -> None:
- registry = await _workspace(tmp_path, 2)
+ registry = await _row(tmp_path, 2)
names = [name for name, _, _ in grid(registry)]
await registry.add_terminal(anchor=names[0], direction="down")
await registry.add_terminal(anchor=names[1], direction="right")
@@ -81,7 +110,7 @@ async def test_a_stacked_column_survives_a_split_right_elsewhere(tmp_path) -> No
async def test_closing_the_top_of_a_stack_packs_the_slots(tmp_path) -> None:
- registry = await _workspace(tmp_path, 2)
+ registry = await _row(tmp_path, 2)
names = [name for name, _, _ in grid(registry)]
await registry.add_terminal(anchor=names[0], direction="down")
await registry.close_terminal(names[0])
@@ -92,7 +121,7 @@ async def test_closing_the_top_of_a_stack_packs_the_slots(tmp_path) -> None:
async def test_closing_a_whole_column_packs_the_columns(tmp_path) -> None:
- registry = await _workspace(tmp_path, 3)
+ registry = await _row(tmp_path, 3)
names = [name for name, _, _ in grid(registry)]
await registry.close_terminal(names[1])
@@ -101,7 +130,7 @@ async def test_closing_a_whole_column_packs_the_columns(tmp_path) -> None:
async def test_terminals_stay_in_reading_order(tmp_path) -> None:
"""Left to right, top to bottom — the order the prompt-bar chips use."""
- registry = await _workspace(tmp_path, 2)
+ registry = await _row(tmp_path, 2)
first, second = [name for name, _, _ in grid(registry)]
await registry.add_terminal(anchor=second, direction="down")
await registry.add_terminal(anchor=first, direction="down")
diff --git a/tests/unit/web/test_skills_import_route.py b/tests/unit/web/test_skills_import_route.py
index 5d58d61ea2..18976de728 100644
--- a/tests/unit/web/test_skills_import_route.py
+++ b/tests/unit/web/test_skills_import_route.py
@@ -51,7 +51,7 @@ def _client_returning(payload: str):
def __init__(self, *args: object, **kwargs: object) -> None:
pass
- async def __aenter__(self) -> "_Client":
+ async def __aenter__(self) -> _Client:
return self
async def __aexit__(self, *args: object) -> bool: