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.

fix(agentic-ide): remove workspace count limit

rubenluetke10-beepb6f58f8e29d8
diff --git a/jarvis/agentic_ide/resume_store.py b/jarvis/agentic_ide/resume_store.py
index f915dd0bbb..0455b52137 100644
--- a/jarvis/agentic_ide/resume_store.py
+++ b/jarvis/agentic_ide/resume_store.py
@@ -371,9 +371,9 @@ def save(snapshot: Snapshot) -> None:
pass
-# How many workspaces one restore point may remember. Above the number that can
-# be open at once, so folders you closed earlier survive alongside what is open
-# now — and bounded, so the offer stays a screen rather than an archive.
+# How many CLOSED workspaces one restore point may remember in addition to all
+# currently open ones. The history stays a screen rather than an archive, but
+# this must never trim a live workspace merely because the user opened many.
MAX_REMEMBERED_WORKSPACES = 20
@@ -412,7 +412,7 @@ def _merged_with_stored(snapshot: Snapshot) -> Snapshot:
# Folders remembered from earlier follow, most recently used first, and the
# trim falls on the oldest of those rather than on anything open now.
kept.sort(key=lambda w: w.saved_at, reverse=True)
- merged = [*stamped, *kept][:MAX_REMEMBERED_WORKSPACES]
+ merged = [*stamped, *kept[:MAX_REMEMBERED_WORKSPACES]]
return Snapshot(
saved_at=snapshot.saved_at,
workspaces=merged,
diff --git a/jarvis/agentic_ide/session.py b/jarvis/agentic_ide/session.py
index 0cae86f77b..56431adade 100644
--- a/jarvis/agentic_ide/session.py
+++ b/jarvis/agentic_ide/session.py
@@ -261,11 +261,11 @@ MOVE_POSITIONS = ("swap", "left", "right", "above", "below")
# paste delivers the whole block in one write, so length costs nothing here —
# the real limit is the pane's readability, not the channel.
MAX_PROMPT_CHARS = 6000
-# How many workspaces may be open at once. Not a technical ceiling — a real one
-# costs a folder's worth of running coding agents, so the cap exists to keep an
-# accidental click from spawning them. The workspace bar compacts crowded tabs
-# into numbered folder icons, which keeps this larger set on one visible row.
-MAX_WORKSPACES = 12
+# There is deliberately no hard limit on open workspaces. Each one carries real
+# processes once its panes attach, so the practical ceiling is the machine's
+# capacity and remains the user's decision. ``None`` keeps the public state
+# field backward-compatible with clients that used to receive an integer cap.
+MAX_WORKSPACES: int | None = None
# How long to wait for the pane to SHOW the prompt before pressing Enter, and
# how finely to look. This replaced a fixed 120 ms delay: the wait is not really
# about debouncing, it is about the pane having taken the text at all. A pane
@@ -1416,8 +1416,8 @@ class Session:
class RestoreResult:
"""What taking a restore point actually brought back.
- ``skipped`` carries a reason per workspace that could not come back (folder
- deleted, workspace limit reached). Reported rather than swallowed: a resume
+ ``skipped`` carries a reason per workspace that could not come back (for
+ example, its folder was deleted). Reported rather than swallowed: a resume
that quietly returns three of five workspaces looks like a bug to the person
who had five.
"""
@@ -1758,12 +1758,6 @@ class Registry:
except OSError as exc:
raise SessionError(f"Cannot open {root}: {exc}") from exc
- if len(self._sessions) >= MAX_WORKSPACES:
- raise SessionError(
- f"{MAX_WORKSPACES} workspaces are already open — close one "
- "before opening another."
- )
-
unknown = {
str(r.get("agent")) for r in requested if not is_runnable(str(r.get("agent")))
}
@@ -1945,8 +1939,8 @@ class Registry:
workspace that is on screen right now.
A workspace that cannot come back does not stop the others: a deleted
- folder is reported, and the workspace limit stops the rest with a
- reason. What could not be restored comes back in ``skipped`` so the
+ folder is reported with a reason. What could not be restored comes back
+ in ``skipped`` so the
caller can say so out loud instead of quietly returning less than it
promised. A folder that is already open in a workspace opened by hand is
NOT one of those cases — two workspaces may share a folder deliberately,
@@ -2055,11 +2049,6 @@ class Registry:
except OSError as exc:
raise SessionError(f"Cannot open {root}: {exc}") from exc
- if len(self._sessions) >= MAX_WORKSPACES:
- raise SessionError(
- f"{MAX_WORKSPACES} workspaces are already open — close one before reopening this."
- )
-
terminals = [
Terminal(
key=entry.key or normalize(entry.name) or f"t{index}",
@@ -3759,7 +3748,7 @@ class Registry:
) -> tuple[list[Terminal], bool]:
"""Open up to ``count`` more panes — the batch behind "open five more".
- Returns the panes that were created and whether the workspace cap
+ Returns the panes that were created and whether the pane cap
truncated the request, because those are two different answers the caller
has to speak out loud: five requested with three opened is a success the
user must hear ("room for three"), not a silent partial.
diff --git a/jarvis/ui/web/agentic_ide_routes.py b/jarvis/ui/web/agentic_ide_routes.py
index 824ca6bab8..e2544b8a6f 100644
--- a/jarvis/ui/web/agentic_ide_routes.py
+++ b/jarvis/ui/web/agentic_ide_routes.py
@@ -467,7 +467,7 @@ class WorkspaceCard(BaseModel):
class WorkspacesResponse(BaseModel):
workspaces: list[WorkspaceCard]
active_id: str | None = None
- max_workspaces: int
+ max_workspaces: int | None
class SpawnGroupRequest(BaseModel):
@@ -1861,8 +1861,8 @@ async def resume_workspace(request: Request) -> dict:
nothing until their panes are looked at.
``409`` when there is nothing to resume, ``422`` when nothing could be
- reopened at all. A workspace that individually could not come back (folder
- deleted, workspace limit reached) does not fail the request: it is reported
+ reopened at all. A workspace that individually could not come back (for
+ example, its folder was deleted) does not fail the request: it is reported
in ``skipped`` so the caller can say which ones are missing.
"""
registry = get_registry()
@@ -2326,7 +2326,7 @@ async def add_terminals(request: Request, req: AddTerminalsRequest) -> dict:
The batch behind a spoken "open five more Claude Code terminals", and the
same call the CLI makes. Placement, call-signs and the agent default are the
single-terminal endpoint's — this only repeats it and reports honestly when
- the workspace cap cut the request short.
+ the pane cap within that workspace cut the request short.
``capped`` is true when fewer panes were opened than asked for. A client MUST
surface that: five requested with three opened is not a plain success.
diff --git a/jarvis/ui/web/frontend/src/components/agentic/WorkspaceBar.test.tsx b/jarvis/ui/web/frontend/src/components/agentic/WorkspaceBar.test.tsx
index a7b73ad04e..abe990ae02 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/WorkspaceBar.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/WorkspaceBar.test.tsx
@@ -18,7 +18,11 @@ function card(index: number): WorkspaceCard {
};
}
-function renderBar(count: number, maxWorkspaces = 12, embedded = false) {
+function renderBar(
+ count: number,
+ maxWorkspaces: number | null = null,
+ embedded = false,
+) {
return render(
<WorkspaceBar
workspaces={Array.from({ length: count }, (_, index) => card(index + 1))}
@@ -52,6 +56,17 @@ describe("WorkspaceBar density", () => {
bounds.mockRestore();
});
+ it("does not treat an unmeasurable zero-width mount as a narrow window", () => {
+ const bounds = vi
+ .spyOn(HTMLElement.prototype, "getBoundingClientRect")
+ .mockReturnValue({ width: 0 } as DOMRect);
+ renderBar(2);
+
+ expect(screen.getByTestId("workspace-bar").dataset.density).toBe("full");
+ expect(screen.getByText("Workspace 2").className).not.toContain("sr-only");
+ bounds.mockRestore();
+ });
+
it("compacts additional workspaces to folder icons and ordinal numbers", () => {
const bounds = vi
.spyOn(HTMLElement.prototype, "getBoundingClientRect")
@@ -72,11 +87,19 @@ describe("WorkspaceBar density", () => {
bounds.mockRestore();
});
- it("renders all twelve workspaces and only then reaches the cap", () => {
- renderBar(12);
+ it("renders beyond the former cap and keeps adding available", () => {
+ renderBar(15);
+
+ expect(screen.getAllByRole("tab")).toHaveLength(16);
+ expect(screen.getByTestId("workspace-ordinal-w15").textContent).toBe("15");
+ expect((screen.getByTestId("workspace-add") as HTMLButtonElement).disabled).toBe(
+ false,
+ );
+ });
+
+ it("still honours a finite cap from an older backend", () => {
+ renderBar(12, 12);
- expect(screen.getAllByRole("tab")).toHaveLength(13);
- expect(screen.getByTestId("workspace-ordinal-w12").textContent).toBe("12");
expect((screen.getByTestId("workspace-add") as HTMLButtonElement).disabled).toBe(
true,
);
diff --git a/jarvis/ui/web/frontend/src/components/agentic/WorkspaceBar.tsx b/jarvis/ui/web/frontend/src/components/agentic/WorkspaceBar.tsx
index 34517c1766..5e391a3a1b 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/WorkspaceBar.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/WorkspaceBar.tsx
@@ -66,7 +66,8 @@ interface WorkspaceBarProps {
activeId: string | null;
/** True while the wizard is open for an ADDITIONAL workspace. */
addingNew: boolean;
- maxWorkspaces: number;
+ /** A legacy/backend safety cap, or null when workspace count is unrestricted. */
+ maxWorkspaces: number | null;
onSelect: (id: string) => void;
onAdd: () => void;
onRename: (id: string, name: string) => Promise<boolean>;
@@ -124,7 +125,7 @@ export function WorkspaceBar({
addingNew ? ADD_TAB_FOCUS_ID : (activeId ?? workspaces[0]?.id ?? ADD_TAB_FOCUS_ID),
);
const workspaceIdKey = workspaces.map((workspace) => workspace.id).join("\u0000");
- const full = workspaces.length >= maxWorkspaces;
+ const full = maxWorkspaces !== null && workspaces.length >= maxWorkspaces;
// A drag that ends anywhere else owes this bar no `dragleave`, and a tab left
// highlighted over a workspace nobody dropped on is a lie about what will
@@ -210,7 +211,9 @@ export function WorkspaceBar({
const bar = barRef.current;
if (!hasTabs || !bar) return;
const update = (width: number) => {
- if (width >= 0 && Number.isFinite(width)) setBarWidth(width);
+ // A hidden element and jsdom both report zero. That is not usable layout
+ // information; keep the count-based tier until the observer sees width.
+ if (width > 0 && Number.isFinite(width)) setBarWidth(width);
};
update(bar.getBoundingClientRect().width);
if (typeof ResizeObserver === "undefined") return;
@@ -247,7 +250,7 @@ export function WorkspaceBar({
const compact = density !== "full";
const ordinalOnly = density === "ordinal";
- /** Standard roving focus for a tablist with up to thirteen focus targets. */
+ /** Standard roving focus across every available tab and the Add control. */
const moveTabFocus = (event: React.KeyboardEvent<HTMLDivElement>) => {
if (!["ArrowLeft", "ArrowRight", "Home", "End"].includes(event.key)) return;
const tabs = Array.from(
@@ -551,7 +554,7 @@ export function WorkspaceBar({
disabled={busy || full}
data-testid="workspace-add"
title={
- full
+ full && maxWorkspaces !== null
? `${maxWorkspaces} workspaces are already open — close one first.`
: "Open another folder in its own workspace"
}
diff --git a/jarvis/ui/web/frontend/src/lib/agenticIdeApi.ts b/jarvis/ui/web/frontend/src/lib/agenticIdeApi.ts
index f69f138cdb..96c64e1413 100644
--- a/jarvis/ui/web/frontend/src/lib/agenticIdeApi.ts
+++ b/jarvis/ui/web/frontend/src/lib/agenticIdeApi.ts
@@ -353,7 +353,8 @@ export interface IdeState {
workspaces: WorkspaceCard[];
/** The one on screen, or null while the wizard is showing. */
active_id: string | null;
- max_workspaces: number;
+ /** Null means the backend leaves workspace count to the machine and user. */
+ max_workspaces?: number | null;
/** The active subscription per coding CLI. Absent on an older backend. */
accounts?: IdeAccountState[];
}
@@ -918,7 +919,7 @@ export async function endIdeSession(): Promise<void> {
export interface WorkspacesResponse {
workspaces: WorkspaceCard[];
active_id: string | null;
- max_workspaces: number;
+ max_workspaces: number | null;
}
/** Every open workspace, in tab order, with the front one marked. */
diff --git a/jarvis/ui/web/frontend/src/views/AgenticIdeView.test.tsx b/jarvis/ui/web/frontend/src/views/AgenticIdeView.test.tsx
index ea1251cb96..e516accb90 100644
--- a/jarvis/ui/web/frontend/src/views/AgenticIdeView.test.tsx
+++ b/jarvis/ui/web/frontend/src/views/AgenticIdeView.test.tsx
@@ -1157,4 +1157,17 @@ describe("AgenticIdeView — the workspace bar", () => {
)) as HTMLButtonElement;
expect(add.disabled).toBe(true);
});
+
+ it("keeps adding available when the backend has no workspace cap", async () => {
+ vi.mocked(api.fetchIdeState).mockResolvedValue({
+ ...twoWorkspaces(),
+ max_workspaces: null,
+ });
+ render(<AgenticIdeView />);
+
+ const add = (await screen.findByTestId(
+ "workspace-add",
+ )) as HTMLButtonElement;
+ expect(add.disabled).toBe(false);
+ });
});
diff --git a/jarvis/ui/web/frontend/src/views/AgenticIdeView.tsx b/jarvis/ui/web/frontend/src/views/AgenticIdeView.tsx
index 58095a0e9f..112c7925a1 100644
--- a/jarvis/ui/web/frontend/src/views/AgenticIdeView.tsx
+++ b/jarvis/ui/web/frontend/src/views/AgenticIdeView.tsx
@@ -142,7 +142,7 @@ export function AgenticIdeView({ onScreen = true }: AgenticIdeViewProps) {
// Every open workspace, for the bar above. The one on screen is `session`;
// these are the others, still running, one click away.
const [workspaces, setWorkspaces] = useState<WorkspaceCard[]>([]);
- const [maxWorkspaces, setMaxWorkspaces] = useState(6);
+ const [maxWorkspaces, setMaxWorkspaces] = useState<number | null>(6);
// Which subscription new terminals open on, per coding CLI. Carried on the
// workspace state rather than fetched separately, so the toolbar and the
// panes can never disagree about which plan the next one will spend.
@@ -201,7 +201,9 @@ export function AgenticIdeView({ onScreen = true }: AgenticIdeViewProps) {
const state = await fetchIdeState();
setSession(state.session);
setWorkspaces(state.workspaces ?? []);
- setMaxWorkspaces(state.max_workspaces ?? 6);
+ setMaxWorkspaces(
+ state.max_workspaces === undefined ? 6 : state.max_workspaces,
+ );
setIdeAccounts(state.accounts ?? []);
setFocus(Boolean(state.session?.focus_mode));
// The backend is the authority on whether a workspace is on screen. It
@@ -239,7 +241,9 @@ export function AgenticIdeView({ onScreen = true }: AgenticIdeViewProps) {
const applyState = useCallback((state: IdeState) => {
setSession(state.session);
setWorkspaces(state.workspaces ?? []);
- setMaxWorkspaces(state.max_workspaces ?? 6);
+ setMaxWorkspaces(
+ state.max_workspaces === undefined ? 6 : state.max_workspaces,
+ );
setFocus(Boolean(state.session?.focus_mode));
// Absent on a backend that predates the switcher — keeping what we had
// beats blanking the toolbar over a field that simply was not sent.
diff --git a/tests/unit/agentic_ide/test_many_terminals.py b/tests/unit/agentic_ide/test_many_terminals.py
index e890fbaba3..2c66843810 100644
--- a/tests/unit/agentic_ide/test_many_terminals.py
+++ b/tests/unit/agentic_ide/test_many_terminals.py
@@ -1,10 +1,10 @@
"""What holds — and what does not — once a workspace has far more than 12 panes.
-The cap was 12 and is now 100 per workspace, with up to 12 workspaces. Twelve
-panes was small enough that several things could get away with being O(n) in
-disguise or quietly bounded; a hundred is not. These tests pin the parts that
-must scale and name the ones that are deliberately bounded, so raising the cap
-again is a measurement rather than a hope.
+The pane cap was 12 and is now 100 per workspace, while workspace count itself
+is unrestricted. Twelve panes was small enough that several things could get
+away with being O(n) in disguise or quietly bounded; a hundred is not. These
+tests pin the parts that must scale and name the ones that are deliberately
+bounded, so raising the pane cap again is a measurement rather than a hope.
"""
from __future__ import annotations
@@ -28,17 +28,16 @@ def registry(monkeypatch: pytest.MonkeyPatch) -> ide.Registry:
# ----------------------------------------------------------------- call-signs
-def test_the_call_sign_pool_covers_a_full_house() -> None:
- """Every pane in every workspace needs its own speakable name.
+def test_the_call_sign_pool_covers_one_full_workspace() -> None:
+ """Every pane in one workspace needs its own speakable name.
- Names are how a pane is addressed by voice, so two panes sharing one would
- make an instruction ambiguous. The pool has to cover the absolute worst case
- — every workspace full — not the common one.
+ 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.
"""
- worst_case = ide.MAX_TERMINALS * ide.MAX_WORKSPACES
- pool = default_names(worst_case)
- assert len(pool) == worst_case
- assert len(set(pool)) == worst_case, "a repeated call-sign is an ambiguous order"
+ 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"
async def test_opening_a_hundred_panes_gives_each_a_distinct_name(
@@ -191,7 +190,8 @@ async def test_a_full_house_across_every_workspace_round_trips(
the whole point of numbering them.
"""
folders = []
- for index in range(ide.MAX_WORKSPACES):
+ workspace_count = 16
+ for index in range(workspace_count):
folder = tmp_path / f"repo{index}"
folder.mkdir()
folders.append(folder)
@@ -201,8 +201,8 @@ async def test_a_full_house_across_every_workspace_round_trips(
loaded = resume_store.load()
assert loaded is not None
- assert len(loaded.workspaces) == ide.MAX_WORKSPACES
- assert loaded.terminal_count == 20 * ide.MAX_WORKSPACES
+ assert len(loaded.workspaces) == workspace_count
+ assert loaded.terminal_count == 20 * workspace_count
for workspace in loaded.workspaces:
names = [t.name for t in workspace.terminals]
assert names == default_names(20), "each workspace numbers its own panes"
diff --git a/tests/unit/agentic_ide/test_pane_batch.py b/tests/unit/agentic_ide/test_pane_batch.py
index 273b6252e6..c931fc6c3e 100644
--- a/tests/unit/agentic_ide/test_pane_batch.py
+++ b/tests/unit/agentic_ide/test_pane_batch.py
@@ -3,8 +3,8 @@
Deliberately layout-agnostic: placement is ``add_terminal``'s job and is pinned
by its own tests. What matters here is the part a spoken request depends on —
how many panes appear, which agent they run, and whether the caller is told the
-truth when the workspace cap cuts the request short. A batch that silently
-opened three of five would report success for work that did not happen.
+truth when the pane cap within a workspace cuts the request short. A batch that
+silently opened three of five would report success for work that did not happen.
"""
from __future__ import annotations
diff --git a/tests/unit/agentic_ide/test_resume_session.py b/tests/unit/agentic_ide/test_resume_session.py
index e968ad0db0..da9cd4f53c 100644
--- a/tests/unit/agentic_ide/test_resume_session.py
+++ b/tests/unit/agentic_ide/test_resume_session.py
@@ -658,7 +658,7 @@ async def test_reopening_the_same_folder_replaces_its_own_record(
assert [len(w.terminals) for w in saved.workspaces] == [1]
-async def test_the_remembered_list_stays_bounded(
+async def test_the_closed_workspace_history_stays_bounded(
registry: ide.Registry, tmp_path: Path
) -> None:
"""A restore point is a screen, not an archive."""
@@ -670,12 +670,28 @@ async def test_the_remembered_list_stays_bounded(
saved = resume_store.load()
assert saved is not None
- assert len(saved.workspaces) == resume_store.MAX_REMEMBERED_WORKSPACES
- # The newest survive; the oldest fall off.
+ # The last live snapshot is retained alongside the bounded older history.
+ assert len(saved.workspaces) == resume_store.MAX_REMEMBERED_WORKSPACES + 1
+ # The newest survive; the oldest history falls off.
assert any("repo13" in w.folder for w in saved.workspaces)
assert not any(w.folder.endswith("repo0") for w in saved.workspaces)
+async def test_open_workspaces_are_never_trimmed_by_the_history_budget(
+ registry: ide.Registry, tmp_path: Path
+) -> None:
+ """The closed-folder archive cap must not become an open-workspace cap."""
+ count = resume_store.MAX_REMEMBERED_WORKSPACES + 4
+ for index in range(count):
+ folder = tmp_path / f"open{index}"
+ folder.mkdir()
+ await registry.start(str(folder), [{"agent": "claude"}])
+
+ saved = resume_store.load()
+ assert saved is not None
+ assert len(saved.workspaces) == count
+
+
async def test_only_starting_fresh_discards_the_restore_point(
registry: ide.Registry, tmp_path: Path
) -> None:
diff --git a/tests/unit/agentic_ide/test_session.py b/tests/unit/agentic_ide/test_session.py
index ea3f28e9eb..d31a46329d 100644
--- a/tests/unit/agentic_ide/test_session.py
+++ b/tests/unit/agentic_ide/test_session.py
@@ -444,22 +444,19 @@ async def test_closing_a_workspace_stops_only_its_own_agents(
assert registry.active_id == first.id, "the survivor takes the front"
-async def test_the_workspace_cap_is_refused_in_plain_language(
+async def test_more_than_the_former_workspace_cap_can_be_opened(
registry: Registry, tmp_path: Path
) -> None:
- for index in range(session_mod.MAX_WORKSPACES):
+ for index in range(16):
folder = tmp_path / f"ws{index}"
folder.mkdir()
await _open(registry, folder, [{"agent": "claude"}])
- one_too_many = tmp_path / "overflow"
- one_too_many.mkdir()
- with pytest.raises(SessionError, match="already open"):
- await _open(registry, one_too_many, [{"agent": "claude"}])
+ assert len(registry.sessions) == 16
-def test_workspace_capacity_is_larger_than_the_original_six_tabs() -> None:
- assert session_mod.MAX_WORKSPACES == 12
+def test_workspace_count_has_no_hard_limit() -> None:
+ assert session_mod.MAX_WORKSPACES is None
# --------------------------------------------------------------------- attach
diff --git a/tests/unit/web/test_agentic_ide_batch_route.py b/tests/unit/web/test_agentic_ide_batch_route.py
index 533d1880e7..d01b15f76b 100644
--- a/tests/unit/web/test_agentic_ide_batch_route.py
+++ b/tests/unit/web/test_agentic_ide_batch_route.py
@@ -1,6 +1,6 @@
"""The batch endpoint behind "open five more terminals".
-Two things it must never do: report a full success when the workspace cap cut
+Two things it must never do: report a full success when the pane cap cut
the request short, and leave connected clients staring at a stale grid. The
second one is why the route publishes an event at all — the workspace view
fetches its state once when it mounts, so panes it did not create itself are