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): keep split terminals in their row instead of re-dealing the workspace
Ruben Lütke970900929f2e
diff --git a/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.test.tsx b/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.test.tsxindex 0a9ed1ca37..606468d7a7 100644--- a/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.test.tsx+++ b/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.test.tsx@@ -500,7 +500,11 @@ describe("grid layout", () => {expect(box("Kai").left).toBe(75);});- it("wraps four tall full-screen TUIs into two balanced bands", async () => {+ it("keeps four splits side by side — the row is the user's choice", async () => {+ // Reported 2026-07-31: an aspect-ratio rule re-wrapped the workspace to+ // 2 x 2 on the fourth "split right", moving a pane the user was reading to+ // another row. The rule is gone — width alone wraps a workspace, so four+ // panes in a 2K window stay in the one row the user built.const previous = globalThis.ResizeObserver;class AreaObserver {constructor(private readonly callback: ResizeObserverCallback) {}@@ -517,9 +521,9 @@ describe("grid layout", () => {try {renderGrid(sessionWith([["Mika", 0], ["Nova", 1], ["Aria", 2], ["Kai", 3]]));await waitFor(() =>- expect(box("Aria")).toMatchObject({ left: 0, top: 50, width: 50, height: 50 }),+ expect(box("Aria")).toMatchObject({ left: 50, top: 0, width: 25, height: 100 }),);- expect(box("Kai")).toMatchObject({ left: 50, top: 50, width: 50, height: 50 });+ expect(box("Kai")).toMatchObject({ left: 75, top: 0, width: 25, height: 100 });} finally {globalThis.ResizeObserver = previous;}@@ -546,13 +550,14 @@ describe("grid layout", () => {expect(box("Vega").width).toBe(box("Nova").width);});- it("wraps a crowded workspace into two even bands", () => {- // 12 columns side by side are too narrow to read anything in, so they break- // into 6 above and 6 below.+ it("wraps a crowded workspace by overflow, never by re-dealing", () => {+ // 12 columns are past the ten-per-band ceiling, so the overflow starts a+ // second band: ten above, two below. The first ten keep their places —+ // filling greedily is what stops an opened pane from moving the others.const panes = Array.from({ length: 12 }, (_, i) => [`T${i + 1}`, i] as [string, number]);renderGrid(sessionWith(panes));expect(box("T1")).toMatchObject({ left: 0, top: 0 });- expect(box("T7")).toMatchObject({ left: 0, top: 50 });+ expect(box("T11")).toMatchObject({ left: 0, top: 50 });// Same parent for every pane — a pane that moves to another parent element// is remounted, and remounting kills the agent behind it.expect(screen.getByTestId("pane-cell-T12").parentElement).toBe(@@ -582,7 +587,7 @@ describe("grid layout", () => {renderGrid(sessionWith(panes));fireEvent.click(screen.getByTestId("pane-maximize-T3"));fireEvent.click(screen.getByTestId("pane-maximize-T3"));- expect(box("T7")).toMatchObject({ left: 0, top: 50 });+ expect(box("T11")).toMatchObject({ left: 0, top: 50 });});});diff --git a/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.tsx b/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.tsxindex 8332679c6b..3d0623780f 100644--- a/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.tsx+++ b/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.tsx@@ -55,7 +55,7 @@ import {} from "./AgenticTerminal";import type { TerminalAppearance } from "./terminalThemes";import {- bandCapacityForArea,+ bandCapacityFor,GRID_HORIZONTAL_PADDING_PX,MIN_PANE_HEIGHT_PX,} from "./layout";@@ -750,21 +750,13 @@ export function AgenticGrid({resizeComposer(composerCollapsed ? COMPOSER_DEFAULT_PX : COMPOSER_COLLAPSED_PX);}, [composerCollapsed, resizeComposer]);- // A split-down pane adds height inside an existing column; it must not make- // the whole workspace re-wrap. Only independent side-by-side columns decide- // the band shape.- const layoutColumnCount = useMemo(- () => new Set(session.terminals.map((term) => term.column)).size,- [session.terminals],- );- // Height now influences wrapping too, so give it the same coarse step as- // width. A one-pixel WebView animation must not flip a whole band back and- // forth around the aspect threshold.- const layoutHeight = Math.round(gridHeight / 16) * 16;- const perBand = useMemo(- () => bandCapacityForArea(gridWidth, layoutHeight, layoutColumnCount),- [gridWidth, layoutHeight, layoutColumnCount],- );+ // How many columns share a row depends on WIDTH alone — the readability+ // floor under each pane. It once also shrank with the window's aspect ratio+ // ("four tall panes waste their lower half, wrap them 2 x 2"), which second-+ // guessed the split buttons: the fourth split re-dealt the workspace and a+ // pane the user was reading jumped to another row. Rows are the user's+ // choice; the layout only wraps when panes would become unreadable.+ const perBand = bandCapacityFor(gridWidth);/** The sizes the panes are drawn at, and the seams between them.diff --git a/jarvis/ui/web/frontend/src/components/agentic/WorkspaceLauncher.tsx b/jarvis/ui/web/frontend/src/components/agentic/WorkspaceLauncher.tsxindex 5a812a055c..a997f41752 100644--- a/jarvis/ui/web/frontend/src/components/agentic/WorkspaceLauncher.tsx+++ b/jarvis/ui/web/frontend/src/components/agentic/WorkspaceLauncher.tsx@@ -39,8 +39,6 @@ export interface WorkspaceLauncherProps {suggestedNames: string[];/** Width the workspace grid will occupy, measured by the view. */workspaceWidthPx: number;- /** Height it will occupy — panes wrap on shape, not on width alone. */- workspaceHeightPx: number;onCount: (next: number) => void;planned: PlannedTerminal[];@@ -101,7 +99,6 @@ export function WorkspaceLauncher({maxTerminals,suggestedNames,workspaceWidthPx,- workspaceHeightPx,onCount,planned,onPlanned,@@ -276,7 +273,6 @@ export function WorkspaceLauncher({count={count}names={suggestedNames}workspaceWidthPx={workspaceWidthPx}- workspaceHeightPx={workspaceHeightPx}/><CountTrackcount={count}diff --git a/jarvis/ui/web/frontend/src/components/agentic/WorkspaceShape.tsx b/jarvis/ui/web/frontend/src/components/agentic/WorkspaceShape.tsxindex 7766f83bfd..a8643a606f 100644--- a/jarvis/ui/web/frontend/src/components/agentic/WorkspaceShape.tsx+++ b/jarvis/ui/web/frontend/src/components/agentic/WorkspaceShape.tsx@@ -42,7 +42,7 @@ import {paneLines,widthForOneBand,wizardPanes,- workspaceBandCapacityForArea,+ workspaceBandCapacityFor,} from "./layout";/**@@ -102,25 +102,20 @@ interface WorkspaceShapeProps {names: string[];/*** Width of the slot the workspace will occupy, in px — measured by the view- * from the element the grid will later fill. Together with the height below,- * it keeps both unreadably narrow and excessively tall panes out of the- * preview and the running workspace.+ * from the element the grid will later fill. It keeps unreadably narrow+ * panes out of the preview and the running workspace.*/workspaceWidthPx: number;- /** Height the live grid will occupy with its default collapsed composer. */- workspaceHeightPx: number;}export function WorkspaceShape({count,names,workspaceWidthPx,- workspaceHeightPx,}: WorkspaceShapeProps) {const perBand = useMemo(- () =>- workspaceBandCapacityForArea(workspaceWidthPx, workspaceHeightPx, count),- [workspaceWidthPx, workspaceHeightPx, count],+ () => workspaceBandCapacityFor(workspaceWidthPx),+ [workspaceWidthPx],);const grid = useMemo(() => paneGrid(wizardPanes(count), perBand),diff --git a/jarvis/ui/web/frontend/src/components/agentic/layout.test.ts b/jarvis/ui/web/frontend/src/components/agentic/layout.test.tsindex 557d5cd7ce..b3f8c3f7fe 100644--- a/jarvis/ui/web/frontend/src/components/agentic/layout.test.ts+++ b/jarvis/ui/web/frontend/src/components/agentic/layout.test.ts@@ -124,17 +124,30 @@ describe("paneColumns", () => {});it("wraps beyond the readable width instead of shrinking panes further", () => {- // 12 columns on one line leaves each of them too narrow to read, so they- // break into two even bands: 6 above, 6 below.- expect(paneColumns(11)).toBe(6);- expect(paneColumns(12)).toBe(6);+ // 12 columns on one line leaves each of them too narrow to read, so the+ // overflow starts a second band: 10 above, 2 below.+ expect(paneColumns(11)).toBe(10);+ expect(paneColumns(12)).toBe(10);+ });++ it("fills the first band up rather than re-balancing the workspace", () => {+ // Balanced bands (21 → 7 + 7 + 7) looked tidier in a still picture, but+ // re-dealt every pane whenever one was added: the user's fourth split+ // moved a terminal they were reading to another row (2026-07-31). Greedy+ // filling keeps every existing column exactly where it is — only the+ // newest can start a band.+ expect(paneColumns(21)).toBe(10);+ expect(paneColumns(20)).toBe(10);});- it("keeps the bands even rather than filling the first one up", () => {- // 21 columns could be 10 + 10 + 1; an almost empty last line next to two- // full ones looks broken, so every band gets the same width.- expect(paneColumns(21)).toBe(7);- expect(paneColumns(20)).toBe(10);+ it("never moves an existing column when one more is opened", () => {+ // The user-facing contract behind greedy filling, pinned directly: for any+ // count, adding a column changes no existing placement.+ for (let count = 1; count < 24; count += 1) {+ const before = paneGrid(wizardPanes(count)).placements;+ const after = paneGrid(wizardPanes(count + 1)).placements;+ expect(after.slice(0, count)).toEqual(before);+ }});it("has no columns for an empty workspace", () => {@@ -214,11 +227,11 @@ describe("paneGrid", () => {it("wraps a crowded workspace into a second band", () => {const panes = Array.from({ length: 12 }, (_, i) => pane(i, 0));const grid = paneGrid(panes);- expect(grid.columns).toBe(6);+ expect(grid.columns).toBe(10);expect(grid.rows).toBe(2);- // The seventh column starts the second band, back at the left edge.- expect(grid.placements[6]).toEqual({ column: 1, row: 2, rowSpan: 1 });- expect(grid.placements[11]).toEqual({ column: 6, row: 2, rowSpan: 1 });+ // The eleventh column starts the second band, back at the left edge.+ expect(grid.placements[10]).toEqual({ column: 1, row: 2, rowSpan: 1 });+ expect(grid.placements[11]).toEqual({ column: 2, row: 2, rowSpan: 1 });});it("closes gaps the backend left in the column numbers", () => {diff --git a/jarvis/ui/web/frontend/src/components/agentic/layout.ts b/jarvis/ui/web/frontend/src/components/agentic/layout.tsindex ad5707fc79..10253ad793 100644--- a/jarvis/ui/web/frontend/src/components/agentic/layout.ts+++ b/jarvis/ui/web/frontend/src/components/agentic/layout.ts@@ -77,23 +77,6 @@ export const MIN_PANE_WIDTH_PX = 380;*/export const MIN_PANE_HEIGHT_PX = 240;-/**- * Tallest useful shape for a full-screen coding-agent terminal, width / height.- *- * Width alone is not enough to decide how many panes belong on one line. A- * Claude Code or Codex TUI keeps its live status and input at the BOTTOM of the- * PTY while completed output stays above it. Four panes across a merely wide- * desktop can each be roughly 450 x 1,050 px: every line is still readable, so- * the width floor accepts the layout, but half the pane becomes blank ground- * between the last answer and the status bar. Four ordinary tiled terminals- * would be 2 x 2 instead.- *- * 0.58 keeps three panes side by side in the reported 2K window, wraps four to- * 2 x 2 there, and still permits four across on a genuinely ultrawide display.- * This is a shape floor, not a preferred ratio: wider panes remain untouched.- */-export const MIN_PANE_ASPECT_RATIO = 0.58;-/*** Horizontal padding of the rendered grid — 4 px on each side.*@@ -119,49 +102,6 @@ export function bandCapacityFor(return Math.max(1, Math.min(MAX_PANES_PER_BAND, fits));}-/**- * Width capacity refined by the height the panes would have to fill.- *- * The return value remains the input expected by {@link paneColumns}; it is a- * ceiling, not necessarily the final column count. This matters for four panes:- * lowering the ceiling from four to three lets `paneColumns` balance them as- * two bands of two instead of producing a three-plus-one stub.- *- * Unknown height keeps the width-only answer. That is both the SSR/test-safe- * fallback and the least surprising first paint before ResizeObserver reports- * the real viewport.- */-export function bandCapacityForArea(- widthPx: number,- heightPx: number,- columnCount: number,- minPaneWidth: number = MIN_PANE_WIDTH_PX,- minPaneAspect: number = MIN_PANE_ASPECT_RATIO,-): number {- const widthCapacity = bandCapacityFor(widthPx, minPaneWidth);- if (- !Number.isFinite(widthPx) ||- widthPx <= 0 ||- !Number.isFinite(heightPx) ||- heightPx <= 0 ||- !Number.isFinite(columnCount) ||- columnCount <= 1 ||- !Number.isFinite(minPaneAspect) ||- minPaneAspect <= 0- ) {- return widthCapacity;- }-- const count = Math.max(1, Math.trunc(columnCount));- for (let capacity = widthCapacity; capacity > 1; capacity -= 1) {- const columns = paneColumns(count, capacity);- const bands = Math.ceil(count / Math.max(1, columns));- const paneAspect = (widthPx / columns) / (heightPx / bands);- if (paneAspect >= minPaneAspect) return capacity;- }- return 1;-}-/*** Columns that fit inside the grid's content box.*@@ -175,19 +115,6 @@ export function workspaceBandCapacityFor(containerWidthPx: number): number {);}-/** Area-aware counterpart for an outer box that still includes grid padding. */-export function workspaceBandCapacityForArea(- containerWidthPx: number,- heightPx: number,- columnCount: number,-): number {- return bandCapacityForArea(- Math.max(0, containerWidthPx - GRID_HORIZONTAL_PADDING_PX),- heightPx,- columnCount,- );-}-/*** Ceiling on the grid's row unit (see `paneGrid`).*@@ -267,12 +194,20 @@ export interface PaneGrid {** Also the wizard's preview width, which is the point — the dots the user sees* before starting are the arrangement they get.+ *+ * Bands fill up GREEDILY: the first band takes the full capacity and only the+ * overflow starts a new one. An earlier version balanced the bands instead+ * (7 columns at capacity 6 became 4 + 3), which read as tidier in a static+ * picture but moved panes the user never touched: splitting a pane to the+ * right re-dealt the whole workspace, and a terminal that was mid-read jumped+ * to another row (reported 2026-07-31). Which panes share a row is the user's+ * decision — the split buttons are exactly that choice — so the layout's only+ * job is the readability wrap, done with the least possible movement: every+ * existing column keeps its place, and only the newest can start a band.*/export function paneColumns(count: number, maxPerBand: number = MAX_PANES_PER_BAND): number {if (count <= 0) return 0;- const cap = Math.max(1, maxPerBand);- const bands = Math.ceil(count / cap);- return Math.ceil(count / bands);+ return Math.min(count, Math.max(1, maxPerBand));}/**diff --git a/jarvis/ui/web/frontend/src/components/agentic/layout.width.test.ts b/jarvis/ui/web/frontend/src/components/agentic/layout.width.test.tsindex 049bc1c22d..9dc498ff0e 100644--- a/jarvis/ui/web/frontend/src/components/agentic/layout.width.test.ts+++ b/jarvis/ui/web/frontend/src/components/agentic/layout.width.test.ts@@ -3,7 +3,6 @@ import {MAX_PANES_PER_BAND,MIN_PANE_WIDTH_PX,bandCapacityFor,- bandCapacityForArea,paneColumns,paneGrid,} from "./layout";@@ -51,33 +50,16 @@ describe("bandCapacityFor", () => {});});-describe("bandCapacityForArea", () => {- it("turns four tall terminal columns into a balanced two-by-two workspace", () => {- // Reported 2026-07-30: at roughly this 2K desktop size, Claude Code kept- // its status at the bottom of each full-height TUI and its answer at the- // top. The width-only layout accepted four 500 x 1,100 panes, leaving a- // conspicuous empty half-screen between them.- const capacity = bandCapacityForArea(2048, 1100, 4);- expect(paneColumns(4, capacity)).toBe(2);- });-- it("keeps three panes side by side in the same window", () => {- const capacity = bandCapacityForArea(2048, 1100, 3);- expect(paneColumns(3, capacity)).toBe(3);- });-- it("still permits four across on a genuinely ultrawide display", () => {- const capacity = bandCapacityForArea(3840, 1000, 4);+describe("splitting stays in the row", () => {+ it("keeps four splits side by side on a 2K desktop", () => {+ // Reported 2026-07-31: the fourth "split right" re-wrapped the workspace+ // to 2 x 2 — a pane the user was reading jumped to a lower row, and the+ // new one appeared above. An aspect-ratio rule used to force that wrap;+ // it is gone, because the split buttons ARE the user's row choice. Width+ // is the only thing that may wrap a workspace.+ const capacity = bandCapacityFor(2048);expect(paneColumns(4, capacity)).toBe(4);});-- it("uses the width-only layout until height has been measured", () => {- expect(bandCapacityForArea(2048, 0, 4)).toBe(bandCapacityFor(2048));- });-- it("does not collapse to one column before width has been measured", () => {- expect(bandCapacityForArea(0, 1100, 4)).toBe(MAX_PANES_PER_BAND);- });});describe("wrapping with a measured capacity", () => {@@ -91,9 +73,10 @@ describe("wrapping with a measured capacity", () => {expect(bands.size).toBeGreaterThan(1);});- it("balances the bands instead of leaving a stub row", () => {- // 8 panes at capacity 5 → 4 + 4, not 5 + 3.- expect(paneColumns(8, 5)).toBe(4);+ it("fills the first band before starting the next", () => {+ // 8 panes at capacity 5 → 5 + 3, never a re-balanced 4 + 4: balancing+ // moved existing panes to another row whenever one was added.+ expect(paneColumns(8, 5)).toBe(5);});it("still places every pane exactly once", () => {diff --git a/jarvis/ui/web/frontend/src/views/AgenticIdeView.test.tsx b/jarvis/ui/web/frontend/src/views/AgenticIdeView.test.tsxindex d3d00837d6..20dd4ffa44 100644--- a/jarvis/ui/web/frontend/src/views/AgenticIdeView.test.tsx+++ b/jarvis/ui/web/frontend/src/views/AgenticIdeView.test.tsx@@ -614,14 +614,13 @@ describe("Agentic IDE launcher", () => {expect(rowsOf(stage)).toBe("repeat(1, minmax(0, 1fr))");});- it("previews four terminals as two by two in a tall 2K workspace", async () => {- // The live grid gets 1,100 px after its 64 px toolbar/composer chrome. Four- // full-height TUI columns would pin their input at the bottom and leave the- // reported half-screen gap above it, so the preview must show the same 2 x- // 2 arrangement the running workspace now chooses.+ it("previews four terminals side by side in a 2K workspace", async () => {+ // An aspect-ratio rule used to fold these into 2 x 2. It re-dealt the+ // running workspace on the fourth split (reported 2026-07-31), so rows are+ // the user's choice now and only width wraps — the preview says the same.const stage = await stageAt(2048, "4", 1164);- expect(columnsOf(stage)).toBe("repeat(2, minmax(0, 1fr))");- expect(rowsOf(stage)).toBe("repeat(2, minmax(0, 1fr))");+ expect(columnsOf(stage)).toBe("repeat(4, minmax(0, 1fr))");+ expect(rowsOf(stage)).toBe("repeat(1, minmax(0, 1fr))");});it("draws one pane per terminal and never more than the stage can hold", async () => {diff --git a/jarvis/ui/web/frontend/src/views/AgenticIdeView.tsx b/jarvis/ui/web/frontend/src/views/AgenticIdeView.tsxindex 8f8a1e0be7..e854736fed 100644--- a/jarvis/ui/web/frontend/src/views/AgenticIdeView.tsx+++ b/jarvis/ui/web/frontend/src/views/AgenticIdeView.tsx@@ -57,17 +57,6 @@ import {type WorkspaceCard,} from "@/lib/agenticIdeApi";-/**- * The running workspace's one-line toolbar plus its default collapsed composer.- *- * The wizard measures the whole slot before either exists, while the terminal- * layout measures only the grid between them. Removing their stable default- * height lets the preview make the same width-and-height decision the live grid- * will make. An opened composer is deliberately excluded: it is a later user- * resize, and the live grid responds to that measurement itself.- */-const WORKSPACE_GRID_CHROME_PX = 64;-/*** Terminal plan for ``count`` panes, preserving whatever the user already chose* for the panes that still exist.@@ -297,35 +286,30 @@ export function AgenticIdeView({ onScreen = true }: AgenticIdeViewProps) {const [modeIntroFor, setModeIntroFor] = useState<string | null>(null);/*- * How large the workspace will be — measured here, in the wizard, because+ * How wide the workspace will be — measured here, in the wizard, because* the preview must promise the arrangement the grid will actually produce.*- * Width stops panes becoming unreadably narrow; height stops full-screen TUIs- * becoming tall shafts with their answer at the top and their input at the- * bottom. A preview computing columns from the count alone drifts apart from- * the running grid on either axis. The wizard shell sits in the same slot the- * grid will occupy, so measuring it here answers the same question.+ * Width is what stops panes becoming unreadably narrow, and it is the ONLY+ * thing that wraps a workspace: which panes share a row is otherwise the+ * user's own choice, made through the split buttons. A preview computing+ * columns from the count alone drifts apart from the running grid. The+ * wizard shell sits in the same slot the grid will occupy, so measuring it+ * here answers the same question.** The readout names the width condition rather than silently assuming it —- * see WorkspaceShape. Measuring the area makes the picture correct for the- * window it was shown in; saying so is what keeps it honest after a resize.+ * see WorkspaceShape. Measuring makes the picture correct for the window it+ * was shown in; saying so is what keeps it honest after a resize.*/const shellRef = useRef<HTMLDivElement | null>(null);const [shellWidth, setShellWidth] = useState(0);- const [shellHeight, setShellHeight] = useState(0);useEffect(() => {const node = shellRef.current;if (!node || typeof ResizeObserver === "undefined") return;setShellWidth(node.clientWidth);- setShellHeight(Math.round(node.clientHeight / 16) * 16);const observer = new ResizeObserver((entries) => {const width = entries[0]?.contentRect.width ?? node.clientWidth;- const height = entries[0]?.contentRect.height ?? node.clientHeight;// Same 16 px step the grid rounds to, so both sides flip at one width.setShellWidth(Math.round(width / 16) * 16);- // Height can now move a whole terminal band too; keep the decision stable- // through one-pixel WebView resize noise just as width already does.- setShellHeight(Math.round(height / 16) * 16);});observer.observe(node);return () => observer.disconnect();@@ -812,7 +796,6 @@ export function AgenticIdeView({ onScreen = true }: AgenticIdeViewProps) {maxTerminals={maxTerminals}suggestedNames={suggested}workspaceWidthPx={shellWidth}- workspaceHeightPx={Math.max(0, shellHeight - WORKSPACE_GRID_CHROME_PX)}onCount={chooseCount}planned={planned}onPlanned={setPlanned}