Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

feat(agentic-ide): drop the workspace pane limit and the 4x4 grid bound

rubenluetke10-beepd045d37d0b64
diff --git a/docs/igentic-workspaces.md b/docs/igentic-workspaces.md
index bafaad491a..2c2aef00cb 100644
--- a/docs/igentic-workspaces.md
+++ b/docs/igentic-workspaces.md
@@ -2,7 +2,7 @@
The IDE is organized as **Project > Workspace > Coding Agent session**. A
project is a connected folder in the existing project library. A workspace is
-an independently named group of up to sixteen coding sessions in that project.
+an independently named group of any number of coding sessions in that project.
Multiple workspaces may use the same folder; independent sessions do not imply
isolated source checkouts. Users who need separate files connect a worktree as
another project.
@@ -15,12 +15,18 @@ shows open and saved workspaces, their session counts, and active selection.
Selecting an open workspace changes the visible group and active runtime ID;
it does not stop background agents. Restoring a closed workspace is explicit.
-The grid uses at most four columns and four rows. The automatic even grid
-keeps one or two rows for up to eight sessions and adds a row per four sessions
-beyond that (nine is 3 x 3, sixteen is 4 x 4). Screens too small for every pane's
-minimum size scroll rather than shrinking the user's terminal font. The limit is
-`MAX_TERMINALS` in `jarvis/agentic_ide/session.py`; the frontend reads it from
-the state's `max_terminals`. Dragging a card header or using
+A workspace has no pane limit and no grid limit: panes can be docked on any
+side of any other pane, so the grid may grow past four columns or rows. The
+automatic even grid keeps one or two rows for up to eight sessions, adds a row
+per four sessions up to sixteen (nine is 3 x 3, sixteen is 4 x 4), and stays
+about square beyond that. A pane opened without a place joins the right edge
+while the workspace is under four columns wide; past that, a shape nobody
+arranged is dealt into the even grid again, while a hand-built arrangement is
+kept and the new pane splits its largest pane. The only guard is on one request:
+`MAX_PANES_PER_REQUEST` in `jarvis/agentic_ide/session.py` (mirrored in
+`workspaceDocking.ts`) bounds how many panes a single launch or batch opens.
+Screens too small for every pane's minimum size scroll rather than shrinking
+the user's terminal font. Dragging a card header or using
Alt+Arrow reorders stable session IDs. Reordering does not recreate the CLI
process. Each tile uses the existing
PTY adapter, output replay, reconnect budget, and terminal appearance tokens.
diff --git a/jarvis/agentic_ide/intent.py b/jarvis/agentic_ide/intent.py
index 531516e7d6..119680e0b4 100644
--- a/jarvis/agentic_ide/intent.py
+++ b/jarvis/agentic_ide/intent.py
@@ -1558,7 +1558,7 @@ def _spoken_count(text: str) -> int:
First hit wins. A count is optional — "open another terminal" is a perfectly
clear request for one — so this never fails, it defaults.
"""
- from .session import MAX_TERMINALS
+ from .session import MAX_PANES_PER_REQUEST
# Read the FIRST number in speech order. Searching all digits before number
# words contradicted this function's contract and turned "five terminals;
@@ -1571,7 +1571,7 @@ def _spoken_count(text: str) -> int:
for match in re.finditer(r"\b(?:\d{1,3}|[^\W\d_]+)\b", text, re.UNICODE):
value = _count_at(text, match)
if value is not None:
- return max(1, min(value, MAX_TERMINALS))
+ return max(1, min(value, MAX_PANES_PER_REQUEST))
return 1
@@ -1840,12 +1840,11 @@ def _merge_groups(found: list[SpawnGroup]) -> tuple[SpawnGroup, ...]:
fleet can now be described across SEVERAL clauses (see ``_spawn_regions``)
and two merge rules would be free to disagree about the same sentence.
- The clamp takes the TOTAL, not each group: the workspace maximum is a
- property of the workspace. Trimming from the back keeps the groups the
- user named first intact rather than shrinking all of them into
- uselessness.
+ The clamp takes the TOTAL, not each group: the guard is on how many panes
+ ONE request may start. Trimming from the back keeps the groups the user
+ named first intact rather than shrinking all of them into uselessness.
"""
- from .session import MAX_TERMINALS
+ from .session import MAX_PANES_PER_REQUEST
merged: dict[str, int] = {}
for group in found:
@@ -1853,7 +1852,7 @@ def _merge_groups(found: list[SpawnGroup]) -> tuple[SpawnGroup, ...]:
merged[key] = merged.get(key, 0) + group.count
out: list[SpawnGroup] = []
- remaining = MAX_TERMINALS
+ remaining = MAX_PANES_PER_REQUEST
for agent, count in merged.items():
if remaining <= 0:
break
diff --git a/jarvis/agentic_ide/layout_tree.py b/jarvis/agentic_ide/layout_tree.py
index b22be7932c..e3e3d12c15 100644
--- a/jarvis/agentic_ide/layout_tree.py
+++ b/jarvis/agentic_ide/layout_tree.py
@@ -59,7 +59,7 @@ Every function returns a tree in canonical form:
from __future__ import annotations
-from collections.abc import Iterable
+from collections.abc import Callable, Iterable
from dataclasses import dataclass, field
from typing import Any, Literal
@@ -175,7 +175,8 @@ def grid_span(node: LayoutNode | None) -> tuple[int, int]:
Siblings in a row add their columns and share the tallest row count;
siblings in a column the other way round. Mirrored by `layoutSpan` in the
- frontend's ``workspaceDocking.ts``, which enforces the same grid bounds.
+ frontend's ``workspaceDocking.ts``. A measurement, never a limit: a
+ workspace may take any shape.
"""
if node is None:
return (0, 0)
@@ -370,6 +371,104 @@ def append_pane(root: LayoutNode | None, added: str) -> LayoutNode:
return Split(direction="row", children=[root, Leaf(pane=added)], weights=[1.0, 1.0])
+#: The window shape the anchor-less add assumes when it decides whether the
+#: pane it splits is wider than tall. A desktop window is landscape; the exact
+#: ratio only breaks ties between "beside" and "beneath".
+_ASSUMED_ASPECT = 16 / 9
+
+
+def pane_boxes(root: LayoutNode | None) -> dict[str, tuple[float, float, float, float]]:
+ """Every pane's ``(x, y, w, h)`` as fractions of the workspace, by weight."""
+ boxes: dict[str, tuple[float, float, float, float]] = {}
+
+ def walk(node: LayoutNode, x: float, y: float, w: float, h: float) -> None:
+ if isinstance(node, Leaf):
+ boxes[node.pane] = (x, y, w, h)
+ return
+ weights = [_clean_weight(value) for value in node.weights[: len(node.children)]]
+ weights += [1.0] * (len(node.children) - len(weights))
+ total = sum(weights) or 1.0
+ offset = 0.0
+ for child, weight in zip(node.children, weights, strict=True):
+ share = weight / total
+ if node.direction == "row":
+ walk(child, x + offset * w, y, share * w, h)
+ else:
+ walk(child, x, y + offset * h, w, share * h)
+ offset += share
+
+ if root is not None:
+ walk(root, 0.0, 0.0, 1.0, 1.0)
+ return boxes
+
+
+def row_major(panes: list[str], columns: int) -> LayoutNode | None:
+ """``panes`` dealt row by row into an even grid ``columns`` wide."""
+ width = max(1, columns)
+ rows = [
+ normalize(
+ Split(
+ direction="row",
+ children=[Leaf(pane=key) for key in panes[start : start + width]],
+ weights=[1.0] * len(panes[start : start + width]),
+ )
+ )
+ for start in range(0, len(panes), width)
+ ]
+ if not rows:
+ return None
+ return normalize(Split(direction="column", children=rows, weights=[1.0] * len(rows)))
+
+
+def _is_automatic(root: LayoutNode, balanced_columns: Callable[[int], int]) -> bool:
+ """Is ``root`` a shape nobody arranged: one plain row, or the even grid?"""
+ if isinstance(root, Leaf):
+ return True
+ if root.direction == "row" and all(isinstance(child, Leaf) for child in root.children):
+ return True
+ panes = leaves(root)
+ return same_shape(root, row_major(panes, balanced_columns(len(panes))))
+
+
+def add_unanchored(
+ root: LayoutNode | None,
+ added: str,
+ *,
+ max_columns: int,
+ balanced_columns: Callable[[int], int],
+) -> LayoutNode:
+ """Where a pane goes when nobody said where: never by re-dealing a hand-built layout.
+
+ While the workspace is narrower than ``max_columns`` the pane joins the
+ right edge as a new full-height column (:func:`append_pane`), the shape
+ "open one more terminal" has always produced. Past that width a further
+ column would only make every pane thinner, so:
+
+ * a shape nobody arranged — one plain row, or the even grid — is dealt
+ into the even grid for one more pane, in the same reading order;
+ * an arrangement the user built by hand is kept: the pane splits the
+ LARGEST pane — beside it when that pane is wider than tall, beneath it
+ otherwise; on a tie the last in reading order, so it lands at the end.
+ Every other pane keeps its place (maintainer request, 2026-10-02).
+ """
+ if root is None:
+ return Leaf(pane=added)
+ columns, _ = grid_span(root)
+ if columns < max_columns:
+ return append_pane(root, added)
+ if _is_automatic(root, balanced_columns):
+ panes = [*leaves(root), added]
+ dealt = row_major(panes, balanced_columns(len(panes)))
+ assert dealt is not None # never empty: it holds at least ``added``
+ return dealt
+ boxes = pane_boxes(root)
+ order = leaves(root)
+ anchor = max(order, key=lambda key: (boxes[key][2] * boxes[key][3], order.index(key)))
+ _, _, width, height = boxes[anchor]
+ side: Literal["right", "down"] = "right" if width * _ASSUMED_ASPECT > height else "down"
+ return split_pane(root, anchor, added, side)
+
+
def axis_span(node: LayoutNode, direction: Direction) -> int:
"""How many TERMINALS wide (``row``) or tall (``column``) ``node`` is.
diff --git a/jarvis/agentic_ide/names.py b/jarvis/agentic_ide/names.py
index 39ebd883b7..f2b4009c5b 100644
--- a/jarvis/agentic_ide/names.py
+++ b/jarvis/agentic_ide/names.py
@@ -179,8 +179,8 @@ def free_positions(taken: Iterable[str], count: int) -> list[str]:
# Number words a person actually speaks for a pane. Capped where speech stops
# being the way anybody addresses a pane: past twenty nobody says "terminal
-# twenty-three" — they say the digits, which the digit form below covers up to
-# MAX_TERMINALS. One table per language, so a locale can be extended without
+# twenty-three" — they say the digits, which the digit form below covers for
+# any pane number. One table per language, so a locale can be extended without
# touching the others.
#
# The indefinite article is deliberately NOT a number word, in any locale:
diff --git a/jarvis/agentic_ide/orchestration.py b/jarvis/agentic_ide/orchestration.py
index 26a20e178f..0662b6572b 100644
--- a/jarvis/agentic_ide/orchestration.py
+++ b/jarvis/agentic_ide/orchestration.py
@@ -20,7 +20,7 @@ from jarvis.core.protocols import CodingSessionGateway
from jarvis.live.state import LiveLedger
from .session import (
- MAX_TERMINALS,
+ MAX_PANES_PER_REQUEST,
Registry,
SessionError,
accepts_prompts,
@@ -410,7 +410,7 @@ class WorkspaceOrchestrator:
count = int(args.get("count") or 1)
except (TypeError, ValueError):
count = 1
- count = max(1, min(count, MAX_TERMINALS))
+ count = max(1, min(count, MAX_PANES_PER_REQUEST))
name = str(args.get("name") or "").strip()
mixed = args.get("agents")
if isinstance(mixed, list) and mixed:
@@ -684,10 +684,10 @@ class WorkspaceOrchestrator:
if isinstance(groups, dict):
return groups
requested = [{"agent": cli} for cli, count in groups for _ in range(count)]
- if len(requested) > MAX_TERMINALS:
+ if len(requested) > MAX_PANES_PER_REQUEST:
return {
"status": "not_accepted",
- "reason": f"A workspace holds at most {MAX_TERMINALS} terminals.",
+ "reason": f"At most {MAX_PANES_PER_REQUEST} terminals open in one go.",
}
try:
session = await self.registry.start(
@@ -760,7 +760,7 @@ class WorkspaceOrchestrator:
count = int(entry.get("count") or 1)
except (TypeError, ValueError):
count = 1
- groups.append((cli, max(1, min(count, MAX_TERMINALS))))
+ groups.append((cli, max(1, min(count, MAX_PANES_PER_REQUEST))))
return groups or [(_default_cli(), 1)]
async def _brief(
diff --git a/jarvis/agentic_ide/session.py b/jarvis/agentic_ide/session.py
index c8033154c7..113a70e07d 100644
--- a/jarvis/agentic_ide/session.py
+++ b/jarvis/agentic_ide/session.py
@@ -63,6 +63,7 @@ from __future__ import annotations
import asyncio
import hashlib
+import math
import os
import re
import shlex
@@ -233,28 +234,37 @@ def _unavailable(agent: str) -> str:
return f"{pretty} cannot open: this machine has no shell Jarvis can start."
-# How many coding sessions one workspace may hold. Every pane is a full CLI
-# process with its own pseudo-terminal and socket, so this is a resource
-# ceiling, not a layout rule. It matches the largest grid the workspace draws
-# (MAX_GRID_COLUMNS x MAX_GRID_ROWS); past it, a second workspace tab is the
-# better home. Voice call-signs cover it (see `names._NUMBER_WORDS`). Mirrored
-# by the frontend's `workspaceDocking.ts`, which reads the count from the state.
-MAX_GRID_COLUMNS = 4
-MAX_GRID_ROWS = 4
-MAX_TERMINALS = MAX_GRID_COLUMNS * MAX_GRID_ROWS
+# A workspace holds as many panes as the user opens, and they may be arranged
+# in any shape: there is no pane limit and no grid limit (maintainer request,
+# 2026-10-02 — a full workspace and a refused drop were both reported as the
+# product getting in the way). What remains is a guard on ONE request: a
+# misheard "open 500 terminals" must not start 500 CLI processes in one go.
+# Opening panes one request after another is never refused. Mirrored by
+# `MAX_PANES_PER_REQUEST` in the frontend's ``workspaceDocking.ts``.
+MAX_PANES_PER_REQUEST = 100
+
+# How wide the even grid prefers to be. Up to this many columns squared it
+# grows a row per this many panes; past that it stays roughly square so every
+# pane keeps both a usable width and a usable height. A preference for
+# `balanced_columns` and the anchor-less add, never a limit on the layout.
+BALANCED_GRID_COLUMNS = 4
def balanced_columns(count: int) -> int:
"""Columns of the even grid ``count`` panes are dealt into, row by row.
Two panes read best side by side; three to eight form two rows (six is
- 3 x 2); beyond that the grid grows a row per four panes, never wider than
- MAX_GRID_COLUMNS. Mirrored by `balancedLayout` in ``workspaceDocking.ts``.
+ 3 x 2); up to sixteen the grid grows a row per four panes; beyond that it
+ grows in both directions, staying about square. Mirrored by
+ `balancedColumns` in ``workspaceDocking.ts``.
"""
if count <= 2:
return max(1, count)
- rows = 2 if count <= 2 * MAX_GRID_COLUMNS else -(-count // MAX_GRID_COLUMNS)
- return min(MAX_GRID_COLUMNS, -(-count // rows))
+ wide = BALANCED_GRID_COLUMNS
+ if count > wide * wide:
+ return math.ceil(math.sqrt(count))
+ rows = 2 if count <= 2 * wide else -(-count // wide)
+ return min(wide, -(-count // rows))
# How deep a wizard-opened column is filled before the next one is started.
@@ -2124,7 +2134,6 @@ class Registry:
return {
"active": session is not None,
"session": session.to_dict() if session else None,
- "max_terminals": MAX_TERMINALS,
"max_workspaces": MAX_WORKSPACES,
"active_id": self._active,
"workspaces": self.workspaces(),
@@ -2137,7 +2146,6 @@ class Registry:
return {
"active": session is not None,
"workspace": session.to_brief() if session else None,
- "max_terminals": MAX_TERMINALS,
"other_workspaces": [
{"name": s.name, "terminals": len(s.terminals)}
for s in self._sessions.values()
@@ -2711,9 +2719,10 @@ class Registry:
async with self._lock:
if not requested:
raise SessionError("Pick at least one terminal.")
- if len(requested) > MAX_TERMINALS:
+ if len(requested) > MAX_PANES_PER_REQUEST:
raise SessionError(
- f"At most {MAX_TERMINALS} terminals per session (got {len(requested)})."
+ f"At most {MAX_PANES_PER_REQUEST} terminals open in one go "
+ f"(got {len(requested)}). Open the rest once these are running."
)
# expanduser() is string/env work, not a filesystem call — the real
@@ -3132,40 +3141,12 @@ class Registry:
"""Keep legacy geometry consistent with the persistent terminal order."""
# Rebuild the legacy split tree from the new order. Old geometry
# must never sort the terminals back into their previous positions.
- columns = balanced_columns(len(session.terminals))
- rows = [
- layout_tree.normalize(
- layout_tree.Split(
- direction="row",
- children=[
- layout_tree.Leaf(term.key)
- for term in session.terminals[start : start + columns]
- ],
- weights=[1.0] * len(session.terminals[start : start + columns]),
- )
- )
- for start in range(0, len(session.terminals), columns or 1)
- ]
- session.layout = (
- layout_tree.normalize(
- layout_tree.Split(
- direction="column",
- children=rows,
- weights=[1.0] * len(rows),
- )
- )
- if rows
- else None
- )
+ keys = [term.key for term in session.terminals]
+ session.layout = layout_tree.row_major(keys, balanced_columns(len(keys)))
Registry._renumber(session)
async def _restore_one_locked(self, space: resume_store.SnapshotWorkspace) -> Session | None:
"""Reopen one remembered workspace. Caller holds the lock."""
- if len(space.terminals) > MAX_TERMINALS:
- raise SessionError(
- f"This saved workspace has {len(space.terminals)} terminals; "
- f"the workspace limit is {MAX_TERMINALS}. Its saved sessions were preserved."
- )
root = Path(space.folder).expanduser() # noqa: ASYNC240
try:
if not await asyncio.to_thread(root.is_dir):
@@ -5297,10 +5278,6 @@ class Registry:
session = self.get(selected_id) if selected_id else None
if session is None:
raise SessionError("No Agentic-IDE session is running.")
- if len(session.terminals) >= MAX_TERMINALS:
- raise SessionError(
- f"This workspace already has the maximum of {MAX_TERMINALS} terminals."
- )
if direction not in ("right", "down", "left", "up", "above", "below"):
raise SessionError("Direction must be 'right', 'down', 'left', or 'up'.")
@@ -5406,13 +5383,12 @@ class Registry:
direction,
)
else:
- session.layout = layout_tree.append_pane(session.layout, term.key)
- # A split or an appended column may not leave the largest grid the
- # workspace draws; past it the panes are dealt into the even grid
- # instead (voice and the CLI have no preview to stop them first).
- columns, rows = layout_tree.grid_span(session.layout)
- if columns > MAX_GRID_COLUMNS or rows > MAX_GRID_ROWS:
- self._row_major_grid(session)
+ session.layout = layout_tree.add_unanchored(
+ session.layout,
+ term.key,
+ max_columns=BALANCED_GRID_COLUMNS,
+ balanced_columns=balanced_columns,
+ )
# Then every terminal back to an equal share — the same act as the
# grid's "even out" button, run for the user on every open — EXCEPT
# inside a container whose boundaries were dragged by hand
@@ -5966,12 +5942,6 @@ class Registry:
session, source = found
if not accepts_prompts(source.agent):
raise SessionError(f"{source.name} is a plain terminal — it has no chat to fork.")
- # Checked before a worktree is created, so a full workspace does not
- # leave an orphaned branch behind.
- if len(session.terminals) >= MAX_TERMINALS:
- raise SessionError(
- f"This workspace already has the maximum of {MAX_TERMINALS} terminals."
- )
folder = ""
branch = ""
if worktree:
@@ -6035,8 +6005,10 @@ class Registry:
if selected is None:
raise SessionError("No Agentic-IDE session is running.")
wanted = max(1, int(count))
- if len(selected.terminals) + wanted > MAX_TERMINALS:
- raise SessionError(f"A workspace can contain at most {MAX_TERMINALS} terminals.")
+ if wanted > MAX_PANES_PER_REQUEST:
+ raise SessionError(
+ f"At most {MAX_PANES_PER_REQUEST} terminals open in one go (asked for {wanted})."
+ )
created: list[Terminal] = []
for _ in range(wanted):
try:
@@ -6187,10 +6159,6 @@ class Registry:
f"{term.name} can only move to a workspace on the same folder; "
f"{target.name} works in another one."
)
- if len(target.terminals) >= MAX_TERMINALS:
- raise SessionError(
- f"{target.name} already has the maximum of {MAX_TERMINALS} terminals."
- )
if term.placing:
raise SessionError(
f"{term.name} is still being set up on its computer. "
@@ -6260,10 +6228,12 @@ class Registry:
else:
# It joins the workspace edge like an anchor-less add: no
# pane was chosen to sit beside.
- target.layout = layout_tree.append_pane(target.layout, term.key)
- columns, rows = layout_tree.grid_span(target.layout)
- if columns > MAX_GRID_COLUMNS or rows > MAX_GRID_ROWS:
- self._row_major_grid(target)
+ target.layout = layout_tree.add_unanchored(
+ target.layout,
+ term.key,
+ max_columns=BALANCED_GRID_COLUMNS,
+ balanced_columns=balanced_columns,
+ )
# Every pane then gets an even share, as after any add.
target.layout = layout_tree.evened(target.layout)
self._renumber(target)
@@ -6283,10 +6253,9 @@ class Registry:
) -> layout_tree.LayoutNode | None:
"""``target``'s tree with pane ``key`` split off ``anchor`` — or None.
- None means no place was asked for. A named pane that is not there, or
- a side that would push the grid past its largest shape, is refused:
- quietly re-dealing the grid would put the pane somewhere the user did
- not choose.
+ None means no place was asked for. A named pane that is not there is
+ refused: quietly placing the pane elsewhere would put it somewhere the
+ user did not choose.
"""
if anchor is None:
return None
@@ -6297,15 +6266,7 @@ class Registry:
tree = target.layout or layout_tree.from_grid(
(t.key, t.column, t.slot) for t in target.terminals
)
- placed = layout_tree.split_pane(tree, beside.key, key, cast("Any", side))
- columns, rows = layout_tree.grid_span(placed)
- if columns > MAX_GRID_COLUMNS or rows > MAX_GRID_ROWS:
- where = {"left": "left of", "right": "right of"}.get(side, side)
- raise SessionError(
- f"No room {where} {beside.name}: a workspace holds at most "
- f"{MAX_GRID_COLUMNS} columns and {MAX_GRID_ROWS} rows."
- )
- return placed
+ return layout_tree.split_pane(tree, beside.key, key, cast("Any", side))
async def refold(self, depth: int) -> Session:
"""Re-deal every pane into columns ``depth`` deep, in reading order.
@@ -7445,9 +7406,8 @@ __all__ = [
"AGENT_BINARIES",
"AGENT_DISPLAY",
"MAX_PROMPT_CHARS",
- "MAX_GRID_COLUMNS",
- "MAX_GRID_ROWS",
- "MAX_TERMINALS",
+ "BALANCED_GRID_COLUMNS",
+ "MAX_PANES_PER_REQUEST",
"MAX_WORKSPACES",
"INHERIT_PLACEMENT",
"PLAIN_TERMINAL",
diff --git a/jarvis/agentic_ide/workspace_catalog.py b/jarvis/agentic_ide/workspace_catalog.py
index a4b2fc631a..bc538bf8be 100644
--- a/jarvis/agentic_ide/workspace_catalog.py
+++ b/jarvis/agentic_ide/workspace_catalog.py
@@ -18,8 +18,6 @@ def project_graph(registry: Registry) -> dict[str, Any]:
Their project rows are derived without writing during a read. Selecting a
saved workspace remains an explicit action; this function never starts it.
"""
- from .session import MAX_TERMINALS
-
projects = {
project.id: {**project.to_dict(), "workspaces": []}
for project in library.list_projects()
@@ -74,7 +72,7 @@ def project_graph(registry: Registry) -> dict[str, Any]:
"last_active_at": space.saved_at,
"active": False,
"status": "closed",
- "restorable": folder_exists and len(space.terminals) <= MAX_TERMINALS,
+ "restorable": folder_exists,
}
)
open_ids.add(space.session_id)
@@ -86,5 +84,4 @@ def project_graph(registry: Registry) -> dict[str, Any]:
active.project_id or library.project_id_for(active.folder) if active else None
),
"active_workspace_id": registry.active_id,
- "max_terminals": MAX_TERMINALS,
}
diff --git a/jarvis/brain/manager.py b/jarvis/brain/manager.py
index 0121fb446e..804369c48e 100644
--- a/jarvis/brain/manager.py
+++ b/jarvis/brain/manager.py
@@ -8118,7 +8118,6 @@ class BrainManager:
try:
from jarvis.agentic_ide import intent as ide_intent
from jarvis.agentic_ide.session import (
- MAX_TERMINALS,
SessionError,
get_registry,
terminals_added_event,
@@ -8243,8 +8242,6 @@ class BrainManager:
group.count, agent=group.agent
)
except SessionError as exc:
- if "maximum" in str(exc).lower():
- raise
log.info(
"Agentic IDE spawn: %s group refused: %s",
group.agent or "inherited",
@@ -8254,31 +8251,26 @@ class BrainManager:
continue
created.extend(opened)
if _capped:
- # The workspace filled up mid-fleet. Stop rather than
- # asking for the next group and getting the same
- # refusal — the readback already reports the shortfall.
+ # A pane failed to open mid-fleet. Stop rather than
+ # asking for the next group and hitting the same
+ # failure — the readback already reports the shortfall.
break
except SessionError as exc:
- # A full workspace, a missing CLI, an unreadable folder: every one of
- # these already carries a user-facing English sentence, and speaking
- # it is more useful than a generic failure.
+ # A missing CLI, an unreadable folder: every one of these already
+ # carries a user-facing English sentence, and speaking it is more
+ # useful than a generic failure.
log.info("Agentic IDE spawn fast-path refused: %s", exc)
- if "maximum" in str(exc).lower():
- return action_phrase(
- "ide_terminals_full", out_lang, max=MAX_TERMINALS
- )
return str(exc)
except Exception: # noqa: BLE001 - never crash the turn over a pane
log.warning("Agentic IDE spawn fast-path failed", exc_info=True)
return None
if not created:
- # Nothing opened. If a group said WHY, that sentence is the answer —
- # "the workspace is full" would be a different claim, and usually a
- # false one (an uninstalled CLI is not a full workspace).
+ # Nothing opened. If a group said WHY, that sentence is the answer;
+ # otherwise the pane failed to start and the log says why.
if refused:
return " ".join(refused)
- return action_phrase("ide_terminals_full", out_lang, max=MAX_TERMINALS)
+ return action_phrase("ide_terminals_open_failed", out_lang)
session = registry.session
if session is not None and self._bus is not None:
diff --git a/jarvis/ui/web/agentic_ide_routes.py b/jarvis/ui/web/agentic_ide_routes.py
index 8abc04b01c..7dbef8e0a4 100644
--- a/jarvis/ui/web/agentic_ide_routes.py
+++ b/jarvis/ui/web/agentic_ide_routes.py
@@ -115,9 +115,9 @@ from jarvis.agentic_ide.names import default_names
from jarvis.agentic_ide.session import (
AGENT_DISPLAY,
INHERIT_PLACEMENT,
+ MAX_PANES_PER_REQUEST,
MAX_PROMPT_CHARS,
MAX_TERMINAL_NAME,
- MAX_TERMINALS,
MAX_WORKSPACES,
PendingPromptAttachmentBatch,
PlacementError,
@@ -371,8 +371,8 @@ class AddTerminalsRequest(BaseModel):
count: int = Field(
default=1,
ge=1,
- le=MAX_TERMINALS,
- description="How many terminals to open, capped by the workspace maximum.",
+ le=MAX_PANES_PER_REQUEST,
+ description="How many terminals to open in this one request.",
)
agent: str | None = Field(
default=None,
@@ -428,7 +428,6 @@ class RefoldRequest(BaseModel):
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 "
@@ -454,7 +453,6 @@ class CloseTerminalsRequest(BaseModel):
names: list[str] = Field(
min_length=1,
- max_length=MAX_TERMINALS,
description="Call-signs of the terminals to close.",
)
@@ -620,7 +618,7 @@ class SpawnGroupRequest(BaseModel):
count: int = Field(
ge=1,
- le=MAX_TERMINALS,
+ le=MAX_PANES_PER_REQUEST,
description="How many terminals to open in this group.",
)
agent: str | None = Field(
@@ -839,7 +837,9 @@ class AgentStatus(BaseModel):
class AgentsResponse(BaseModel):
terminal_available: bool
- max_terminals: int
+ #: The most panes one launch or batch request opens. A guard on a single
+ #: request, never a limit on how many a workspace holds.
+ max_panes_per_request: int
suggested_names: list[str]
agents: list[AgentStatus]
@@ -1495,8 +1495,8 @@ async def get_agents(quick: bool = False) -> AgentsResponse:
]
return AgentsResponse(
terminal_available=pty_available(),
- max_terminals=MAX_TERMINALS,
- suggested_names=default_names(MAX_TERMINALS),
+ max_panes_per_request=MAX_PANES_PER_REQUEST,
+ suggested_names=default_names(MAX_PANES_PER_REQUEST),
agents=agents,
)
@@ -1524,8 +1524,8 @@ def _quick_agent_catalog() -> AgentsResponse:
]
return AgentsResponse(
terminal_available=workspace_agents.pty_available(),
- max_terminals=MAX_TERMINALS,
- suggested_names=default_names(MAX_TERMINALS),
+ max_panes_per_request=MAX_PANES_PER_REQUEST,
+ suggested_names=default_names(MAX_PANES_PER_REQUEST),
agents=agents,
)
@@ -2974,7 +2974,6 @@ def get_workspace_layout(workspace_id: str) -> dict:
}
for t in session.terminals
],
- "max_terminals": MAX_TERMINALS,
}
diff --git a/jarvis/ui/web/frontend/src/components/agentic/MovePaneDialog.test.tsx b/jarvis/ui/web/frontend/src/components/agentic/MovePaneDialog.test.tsx
index 72df338cab..57239acf6a 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/MovePaneDialog.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/MovePaneDialog.test.tsx
@@ -3,9 +3,9 @@
*
* Its promise is that nothing it offers is refused later and that what it
* shows is what will happen: the tile pointed at splits in place to show the
- * moved pane, a side with no room says so instead of being offered, a full
- * workspace cannot be confirmed, and what is sent names the target pane by
- * identity. There is no hidden "automatic" place: the map always shows one.
+ * moved pane, every side of every pane is a place (a workspace has no size
+ * limit), and what is sent names the target pane by identity. There is no
+ * hidden "automatic" place: the map always shows one.
*/
import { afterEach, beforeEach, expect, it, vi } from "vitest";
import { cleanup, fireEvent, render, screen } from "@testing-library/react";
@@ -15,8 +15,8 @@ import { MovePaneDialog, type MovePaneRequest } from "./MovePaneDialog";
import { balancedLayout } from "./workspaceDocking";
const pane = (name: string) => ({ key: name.toLowerCase(), name, agent: "codex", display_name: "Codex", history_id: `h-${name}`, title: `Work of ${name}` });
-const workspace = (names: string[], layout = balancedLayout(names.map((name) => name.toLowerCase())), max = 16) =>
- ({ id: "w2", name: "Blog", layout, max_terminals: max, terminals: names.map(pane) });
+const workspace = (names: string[], layout = balancedLayout(names.map((name) => name.toLowerCase()))) =>
+ ({ id: "w2", name: "Blog", layout, terminals: names.map(pane) });
const request: MovePaneRequest = { pane: { name: "T9", agent: "claude", displayName: "Claude Code" }, target: { id: "w2", name: "Blog" } };
const status = () => screen.getByRole("status").textContent;
@@ -38,13 +38,13 @@ it("draws the target panes with their task and shows a place from the start", as
expect(onConfirm).toHaveBeenCalledExactlyOnceWith({ anchor: "pane:h-T2", side: "right" });
});
-it("starts below the last pane when the row has no room", async () => {
+it("starts right of the last pane even in a row four wide", async () => {
const row = ["T1", "T2", "T3", "T4"];
api.layout.mockResolvedValue(workspace(row, { direction: "row", children: row.map((name) => ({ pane: name.toLowerCase() })), weights: [1, 1, 1, 1] }));
render(<MovePaneDialog request={request} busy={false} onCancel={() => {}} onConfirm={() => {}} />);
await screen.findByText("Work of T4");
- expect(screen.getByTestId("move-pane-tile-T4").dataset.lit).toBe("below");
+ expect(screen.getByTestId("move-pane-tile-T4").dataset.lit).toBe("right");
});
it("splits the pointed-at tile to preview the place, and keeps it on click", async () => {
@@ -67,24 +67,19 @@ it("splits the pointed-at tile to preview the place, and keeps it on click", asy
expect(onConfirm).toHaveBeenCalledExactlyOnceWith({ anchor: "pane:h-T2", side: "left" });
});
-it("says a side has no room instead of taking it", async () => {
+it("offers a fifth column beside a row four wide", async () => {
const row = ["T1", "T2", "T3", "T4"];
api.layout.mockResolvedValue(workspace(row, { direction: "row", children: row.map((name) => ({ pane: name.toLowerCase() })), weights: [1, 1, 1, 1] }));
const onConfirm = vi.fn();
render(<MovePaneDialog request={request} busy={false} onCancel={() => {}} onConfirm={onConfirm} />);
- // Four columns already: a fifth beside any of them does not fit, a second row does.
const right = await screen.findByRole("button", { name: "Place T9 right of T1" });
- expect(right.getAttribute("aria-disabled")).toBe("true");
- fireEvent.mouseEnter(right);
- expect(screen.getByText("No room")).toBeTruthy();
- expect(status()).toContain("No room right of T1");
+ expect(right.getAttribute("aria-disabled")).toBe("false");
fireEvent.click(right);
- fireEvent.mouseLeave(screen.getByTestId("move-pane-map").parentElement!);
- // The click changed nothing: the place picked at the start still stands.
- expect(screen.getByTestId("move-pane-tile-T1").dataset.lit).toBeUndefined();
- expect(screen.getByTestId("move-pane-tile-T4").dataset.lit).toBe("below");
- expect(screen.getByRole("button", { name: "Place T9 below T1" }).getAttribute("aria-disabled")).toBe("false");
+ expect(screen.queryByText("No room")).toBeNull();
+ expect(status()).toBe("Right of T1: T9 takes half of its space.");
+ fireEvent.click(screen.getByTestId("move-pane-confirm"));
+ expect(onConfirm).toHaveBeenCalledExactlyOnceWith({ anchor: "pane:h-T1", side: "right" });
});
it("lets arrow keys pick a side of the focused pane", async () => {
@@ -99,13 +94,14 @@ it("lets arrow keys pick a side of the focused pane", async () => {
expect(onConfirm).toHaveBeenCalledExactlyOnceWith({ anchor: "pane:h-T1", side: "below" });
});
-it("cannot confirm into a full workspace", async () => {
- api.layout.mockResolvedValue(workspace(["T1", "T2"], undefined, 2));
+it("confirms into a workspace of any size", async () => {
+ const many = Array.from({ length: 20 }, (_, index) => `T${index + 1}`);
+ api.layout.mockResolvedValue(workspace(many));
render(<MovePaneDialog request={request} busy={false} onCancel={() => {}} onConfirm={() => {}} />);
await screen.findByText("Work of T1");
- expect((screen.getByTestId("move-pane-confirm") as HTMLButtonElement).disabled).toBe(true);
- expect(status()).toContain("is full");
+ expect((screen.getByTestId("move-pane-confirm") as HTMLButtonElement).disabled).toBe(false);
+ expect(status()).not.toContain("is full");
});
it("says an empty workspace is simply filled", async () => {
diff --git a/jarvis/ui/web/frontend/src/components/agentic/MovePaneDialog.tsx b/jarvis/ui/web/frontend/src/components/agentic/MovePaneDialog.tsx
index 91573bcb7f..ca95653aa9 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/MovePaneDialog.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/MovePaneDialog.tsx
@@ -3,7 +3,7 @@ import * as Dialog from "@radix-ui/react-dialog";
import { Check, FolderInput, Loader2 } from "lucide-react";
import { AgentMark } from "./AgentMark";
import { treeLayout } from "./treeLayout";
-import { GRID_LIMIT_HINT, fitsWorkspace, previewSplit, workspaceLayout } from "./workspaceDocking";
+import { workspaceLayout } from "./workspaceDocking";
import { fetchWorkspaceLayout, type TransferPlacement, type TransferSide, type WorkspaceLayoutView } from "@/lib/agenticIdeApi";
import { cn } from "@/lib/utils";
@@ -34,8 +34,6 @@ const SIDES: { side: TransferSide; words: string; clip: string; key: string }[]
{ side: "above", words: "above", clip: "polygon(0 0, 100% 0, 50% 50%)", key: "ArrowUp" },
{ side: "below", words: "below", clip: "polygon(0 100%, 50% 50%, 100% 100%)", key: "ArrowDown" },
];
-const SPLIT_DIRECTION = { left: "left", right: "right", above: "above", below: "down" } as const;
-const INCOMING = "__incoming__";
const anchorOf = (pane: MapPane) => pane.history_id ? `pane:${pane.history_id}` : pane.name;
const capital = (text: string) => text.charAt(0).toUpperCase() + text.slice(1);
@@ -99,26 +97,18 @@ export function MovePaneDialog({ request, busy, onCancel, onConfirm }: Props) {
const panes = view?.terminals ?? [];
const current = view ? workspaceLayout(view.layout, panes) : null;
const boxes = treeLayout(current, panes).boxes;
- const full = view !== null && panes.length >= view.max_terminals;
- const fits = (pane: MapPane, side: TransferSide) =>
- !full && current !== null && fitsWorkspace(previewSplit(current, pane.key, INCOMING, SPLIT_DIRECTION[side]));
+ // A workspace has no size limit: every side of every pane is a place.
+ const fits = (_pane: MapPane, _side: TransferSide) => current !== null;
const shown = hover ?? choice;
const paneName = request?.pane.name ?? "";
const targetName = request?.target.name ?? "";
- // The first place with room, nearest the end of the reading order: what an
- // open-one-more would have done, but shown on the map and changeable.
+ // Beside the last pane in reading order: where an open-one-more lands, but
+ // shown on the map and changeable.
useEffect(() => {
- if (!view || !current || full) return;
- for (const pane of [...view.terminals].reverse()) {
- for (const side of ["right", "below"] as const) {
- if (fitsWorkspace(previewSplit(current, pane.key, INCOMING, SPLIT_DIRECTION[side]))) {
- setChoice({ anchor: anchorOf(pane), side });
- return;
- }
- }
- }
- // A layout without room anywhere is left to the server's even grid.
+ const last = view?.terminals[view.terminals.length - 1];
+ if (!current || !last) return;
+ setChoice({ anchor: anchorOf(last), side: "right" });
// Only a newly loaded workspace re-picks; everything else derives from it.
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [view]);
@@ -133,16 +123,14 @@ export function MovePaneDialog({ request, busy, onCancel, onConfirm }: Props) {
const summary = (() => {
if (!view) return "";
- if (full) return `${targetName} is full: a workspace holds ${view.max_terminals} terminals.`;
if (!panes.length) return `${targetName} is empty, so ${paneName} fills it.`;
if (!shown) return `${paneName} joins ${targetName}, and every pane gets an even share.`;
const pane = panes.find((entry) => anchorOf(entry) === shown.anchor);
const words = SIDES.find((entry) => entry.side === shown.side)?.words ?? shown.side;
if (!pane) return "";
- if (!fits(pane, shown.side)) return `No room ${words} ${pane.name}. ${GRID_LIMIT_HINT}`;
return `${capital(words)} ${pane.name}: ${paneName} takes half of its space.`;
})();
- const submit = () => { if (!busy && !full && view) onConfirm(choice); };
+ const submit = () => { if (!busy && view) onConfirm(choice); };
return <Dialog.Root open={request !== null} onOpenChange={(open) => { if (!open && !busy) onCancel(); }}>
<Dialog.Portal>
@@ -214,7 +202,7 @@ export function MovePaneDialog({ request, busy, onCancel, onConfirm }: Props) {
<button type="button" disabled={busy} onClick={onCancel}
className="rounded-lg border border-border px-3.5 py-2 text-sm font-medium hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-40">
Cancel</button>
- <button type="submit" data-testid="move-pane-confirm" disabled={busy || full || !view}
+ <button type="submit" data-testid="move-pane-confirm" disabled={busy || !view}
className="flex items-center gap-1.5 rounded-lg bg-primary px-3.5 py-2 text-sm font-medium text-primary-foreground hover:bg-primary/90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-popover disabled:opacity-50">
{busy && <Loader2 className="h-3.5 w-3.5 animate-spin" aria-hidden />}
Move to {targetName}</button>
diff --git a/jarvis/ui/web/frontend/src/components/agentic/WorkspaceAgentSetup.tsx b/jarvis/ui/web/frontend/src/components/agentic/WorkspaceAgentSetup.tsx
index 90ddc0ab3f..8bee2603ad 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/WorkspaceAgentSetup.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/WorkspaceAgentSetup.tsx
@@ -3,19 +3,19 @@ import { Check } from "lucide-react";
import type { AgentStatus } from "@/lib/agenticIdeApi";
import { cn } from "@/lib/utils";
import { AgentMark } from "./AgentMark";
-import { MAX_WORKSPACE_PANES, balancedColumns } from "./workspaceDocking";
+import { MAX_PANES_PER_REQUEST, balancedColumns } from "./workspaceDocking";
interface Props {
agents: AgentStatus[];
sessions: string[];
onChange: (sessions: string[]) => void;
disabled?: boolean;
- /** The server's per-workspace pane limit (`max_terminals`). */
- maxSessions?: number;
+ /** How many one-click counts to offer; any larger count is typed. */
+ quickCounts?: number;
}
/** One launch plan: choose an agent for everyone, then customize individual seats. */
-export function WorkspaceAgentSetup({ agents, sessions, onChange, disabled = false, maxSessions = MAX_WORKSPACE_PANES }: Props) {
+export function WorkspaceAgentSetup({ agents, sessions, onChange, disabled = false, quickCounts = 16 }: Props) {
const [editingSeat, setEditing] = useState<number | null>(null);
const editing = editingSeat !== null && editingSeat < sessions.length ? editingSeat : null;
const firstAgent = agents[0]?.name ?? "";
@@ -85,15 +85,24 @@ export function WorkspaceAgentSetup({ agents, sessions, onChange, disabled = fal
<section aria-label="Number of sessions">
<h3 className="mb-3 text-xs font-semibold uppercase tracking-[0.14em] text-muted-foreground">How many sessions?</h3>
<div className="flex flex-wrap items-center gap-2">
- {Array.from({ length: maxSessions }, (_, index) => index + 1).map((count) => <button
+ {Array.from({ length: quickCounts }, (_, index) => index + 1).map((count) => <button
key={count} type="button" aria-label={`${count} ${count === 1 ? "session" : "sessions"}`}
aria-pressed={sessions.length === count} disabled={disabled || !firstAgent}
onClick={() => chooseCount(count)}
className={cn("flex h-11 w-11 items-center justify-center rounded-lg border text-sm font-semibold tabular-nums transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-40", sessions.length === count ? selection : idle)}>
{count}
</button>)}
+ <label className="flex items-center gap-1.5 text-xs text-muted-foreground">More
+ <input type="number" aria-label="Number of sessions" min={1} max={MAX_PANES_PER_REQUEST} value={sessions.length || ""}
+ disabled={disabled || !firstAgent}
+ onChange={(event) => {
+ const count = Math.trunc(Number(event.target.value));
+ if (Number.isFinite(count) && count >= 1) chooseCount(Math.min(count, MAX_PANES_PER_REQUEST));
+ }}
+ className="h-11 w-16 rounded-lg border border-input bg-background/60 px-2 text-center text-sm font-semibold tabular-nums text-foreground outline-none focus:border-ring focus:ring-1 focus:ring-ring/30 disabled:opacity-40" />
+ </label>
<span className="ml-2 text-xs text-muted-foreground">
- Up to {maxSessions} per workspace{sessions.length > 1 && <> · opens as {balancedColumns(sessions.length)} × {Math.ceil(sessions.length / balancedColumns(sessions.length))}</>}
+ Add more anytime{sessions.length > 1 && <> · opens as {balancedColumns(sessions.length)} × {Math.ceil(sessions.length / balancedColumns(sessions.length))}</>}
</span>
</div>
</section>
diff --git a/jarvis/ui/web/frontend/src/components/agentic/WorkspaceOptionsDialog.test.tsx b/jarvis/ui/web/frontend/src/components/agentic/WorkspaceOptionsDialog.test.tsx
index 54ff0fddfd..cd42b76ac4 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/WorkspaceOptionsDialog.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/WorkspaceOptionsDialog.test.tsx
@@ -5,7 +5,7 @@ import { WorkspaceOptionsDialog } from "./WorkspaceOptionsDialog";
afterEach(cleanup);
const setup = () => ({
open: true, onOpenChange: vi.fn(), workspace: "Installer", count: 6, busy: false, canAdd: true,
- maxPanes: 16, onAdd: vi.fn(), onBalance: vi.fn(), onRename: vi.fn(), onClose: vi.fn(), onGit: vi.fn(),
+ onAdd: vi.fn(), onBalance: vi.fn(), onRename: vi.fn(), onClose: vi.fn(), onGit: vi.fn(),
appearance: null, onAppearance: vi.fn(),
});
@@ -21,10 +21,10 @@ it("keeps arrangement and display controls accessible without a main toolbar", (
expect(props.onBalance).toHaveBeenCalledOnce();
});
-it("disables adding past the workspace limit and closes with Escape", () => {
+it("keeps adding open however many agents run, and closes with Escape", () => {
const props = setup();
- render(<WorkspaceOptionsDialog {...props} count={16} maxPanes={16} />);
- expect((screen.getByRole("button", { name: "Add coding agent" }) as HTMLButtonElement).disabled).toBe(true);
+ render(<WorkspaceOptionsDialog {...props} count={40} />);
+ expect((screen.getByRole("button", { name: "Add coding agent" }) as HTMLButtonElement).disabled).toBe(false);
fireEvent.keyDown(document, { key: "Escape" });
expect(props.onOpenChange).toHaveBeenCalledWith(false);
});
diff --git a/jarvis/ui/web/frontend/src/components/agentic/WorkspaceOptionsDialog.tsx b/jarvis/ui/web/frontend/src/components/agentic/WorkspaceOptionsDialog.tsx
index 805593919f..fa22ad2688 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/WorkspaceOptionsDialog.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/WorkspaceOptionsDialog.tsx
@@ -8,8 +8,6 @@ interface Props {
onOpenChange: (open: boolean) => void;
workspace: string;
count: number;
- /** The server's per-workspace pane limit (`max_terminals`). */
- maxPanes: number;
busy: boolean;
canAdd: boolean;
onAdd: () => void;
@@ -68,7 +66,7 @@ export function WorkspaceOptionsDialog(props: Props) {
</div>
</section>
<div className="border-t border-border pt-2">
- <button type="button" disabled={props.busy || !props.canAdd || props.count >= props.maxPanes} onClick={() => choose(props.onAdd)} className="block w-full rounded-lg px-2 py-2.5 text-left text-sm hover:bg-muted disabled:opacity-40">Add coding agent</button>
+ <button type="button" disabled={props.busy || !props.canAdd} onClick={() => choose(props.onAdd)} className="block w-full rounded-lg px-2 py-2.5 text-left text-sm hover:bg-muted disabled:opacity-40">Add coding agent</button>
<button type="button" disabled={props.busy} onClick={() => choose(props.onGit)} className="flex w-full items-center gap-2 rounded-lg px-2 py-2.5 text-left text-sm hover:bg-muted disabled:opacity-40"><GitBranch className="h-4 w-4 text-muted-foreground" />Git: branches, commits, worktrees</button>
<button type="button" disabled={props.busy} onClick={() => choose(props.onRename)} className="block w-full rounded-lg px-2 py-2.5 text-left text-sm hover:bg-muted disabled:opacity-40">Rename workspace</button>
<button type="button" disabled={props.busy} onClick={() => choose(props.onClose)} className="block w-full rounded-lg px-2 py-2.5 text-left text-sm text-destructive hover:bg-muted disabled:opacity-40">Close workspace</button>
diff --git a/jarvis/ui/web/frontend/src/components/agentic/WorkspaceTerminalGrid.transfer.test.tsx b/jarvis/ui/web/frontend/src/components/agentic/WorkspaceTerminalGrid.transfer.test.tsx
index 4d5e1b47cf..72a145a790 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/WorkspaceTerminalGrid.transfer.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/WorkspaceTerminalGrid.transfer.test.tsx
@@ -61,7 +61,7 @@ function sidebarRow(id: string, name: string): HTMLElement {
}
/** Blog, as the move dialog's map draws it: one Claude pane. */
-const blog = { id: "w2", name: "Blog", layout: { pane: "t1" }, max_terminals: 16,
+const blog = { id: "w2", name: "Blog", layout: { pane: "t1" },
terminals: [{ key: "t1", name: "T1", agent: "claude", display_name: "Claude Code", history_id: "b-T1" }] };
beforeEach(() => { vi.clearAllMocks(); api.layout.mockResolvedValue(blog); });
@@ -90,7 +90,7 @@ it("offers the other workspaces on this folder and moves the pane to the place p
});
it("says why a move was refused and keeps the pane", async () => {
- api.transfer.mockRejectedValue(new Error("Blog already has the maximum of 12 terminals."));
+ api.transfer.mockRejectedValue(new Error("Blog works in another folder."));
const onChanged = vi.fn(), onMutationEnd = vi.fn();
render(<WorkspaceTerminalGrid {...props} session={makeSession()} onChanged={onChanged} onMutationEnd={onMutationEnd} />);
@@ -98,7 +98,7 @@ it("says why a move was refused and keeps the pane", async () => {
await screen.findByRole("button", { name: "Place T1 below T1" });
fireEvent.click(screen.getByTestId("move-pane-confirm"));
- await waitFor(() => expect(api.toast).toHaveBeenCalledWith("error", "Blog already has the maximum of 12 terminals."));
+ await waitFor(() => expect(api.toast).toHaveBeenCalledWith("error", "Blog works in another folder."));
expect(onChanged).not.toHaveBeenCalled();
expect(onMutationEnd).toHaveBeenCalledOnce();
// Still open: another place can be picked.
diff --git a/jarvis/ui/web/frontend/src/components/agentic/WorkspaceTerminalGrid.tsx b/jarvis/ui/web/frontend/src/components/agentic/WorkspaceTerminalGrid.tsx
index 4c3cff8b09..041cd40179 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/WorkspaceTerminalGrid.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/WorkspaceTerminalGrid.tsx
@@ -16,7 +16,7 @@ import { cn } from "@/lib/utils";
import { PaneResizer } from "@/components/layout/PaneResizer";
import { treeLayout, treeLeaves, type LayoutNode, type PaneSeam } from "./treeLayout";
import { useTreeSizes } from "./useTreeSizes";
-import { DOCK_LABELS, GRID_LIMIT_HINT, MAX_GRID_COLUMNS, MAX_GRID_ROWS, MAX_WORKSPACE_PANES, dockPosition, fitsWorkspace, layoutSpan, paneStyle, previewDock, workspaceLayout } from "./workspaceDocking";
+import { DOCK_LABELS, dockPosition, layoutSpan, paneStyle, previewDock, workspaceLayout } from "./workspaceDocking";
const GAP = 8;
const MIN_WIDTH = 280;
@@ -46,8 +46,6 @@ interface Props {
onClose: (terminal: TerminalState) => void;
onSelect: (name: string) => void;
selected: string;
- /** The server's per-workspace pane limit; splitting stops there. */
- maxPanes?: number;
fontSize: number;
appearance: "light" | "dark" | null;
disabled?: boolean;
@@ -63,7 +61,7 @@ interface Props {
}
interface WorkspaceChoice { id: string; name: string; folder?: string }
-interface DropTarget { id: string; position: PaneMovePosition; allowed: boolean }
+interface DropTarget { id: string; position: PaneMovePosition }
interface DragFeedback { id: string; target: DropTarget | null; x: number; y: number; workspace?: WorkspaceChoice | null; blocked?: string | null }
/** The attribute a sidebar row carries when a dragged pane may be dropped on it. */
@@ -81,7 +79,7 @@ function sameFolder(left: string | undefined, right: string | undefined): boolea
return /^[a-z]:\//i.test(a) ? a.toLowerCase() === b.toLowerCase() : a === b;
}
-export function WorkspaceTerminalGrid({ session, onChanged, onAdd, onClose, onSelect, selected, maxPanes = MAX_WORKSPACE_PANES, fontSize, appearance, disabled = false, onMutationStart, onMutationEnd, paneStyle: look = "classic", workspaces = [] }: Props) {
+export function WorkspaceTerminalGrid({ session, onChanged, onAdd, onClose, onSelect, selected, fontSize, appearance, disabled = false, onMutationStart, onMutationEnd, paneStyle: look = "classic", workspaces = [] }: Props) {
const theme = useThemeValue();
const pushToast = useEventStore((state) => state.pushToast);
// The pane an agent card in the side panel pointed at, framed in blue.
@@ -182,7 +180,6 @@ export function WorkspaceTerminalGrid({ session, onChanged, onAdd, onClose, onSe
const before = workspaceLayout(owner.layout, owner.terminals);
if (!before || !source || !target) return;
const next = previewDock(before, source.key, target.key, position);
- if (!fitsWorkspace(next)) { setAnnouncement(GRID_LIMIT_HINT); return; }
saveInFlight.current = true;
latest.current.onMutationStart?.();
setSaving(true);
@@ -267,10 +264,8 @@ export function WorkspaceTerminalGrid({ session, onChanged, onAdd, onClose, onSe
const owner = latest.current.session;
const source = owner.terminals.find((terminal) => idOf(terminal) === id);
const target = owner.terminals.find((terminal) => idOf(terminal) === targetId);
- const before = workspaceLayout(owner.layout, owner.terminals);
- if (!source || !target || !before || targetId === id) return null;
- const position = dockPosition(x, y, rect);
- return { id: targetId!, position, allowed: fitsWorkspace(previewDock(before, source.key, target.key, position)) };
+ if (!source || !target || targetId === id) return null;
+ return { id: targetId!, position: dockPosition(x, y, rect) };
}
}
return null;
@@ -322,7 +317,7 @@ export function WorkspaceTerminalGrid({ session, onChanged, onAdd, onClose, onSe
const target = workspace ? null : targetAt(release.clientX, release.clientY);
cleanup();
if (armed && workspace) askWhere(id, workspace);
- else if (armed && target?.allowed) void move(id, target.id, target.position);
+ else if (armed && target) void move(id, target.id, target.position);
};
dragCleanup.current = cleanup;
window.addEventListener("pointermove", onMove, { capture: true, passive: false });
@@ -478,16 +473,16 @@ export function WorkspaceTerminalGrid({ session, onChanged, onAdd, onClose, onSe
onClose={() => onClose(terminal)} onAttachError={(message) => pushToast("error", message)}
onRename={(name) => rename(terminal, name)}
restartToken={restarts[id] ?? 0} onRestart={() => setRestarts((current) => ({ ...current, [id]: (current[id] ?? 0) + 1 }))}
- splitDisabled={tiles.length >= maxPanes} onSplit={(direction) => onAdd(terminal.name, direction)}
+ onSplit={(direction) => onAdd(terminal.name, direction)}
branch={terminal.branch || undefined}
computerName={computerName(terminal)} placementItems={placementItems(terminal)}
workspaceItems={transferring || saving || disabled ? [] : movable
.map((workspace) => ({ label: `Move to ${workspace.name}…`, run: () => askWhere(id, workspace) }))}
onFork={terminal.accepts_prompts === false ? undefined : () => setForking({ name: terminal.name, agent: terminal.agent, displayName: terminal.display_name, workspaceId: session.id })} />
{drag?.target?.id === id && <div aria-hidden="true" data-testid="dock-preview" data-position={drag.target.position}
- className={cn("pointer-events-none absolute z-20 flex items-center justify-center border-2 p-2", minimal ? "rounded-none" : "rounded-xl", drag.target.allowed ? "border-ring/70 bg-accent/[0.15]" : "border-destructive bg-background/80",
+ className={cn("pointer-events-none absolute z-20 flex items-center justify-center border-2 p-2", minimal ? "rounded-none" : "rounded-xl", "border-ring/70 bg-accent/[0.15]",
drag.target.position === "left" ? "inset-y-1 left-1 w-1/2" : drag.target.position === "right" ? "inset-y-1 right-1 w-1/2" : drag.target.position === "above" ? "inset-x-1 top-1 h-1/2" : drag.target.position === "below" ? "inset-x-1 bottom-1 h-1/2" : "inset-1")}>
- <span className="rounded-md bg-popover px-3 py-2 text-center text-xs font-medium text-popover-foreground shadow-lg">{drag.target.allowed ? DOCK_LABELS[drag.target.position] : `Maximum ${MAX_GRID_COLUMNS} columns × ${MAX_GRID_ROWS} rows`}</span>
+ <span className="rounded-md bg-popover px-3 py-2 text-center text-xs font-medium text-popover-foreground shadow-lg">{DOCK_LABELS[drag.target.position]}</span>
</div>}
</div>;
})}
diff --git a/jarvis/ui/web/frontend/src/components/agentic/workspaceDocking.test.ts b/jarvis/ui/web/frontend/src/components/agentic/workspaceDocking.test.ts
index 1b49f7cf57..7865eb2c48 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/workspaceDocking.test.ts
+++ b/jarvis/ui/web/frontend/src/components/agentic/workspaceDocking.test.ts
@@ -1,5 +1,5 @@
import { describe, expect, it } from "vitest";
-import { MAX_GRID_COLUMNS, MAX_GRID_ROWS, MAX_WORKSPACE_PANES, balancedColumns, balancedLayout, canSplitFit, dockPosition, fitsWorkspace, layoutSpan, previewDock, workspaceLayout } from "./workspaceDocking";
+import { BALANCED_GRID_COLUMNS, balancedColumns, balancedLayout, dockPosition, layoutSpan, previewDock, workspaceLayout } from "./workspaceDocking";
import { treeLayout, treeLeaves } from "./treeLayout";
describe("workspace docking geometry", () => {
@@ -8,7 +8,6 @@ describe("workspace docking geometry", () => {
const tree = balancedLayout(Array.from({ length: count }, (_, i) => String(i)));
expect(layoutSpan(tree, "row")).toBe(count <= 2 ? count : Math.ceil(count / 2));
expect(layoutSpan(tree, "column")).toBe(count <= 2 ? 1 : 2);
- expect(fitsWorkspace(tree)).toBe(true);
}
});
@@ -22,35 +21,31 @@ describe("workspace docking geometry", () => {
expect(treeLeaves(row)).toEqual(["a", "b"]);
});
- it("grows past eight panes a row at a time, never wider than four columns", () => {
- // Same table as `test_an_even_grid_never_grows_wider_than_four_columns`.
- const expected: [number, number, number][] = [[1, 1, 1], [2, 2, 1], [6, 3, 2], [8, 4, 2], [9, 3, 3], [12, 4, 3], [16, 4, 4]];
+ it("grows a row at a time up to sixteen panes, then about square", () => {
+ // Same table as `test_an_even_grid_grows_square_past_sixteen`.
+ const expected: [number, number, number][] = [
+ [1, 1, 1], [2, 2, 1], [6, 3, 2], [8, 4, 2], [9, 3, 3], [12, 4, 3], [16, 4, 4],
+ [17, 5, 4], [20, 5, 4], [25, 5, 5], [30, 6, 5], [100, 10, 10],
+ ];
for (const [count, columns, rows] of expected) {
expect(balancedColumns(count)).toBe(columns);
const tree = balancedLayout(Array.from({ length: count }, (_, i) => String(i)));
expect(layoutSpan(tree, "row")).toBe(columns);
expect(layoutSpan(tree, "column")).toBe(rows);
- expect(fitsWorkspace(tree)).toBe(true);
}
- expect(MAX_WORKSPACE_PANES).toBe(MAX_GRID_COLUMNS * MAX_GRID_ROWS);
+ expect(BALANCED_GRID_COLUMNS).toBe(4);
});
- it("allows a third row where eight panes used to be the end", () => {
- const eight = balancedLayout(["a", "b", "c", "d", "e", "f", "g", "h"])!;
- expect(fitsWorkspace(previewDock(eight, "e", "b", "above"))).toBe(true);
- const terminals = ["a", "b", "c", "d", "e", "f", "g", "h"].map((key) => ({ key }));
- expect(canSplitFit(eight, terminals, "a", "down")).toBe(true);
- });
-
- it("rejects a fifth row or fifth column while allowing swaps in a full workspace", () => {
+ it("docks a pane on any side, however wide or tall the workspace already is", () => {
const keys = Array.from({ length: 16 }, (_, i) => `p${i}`);
const full = balancedLayout(keys)!;
- expect(fitsWorkspace(previewDock(full, "p4", "p1", "above"))).toBe(false);
- expect(fitsWorkspace(previewDock(full, "p4", "p1", "left"))).toBe(false);
- expect(fitsWorkspace(previewDock(full, "p0", "p15", "swap"))).toBe(true);
- const terminals = keys.map((key) => ({ key }));
- expect(canSplitFit(full, terminals.slice(0, 15), "p0", "right", 16)).toBe(false);
- expect(canSplitFit(full, terminals, "p0", "down", 16)).toBe(false);
+ const fifthRow = previewDock(full, "p4", "p1", "above");
+ const fifthColumn = previewDock(full, "p4", "p1", "left");
+ expect(layoutSpan(fifthRow, "column")).toBe(5);
+ expect(layoutSpan(fifthColumn, "row")).toBe(5);
+ expect(treeLeaves(fifthColumn).sort()).toEqual([...keys].sort());
+ // What the grid draws is the docked tree itself, never a re-dealt grid.
+ expect(workspaceLayout(fifthColumn, keys.map((key) => ({ key })))).toBe(fifthColumn);
});
it("distinguishes the four edges from the center regardless of card aspect ratio", () => {
@@ -62,12 +57,18 @@ describe("workspace docking geometry", () => {
expect(dockPosition(410, 220, rect)).toBe("swap");
});
- it("fits legacy single-row snapshots into the workspace bounds before drawing", () => {
+ it("draws a wide saved row as it was saved", () => {
const terminals = Array.from({ length: 6 }, (_, i) => ({ key: `t${i}` }));
const saved = { direction: "row" as const, children: terminals.map(({ key }) => ({ pane: key })), weights: terminals.map(() => 1) };
const rendered = workspaceLayout(saved, terminals);
- expect(layoutSpan(rendered, "row")).toBe(3);
- expect(layoutSpan(rendered, "column")).toBe(2);
+ expect(layoutSpan(rendered, "row")).toBe(6);
+ expect(layoutSpan(rendered, "column")).toBe(1);
expect(treeLeaves(rendered)).toEqual(terminals.map((terminal) => terminal.key));
});
+
+ it("falls back to the even grid only when the saved tree does not match the panes", () => {
+ const terminals = Array.from({ length: 3 }, (_, i) => ({ key: `t${i}` }));
+ const stale = { direction: "row" as const, children: [{ pane: "t0" }, { pane: "gone" }], weights: [1, 1] };
+ expect(treeLeaves(workspaceLayout(stale, terminals))).toEqual(["t0", "t1", "t2"]);
+ });
});
diff --git a/jarvis/ui/web/frontend/src/components/agentic/workspaceDocking.ts b/jarvis/ui/web/frontend/src/components/agentic/workspaceDocking.ts
index 5c02905589..7ee2047f7f 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/workspaceDocking.ts
+++ b/jarvis/ui/web/frontend/src/components/agentic/workspaceDocking.ts
@@ -7,23 +7,26 @@ export const DOCK_LABELS: Record<PaneMovePosition, string> = {
};
/**
- * The largest grid a workspace draws, and so how many agents it holds. Mirrors
- * `MAX_GRID_COLUMNS` / `MAX_GRID_ROWS` in `jarvis/agentic_ide/session.py`; the
- * live count limit comes from the server's `max_terminals`.
+ * A workspace holds any number of panes in any shape. The only guard is on ONE
+ * request: a launch opens at most this many at once. Mirrors
+ * `MAX_PANES_PER_REQUEST` in `jarvis/agentic_ide/session.py`.
*/
-export const MAX_GRID_COLUMNS = 4;
-export const MAX_GRID_ROWS = 4;
-export const MAX_WORKSPACE_PANES = MAX_GRID_COLUMNS * MAX_GRID_ROWS;
-export const GRID_LIMIT_HINT = `A workspace holds at most ${MAX_GRID_COLUMNS} columns and ${MAX_GRID_ROWS} rows.`;
+export const MAX_PANES_PER_REQUEST = 100;
+
+/** How wide the even grid prefers to be; a preference, never a limit. Mirrors `BALANCED_GRID_COLUMNS`. */
+export const BALANCED_GRID_COLUMNS = 4;
/**
* Columns of the even grid: two panes share a row, three to eight use two
- * rows, beyond that one more row per four panes. Mirrors `balanced_columns`.
+ * rows, up to sixteen one more row per four panes, beyond that about square.
+ * Mirrors `balanced_columns`.
*/
export function balancedColumns(count: number): number {
if (count <= 2) return Math.max(1, count);
- const rows = count <= 2 * MAX_GRID_COLUMNS ? 2 : Math.ceil(count / MAX_GRID_COLUMNS);
- return Math.min(MAX_GRID_COLUMNS, Math.ceil(count / rows));
+ const wide = BALANCED_GRID_COLUMNS;
+ if (count > wide * wide) return Math.ceil(Math.sqrt(count));
+ const rows = count <= 2 * wide ? 2 : Math.ceil(count / wide);
+ return Math.min(wide, Math.ceil(count / rows));
}
/** The even grid for `keys`, dealt row by row. */
@@ -40,7 +43,7 @@ export function balancedLayout(keys: readonly string[]): LayoutNode | null {
export function workspaceLayout(tree: LayoutNode | null | undefined, terminals: readonly Pick<TerminalState, "key">[]): LayoutNode | null {
const keys = terminals.map((terminal) => terminal.key);
const leaves = treeLeaves(tree);
- return tree && fitsWorkspace(tree) && leaves.length === keys.length && new Set(leaves).size === keys.length && leaves.every((key) => keys.includes(key))
+ return tree && leaves.length === keys.length && new Set(leaves).size === keys.length && leaves.every((key) => keys.includes(key))
? tree : balancedLayout(keys);
}
@@ -51,10 +54,6 @@ export function layoutSpan(tree: LayoutNode | null, axis: "row" | "column"): num
return tree.direction === axis ? spans.reduce((a, b) => a + b, 0) : Math.max(0, ...spans);
}
-export function fitsWorkspace(tree: LayoutNode | null): boolean {
- return layoutSpan(tree, "row") <= MAX_GRID_COLUMNS && layoutSpan(tree, "column") <= MAX_GRID_ROWS;
-}
-
export function isBalancedWorkspace(tree: LayoutNode | null | undefined, terminals: readonly Pick<TerminalState, "key" | "name">[]): boolean {
const current = treeLayout(workspaceLayout(tree, terminals), terminals).boxes;
const balanced = treeLayout(balancedLayout(terminals.map((terminal) => terminal.key)), terminals).boxes;
@@ -110,22 +109,6 @@ export function previewSplit(
return insert(tree);
}
-/** Whether one more pane split off `anchorKey` stays within the pane limit and the grid. */
-export function canSplitFit(
- tree: LayoutNode | null | undefined,
- terminals: readonly Pick<TerminalState, "key">[],
- anchorKey: string | undefined,
- direction: "right" | "down" | "left" | "above",
- maxPanes: number = MAX_WORKSPACE_PANES,
-): boolean {
- if (terminals.length >= maxPanes) return false;
- if (terminals.length === 0 || !anchorKey) return true;
- const current = workspaceLayout(tree, terminals);
- if (!current) return true;
- const preview = previewSplit(current, anchorKey, "__preview__", direction);
- return fitsWorkspace(preview);
-}
-
/** The nearest outer quarter is a docking edge; the middle swaps whole panes. */
export function dockPosition(x: number, y: number, rect: Pick<DOMRect, "left" | "top" | "width" | "height">): PaneMovePosition {
const horizontal = (x - rect.left) / rect.width, vertical = (y - rect.top) / rect.height;
diff --git a/jarvis/ui/web/frontend/src/components/society/chat/CodingComposer.test.tsx b/jarvis/ui/web/frontend/src/components/society/chat/CodingComposer.test.tsx
index dbfa8e9655..41ce730d1a 100644
--- a/jarvis/ui/web/frontend/src/components/society/chat/CodingComposer.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/society/chat/CodingComposer.test.tsx
@@ -20,7 +20,7 @@ afterEach(cleanup);
beforeEach(() => {
vi.clearAllMocks();
vi.mocked(fetchIdeAgents).mockResolvedValue({
- terminal_available: true, max_terminals: 12, suggested_names: ["T1"],
+ terminal_available: true, max_panes_per_request: 100, suggested_names: ["T1"],
agents: [
{ name: "codex", display_name: "Codex", installed: true, accepts_prompts: true, version: null, install_command: null },
{ name: "future-cli", display_name: "Future CLI", installed: true, accepts_prompts: true, custom: true, version: null, install_command: null },
diff --git a/jarvis/ui/web/frontend/src/lib/agenticIdeApi.transfer.test.ts b/jarvis/ui/web/frontend/src/lib/agenticIdeApi.transfer.test.ts
index 1ebdb4d864..bad429e422 100644
--- a/jarvis/ui/web/frontend/src/lib/agenticIdeApi.transfer.test.ts
+++ b/jarvis/ui/web/frontend/src/lib/agenticIdeApi.transfer.test.ts
@@ -44,7 +44,7 @@ it("names the chosen place in the target grid", async () => {
});
it("reads another workspace's shape from its own route", async () => {
- answer(200, { id: "w2", name: "Blog", layout: null, terminals: [], max_terminals: 16 });
+ answer(200, { id: "w2", name: "Blog", layout: null, terminals: [] });
const view = await fetchWorkspaceLayout("w2");
diff --git a/jarvis/ui/web/frontend/src/lib/agenticIdeApi.ts b/jarvis/ui/web/frontend/src/lib/agenticIdeApi.ts
index 118c6b247b..62023dccec 100644
--- a/jarvis/ui/web/frontend/src/lib/agenticIdeApi.ts
+++ b/jarvis/ui/web/frontend/src/lib/agenticIdeApi.ts
@@ -73,7 +73,8 @@ export interface AgentStatus {
export interface AgentsResponse {
terminal_available: boolean;
- max_terminals: number;
+ /** The most panes one launch opens at once; a workspace itself has no limit. */
+ max_panes_per_request: number;
suggested_names: string[];
agents: AgentStatus[];
}
@@ -425,7 +426,6 @@ export interface IdeProjectsResponse {
projects: IdeProject[];
active_project_id: string | null;
active_workspace_id: string | null;
- max_terminals: number;
}
export function fetchIdeProjects(): Promise<IdeProjectsResponse> {
@@ -501,7 +501,6 @@ export interface IdeAccountState {
export interface IdeState {
active: boolean;
session: SessionState | null;
- max_terminals: number;
/** Every open workspace, in tab order. */
workspaces: WorkspaceCard[];
/** The one on screen, or null while the wizard is showing. */
@@ -1246,7 +1245,6 @@ export async function openIdeWorkspace(
const EMPTY_IDE_STATE: IdeState = {
active: false,
session: null,
- max_terminals: 16,
workspaces: [],
active_id: null,
max_workspaces: 6,
@@ -1525,7 +1523,6 @@ export interface WorkspaceLayoutView {
/** What the pane's header shows: its goal in a few words, or empty. */
title?: string;
})[];
- max_terminals: number;
}
/** The split tree and panes of an open workspace that may not be on screen. */
diff --git a/jarvis/ui/web/frontend/src/views/AgenticIdeView.test.tsx b/jarvis/ui/web/frontend/src/views/AgenticIdeView.test.tsx
index e4250540fe..58767ba094 100644
--- a/jarvis/ui/web/frontend/src/views/AgenticIdeView.test.tsx
+++ b/jarvis/ui/web/frontend/src/views/AgenticIdeView.test.tsx
@@ -173,18 +173,18 @@ describe("Agentic IDE project flow", () => {
expect(api.reorderIdeTerminals).not.toHaveBeenCalled();
});
- it("shows the pane count and refuses a new agent once the workspace is full", async () => {
- const terminals = Array.from({ length: 16 }, (_, index) => ({ key: `t${index}`, history_id: `id${index}`, name: `T${index}`, display_name: "Codex" }));
+ it("shows the pane count and never refuses a new agent, however many are open", async () => {
+ const terminals = Array.from({ length: 20 }, (_, index) => ({ key: `t${index}`, history_id: `id${index}`, name: `T${index}`, display_name: "Codex" }));
const session = { id: "w1", project_id: "p1", folder: "/code/app", name: "App work", created_at: 0,
focus_mode: false, project: { name: "App" }, terminals, layout: balancedLayout(terminals.map((terminal) => terminal.key)) };
- api.fetchIdeState.mockResolvedValue({ ...emptyState, active: true, active_id: "w1", session, max_terminals: 16 });
+ api.fetchIdeState.mockResolvedValue({ ...emptyState, active: true, active_id: "w1", session });
api.fetchIdeProjects.mockResolvedValue({ projects: [project], active_workspace_id: "w1" });
render(<AgenticIdeView />);
fireEvent.click(await screen.findByRole("button", { name: "Pane add" }));
const dialog = screen.getByRole("dialog", { name: "Add coding agent" });
- expect(within(dialog).getByText(/16 of 16 agents/)).toBeTruthy();
- expect(within(dialog).getByRole("status").textContent).toContain("This workspace is full");
- expect((within(dialog).getByRole("button", { name: "Codex" }) as HTMLButtonElement).disabled).toBe(true);
+ expect(within(dialog).getByText(/20 agents/)).toBeTruthy();
+ expect(within(dialog).queryByText(/is full/)).toBeNull();
+ expect((within(dialog).getByRole("button", { name: "Codex" }) as HTMLButtonElement).disabled).toBe(false);
});
it("exposes compact workspace rename and close actions", async () => {
@@ -223,18 +223,16 @@ describe("Agentic IDE project flow", () => {
await waitFor(() => expect(api.reorderIdeTerminals).toHaveBeenCalledWith("w1", terminals.map((terminal) => terminal.history_id)));
});
- it("persists a balanced correction for an oversized restored layout", async () => {
+ it("keeps a wide restored layout as it was arranged", async () => {
const terminals = Array.from({ length: 6 }, (_, index) => ({ key: `t${index}`, history_id: `id${index}`, name: `T${index}` }));
const session = { id: "w1", project_id: "p1", folder: "/code/app", name: "Restored", created_at: 0,
focus_mode: false, project: { name: "App" }, terminals, layout: { direction: "row", children: terminals.map((terminal) => ({ pane: terminal.key })), weights: terminals.map(() => 1) } };
const current = { ...emptyState, active: true, active_id: "w1", session };
api.fetchIdeState.mockResolvedValue(current);
api.fetchIdeProjects.mockResolvedValue({ projects: [project], active_workspace_id: "w1" });
- api.reorderIdeTerminals.mockResolvedValue({ ...current, session: { ...session, layout: balancedLayout(terminals.map((terminal) => terminal.key)) } });
render(<AgenticIdeView onScreen={false} />);
await screen.findByTestId("live-grid");
- expect(api.reorderIdeTerminals).toHaveBeenCalledOnce();
- expect(api.reorderIdeTerminals).toHaveBeenCalledWith("w1", terminals.map((terminal) => terminal.history_id));
+ expect(api.reorderIdeTerminals).not.toHaveBeenCalled();
});
it("never rebalances a different workspace returned by a delayed add", async () => {
diff --git a/jarvis/ui/web/frontend/src/views/AgenticIdeView.tsx b/jarvis/ui/web/frontend/src/views/AgenticIdeView.tsx
index 1026e91506..4781b7a0e1 100644
--- a/jarvis/ui/web/frontend/src/views/AgenticIdeView.tsx
+++ b/jarvis/ui/web/frontend/src/views/AgenticIdeView.tsx
@@ -9,7 +9,7 @@ import { WorkspaceOptionsDialog } from "@/components/agentic/WorkspaceOptionsDia
import { FONT_DEFAULT } from "@/components/agentic/paneFont";
import { storePaneStyle, storedPaneStyle, type PaneStyle } from "@/components/agentic/terminalThemes";
import { IdeSidePanelFrame } from "@/components/agentic/sidePanel/IdeSidePanel";
-import { GRID_LIMIT_HINT, MAX_WORKSPACE_PANES, canSplitFit, fitsWorkspace, isBalancedWorkspace } from "@/components/agentic/workspaceDocking";
+import { isBalancedWorkspace } from "@/components/agentic/workspaceDocking";
import { AgentMark } from "@/components/agentic/AgentMark";
import { CloseAgentDialog, type CloseTarget } from "@/components/agentic/CloseAgentDialog";
import { GitCheckoutPicker } from "@/components/agentic/git/GitCheckoutPicker";
@@ -117,9 +117,7 @@ export function AgenticIdeView({ onScreen = true }: AgenticIdeViewProps) {
const activationRunning = useRef(false);
const pendingActivation = useRef<string | null>(null);
const gridMutations = useRef(0);
- const normalizingLayout = useRef(false);
const session = state?.session ?? null;
- const maxPanes = state?.max_terminals ?? MAX_WORKSPACE_PANES;
const codingAgents = agents.filter((agent) => agent.kind !== "shell" && agent.accepts_prompts !== false);
const installed = codingAgents.filter((agent) => agent.installed);
// On a connected computer the CLI has to be installed THERE, not here: the
@@ -158,7 +156,7 @@ export function AgenticIdeView({ onScreen = true }: AgenticIdeViewProps) {
}, [dialogOpen, projectDialog, workspaceProject, renameOpen, agentPicker, busy]);
const refresh = useCallback(async (allowDuringActivation = false) => {
- if (normalizingLayout.current || ((activationRunning.current || gridMutations.current > 0) && !allowDuringActivation)) return;
+ if (((activationRunning.current || gridMutations.current > 0) && !allowDuringActivation)) return;
const epoch = ++refreshEpoch.current;
let [nextState, listing] = await Promise.all([fetchIdeState(), fetchIdeProjects()]);
// A workspace switch can fall between the two reads. Never publish a tree
@@ -167,17 +165,6 @@ export function AgenticIdeView({ onScreen = true }: AgenticIdeViewProps) {
[nextState, listing] = await Promise.all([fetchIdeState(), fetchIdeProjects()]);
}
if (epoch !== refreshEpoch.current || pendingActivation.current || ((activationRunning.current || gridMutations.current > 0) && !allowDuringActivation) || nextState.active_id !== listing.active_workspace_id) return;
- const incoming = nextState.session;
- if (incoming?.layout && incoming.terminals.length <= (nextState.max_terminals ?? MAX_WORKSPACE_PANES) && !fitsWorkspace(incoming.layout)) {
- // Older snapshots and terminals opened outside this view may exceed the
- // grid bounds. Persist the same balanced fallback the grid displays.
- normalizingLayout.current = true;
- try {
- nextState = await reorderIdeTerminals(incoming.id, incoming.terminals.map((terminal) => terminal.history_id ?? terminal.key));
- listing = await fetchIdeProjects();
- } finally { normalizingLayout.current = false; }
- if (epoch !== refreshEpoch.current || pendingActivation.current || nextState.active_id !== listing.active_workspace_id) return;
- }
setState(nextState);
setProjects(listing.projects);
publishProjects(listing.projects, listing.active_workspace_id);
@@ -385,8 +372,8 @@ export function AgenticIdeView({ onScreen = true }: AgenticIdeViewProps) {
}, { onMessage: notify });
onDone?.();
// Grow an automatic grid evenly when adding without an explicit anchor;
- // keep a custom arrangement until another pane would exceed the workspace bounds.
- if (next.id === workspaceId && next.terminals.length > 1 && ((wasBalanced && !hasExplicitAnchor) || (next.layout && !fitsWorkspace(next.layout)))) {
+ // a custom arrangement is always kept — it has no size limit.
+ if (next.id === workspaceId && next.terminals.length > 1 && wasBalanced && !hasExplicitAnchor) {
const balanced = await reorderIdeTerminals(next.id, next.terminals.map((terminal) => terminal.history_id ?? terminal.key));
next = balanced.session ?? next;
}
@@ -434,15 +421,10 @@ export function AgenticIdeView({ onScreen = true }: AgenticIdeViewProps) {
setAgentComputer(anchorPane ? anchorPane.computer_id || null : workspaceRunsOn(session.terminals));
setAgentPicker({ id: session.id, name: session.name ?? session.project.name });
}, [session, selected]);
- // The chosen direction when it fits; otherwise the first that does; null
- // when the anchor has no room at all (the agent then joins the even grid).
- const workspaceFull = Boolean(session && session.terminals.length >= maxPanes);
+ // The chosen direction beside the chosen pane; null without an anchor (the
+ // agent then joins the grid). Every direction fits: a workspace has no size limit.
const pickerAnchorKey = session?.terminals.find((terminal) => terminal.name === splitAnchor)?.key;
- const directionFits = (direction: PaneSplitDirection) =>
- Boolean(session && pickerAnchorKey && canSplitFit(session.layout, session.terminals, pickerAnchorKey, direction, maxPanes));
- const effectiveDirection = !pickerAnchorKey ? null
- : directionFits(splitDirection) ? splitDirection
- : SPLIT_DIRECTIONS.find((item) => directionFits(item.id))?.id ?? null;
+ const effectiveDirection = pickerAnchorKey ? splitDirection : null;
const closeVoice = () => { setVoiceOpen(false); storeVoiceBubbleOpen(false); };
const jumpToPane = (workspaceId: string, pane: string) => void run(async () => {
if (workspaceId !== session?.id) setState(await activateWorkspace(workspaceId));
@@ -474,7 +456,7 @@ export function AgenticIdeView({ onScreen = true }: AgenticIdeViewProps) {
return <div className="relative flex h-full min-h-0 flex-col bg-background text-foreground" data-testid="igentic-ide">
<WorkspaceOptionsDialog open={optionsOpen && !!session} onOpenChange={setOptionsOpen} workspace={session?.name ?? session?.project.name ?? ""}
- count={session?.terminals.length ?? 0} maxPanes={maxPanes} busy={busy} canAdd={installed.length > 0}
+ count={session?.terminals.length ?? 0} busy={busy} canAdd={installed.length > 0}
onAdd={openAgentPicker} onBalance={balanceLayout} onRename={() => { setRenameValue(session?.name ?? session?.project.name ?? ""); setRenameOpen(true); }}
onClose={stopWorkspace} onGit={() => setGitOpen(true)} appearance={appearance} onAppearance={saveAppearance}
paneStyle={paneStyle} onPaneStyle={savePaneStyle}
@@ -486,7 +468,7 @@ export function AgenticIdeView({ onScreen = true }: AgenticIdeViewProps) {
<main className="min-h-0 flex-1">
<IdeSidePanelFrame markInUse={paneStyle === "minimal"}>
{session ? <WorkspaceTerminalGrid key={session.id} session={session} onChanged={(next) => setState((current) => current?.session?.id === next.id ? { ...current, session: next } : current)}
- onAdd={openAgentPicker} onClose={closeAgent} onSelect={setSelected} selected={selected} maxPanes={maxPanes} fontSize={fontSize} appearance={appearance} disabled={busy}
+ onAdd={openAgentPicker} onClose={closeAgent} onSelect={setSelected} selected={selected} fontSize={fontSize} appearance={appearance} disabled={busy}
onMutationStart={beginGridMutation} onMutationEnd={endGridMutation} paneStyle={paneStyle} workspaces={state.workspaces ?? []} />
: <div className="flex h-full flex-col items-center justify-center gap-3 px-6 text-center">
<FolderPlus className="h-8 w-8 text-muted-foreground/70" />
@@ -504,7 +486,7 @@ export function AgenticIdeView({ onScreen = true }: AgenticIdeViewProps) {
<section data-ide-dialog tabIndex={-1} role="dialog" aria-modal="true" aria-label="Add coding agent"
className="w-full max-w-lg rounded-2xl border border-border bg-card p-5 shadow-2xl">
<div className="mb-4 flex items-center justify-between gap-3">
- <div><h2 className="text-base font-semibold">Add coding agent</h2><p className="mt-1 text-xs text-muted-foreground">{agentPicker.name}{session && <> · {session.terminals.length} of {maxPanes} agents</>}</p></div>
+ <div><h2 className="text-base font-semibold">Add coding agent</h2><p className="mt-1 text-xs text-muted-foreground">{agentPicker.name}{session && <> · {session.terminals.length} {session.terminals.length === 1 ? "agent" : "agents"}</>}</p></div>
<button type="button" aria-label="Close" onClick={() => setAgentPicker(null)} className="rounded-md p-1.5 hover:bg-muted"><X className="h-4 w-4" /></button>
</div>
@@ -527,10 +509,9 @@ export function AgenticIdeView({ onScreen = true }: AgenticIdeViewProps) {
</div>
{anchorTerminal ? <div className="grid grid-cols-4 gap-2" role="radiogroup" aria-label="Split direction">
{SPLIT_DIRECTIONS.map((item) => {
- const fits = directionFits(item.id);
const checked = effectiveDirection === item.id;
return <button key={item.id} type="button" role="radio" aria-checked={checked} aria-label={`Split ${item.label.toLowerCase()}`}
- disabled={busy || !fits} title={fits ? item.hint : `No room here. ${GRID_LIMIT_HINT}`}
+ disabled={busy} title={item.hint}
onClick={() => { setSplitDirection(item.id); storeSplitDirection(item.id); }}
className={cn("flex flex-col items-center justify-center gap-1.5 rounded-lg border py-2 text-xs font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-40",
checked ? "border-primary bg-primary/10 text-foreground ring-1 ring-primary/40" : "border-border bg-background text-muted-foreground hover:bg-muted hover:text-foreground")}>
@@ -538,14 +519,11 @@ export function AgenticIdeView({ onScreen = true }: AgenticIdeViewProps) {
</button>;
})}
</div> : <p className="text-xs text-muted-foreground">The new agent joins the grid and every pane gets an equal share.</p>}
- {anchorTerminal && !effectiveDirection && <p className="text-xs text-muted-foreground">No room beside {anchorTerminal.name}; the new agent joins the automatic grid instead.</p>}
</div>;
})()}
<div className="grid grid-cols-1 gap-2 sm:grid-cols-2">
- {workspaceFull && agentGit.mode === "current" && <p role="status" className="col-span-full rounded-lg border border-border bg-muted/40 px-3 py-2 text-xs text-muted-foreground">
- This workspace is full ({maxPanes} agents). Close a pane, or open another workspace for more agents.</p>}
- {agentChoices.map((agent) => <button key={agent.name} type="button" disabled={busy || (workspaceFull && agentGit.mode === "current")}
+ {agentChoices.map((agent) => <button key={agent.name} type="button" disabled={busy}
onClick={() => {
const owner = agentPicker.id;
// Copying a folder to a computer takes a while: the dialog stays
@@ -593,7 +571,7 @@ export function AgenticIdeView({ onScreen = true }: AgenticIdeViewProps) {
<input value={workspaceName} disabled={busy} onChange={(event) => setWorkspaceName(event.target.value)}
placeholder="Workspace" className="mt-2 h-11 w-full rounded-lg border border-input bg-background/60 px-3 text-sm text-foreground outline-none focus:border-ring focus:ring-1 focus:ring-ring/30" />
</label>
- <WorkspaceAgentSetup agents={workspaceChoices} sessions={workspaceAgents} onChange={setWorkspaceAgents} disabled={busy} maxSessions={maxPanes} />
+ <WorkspaceAgentSetup agents={workspaceChoices} sessions={workspaceAgents} onChange={setWorkspaceAgents} disabled={busy} />
<GitCheckoutPicker folder={workspaceProject.path} value={workspaceGit} onChange={setWorkspaceGit} disabled={busy} context="workspace" />
<RunOnPicker value={workspaceComputer} onChange={setWorkspaceComputer} disabled={busy} />
</div>
diff --git a/jarvis/voice/action_phrases.py b/jarvis/voice/action_phrases.py
index 7fdedf5255..07c649c013 100644
--- a/jarvis/voice/action_phrases.py
+++ b/jarvis/voice/action_phrases.py
@@ -582,17 +582,17 @@ _PHRASES: dict[str, dict[str, str]] = {
"en": "There are no matching open terminals.",
"es": "No hay terminales abiertas que coincidan.",
},
- # Fewer than asked for, because the workspace cap cut the batch short. Named
+ # Fewer than asked for, because a pane failed to start mid-batch. Named
# separately from the plain success so the shortfall is impossible to miss.
"ide_terminals_spawned_capped": {
- "de": "Platz war nur für {count}: {names}.", # i18n-allow
- "en": "There was only room for {count}: {names}.",
- "es": "Solo había espacio para {count}: {names}.",
- },
- "ide_terminals_full": {
- "de": "Der Workspace ist voll, {max} Terminals laufen schon.", # i18n-allow
- "en": "The workspace is full, {max} terminals are already running.",
- "es": "El espacio de trabajo está lleno, ya hay {max} terminales.",
+ "de": "Nur {count} ließen sich öffnen: {names}.", # i18n-allow
+ "en": "Only {count} could be opened: {names}.",
+ "es": "Solo se pudieron abrir {count}: {names}.",
+ },
+ "ide_terminals_open_failed": {
+ "de": "Ich konnte kein Terminal öffnen.", # i18n-allow
+ "en": "I could not open a terminal.",
+ "es": "No pude abrir ninguna terminal.",
},
# The name came through garbled and lands between two coding CLIs. Asked
# rather than guessed (maintainer directive 2026-07-28): a needless question
diff --git a/tests/unit/agentic_ide/test_cold_start_gate.py b/tests/unit/agentic_ide/test_cold_start_gate.py
index 24063a8454..6dc40f9aa9 100644
--- a/tests/unit/agentic_ide/test_cold_start_gate.py
+++ b/tests/unit/agentic_ide/test_cold_start_gate.py
@@ -88,12 +88,12 @@ async def test_a_full_workspace_starts_in_waves(
pool.hold_s = 0.05
registry = ide.Registry(pty_manager=pool)
session = await registry.start(
- str(tmp_path), [{"agent": "claude"} for _ in range(ide.MAX_TERMINALS)]
+ str(tmp_path), [{"agent": "claude"} for _ in range(16)]
)
await _attach_all(registry, session)
- assert len(pool.spawns) == ide.MAX_TERMINALS, "every pane still gets its agent"
+ assert len(pool.spawns) == 16, "every pane still gets its agent"
assert pool.peak <= 3, f"{pool.peak} agents were starting at once"
diff --git a/tests/unit/agentic_ide/test_many_terminals.py b/tests/unit/agentic_ide/test_many_terminals.py
index a41a21b6e0..14e8e740c4 100644
--- a/tests/unit/agentic_ide/test_many_terminals.py
+++ b/tests/unit/agentic_ide/test_many_terminals.py
@@ -1,4 +1,4 @@
-"""Workspace capacity, independent sessions and bounded persistent metadata."""
+"""Large workspaces, independent sessions and bounded persistent metadata."""
from __future__ import annotations
@@ -13,6 +13,10 @@ from jarvis.agentic_ide.agent_sessions import ResumeHandle
from jarvis.agentic_ide.names import default_names
from tests.fakes.fake_pty_manager import FakePtyManager
+#: A workspace well past the sixteen panes that used to be the ceiling. There
+#: is no ceiling any more; this is just "large" for the tests below.
+LARGE = 24
+
@pytest.fixture
def registry(monkeypatch: pytest.MonkeyPatch) -> ide.Registry:
@@ -21,28 +25,25 @@ def registry(monkeypatch: pytest.MonkeyPatch) -> ide.Registry:
# ----------------------------------------------------------------- call-signs
-def test_the_call_sign_pool_covers_one_full_workspace() -> None:
+def test_the_call_sign_pool_covers_a_large_workspace() -> None:
"""Every pane in one workspace needs its own speakable name.
Names are scoped to the front workspace, so other tabs may reuse them
- without ambiguity. The pool therefore only has to cover the per-workspace
- pane ceiling, regardless of how many workspaces are open.
+ without ambiguity. The pool grows with the workspace: there is no ceiling.
"""
- pool = default_names(ide.MAX_TERMINALS)
- assert len(pool) == ide.MAX_TERMINALS
- assert len(set(pool)) == ide.MAX_TERMINALS, "a repeated call-sign is ambiguous"
+ pool = default_names(ide.MAX_PANES_PER_REQUEST)
+ assert len(pool) == ide.MAX_PANES_PER_REQUEST
+ assert len(set(pool)) == ide.MAX_PANES_PER_REQUEST, "a repeated call-sign is ambiguous"
async def test_opening_a_full_workspace_gives_each_a_distinct_name(
registry: ide.Registry, tmp_path: Path
) -> None:
- session = await registry.start(
- str(tmp_path), [{"agent": "claude"} for _ in range(ide.MAX_TERMINALS)]
- )
+ session = await registry.start(str(tmp_path), [{"agent": "claude"} for _ in range(LARGE)])
names = [t.name for t in session.terminals]
keys = [t.key for t in session.terminals]
- assert len(set(names)) == ide.MAX_TERMINALS
- assert len(set(keys)) == ide.MAX_TERMINALS
+ assert len(set(names)) == LARGE
+ assert len(set(keys)) == LARGE
assert "" not in keys
@@ -50,9 +51,7 @@ async def test_a_full_workspace_can_each_be_found_by_name(
registry: ide.Registry, tmp_path: Path
) -> None:
"""Voice reaches a pane by its call-sign; that must not degrade with size."""
- session = await registry.start(
- str(tmp_path), [{"agent": "claude"} for _ in range(ide.MAX_TERMINALS)]
- )
+ session = await registry.start(str(tmp_path), [{"agent": "claude"} for _ in range(LARGE)])
for term in session.terminals:
assert session.find(term.name) is term
assert session.find(term.key) is term
@@ -63,49 +62,64 @@ async def test_the_grid_stays_gapless_at_a_full_workspace(
registry: ide.Registry, tmp_path: Path
) -> None:
"""A hole in the coordinates renders as a blank stripe in the UI."""
- session = await registry.start(
- str(tmp_path), [{"agent": "claude"} for _ in range(ide.MAX_TERMINALS)]
- )
+ session = await registry.start(str(tmp_path), [{"agent": "claude"} for _ in range(LARGE)])
columns = sorted({t.column for t in session.terminals})
assert columns == list(range(len(columns))), "column numbers must be packed"
for column in columns:
slots = sorted(t.slot for t in session.terminals if t.column == column)
assert slots == list(range(len(slots))), "slots must be packed per column"
- assert [t.index for t in session.terminals] == list(range(ide.MAX_TERMINALS))
+ assert [t.index for t in session.terminals] == list(range(LARGE))
async def test_closing_the_middle_of_a_large_workspace_repacks_it(
registry: ide.Registry, tmp_path: Path
) -> None:
- session = await registry.start(
- str(tmp_path), [{"agent": "claude"} for _ in range(ide.MAX_TERMINALS)]
- )
- victim = session.terminals[ide.MAX_TERMINALS // 2].name
+ session = await registry.start(str(tmp_path), [{"agent": "claude"} for _ in range(LARGE)])
+ victim = session.terminals[LARGE // 2].name
await registry.close_terminal(victim)
- assert len(session.terminals) == ide.MAX_TERMINALS - 1
+ assert len(session.terminals) == LARGE - 1
columns = sorted({t.column for t in session.terminals})
assert columns == list(range(len(columns)))
- assert [t.index for t in session.terminals] == list(range(ide.MAX_TERMINALS - 1))
+ assert [t.index for t in session.terminals] == list(range(LARGE - 1))
+
+
+async def test_a_workspace_has_no_pane_limit(registry: ide.Registry, tmp_path: Path) -> None:
+ """Past the sixteen that used to be the ceiling, one more pane still opens."""
+ await registry.start(str(tmp_path), [{"agent": "claude"} for _ in range(16)])
+ for _ in range(LARGE - 16):
+ await registry.add_terminal(agent="claude")
+ session = registry.session
+ assert session is not None
+ assert len(session.terminals) == LARGE
+ assert len(set(ide.layout_tree.leaves(session.layout))) == LARGE
-async def test_the_cap_is_enforced_rather_than_exceeded(
+async def test_a_batch_is_never_refused_for_the_size_of_the_workspace(
registry: ide.Registry, tmp_path: Path
) -> None:
- """Whatever the cap is, it has to be the real ceiling."""
- await registry.start(str(tmp_path), [{"agent": "claude"} for _ in range(ide.MAX_TERMINALS)])
- with pytest.raises(ide.SessionError, match="maximum"):
- await registry.add_terminal()
+ await registry.start(str(tmp_path), [{"agent": "claude"} for _ in range(LARGE)])
+ created, capped = await registry.add_terminals(10)
+ assert len(created) == 10 and not capped
+ assert registry.session is not None
+ assert len(registry.session.terminals) == LARGE + 10
-async def test_a_batch_past_the_cap_is_rejected_without_partial_creation(
+async def test_one_request_opens_at_most_the_per_request_guard(
registry: ide.Registry, tmp_path: Path
) -> None:
- """An oversized batch must not silently create a smaller agent group."""
- await registry.start(str(tmp_path), [{"agent": "claude"} for _ in range(ide.MAX_TERMINALS - 3)])
- with pytest.raises(ide.SessionError, match="at most"):
- await registry.add_terminals(10)
- assert len(registry.session.terminals) == ide.MAX_TERMINALS - 3
+ """A misheard "open 500" must not start 500 processes in one go."""
+ await registry.start(str(tmp_path), [{"agent": "claude"}])
+ with pytest.raises(ide.SessionError, match="in one go"):
+ await registry.add_terminals(ide.MAX_PANES_PER_REQUEST + 1)
+ assert registry.session is not None
+ assert len(registry.session.terminals) == 1
+ other = tmp_path / "other"
+ other.mkdir()
+ with pytest.raises(ide.SessionError, match="in one go"):
+ await registry.start(
+ str(other), [{"agent": "claude"} for _ in range(ide.MAX_PANES_PER_REQUEST + 1)]
+ )
# ------------------------------------------------------------------- resuming
@@ -113,14 +127,12 @@ async def test_a_full_workspace_survive_the_snapshot_round_trip(
registry: ide.Registry, tmp_path: Path
) -> None:
"""The restore point has to carry a full workspace, not a readable prefix."""
- session = await registry.start(
- str(tmp_path), [{"agent": "claude"} for _ in range(ide.MAX_TERMINALS)]
- )
+ session = await registry.start(str(tmp_path), [{"agent": "claude"} for _ in range(LARGE)])
expected = [(t.name, t.column, t.slot) for t in session.terminals]
loaded = resume_store.load()
assert loaded is not None
- assert loaded.terminal_count == ide.MAX_TERMINALS
+ assert loaded.terminal_count == LARGE
stored = [(t.name, t.column, t.slot) for t in loaded.workspaces[0].terminals]
assert stored == expected
@@ -137,7 +149,7 @@ async def test_restoring_a_full_workspace_keeps_every_position(
slot=i // 4,
resume=ResumeHandle(kind="claude_session", id=f"conv-{i}", captured_at=1.0),
)
- for i in range(ide.MAX_TERMINALS)
+ for i in range(LARGE)
]
snapshot = resume_store.Snapshot(
saved_at=1.0,
@@ -150,17 +162,17 @@ async def test_restoring_a_full_workspace_keeps_every_position(
result = await registry.restore(snapshot)
session = result.sessions[0]
- assert len(session.terminals) == ide.MAX_TERMINALS
- # Every pane sits exactly where it sat — four columns of two — read
+ assert len(session.terminals) == LARGE
+ # Every pane sits exactly where it sat — four columns of six — read
# back across the bands rather than down the columns, because a grid
# stands on its rows once it is restored (`layout_tree.rows_outermost`).
across = 4
assert [(t.column, t.slot) for t in session.terminals] == [
- (i % across, i // across) for i in range(ide.MAX_TERMINALS)
+ (i % across, i // across) for i in range(LARGE)
]
# Every pane keeps its own conversation — no two share a handle.
ids = [t.resume.id for t in session.terminals if t.resume]
- assert len(set(ids)) == ide.MAX_TERMINALS
+ assert len(set(ids)) == LARGE
async def test_a_full_house_across_every_workspace_round_trips(
@@ -168,7 +180,7 @@ async def test_a_full_house_across_every_workspace_round_trips(
) -> None:
"""The absolute worst case: every workspace open, each one full.
- Deliberately smaller than MAX_TERMINALS per workspace so the test stays
+ Sixteen panes per workspace so the test stays
fast — what is being pinned is that nothing collapses when several large
workspaces are remembered at once, including every workspace numbering its
panes T1..Tn on its own.
@@ -180,26 +192,27 @@ async def test_a_full_house_across_every_workspace_round_trips(
"""
folders = []
workspace_count = 16
+ per_workspace = 16
for index in range(workspace_count):
folder = tmp_path / f"repo{index}"
folder.mkdir()
folders.append(folder)
- await registry.start(str(folder), [{"agent": "claude"} for _ in range(ide.MAX_TERMINALS)])
+ await registry.start(str(folder), [{"agent": "claude"} for _ in range(per_workspace)])
loaded = resume_store.load()
assert loaded is not None
assert len(loaded.workspaces) == workspace_count
- assert loaded.terminal_count == ide.MAX_TERMINALS * workspace_count
+ assert loaded.terminal_count == per_workspace * workspace_count
for workspace in loaded.workspaces:
names = [t.name for t in workspace.terminals]
- assert names == default_names(ide.MAX_TERMINALS), "each workspace numbers its own panes"
+ assert names == default_names(per_workspace), "each workspace numbers its own panes"
async def test_the_snapshot_of_a_full_house_stays_a_sane_size(
registry: ide.Registry, tmp_path: Path
) -> None:
"""It is read on the first screen of the IDE, so it must stay small."""
- await registry.start(str(tmp_path), [{"agent": "claude"} for _ in range(ide.MAX_TERMINALS)])
+ await registry.start(str(tmp_path), [{"agent": "claude"} for _ in range(LARGE)])
raw = resume_store._store_path().read_text(encoding="utf-8")
# Eight panes of metadata, not a transcript: comfortably under 100 KB.
assert len(raw) < 100_000
@@ -207,68 +220,110 @@ async def test_the_snapshot_of_a_full_house_stays_a_sane_size(
assert json.loads(raw)["workspaces"][0]["terminals"]
-# ------------------------------------------------------------- grid ceiling
-def test_the_ceiling_is_the_largest_grid_the_workspace_draws() -> None:
- assert ide.MAX_TERMINALS == ide.MAX_GRID_COLUMNS * ide.MAX_GRID_ROWS
- assert ide.MAX_TERMINALS > 8, "eight panes was a layout rule, not a resource limit"
-
-
+# ------------------------------------------------------------- grid shape
@pytest.mark.parametrize(
("count", "columns", "rows"),
- [(1, 1, 1), (2, 2, 1), (6, 3, 2), (8, 4, 2), (9, 3, 3), (12, 4, 3), (16, 4, 4)],
+ [
+ (1, 1, 1),
+ (2, 2, 1),
+ (6, 3, 2),
+ (8, 4, 2),
+ (9, 3, 3),
+ (12, 4, 3),
+ (16, 4, 4),
+ (17, 5, 4),
+ (20, 5, 4),
+ (25, 5, 5),
+ (30, 6, 5),
+ (100, 10, 10),
+ ],
)
-def test_an_even_grid_never_grows_wider_than_four_columns(
- count: int, columns: int, rows: int
-) -> None:
+def test_an_even_grid_grows_square_past_sixteen(count: int, columns: int, rows: int) -> None:
+ """Four wide up to sixteen panes, then about square — never a limit.
+
+ Same table as the frontend's ``workspaceDocking.test.ts``.
+ """
assert ide.balanced_columns(count) == columns
- assert -(-count // columns) == rows <= ide.MAX_GRID_ROWS
+ assert -(-count // columns) == rows
-async def test_a_full_workspace_rebalances_into_four_by_four(
+async def test_reordering_a_large_workspace_deals_the_even_grid(
registry: ide.Registry, tmp_path: Path
) -> None:
- await registry.start(str(tmp_path), [{"agent": "claude"} for _ in range(ide.MAX_TERMINALS)])
+ await registry.start(str(tmp_path), [{"agent": "claude"} for _ in range(LARGE)])
session = registry.session
assert session is not None
await registry.reorder_terminals(session.id, [term.history_id for term in session.terminals])
- layout = session.layout
- assert isinstance(layout, ide.layout_tree.Split) and layout.direction == "column"
- assert len(layout.children) == ide.MAX_GRID_ROWS
- assert all(len(ide.layout_tree.leaves(row)) == ide.MAX_GRID_COLUMNS for row in layout.children)
- with pytest.raises(ide.SessionError):
- await registry.add_terminal(agent="claude")
+ assert ide.layout_tree.grid_span(session.layout) == (5, 5)
+ await registry.add_terminal(agent="claude")
+ assert len(ide.layout_tree.leaves(session.layout)) == LARGE + 1
- ("count", "direction"), [(8, None), (12, None), (15, "down"), (15, "right")]
-)
-async def test_no_way_of_adding_a_pane_leaves_the_four_by_four_grid(
- registry: ide.Registry, tmp_path: Path, count: int, direction: str | None
[email protected](("count", "direction"), [(15, "down"), (16, "right"), (16, "down")])
+async def test_a_split_is_kept_where_it_was_put_at_any_size(
+ registry: ide.Registry, tmp_path: Path, count: int, direction: str
) -> None:
- """Voice and the CLI have no preview, so the server keeps the bounds itself."""
+ """No grid bound: a split past four columns or rows is not re-dealt."""
await registry.start(str(tmp_path), [{"agent": "claude"} for _ in range(count)])
session = registry.session
assert session is not None
- if direction is None:
- await registry.add_terminal(agent="claude")
- else:
- await registry.add_terminal(
- anchor=session.terminals[0].name, agent="claude", direction=direction
- )
+ anchor = session.terminals[0]
+ before = ide.layout_tree.leaves(session.layout)
+ added = await registry.add_terminal(anchor=anchor.name, agent="claude", direction=direction)
+ after = ide.layout_tree.leaves(session.layout)
+ # The new pane went right beside its anchor; every other pane kept its order.
+ assert after.index(added.key) == after.index(anchor.key) + 1
+ assert [key for key in after if key != added.key] == before
columns, rows = ide.layout_tree.grid_span(session.layout)
- assert columns <= ide.MAX_GRID_COLUMNS and rows <= ide.MAX_GRID_ROWS
- assert len(ide.layout_tree.leaves(session.layout)) == count + 1
+ assert (columns if direction == "right" else rows) == 5, "the grid grew past four"
-async def test_a_split_within_the_grid_keeps_the_users_shape(
+async def test_an_unanchored_add_never_reshuffles_a_hand_built_layout(
registry: ide.Registry, tmp_path: Path
) -> None:
- """Rebalancing is only the fallback: a split that fits stays where it was put."""
+ """Four columns wide, one more pane splits the largest pane; nobody else moves."""
await registry.start(str(tmp_path), [{"agent": "claude"} for _ in range(8)])
session = registry.session
assert session is not None
- anchor = session.terminals[0]
- added = await registry.add_terminal(anchor=anchor.name, agent="claude", direction="down")
- assert ide.layout_tree.grid_span(session.layout) == (4, 3)
- first_column = ide.layout_tree.leaves(session.layout)
- assert first_column.index(added.key) > first_column.index(anchor.key)
+ assert ide.layout_tree.grid_span(session.layout) == (4, 2)
+ # Shape it by hand: one pane split in two.
+ await registry.add_terminal(anchor=session.terminals[1].name, agent="claude", direction="down")
+ order_before = ide.layout_tree.leaves(session.layout)
+ added = await registry.add_terminal(agent="claude")
+ order_after = ide.layout_tree.leaves(session.layout)
+ assert [key for key in order_after if key != added.key] == order_before
+ assert ide.layout_tree.grid_span(session.layout)[0] == 4, "no fifth column was appended"
+
+
+def _unanchored(tree: ide.layout_tree.LayoutNode | None, added: str):
+ return ide.layout_tree.add_unanchored(
+ tree, added, max_columns=4, balanced_columns=ide.balanced_columns
+ )
+
+
+def test_an_unanchored_add_appends_a_column_while_the_workspace_is_narrow() -> None:
+ grown = _unanchored(ide.layout_tree.from_grid([("a", 0, 0), ("b", 1, 0)]), "c")
+ assert ide.layout_tree.grid_span(grown) == (3, 1)
+ assert ide.layout_tree.leaves(grown) == ["a", "b", "c"]
+
+
+def test_an_unanchored_add_deals_a_shape_nobody_arranged_into_the_even_grid() -> None:
+ row = ide.layout_tree.from_grid([(key, column, 0) for column, key in enumerate("abcd")])
+ grown = _unanchored(row, "e")
+ assert ide.layout_tree.grid_span(grown) == (3, 2)
+ assert ide.layout_tree.leaves(grown) == ["a", "b", "c", "d", "e"]
+
+
+def test_an_unanchored_add_splits_the_largest_pane_of_a_hand_built_layout() -> None:
+ tree = ide.layout_tree.from_grid(
+ [("a", 0, 0), ("b", 1, 0), ("c", 1, 1), ("d", 2, 0), ("e", 3, 0)]
+ )
+ grown = _unanchored(tree, "f")
+ # "a", "d" and "e" are equally large full-height columns; "e" is last in
+ # reading order. A column a quarter wide is taller than wide, so "f" goes
+ # beneath it and lands at the end of the reading order.
+ boxes = ide.layout_tree.pane_boxes(grown)
+ assert boxes["f"][0] == pytest.approx(boxes["e"][0])
+ assert boxes["f"][1] > boxes["e"][1]
+ assert ide.layout_tree.grid_span(grown)[0] == 4
+ assert ide.layout_tree.leaves(grown) == ["a", "b", "c", "d", "e", "f"]
diff --git a/tests/unit/agentic_ide/test_names.py b/tests/unit/agentic_ide/test_names.py
index a7b96bf438..e06f461b10 100644
--- a/tests/unit/agentic_ide/test_names.py
+++ b/tests/unit/agentic_ide/test_names.py
@@ -32,12 +32,12 @@ class TestPositionsAreAssignedByPlace:
assert default_names(0) == []
assert default_names(-1) == []
- def test_a_full_workspace_needs_no_fallback_shape(self) -> None:
- """Every pane of the biggest allowed workspace has a speakable name."""
- from jarvis.agentic_ide.session import MAX_TERMINALS
+ def test_a_large_workspace_needs_no_fallback_shape(self) -> None:
+ """Every pane of a large workspace has a speakable name."""
+ from jarvis.agentic_ide.session import MAX_PANES_PER_REQUEST
- names = default_names(MAX_TERMINALS)
- assert len(set(names)) == MAX_TERMINALS
+ names = default_names(MAX_PANES_PER_REQUEST)
+ assert len(set(names)) == MAX_PANES_PER_REQUEST
assert all(position_of(name) is not None for name in names)
def test_free_positions_fills_the_lowest_gap(self) -> None:
diff --git a/tests/unit/agentic_ide/test_pane_batch.py b/tests/unit/agentic_ide/test_pane_batch.py
index 648b19df30..fa11b34e0d 100644
--- a/tests/unit/agentic_ide/test_pane_batch.py
+++ b/tests/unit/agentic_ide/test_pane_batch.py
@@ -15,7 +15,7 @@ import pytest
from jarvis.agentic_ide import session as session_mod
from jarvis.agentic_ide.session import (
- MAX_TERMINALS,
+ MAX_PANES_PER_REQUEST,
Registry,
SessionError,
terminals_added_event,
@@ -68,23 +68,22 @@ async def test_a_batch_opens_every_requested_pane(registry: Registry, tmp_path:
assert len(set(_names(registry))) == 5
-async def test_the_cap_rejects_the_batch_without_creating_any_pane(
+async def test_an_oversized_request_is_refused_without_creating_any_pane(
registry: Registry, tmp_path: Path
) -> None:
- """The eight-session workspace limit is checked before creating the batch."""
- await _open(registry, tmp_path, MAX_TERMINALS - 3)
- with pytest.raises(SessionError, match="at most"):
- await registry.add_terminals(5)
- assert len(_names(registry)) == MAX_TERMINALS - 3
-
-
-async def test_a_full_workspace_refuses_instead_of_reporting_nothing(
- registry: Registry, tmp_path: Path
-) -> None:
- """With no room at all the caller gets an error it can read out loud."""
- await _open(registry, tmp_path, MAX_TERMINALS)
- with pytest.raises(SessionError, match="at most"):
- await registry.add_terminals(2)
+ """The per-request guard is checked before creating the batch."""
+ await _open(registry, tmp_path, 3)
+ with pytest.raises(SessionError, match="in one go"):
+ await registry.add_terminals(MAX_PANES_PER_REQUEST + 1)
+ assert len(_names(registry)) == 3
+
+
+async def test_a_large_workspace_still_takes_a_batch(registry: Registry, tmp_path: Path) -> None:
+ """There is no workspace limit: a batch on top of sixteen panes opens in full."""
+ await _open(registry, tmp_path, 16)
+ created, capped = await registry.add_terminals(5)
+ assert len(created) == 5 and not capped
+ assert len(_names(registry)) == 21
async def test_the_agent_is_inherited_unless_named(registry: Registry, tmp_path: Path) -> None:
diff --git a/tests/unit/agentic_ide/test_pane_transfer.py b/tests/unit/agentic_ide/test_pane_transfer.py
index 391f303b21..0733b95c25 100644
--- a/tests/unit/agentic_ide/test_pane_transfer.py
+++ b/tests/unit/agentic_ide/test_pane_transfer.py
@@ -18,7 +18,7 @@ from fastapi import HTTPException
from jarvis.agentic_ide import resume_store
from jarvis.agentic_ide import session as session_mod
-from jarvis.agentic_ide.session import MAX_TERMINALS, Registry, SessionError
+from jarvis.agentic_ide.session import Registry, SessionError
from jarvis.ui.web import agentic_ide_routes as routes
from tests.fakes.fake_pty_manager import FakePtyManager
@@ -242,18 +242,18 @@ async def test_moving_into_the_same_tab_changes_nothing(
assert [(t.name, t.key) for t in source.terminals] == before
-async def test_a_full_or_closed_target_is_refused(registry: Registry, tmp_path: Path) -> None:
- source, target = await _two_tabs(registry, tmp_path, second=MAX_TERMINALS)
+async def test_a_large_target_takes_the_pane_and_a_closed_one_refuses(
+ registry: Registry, tmp_path: Path
+) -> None:
+ source, target = await _two_tabs(registry, tmp_path, second=16)
- with pytest.raises(SessionError, match="maximum"):
- await registry.transfer_terminal(
- "T1", workspace_id=source.id, target_workspace_id=target.id
- )
+ await registry.transfer_terminal("T2", workspace_id=source.id, target_workspace_id=target.id)
+ assert len(target.terminals) == 17
with pytest.raises(SessionError, match="not open"):
await registry.transfer_terminal(
"T1", workspace_id=source.id, target_workspace_id="ide_missing"
)
- assert len(source.terminals) == 2
+ assert len(source.terminals) == 1
async def test_the_route_answers_with_the_new_name_and_both_tabs(
@@ -325,21 +325,22 @@ async def test_left_of_a_pane_puts_it_first_in_the_row(
assert [t.name for t in target.terminals] == ["T2", "T1"]
-async def test_a_place_without_room_changes_nothing(registry: Registry, tmp_path: Path) -> None:
- """Refused before the pane leaves its tab — never half-way between two."""
+async def test_a_fifth_column_is_a_place_like_any_other(
+ registry: Registry, tmp_path: Path
+) -> None:
+ """No grid bound: beside a row four wide, the pane lands where it was put."""
source = await registry.start(str(tmp_path), [{"agent": "claude"}], name="Jarvis")
target = await registry.start(str(tmp_path), [{"agent": "claude"}], name="Blog")
- for _ in range(session_mod.MAX_GRID_COLUMNS - 1):
+ for _ in range(3):
await registry.add_terminal(workspace_id=target.id, direction="right")
- before = [t.name for t in target.terminals]
+ assert session_mod.layout_tree.grid_span(target.layout) == (4, 1)
- with pytest.raises(SessionError, match="No room"):
- await registry.transfer_terminal(
- "T1", workspace_id=source.id, target_workspace_id=target.id, anchor="T1", side="right"
- )
+ await registry.transfer_terminal(
+ "T1", workspace_id=source.id, target_workspace_id=target.id, anchor="T1", side="right"
+ )
- assert [t.name for t in source.terminals] == ["T1"]
- assert [t.name for t in target.terminals] == before
+ assert source.terminals == []
+ assert session_mod.layout_tree.grid_span(target.layout) == (5, 1)
async def test_an_unknown_anchor_is_refused(registry: Registry, tmp_path: Path) -> None:
diff --git a/tests/unit/agentic_ide/test_panes.py b/tests/unit/agentic_ide/test_panes.py
index 201a240aa6..8fd0581b48 100644
--- a/tests/unit/agentic_ide/test_panes.py
+++ b/tests/unit/agentic_ide/test_panes.py
@@ -14,7 +14,7 @@ from pathlib import Path
import pytest
from jarvis.agentic_ide import session as session_mod
-from jarvis.agentic_ide.session import MAX_TERMINALS, Registry, SessionError
+from jarvis.agentic_ide.session import Registry, SessionError
from tests.fakes.fake_pty_manager import FakePtyManager
@@ -166,10 +166,13 @@ async def test_the_new_pane_starts_pending_and_addressable(
# --------------------------------------------------------------------- limits
-async def test_adding_past_the_limit_is_refused(registry: Registry, tmp_path: Path) -> None:
- await _open(registry, tmp_path, MAX_TERMINALS)
- with pytest.raises(SessionError, match="maximum"):
- await registry.add_terminal(direction="right")
+async def test_adding_past_sixteen_is_never_refused(registry: Registry, tmp_path: Path) -> None:
+ """There is no pane limit: the seventeenth pane splits off like any other."""
+ await _open(registry, tmp_path, 16)
+ term = await registry.add_terminal(anchor="T1", direction="right")
+ assert registry.session is not None
+ assert len(registry.session.terminals) == 17
+ assert registry.session.find(term.name) is term
async def test_an_unknown_anchor_is_refused(registry: Registry, tmp_path: Path) -> None:
diff --git a/tests/unit/agentic_ide/test_quick_agent_catalog.py b/tests/unit/agentic_ide/test_quick_agent_catalog.py
index 96d1509fa6..9dd520f369 100644
--- a/tests/unit/agentic_ide/test_quick_agent_catalog.py
+++ b/tests/unit/agentic_ide/test_quick_agent_catalog.py
@@ -48,8 +48,8 @@ async def test_quick_catalog_resolves_off_loop_without_expensive_probes(
result = await routes.get_agents(quick=True)
assert resolved == ["example", "missing"]
assert result.terminal_available is pty_available
- assert result.max_terminals == routes.MAX_TERMINALS
- assert len(result.suggested_names) == routes.MAX_TERMINALS
+ assert result.max_panes_per_request == routes.MAX_PANES_PER_REQUEST
+ assert len(result.suggested_names) == routes.MAX_PANES_PER_REQUEST
example, missing = result.agents
assert example.installed is True
assert missing.installed is False
diff --git a/tests/unit/agentic_ide/test_resume_session.py b/tests/unit/agentic_ide/test_resume_session.py
index dbf38fa020..c132ac5bd8 100644
--- a/tests/unit/agentic_ide/test_resume_session.py
+++ b/tests/unit/agentic_ide/test_resume_session.py
@@ -627,7 +627,7 @@ async def test_a_new_workspace_does_not_erase_the_folders_you_closed(
big, quick = tmp_path / "big", tmp_path / "quick"
big.mkdir()
quick.mkdir()
- await registry.start(str(big), [{"agent": "claude"} for _ in range(ide.MAX_TERMINALS)])
+ await registry.start(str(big), [{"agent": "claude"} for _ in range(16)])
await registry.end()
await registry.start(str(quick), [{"agent": "claude", "name": "Solo"}])
@@ -635,7 +635,7 @@ async def test_a_new_workspace_does_not_erase_the_folders_you_closed(
saved = resume_store.load()
assert saved is not None
folders = {w.folder: len(w.terminals) for w in saved.workspaces}
- assert folders == {str(quick): 1, str(big): ide.MAX_TERMINALS}
+ assert folders == {str(quick): 1, str(big): 16}
async def test_reopening_the_same_folder_preserves_independent_workspace_records(
diff --git a/tests/unit/agentic_ide/test_session.py b/tests/unit/agentic_ide/test_session.py
index e157f7b22b..a8002dc693 100644
--- a/tests/unit/agentic_ide/test_session.py
+++ b/tests/unit/agentic_ide/test_session.py
@@ -139,10 +139,10 @@ async def test_start_rejects_an_unknown_agent(registry: Registry, tmp_path: Path
await _open(registry, tmp_path, [{"agent": "emacs"}])
-async def test_start_refuses_more_than_the_maximum(
+async def test_start_refuses_more_than_one_request_may_open(
registry: Registry, tmp_path: Path
) -> None:
- panes = [{"agent": "claude"}] * (session_mod.MAX_TERMINALS + 1)
+ panes = [{"agent": "claude"}] * (session_mod.MAX_PANES_PER_REQUEST + 1)
with pytest.raises(SessionError, match="At most"):
await _open(registry, tmp_path, panes)
diff --git a/tests/unit/agentic_ide/test_spawn_intent.py b/tests/unit/agentic_ide/test_spawn_intent.py
index b015df25b8..f10bf2c358 100644
--- a/tests/unit/agentic_ide/test_spawn_intent.py
+++ b/tests/unit/agentic_ide/test_spawn_intent.py
@@ -23,7 +23,7 @@ from __future__ import annotations
import pytest
from jarvis.agentic_ide import intent
-from jarvis.agentic_ide.session import MAX_TERMINALS
+from jarvis.agentic_ide.session import MAX_PANES_PER_REQUEST
NAMES = ["Alex", "Blake", "Casey", "Dana"]
@@ -81,14 +81,14 @@ def test_a_number_above_the_cap_is_clamped_not_refused() -> None:
# number is therefore no count at all, rather than a huge one.
found = intent.detect_spawn("Spawne 999 Terminals") # i18n-allow: spoken input under test
assert found is not None
- assert found.count == MAX_TERMINALS
+ assert found.count == MAX_PANES_PER_REQUEST
-def test_a_large_requested_count_obeys_the_workspace_capacity() -> None:
- """Spoken counts share the same eight-session ceiling as the launch picker."""
+def test_a_count_past_sixteen_is_taken_as_said() -> None:
+ """A workspace has no pane limit, so twenty means twenty."""
found = intent.detect_spawn("Spawne 20 Terminals") # i18n-allow: spoken input under test
assert found is not None
- assert found.count == MAX_TERMINALS
+ assert found.count == 20
@pytest.mark.parametrize(
@@ -299,13 +299,13 @@ def test_the_same_agent_named_twice_is_merged() -> None:
assert found.count == 4
-def test_the_total_is_capped_at_the_workspace_maximum() -> None:
+def test_the_total_is_capped_at_the_per_request_guard() -> None:
found = intent.detect_spawn(
- f"Open {MAX_TERMINALS} Codex terminals and 5 Claude Code terminals",
+ f"Open {MAX_PANES_PER_REQUEST} Codex terminals and 5 Claude Code terminals",
names=NAMES,
)
assert found is not None
- assert found.count <= MAX_TERMINALS
+ assert found.count <= MAX_PANES_PER_REQUEST
assert sum(g.count for g in found.groups) == found.count
diff --git a/tests/unit/agentic_ide/test_spawn_misheard_agent_name.py b/tests/unit/agentic_ide/test_spawn_misheard_agent_name.py
index 524ac2630e..87b25664e1 100644
--- a/tests/unit/agentic_ide/test_spawn_misheard_agent_name.py
+++ b/tests/unit/agentic_ide/test_spawn_misheard_agent_name.py
@@ -153,20 +153,20 @@ def test_a_group_without_a_cli_keeps_its_own_count() -> None:
],
)
def test_a_large_spoken_count_is_heard_and_bounded(utterance: str, expected: int) -> None:
- """Large number words are recognized, then capped by workspace capacity."""
- from jarvis.agentic_ide.session import MAX_TERMINALS
+ """Large number words are recognized, then bounded by the per-request guard."""
+ from jarvis.agentic_ide.session import MAX_PANES_PER_REQUEST
request = intent.detect_spawn(utterance)
assert request is not None, utterance
- assert request.count == min(expected, MAX_TERMINALS)
+ assert request.count == min(expected, MAX_PANES_PER_REQUEST)
-def test_the_workspace_maximum_is_the_only_ceiling() -> None:
- from jarvis.agentic_ide.session import MAX_TERMINALS
+def test_the_per_request_guard_is_the_only_ceiling() -> None:
+ from jarvis.agentic_ide.session import MAX_PANES_PER_REQUEST
- request = intent.detect_spawn(f"open {MAX_TERMINALS + 40} Codex terminals")
+ request = intent.detect_spawn(f"open {MAX_PANES_PER_REQUEST + 40} Codex terminals")
assert request is not None
- assert request.count == MAX_TERMINALS
+ assert request.count == MAX_PANES_PER_REQUEST
def test_naming_a_cli_without_counting_it_is_not_a_pane_request() -> None:
diff --git a/tests/unit/agentic_ide/test_workspace_graph.py b/tests/unit/agentic_ide/test_workspace_graph.py
index 8de8480a1e..112dc0f3a8 100644
--- a/tests/unit/agentic_ide/test_workspace_graph.py
+++ b/tests/unit/agentic_ide/test_workspace_graph.py
@@ -98,18 +98,14 @@ async def test_project_ownership_rejects_another_folder(registry, tmp_path):
assert registry.sessions == []
-async def test_pane_cap_applies_to_create_add_and_batch(registry, tmp_path):
- cap = session.MAX_TERMINALS
- with pytest.raises(session.SessionError, match=f"At most {cap}"):
- await registry.start(str(tmp_path), [{"agent": "claude"}] * (cap + 1))
- space = await registry.start(str(tmp_path), [{"agent": "claude"}] * (cap - 1))
- with pytest.raises(session.SessionError, match=f"at most {cap}"):
- await registry.add_terminals(2)
- assert len(space.terminals) == cap - 1
+async def test_only_one_request_is_bounded_never_the_workspace(registry, tmp_path):
+ guard = session.MAX_PANES_PER_REQUEST
+ with pytest.raises(session.SessionError, match=f"At most {guard}"):
+ await registry.start(str(tmp_path), [{"agent": "claude"}] * (guard + 1))
+ space = await registry.start(str(tmp_path), [{"agent": "claude"}] * 15)
+ await registry.add_terminals(2)
await registry.add_terminal(agent="claude")
- with pytest.raises(session.SessionError, match=f"maximum of {cap}"):
- await registry.add_terminal(agent="claude")
- assert len(space.terminals) == cap
+ assert len(space.terminals) == 18
@pytest.mark.parametrize(
@@ -227,20 +223,18 @@ async def test_duplicate_legacy_workspace_ids_do_not_overwrite_another_project(r
assert {space.session_id for space in saved.workspaces} == set(ids)
-async def test_oversized_legacy_workspace_is_preserved_without_partial_restore(registry, tmp_path):
+async def test_a_large_saved_workspace_restores_in_full(registry, tmp_path):
saved = resume_store.SnapshotWorkspace(
session_id="legacy-large",
folder=str(tmp_path),
terminals=[
resume_store.SnapshotTerminal(key=f"t{i}", name=f"T{i}", agent="claude")
- for i in range(session.MAX_TERMINALS + 1)
+ for i in range(17)
],
)
resume_store.save(resume_store.snapshot_now([saved]))
- with pytest.raises(session.SessionError, match=f"limit is {session.MAX_TERMINALS}"):
- await registry.restore_workspace(saved.session_id)
- assert len(resume_store.load().workspaces[0].terminals) == session.MAX_TERMINALS + 1
- assert registry.sessions == []
+ await registry.restore_workspace(saved.session_id)
+ assert [len(space.terminals) for space in registry.sessions] == [17]
async def test_session_route_accepts_project_and_workspace_name(registry, tmp_path):
diff --git a/tests/unit/brain/test_agentic_ide_spawn_fast_path.py b/tests/unit/brain/test_agentic_ide_spawn_fast_path.py
index 8fec5e2cd6..260e451436 100644
--- a/tests/unit/brain/test_agentic_ide_spawn_fast_path.py
+++ b/tests/unit/brain/test_agentic_ide_spawn_fast_path.py
@@ -21,7 +21,7 @@ import pytest
from jarvis.agentic_ide import recents
from jarvis.agentic_ide import session as session_mod
-from jarvis.agentic_ide.session import MAX_TERMINALS, Registry
+from jarvis.agentic_ide.session import Registry, SessionError
from jarvis.brain.manager import BrainManager
from jarvis.core.bus import EventBus
from jarvis.core.config import JarvisConfig
@@ -391,33 +391,48 @@ async def test_without_a_named_agent_the_new_panes_inherit(
# ------------------------------------------------------------------ the limits
-async def test_a_capped_batch_says_how_many_actually_opened(
+async def test_a_large_workspace_still_takes_more_panes(
manager: tuple[BrainManager, FakeBus], registry: Registry, tmp_path: Path
) -> None:
- """The maintainer's live case: nine panes open, five requested, three appear."""
+ """There is no pane limit: sixteen open, five more requested, five appear."""
mgr, _bus = manager
- await _open(registry, tmp_path, MAX_TERMINALS - 3)
+ await _open(registry, tmp_path, 16)
reply = await mgr._run_agentic_ide_spawn_fast_path("Spawn five more terminals")
assert reply is not None
- assert "only room for 3" in reply
+ assert "full" not in reply.lower()
assert registry.session is not None
- assert len(registry.session.terminals) == MAX_TERMINALS
+ assert len(registry.session.terminals) == 21
-async def test_a_full_workspace_says_so_instead_of_failing_silently(
- manager: tuple[BrainManager, FakeBus], registry: Registry, tmp_path: Path
+async def test_a_batch_cut_short_says_how_many_actually_opened(
+ manager: tuple[BrainManager, FakeBus],
+ registry: Registry,
+ tmp_path: Path,
+ monkeypatch: pytest.MonkeyPatch,
) -> None:
- mgr, bus = manager
- await _open(registry, tmp_path, MAX_TERMINALS)
+ """A pane that fails to start mid-batch: the readback names the shortfall."""
+ mgr, _bus = manager
+ await _open(registry, tmp_path, 2)
+ real_add = registry.add_terminal
+ calls = 0
+
+ async def flaky_add(**kwargs):
+ nonlocal calls
+ calls += 1
+ if calls > 3:
+ raise SessionError("The fourth pane could not start.")
+ return await real_add(**kwargs)
+
+ monkeypatch.setattr(registry, "add_terminal", flaky_add)
- reply = await mgr._run_agentic_ide_spawn_fast_path("Open two more terminals")
+ reply = await mgr._run_agentic_ide_spawn_fast_path("Spawn five more terminals")
assert reply is not None
- assert "full" in reply.lower()
- assert str(MAX_TERMINALS) in reply
- assert bus.published == [] # nothing changed, so nothing is announced
+ assert "Only 3 could be opened" in reply
+ assert registry.session is not None
+ assert len(registry.session.terminals) == 5
# ----------------------------------------------------------- no open workspace
diff --git a/tests/unit/web/test_agentic_ide_batch_route.py b/tests/unit/web/test_agentic_ide_batch_route.py
index 810291d8d9..1c5cf48360 100644
--- a/tests/unit/web/test_agentic_ide_batch_route.py
+++ b/tests/unit/web/test_agentic_ide_batch_route.py
@@ -122,7 +122,7 @@ async def test_a_refusal_becomes_a_conflict_with_the_reason(
account: str | None = None,
workspace_id: str | None = None,
):
- raise SessionError("This workspace already has the maximum of 8 terminals.")
+ raise SessionError("Claude Code is not installed or not on this machine's PATH.")
def state(self) -> dict:
return {}
@@ -132,7 +132,7 @@ async def test_a_refusal_becomes_a_conflict_with_the_reason(
with pytest.raises(routes.HTTPException) as caught:
await routes.add_terminals(_request(None), routes.AddTerminalsRequest(count=3))
assert caught.value.status_code == 409
- assert "maximum" in caught.value.detail
+ assert "not installed" in caught.value.detail
async def test_no_bus_still_opens_the_panes(