Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.
Python agent-orchestrationai-agentai-coding-assistantclaude-codecoding-agentcomputer-usedesktop-applocal-firstmcppersonal-jarvisvoice-assistantvoice-coding
fix(agentic-ide): give panes a readable-height floor so a big workspace scrolls
Ruben Lütke276ad493997b
diff --git a/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.test.tsx b/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.test.tsxindex ab6950aca0..bf6730d15b 100644--- a/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.test.tsx+++ b/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.test.tsx@@ -306,7 +306,7 @@ describe("grid layout", () => {it("puts a fresh workspace side by side in one row", () => {renderGrid(sessionWith([["Mika", 0], ["Nova", 1], ["Aria", 2], ["Kai", 3]]));expect(gridEl().style.gridTemplateColumns).toBe("repeat(4, minmax(0, 1fr))");- expect(gridEl().style.gridTemplateRows).toBe("repeat(1, minmax(0, 1fr))");+ expect(gridEl().style.gridTemplateRows).toBe("repeat(1, minmax(240px, 1fr))");});it("a downward split takes only its OWN column, not the whole width", () => {@@ -322,7 +322,7 @@ describe("grid layout", () => {]),);expect(gridEl().style.gridTemplateColumns).toBe("repeat(3, minmax(0, 1fr))");- expect(gridEl().style.gridTemplateRows).toBe("repeat(2, minmax(0, 1fr))");+ expect(gridEl().style.gridTemplateRows).toBe("repeat(2, minmax(240px, 1fr))");expect(cellStyle("Mika")).toContain("grid-row: 1 / span 2");expect(cellStyle("Aria")).toContain("grid-row: 1 / span 2");expect(cellStyle("Nova")).toContain("grid-row: 1 / span 1");@@ -686,3 +686,42 @@ describe("prompt bar seam", () => {expect(screen.getByTestId("agentic-composer").style.height).toBe("176px");});});+++describe("a workspace with far more panes than the window fits", () => {+ /** Many panes, one per column, the way a big fan-out opens them. */+ function manyPanes(count: number) {+ return sessionWith(+ Array.from({ length: count }, (_, i) => [`T${i}`, i] as [string, number]),+ );+ }++ function grid(): HTMLElement {+ const cell = screen.getAllByTestId(/^pane-cell-/)[0];+ const container = cell.parentElement;+ if (!container) throw new Error("no grid container");+ return container;+ }++ it("keeps every pane readable instead of sharing the height N ways", () => {+ // The failure this guards: rows used to be a free `1fr`, so panes shrank+ // without limit. Measured on a 2560 px screen, 12 panes gave each ~26 text+ // rows, 40 gave 7 and 100 gave 3 — readable width, unusable height, and+ // nothing crashed to tell anyone.+ renderGrid(manyPanes(40));+ const rows = grid().style.gridTemplateRows;+ expect(rows).toContain("240px");+ expect(rows).not.toContain("minmax(0,");+ });++ it("scrolls once the panes stop fitting, rather than squeezing them", () => {+ renderGrid(manyPanes(40));+ expect(grid().className).toContain("overflow-y-auto");+ });++ it("renders a pane for every one of a hundred terminals", () => {+ // The backend cap; nothing may be silently dropped on the way to the screen.+ renderGrid(manyPanes(100));+ expect(screen.getAllByTestId(/^pane-cell-/)).toHaveLength(100);+ });+});diff --git a/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.tsx b/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.tsxindex ddba63777b..3571916a14 100644--- a/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.tsx+++ b/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.tsx@@ -36,7 +36,12 @@ import {type SplitDirection,} from "./AgenticTerminal";import type { TerminalAppearance } from "./terminalThemes";-import { bandCapacityFor, GRID_HORIZONTAL_PADDING_PX, paneGrid } from "./layout";+import {+ bandCapacityFor,+ GRID_HORIZONTAL_PADDING_PX,+ MIN_PANE_HEIGHT_PX,+ paneGrid,+} from "./layout";import { PromptPreview } from "./PromptPreview";import {addTerminal,@@ -518,10 +523,20 @@ export function AgenticGrid({<divref={gridRef}data-testid="agentic-grid"- className="grid min-h-0 flex-1 gap-3 overflow-hidden p-3"+ className={cn(+ "grid min-h-0 flex-1 gap-3 p-3",+ // Scrolls only once the panes would be squeezed below a readable+ // height. With a workspace that fits, this is `overflow-hidden`+ // behaviour and nothing moves.+ maximized !== null ? "overflow-hidden" : "overflow-y-auto scrollbar-jarvis",+ )}style={{gridTemplateColumns: `repeat(${Math.max(1, grid.columns)}, minmax(0, 1fr))`,- gridTemplateRows: `repeat(${Math.max(1, grid.rows)}, minmax(0, 1fr))`,+ // A floor on row height, not a free 1fr. Panes used to share the+ // window height in equal parts however many there were, so a large+ // workspace ended up with three text rows per pane — readable width,+ // unusable height. Below the floor the grid grows and scrolls instead.+ gridTemplateRows: `repeat(${Math.max(1, grid.rows)}, minmax(${MIN_PANE_HEIGHT_PX}px, 1fr))`,}}>{session.terminals.map((term, index) => {diff --git a/jarvis/ui/web/frontend/src/components/agentic/layout.ts b/jarvis/ui/web/frontend/src/components/agentic/layout.tsindex 0c6a551866..b4eac19a02 100644--- a/jarvis/ui/web/frontend/src/components/agentic/layout.ts+++ b/jarvis/ui/web/frontend/src/components/agentic/layout.ts@@ -60,6 +60,23 @@ export const MAX_PANES_PER_BAND = 10;*/export const MIN_PANE_WIDTH_PX = 380;+/**+ * Shortest a pane may get before its agent's output stops being readable.+ *+ * The mirror of `MIN_PANE_WIDTH_PX`, and it was missing. Panes shared the window+ * height in equal parts with nothing stopping them from shrinking, so raising+ * the per-workspace cap from 12 to 100 quietly traded one failure for another:+ * measured on a 2560 px screen, 12 panes give each ~26 text rows, 40 give 7, and+ * 100 give 3. Nothing crashes — the workspace simply becomes unusable, which is+ * harder to notice than a crash and worse to live with.+ *+ * An agent TUI needs its input box plus enough history to see what it just did:+ * roughly a dozen rows at the default 13 px (~17 px per row) plus the pane's+ * header and frame. Past that point the grid scrolls instead of shrinking, the+ * same way a long page does.+ */+export const MIN_PANE_HEIGHT_PX = 240;+/** Horizontal padding of the rendered grid (`p-3`: 12 px on each side). */export const GRID_HORIZONTAL_PADDING_PX = 24;diff --git a/tests/unit/agentic_ide/test_many_terminals.py b/tests/unit/agentic_ide/test_many_terminals.pynew file mode 100644index 0000000000..029f94992d--- /dev/null+++ b/tests/unit/agentic_ide/test_many_terminals.py@@ -0,0 +1,218 @@+"""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 6 workspaces. Twelve 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.+"""++from __future__ import annotations++import json+from pathlib import Path++import pytest++from jarvis.agentic_ide import resume_store+from jarvis.agentic_ide import session as ide+from jarvis.agentic_ide.agent_sessions import ResumeHandle+from jarvis.agentic_ide.names import default_names+from tests.fakes.fake_pty_manager import FakePtyManager+++def registry(monkeypatch: pytest.MonkeyPatch) -> ide.Registry:+ monkeypatch.setattr(ide, "agent_argv", lambda name: (f"/usr/bin/{name}",))+ return ide.Registry(pty_manager=FakePtyManager())+++# ----------------------------------------------------------------- call-signs+def test_the_call_sign_pool_covers_a_full_house() -> None:+ """Every pane in every 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.+ """+ 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"+++async def test_opening_a_hundred_panes_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)]+ )+ 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 "" not in keys+++async def test_a_hundred_panes_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)]+ )+ for term in session.terminals:+ assert session.find(term.name) is term+ assert session.find(term.key) is term+++# --------------------------------------------------------------------- layout+async def test_the_grid_stays_gapless_at_a_hundred_panes(+ 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)]+ )+ 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))+++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(40)]+ )+ victim = session.terminals[17].name+ await registry.close_terminal(victim)++ assert len(session.terminals) == 39+ 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(39))+++async def test_the_cap_is_enforced_rather_than_exceeded(+ 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()+++async def test_a_batch_past_the_cap_reports_being_capped(+ registry: ide.Registry, tmp_path: Path+) -> None:+ """Asking for more than fits is a partial success the caller must surface."""+ await registry.start(+ str(tmp_path), [{"agent": "claude"} for _ in range(ide.MAX_TERMINALS - 3)]+ )+ created, capped = await registry.add_terminals(10)+ assert len(created) == 3+ assert capped is True+++# ------------------------------------------------------------------- resuming+async def test_a_hundred_panes_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)]+ )+ 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+ stored = [+ (t.name, t.column, t.slot) for t in loaded.workspaces[0].terminals+ ]+ assert stored == expected+++async def test_restoring_a_hundred_panes_keeps_every_position(+ registry: ide.Registry, tmp_path: Path+) -> None:+ panes = [+ resume_store.SnapshotTerminal(+ key=f"t{i}",+ name=f"T{i}",+ agent="claude",+ column=i // 5,+ slot=i % 5,+ resume=ResumeHandle(+ kind="claude_session", id=f"conv-{i}", captured_at=1.0+ ),+ )+ for i in range(ide.MAX_TERMINALS)+ ]+ snapshot = resume_store.Snapshot(+ saved_at=1.0,+ workspaces=[+ resume_store.SnapshotWorkspace(+ session_id="ide_big", folder=str(tmp_path), terminals=panes+ )+ ],+ )++ result = await registry.restore(snapshot)+ session = result.sessions[0]+ assert len(session.terminals) == ide.MAX_TERMINALS+ assert [(t.column, t.slot) for t in session.terminals] == [+ (i // 5, i % 5) for i in range(ide.MAX_TERMINALS)+ ]+ # 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+++async def test_a_full_house_across_every_workspace_round_trips(+ registry: ide.Registry, tmp_path: Path+) -> None:+ """The absolute worst case: every workspace open, each one full.++ Deliberately smaller than MAX_TERMINALS per workspace so the test stays+ fast — what is being pinned is that nothing collapses when several large+ workspaces are remembered at once, including their call-signs staying+ unique ACROSS workspaces.+ """+ folders = []+ for index in range(ide.MAX_WORKSPACES):+ folder = tmp_path / f"repo{index}"+ folder.mkdir()+ folders.append(folder)+ await registry.start(+ str(folder), [{"agent": "claude"} for _ in range(20)]+ )++ loaded = resume_store.load()+ assert loaded is not None+ assert len(loaded.workspaces) == ide.MAX_WORKSPACES+ assert loaded.terminal_count == 20 * ide.MAX_WORKSPACES+ every_name = [+ t.name for w in loaded.workspaces for t in w.terminals+ ]+ assert len(set(every_name)) == len(every_name), "call-signs collided"+++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)]+ )+ raw = resume_store._store_path().read_text(encoding="utf-8")+ # A hundred panes of metadata, not a transcript: comfortably under 100 KB.+ assert len(raw) < 100_000+ # And still valid JSON rather than something truncated.+ assert json.loads(raw)["workspaces"][0]["terminals"]