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): keep the whole workspace on one screen, however many panes are open

rubenluetke10-beep3db8ca74af5a
diff --git a/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.test.tsx b/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.test.tsx
index f97b305818..04e175aea1 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.test.tsx
@@ -497,35 +497,38 @@ describe("pane actions", () => {
});
});
-describe("grid layout", () => {
- /** The inline style of a pane's cell, as written (jsdom keeps it verbatim). */
- function cellStyle(name: string): string {
- return screen.getByTestId(`pane-cell-${name}`).getAttribute("style") ?? "";
- }
+/** The inline style of a pane's cell, as written (jsdom keeps it verbatim). */
+function cellStyle(name: string): string {
+ return screen.getByTestId(`pane-cell-${name}`).getAttribute("style") ?? "";
+}
- /**
- * A pane's rectangle, as the four percentages it was positioned with.
- *
- * Panes are placed by FRACTION now rather than by grid track, because one CSS
- * grid shares `grid-template-columns` across all of its rows — so two bands
- * could never have had different column widths, and every pane in a band was
- * stuck the same size as its neighbours.
- */
- function box(name: string): { left: number; top: number; width: number; height: number } {
- const style = cellStyle(name);
- const read = (property: string) => {
- const match = new RegExp(`${property}: (?:calc\\()?([-\\d.]+)%`).exec(style);
- if (!match) throw new Error(`${name} has no ${property}: ${style}`);
- return Number(match[1]);
- };
- return {
- left: read("left"),
- top: read("top"),
- width: read("width"),
- height: read("height"),
- };
- }
+/**
+ * A pane's rectangle, as the four percentages it was positioned with.
+ *
+ * Panes are placed by FRACTION now rather than by grid track, because one CSS
+ * grid shares `grid-template-columns` across all of its rows — so two bands
+ * could never have had different column widths, and every pane in a band was
+ * stuck the same size as its neighbours.
+ *
+ * Percentages of the WORKSPACE, which is the window — so these numbers are also
+ * the proof that a workspace never grows past what is on screen.
+ */
+function box(name: string): { left: number; top: number; width: number; height: number } {
+ const style = cellStyle(name);
+ const read = (property: string) => {
+ const match = new RegExp(`${property}: (?:calc\\()?([-\\d.]+)%`).exec(style);
+ if (!match) throw new Error(`${name} has no ${property}: ${style}`);
+ return Number(match[1]);
+ };
+ return {
+ left: read("left"),
+ top: read("top"),
+ width: read("width"),
+ height: read("height"),
+ };
+}
+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(box("Mika")).toMatchObject({ left: 0, top: 0, width: 25, height: 100 });
@@ -587,8 +590,7 @@ describe("grid layout", () => {
// Reported 2026-08-03: past a width-derived ceiling the extra columns used
// to start a second line — which paid for them with the height of every
// pane already open, and moved a pane the user was reading. Twelve columns
- // are twelve columns now; the workspace is wider than the window and the
- // grid scrolls sideways.
+ // are twelve columns now, sharing the one window between them.
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, height: 100 });
@@ -608,10 +610,10 @@ describe("grid layout", () => {
// Without this the pane would stay in its one-twelfth rectangle while the
// rest of the workspace is blank.
expect(cellStyle("T3")).toContain("inset: 0");
- // ...and the surface it fills is exactly the window, not the whole
- // workspace. A maximized pane taller than the visible area made the
- // terminal fit itself to rows below the clip — which is where the CLI keeps
- // its prompt box.
+ // ...and the surface it fills is exactly the window — which is now true of
+ // every pane, maximized or not. A maximized pane taller than the visible
+ // area made the terminal fit itself to rows below the clip, which is where
+ // the CLI keeps its prompt box.
expect(screen.getByTestId("agentic-grid").className).toContain("overflow-hidden");
expect(screen.getByTestId("agentic-grid-canvas").style.height).toBe("");
// Nothing to divide while one pane covers the others.
@@ -1771,7 +1773,14 @@ describe("resizing the workspace", () => {
});
});
-describe("a workspace with far more panes than the window fits", () => {
+/**
+ * The standing rule for this screen, reported 2026-08-04: the workspace is ONE
+ * screenful, always. Opening a seventh terminal used to widen the canvas past
+ * the window, so the maintainer had to scroll sideways to see the pane they had
+ * just opened — and watching eight agents at once meant scrolling between them.
+ * Panes get smaller instead.
+ */
+describe("a workspace with far more panes than the window comfortably fits", () => {
/** Many panes, one per column, the way a big fan-out opens them. */
function manyPanes(count: number) {
return sessionWith(
@@ -1779,34 +1788,36 @@ describe("a workspace with far more panes than the window fits", () => {
);
}
- it("keeps every pane readable instead of sharing the height N ways", () => {
- // The failure this guards: height 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.
- //
- // A column four panes deep is drawn 4 × 240 px tall however short the
- // window is, and the workspace scrolls down to the rest.
+ it("divides the window's HEIGHT between a deep column instead of growing past it", () => {
+ // The canvas used to be drawn 4 × 240 px tall for a four-deep column, and
+ // the grid scrolled down to the rest.
renderGrid(
sessionWith(
Array.from({ length: 4 }, (_, i) => [`T${i}`, 0, i] as [string, number, number]),
),
);
- expect(screen.getByTestId("agentic-grid-canvas").style.height).toBe("960px");
+ const canvas = screen.getByTestId("agentic-grid-canvas");
+ expect(canvas.style.height).toBe("");
+ expect(canvas.className).toContain("h-full");
+ // Four panes, four quarters, the last one ending exactly at the bottom.
+ expect(box("T3")).toMatchObject({ top: 75, height: 25 });
});
- it("keeps every pane readable instead of sharing the WIDTH N ways", () => {
- // The 2026-08-03 half of the same rule. Forty columns used to wrap into
- // four lines of ten — which fixed the width by taking three quarters of
- // every pane's height, and moved panes the user was reading. Now the
- // workspace is drawn 40 × 380 px wide and scrolls sideways instead.
+ it("divides the window's WIDTH between forty columns instead of growing past it", () => {
+ // The 2026-08-03 half of the same rule, which used to draw the canvas
+ // 40 × 380 px wide and scroll sideways.
renderGrid(manyPanes(40));
- expect(screen.getByTestId("agentic-grid-canvas").style.width).toBe("15200px");
+ const canvas = screen.getByTestId("agentic-grid-canvas");
+ expect(canvas.style.width).toBe("");
+ expect(canvas.className).toContain("w-full");
+ expect(box("T39").left).toBeCloseTo(97.5, 5);
});
- it("scrolls on either axis once the panes stop fitting, rather than squeezing them", () => {
+ it("never scrolls on either axis, however many panes are open", () => {
renderGrid(manyPanes(40));
- expect(screen.getByTestId("agentic-grid").className).toContain("overflow-auto");
+ const grid = screen.getByTestId("agentic-grid").className;
+ expect(grid).toContain("overflow-hidden");
+ expect(grid).not.toContain("overflow-auto");
});
it("renders a pane for every one of a hundred terminals", () => {
@@ -2176,13 +2187,12 @@ describe("the workspace header row", () => {
/**
* Panes arrive from outside this grid — spoken across the room, or from the
- * CLI — so nothing draws the user's eye to the change, and a workspace taller
- * than its viewport puts the new pane below the fold entirely. Reported
- * 2026-07-28 as terminals that "just don't load": they had loaded, off-screen
- * and unannounced.
+ * CLI — so nothing draws the user's eye to the change. Reported 2026-07-28 as
+ * terminals that "just don't load": they had loaded, unannounced (and, back
+ * when a workspace could be taller than its viewport, off screen as well).
*/
describe("panes that appear from outside the grid", () => {
- it("scrolls the newest pane into view and marks what just arrived", () => {
+ it("marks what just arrived, without moving the workspace under the user", () => {
const scrollIntoView = vi.fn();
Object.defineProperty(HTMLElement.prototype, "scrollIntoView", {
configurable: true,
@@ -2208,9 +2218,6 @@ describe("panes that appear from outside the grid", () => {
),
);
- // Nothing was announced on mount: a restored workspace's panes are not news.
- expect(scrollIntoView).not.toHaveBeenCalled();
-
view.rerender(
grid(
sessionWith([
@@ -2222,7 +2229,10 @@ describe("panes that appear from outside the grid", () => {
),
);
- expect(scrollIntoView).toHaveBeenCalledTimes(1);
+ // Nothing is scrolled to any more: the workspace is one screenful, so the
+ // new pane is already in view — and the only scroller such a call could
+ // still find is the app's own, which would move the whole section.
+ expect(scrollIntoView).not.toHaveBeenCalled();
// The panes that arrived wear a ring; the ones that were already there
// must not, or "what is new" says nothing at all.
expect(screen.getByTestId("pane-cell-T4").className).toContain("ring-2");
diff --git a/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.tsx b/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.tsx
index 43650f419d..6bca020eaa 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.tsx
@@ -46,11 +46,6 @@ import { AgentMark } from "./AgentMark";
import { PaneActivityPill } from "./PaneActivityPill";
import { AgentPickerMenu, offersAgentChoice, type SplitAgentChoice } from "./AgentPicker";
import type { TerminalAppearance } from "./terminalThemes";
-import {
- GRID_HORIZONTAL_PADDING_PX,
- MIN_PANE_HEIGHT_PX,
- workspaceWidthFor,
-} from "./layout";
import {
paneArrangement,
paneLayout,
@@ -856,38 +851,29 @@ export function AgenticGrid({
// Where each pane sits in the one grid below — coordinates, not nested
// lists, so a layout change never re-parents a pane (see ./layout).
/*
- * How big the workspace's VISIBLE area is — the grid's content box, padding
- * excluded on both axes.
+ * The grid is the window, and the workspace is exactly the grid.
*
- * Neither number decides the arrangement; the panes do. Both are the size a
- * percentage resolves against, and both carry a floor (`canvasWidth` and
- * `canvasHeight` below): once the columns would fall under
- * `MIN_PANE_WIDTH_PX` or the stacks under `MIN_PANE_HEIGHT_PX`, the canvas
- * grows past this box and the grid scrolls rather than shrinking panes
- * further.
+ * Its SIZE is nobody's business here any more: the canvas below fills this
+ * element on both axes, so every pane's percentage resolves against the
+ * visible area and a workspace of twenty panes is twenty smaller panes rather
+ * than a wall you scroll along. The one thing that still needs pixels —
+ * turning a seam drag into weights — reads the canvas at the moment of the
+ * gesture.
*
- * Which of the two widths this holds matters, and getting it wrong was a real
- * defect back when the column COUNT came from it: `contentRect.width` already
- * excludes this element's padding, and a helper that subtracted it a second
- * time laid the grid out narrower than it is. The seed value has to agree —
- * `clientWidth` INCLUDES padding, hence the subtraction in `fallback`.
+ * What survives is the one BOOLEAN the panes need: has this element been laid
+ * out at all? A terminal opened during the first, sizeless pass attaches its
+ * PTY at one size and is moved to another while its replay is still being
+ * parsed (see `geometryReady` in ./AgenticTerminal), which is a real garbled
+ * pane rather than a cosmetic flicker.
*/
const gridRef = useRef<HTMLDivElement | null>(null);
- const [gridWidth, setGridWidth] = useState(0);
- const [gridHeight, setGridHeight] = useState(0);
+ const [gridMeasured, setGridMeasured] = useState(false);
useEffect(() => {
const node = gridRef.current;
if (!node) return;
- const fallback = () => Math.max(0, node.clientWidth - GRID_HORIZONTAL_PADDING_PX);
- setGridWidth(fallback());
- setGridHeight(node.clientHeight);
- const observer = new ResizeObserver((entries) => {
- const width = entries[0]?.contentRect.width ?? fallback();
- // Round to a step so a one-pixel drift cannot churn the layout (and with
- // it every pane's resize) on window animations.
- setGridWidth(Math.round(width / 16) * 16);
- setGridHeight(Math.round(entries[0]?.contentRect.height ?? node.clientHeight));
- });
+ const measured = () => node.clientWidth > 0 && node.clientHeight > 0;
+ setGridMeasured(measured());
+ const observer = new ResizeObserver(() => setGridMeasured(measured()));
observer.observe(node);
return () => observer.disconnect();
}, []);
@@ -1019,12 +1005,16 @@ export function AgenticGrid({
const sizes = usePaneWeights(
session.id,
+ // Measured at the moment of the drag rather than kept in state: the canvas
+ // IS the visible workspace now, so its live size is the only truth a
+ // pixels-to-weights conversion needs. A canvas that is not there yet
+ // reports 0, which `dragSeam` treats as "no room, change nothing".
useCallback(
() => ({
- width: canvasRef.current?.clientWidth ?? gridWidth,
- height: canvasRef.current?.clientHeight ?? gridHeight,
+ width: canvasRef.current?.clientWidth ?? 0,
+ height: canvasRef.current?.clientHeight ?? 0,
}),
- [gridWidth, gridHeight],
+ [],
),
paintDraggedLayout,
);
@@ -1137,28 +1127,6 @@ export function AgenticGrid({
*/
const layoutBusy = sizes.dragging !== null || composer.isResizing;
- /*
- * How big the workspace is DRAWN, which is not always how big it looks.
- *
- * Panes take a percentage of these two numbers, so they are also the floor
- * that keeps them readable. Once the columns cannot fit at
- * `MIN_PANE_WIDTH_PX` each, or the tallest stack at `MIN_PANE_HEIGHT_PX` per
- * pane, the canvas grows past the window and the workspace scrolls — rather
- * than shrinking every pane further, or (as it did until 2026-08-03)
- * rearranging the workspace behind the user's back to make the new pane fit.
- * A workspace bigger than its window is an ordinary thing; a workspace that
- * re-deals itself when you open a terminal is not.
- *
- * A maximized pane is exactly the window on both axes, so it can never end up
- * larger than the area it is being read in.
- */
- const canvasWidth =
- maximized !== null ? gridWidth : workspaceWidthFor(layout.columns, gridWidth);
- const canvasHeight =
- maximized !== null
- ? gridHeight
- : Math.max(gridHeight, layout.minHeightUnits * MIN_PANE_HEIGHT_PX);
-
const atLimit = session.terminals.length >= maxTerminals;
/*
@@ -1385,18 +1353,12 @@ export function AgenticGrid({
const rail = chatRailRef.current;
if (rail) rail.scrollTop = rail.scrollHeight;
});
- } else {
- // The LAST one: panes are appended, so the newest is the one whose arrival
- // could have pushed the grid past its viewport — SIDEWAYS as often as
- // down, now that a workspace grows to the right instead of wrapping, so
- // both axes are named rather than left to the browser's default.
- // Probed rather than assumed: `scrollIntoView` is absent in jsdom and in
- // some embedded WebViews.
- const newest = paneNodes.current.get(fresh[fresh.length - 1]);
- if (typeof newest?.scrollIntoView === "function") {
- newest.scrollIntoView({ block: "nearest", inline: "nearest", behavior: "auto" });
- }
}
+ // In the grid there is nothing to scroll to: the workspace is one screenful
+ // by rule, so a pane that just opened is already in view and the ring below
+ // is the whole announcement. This used to call `scrollIntoView` on the
+ // newest pane, which was the honest answer while a workspace could be wider
+ // or taller than its window.
const timer = window.setTimeout(() => setJustOpened(new Set()), 2600);
return () => {
if (frame !== undefined) cancelAnimationFrame(frame);
@@ -1407,12 +1369,12 @@ export function AgenticGrid({
/*
* "Jump to pane" — from the header bell, or from the view after a tab switch.
*
- * Three things, in this order: the pane is maximized, it is scrolled to, and
- * it wears the same arrival ring a freshly opened pane does. Maximizing is
- * what the user asked for — a notification about a pane is a request to READ
- * that pane, and reading a postcard-sized terminal in a grid of twelve is the
- * problem, not the answer. The ring covers the case where the pane was
- * already the maximized one and nothing visibly moved.
+ * Two things: the pane is maximized, and it wears the same arrival ring a
+ * freshly opened pane does. Maximizing is what the user asked for — a
+ * notification about a pane is a request to READ that pane, and reading a
+ * postcard-sized terminal in a grid of twelve is the problem, not the answer.
+ * The ring covers the case where the pane was already the maximized one and
+ * nothing visibly moved.
*
* Silently ignored for a pane that is no longer here: an entry outlives the
* terminal it came from by up to one poll, and a stray maximize of "whatever
@@ -1440,12 +1402,6 @@ export function AgenticGrid({
if (chatView) setChatPane(wanted);
else setMaximized(wanted);
setJustOpened(new Set([wanted]));
- const node = paneNodes.current.get(wanted);
- // Probed rather than assumed — `scrollIntoView` is absent in jsdom and in
- // some embedded WebViews, and a maximized pane fills the grid anyway.
- if (typeof node?.scrollIntoView === "function") {
- node.scrollIntoView({ block: "nearest", inline: "nearest", behavior: "auto" });
- }
const timer = window.setTimeout(() => setJustOpened(new Set()), 2600);
return () => window.clearTimeout(timer);
// `session.terminals` deliberately absent: this fires on a JUMP, not every
@@ -2172,14 +2128,15 @@ export function AgenticGrid({
ref={gridRef}
data-testid="agentic-grid"
className={cn(
- "relative min-h-0 min-w-0 flex-1",
- // Scrolls on EITHER axis, and only once the panes would be squeezed
- // below a readable size — sideways past `MIN_PANE_WIDTH_PX` per
- // column, down past `MIN_PANE_HEIGHT_PX` per stacked pane. With a
- // workspace that fits, this is `overflow-hidden` behaviour and
- // nothing moves. The chat stage never scrolls — its one pane fills
- // it, and the terminal scrolls inside itself.
- chatView || maximized !== null ? "overflow-hidden" : "overflow-auto scrollbar-jarvis",
+ // NEVER scrolls, on either axis. The workspace is one screenful by
+ // rule (maintainer, 2026-08-04): opening a pane makes every pane a
+ // little smaller, and finding the seventh terminal is never a
+ // matter of scrolling sideways to it. `overflow-hidden` is the
+ // whole enforcement — the canvas below is sized to this element, so
+ // there is nothing to scroll to in the first place, and this only
+ // guarantees that a rounding error or a pane's own overflow cannot
+ // quietly hand the grid a scrollbar back.
+ "relative min-h-0 min-w-0 flex-1 overflow-hidden",
// A drag across the grid would otherwise sweep a text selection over
// every header and label it crosses.
arrange.held !== null && "select-none",
@@ -2189,30 +2146,18 @@ export function AgenticGrid({
style={{ padding: chatView ? 12 : GRID_GAP_PX }}
>
{/*
- The surface the fractions resolve against.
+ The surface the fractions resolve against — always exactly the window.
- Separate from the scroller because the two have different sizes on
- purpose: the scroller is the window, this is the workspace, and a
- workspace whose panes would fall below `MIN_PANE_WIDTH_PX` or
- `MIN_PANE_HEIGHT_PX` grows past the window on that axis and scrolls
- rather than shrinking them further.
+ It kept its own size until 2026-08-04, growing past the grid so the
+ panes could stay above a minimum and the workspace scrolled to reach
+ them. That is the behaviour this element now exists to prevent: a pane
+ is a share of what is on screen, so the twelfth terminal makes the other
+ eleven smaller and stays in the same view as them.
*/}
<div
ref={canvasRef}
data-testid="agentic-grid-canvas"
- className={cn(
- "relative",
- // The chat stage fills everything between the rail and the voice
- // column. It started as a centred, capped column; the maintainer
- // wants the terminal at full size (2026-07-31), and the calm framing
- // comes from the rail and the card border, not from margins.
- chatView && "h-full w-full",
- )}
- style={
- chatView
- ? undefined
- : { width: canvasWidth || "100%", height: canvasHeight || undefined }
- }
+ className="relative h-full w-full"
>
{session.terminals.map((term, index) => {
const box = layout.boxes[index];
@@ -2271,7 +2216,7 @@ export function AgenticGrid({
promptCount={term.prompts_sent}
appearance={appearance}
fontSize={fontSize}
- geometryReady={gridWidth > 0 && gridHeight > 0}
+ geometryReady={gridMeasured}
focused={target === term.name}
active={!chatView || onStage}
maximized={isMaximized}
diff --git a/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.tsx b/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.tsx
index ad12b89357..80b9b568eb 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.tsx
@@ -867,13 +867,18 @@ export function AgenticTerminal({
/**
* A prompt just landed in this pane — make that impossible to miss.
*
- * Three things, and the order matters. The pane is un-parked FIRST:
+ * Two things, and the order matters. The pane is un-parked FIRST:
* whatever the observer believes, output held back now is output the
* user will not see while they are looking straight at the receipt
- * telling them it arrived. Then it is scrolled into the viewport,
- * because a receipt drawn on a pane two screens down is no better than
- * no receipt. Only then does it flash, which is the part that is merely
- * nice.
+ * telling them it arrived. Only then does it flash, which is the part
+ * that is merely nice.
+ *
+ * It used to scroll the pane into the viewport as well, because a
+ * receipt drawn on a pane two screens down is no better than no
+ * receipt. There is no such pane any more — the workspace is one
+ * screenful by rule (see the header of ./layout) — and the call would
+ * now find the app's own scroller instead and move the whole section
+ * under the user.
*
* None of this depends on the agent echoing anything, which is the
* whole point: this path is what remains true when the terminal is a
@@ -885,15 +890,6 @@ export function AgenticTerminal({
setReceipt(delivery);
setJustDelivered(true);
window.setTimeout(() => setJustDelivered(false), 2_000);
- if (activeRef.current) {
- try {
- container.scrollIntoView({ block: "nearest", behavior: "auto" });
- } catch {
- // Older engines take no options object; position is a nicety and
- // the receipt is legible wherever the pane happens to sit.
- container.scrollIntoView();
- }
- }
},
onReady: ({ resumed, reattached, lastPrompt }) => {
troubleShown = null;
@@ -1679,8 +1675,8 @@ function PaneHeader({
"flex h-5 w-5 shrink-0 items-center justify-center rounded transition-opacity",
"opacity-0 focus-visible:opacity-100 group-hover/header:opacity-100",
light
- ? "text-[#6b6b73] hover:bg-black/10"
- : "text-[#9a9aa5] hover:bg-white/10",
+ ? "text-[#6b6b73] hover:bg-scrim/10"
+ : "text-[#9a9aa5] hover:bg-sheen/10",
)}
>
<Pencil className="h-3 w-3" />
@@ -1869,8 +1865,8 @@ function PaneAction({
danger
? "hover:bg-destructive/20 hover:text-destructive"
: light
- ? "hover:bg-black/10"
- : "hover:bg-white/10",
+ ? "hover:bg-scrim/10"
+ : "hover:bg-sheen/10",
)}
style={{ color: light ? "#55555e" : "#a8a8b2" }}
>
diff --git a/jarvis/ui/web/frontend/src/components/agentic/WorkspaceShape.tsx b/jarvis/ui/web/frontend/src/components/agentic/WorkspaceShape.tsx
index 602ae4f489..2427122b56 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/WorkspaceShape.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/WorkspaceShape.tsx
@@ -36,12 +36,7 @@ import { useEffect, useMemo, useRef, useState } from "react";
import { Minus, Plus } from "lucide-react";
import { cn } from "@/lib/utils";
import { IconButton } from "./controls";
-import {
- columnsWithoutScrolling,
- paneGrid,
- widthForAllVisible,
- wizardPanes,
-} from "./layout";
+import { paneGrid, paneWidthAt, panesAreComfortable, wizardPanes } from "./layout";
/**
* Counts that get a labelled tick on the track.
@@ -112,35 +107,16 @@ export function WorkspaceShape({
workspaceWidthPx,
}: WorkspaceShapeProps) {
const grid = useMemo(() => paneGrid(wizardPanes(count)), [count]);
- /*
- * How many of those columns the window shows at once.
- *
- * The stage draws all of them — the workspace really is `count` columns wide
- * whatever the window does — and the readout says how many are on screen
- * before it scrolls. Two different questions since 2026-08-03, when the
- * workspace stopped wrapping: the ARRANGEMENT no longer depends on the window
- * at all, only the view onto it does.
- */
- const visible = useMemo(
- () => columnsWithoutScrolling(workspaceWidthPx),
- [workspaceWidthPx],
- );
return (
<div className="flex flex-col gap-3 p-3">
<WorkspaceStage
columns={grid.columns}
- visible={visible}
rows={grid.rows}
count={count}
names={names}
/>
- <Readout
- columns={grid.columns}
- visible={visible}
- count={count}
- workspaceWidthPx={workspaceWidthPx}
- />
+ <Readout columns={grid.columns} workspaceWidthPx={workspaceWidthPx} />
</div>
);
}
@@ -307,21 +283,20 @@ export function CountTrack({
* — over the panes the backend will actually create (`wizardPanes`). The two
* cannot drift apart without the running grid changing too.
*
- * The stage is the WINDOW, not the workspace. Past `visible` columns the grid
- * inside it is drawn wider than the frame and the remainder is clipped at the
- * right edge — which is exactly what the running workspace does, and says it
- * more plainly than any sentence could: this many fit, the rest are a scroll
- * away.
+ * The stage is the whole workspace AND the whole window, because those are the
+ * same thing now: every column is drawn inside the frame, however many there
+ * are, and more terminals make each one narrower. It used to draw the grid
+ * wider than the frame and clip the remainder, which was the honest picture of
+ * a workspace you scrolled sideways — and is exactly what the maintainer asked
+ * to be rid of on 2026-08-04.
*/
function WorkspaceStage({
columns,
- visible,
rows,
count,
names,
}: {
columns: number;
- visible: number;
rows: number;
count: number;
names: string[];
@@ -352,9 +327,6 @@ function WorkspaceStage({
const safeColumns = Math.max(1, columns);
const safeRows = Math.max(1, rows);
- // How much wider than the frame the workspace is drawn. 1 while everything
- // fits, so the common case is an ordinary full-width grid.
- const overshoot = Math.max(1, safeColumns / Math.max(1, visible));
const paneWidth = size.width > 0 ? size.width / safeColumns : 0;
const paneHeight = size.height > 0 ? size.height / safeRows : 0;
// Panes are laid out as a grid of equal cells, so one pane's detail level is
@@ -384,9 +356,8 @@ function WorkspaceStage({
<div
ref={stageRef}
data-testid="workspace-stage-grid"
- className="grid h-full gap-1 p-1"
+ className="grid h-full w-full gap-1 p-1"
style={{
- width: `${overshoot * 100}%`,
gridTemplateColumns: `repeat(${safeColumns}, minmax(0, 1fr))`,
gridTemplateRows: `repeat(${safeRows}, minmax(0, 1fr))`,
}}
@@ -453,37 +424,39 @@ function StagePane({
}
/**
- * What the stage shows, in words, together with what it depends on.
+ * What the stage shows, in words, together with what it costs.
*
* The second half is the part that matters. An arrangement stated without its
- * condition is a bug this step actually had: correct on screen, wrong five
- * seconds later after a maximise, with nothing to explain the difference.
+ * consequence is a bug this step actually had: correct on screen, and silent
+ * about the thing the user would notice a minute later.
*/
function Readout({
columns,
- visible,
- count,
workspaceWidthPx,
}: {
columns: number;
- visible: number;
- count: number;
workspaceWidthPx: number;
}) {
- const allVisibleAt = widthForAllVisible(count);
- const scrolls = columns > visible;
+ // By COLUMNS rather than the raw count, so the sentence can never describe a
+ // different workspace from the stage above it.
+ const paneWidth = paneWidthAt(columns, workspaceWidthPx);
+ const comfortable = panesAreComfortable(columns, workspaceWidthPx);
+ /*
+ * There is no longer an "and the rest are off screen" case to warn about —
+ * every pane is on screen, always. What is left to say is the price of that
+ * promise, which the user pays in pane WIDTH, so the readout quotes it before
+ * they commit to the count rather than after.
+ */
let condition: string;
- if (!scrolls) {
- condition = "All side by side — this window is wide enough.";
- } else if (allVisibleAt !== null) {
- condition = `All side by side, ${visible} of them on screen — scroll sideways for the rest. From ${formatPx(
- allVisibleAt,
- )} px wide they all fit at once; this window is ${formatPx(
- Math.round(workspaceWidthPx),
- )} px.`;
+ if (paneWidth === 0) {
+ condition = "All on one screen.";
+ } else if (comfortable) {
+ condition = `All on one screen, about ${formatPx(paneWidth)} px each.`;
} else {
- condition = "All side by side — scroll sideways for the rest.";
+ condition = `All on one screen, about ${formatPx(
+ paneWidth,
+ )} px each — narrow for an agent's output. Maximize a pane to read it full size.`;
}
return (
diff --git a/jarvis/ui/web/frontend/src/components/agentic/layout.test.ts b/jarvis/ui/web/frontend/src/components/agentic/layout.test.ts
index cbd686d23c..2a0d84c31f 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/layout.test.ts
+++ b/jarvis/ui/web/frontend/src/components/agentic/layout.test.ts
@@ -1,85 +1,69 @@
import { describe, expect, it } from "vitest";
import {
+ COMFORTABLE_PANE_WIDTH_PX,
GRID_HORIZONTAL_PADDING_PX,
- MIN_PANE_WIDTH_PX,
- columnsWithoutScrolling,
paneGrid,
- widthForAllVisible,
+ paneWidthAt,
+ panesAreComfortable,
wizardPanes,
- workspaceWidthFor,
} from "./layout";
/*
- * The thresholds are expressed as "content width + the grid's own padding"
- * rather than as the literal pixel numbers they came to.
+ * The widths are expressed as "content width + the grid's own padding" rather
+ * than as the literal pixel numbers they come to.
*
* Those literals were what made this file break when the grid was tightened
* from 12 px of padding a side to 4 — a purely visual change that has no
* business moving a threshold, and did not: only the OUTER width at which it is
* crossed moved, by exactly the padding.
*/
-const FOUR_COLUMNS_AT = 4 * MIN_PANE_WIDTH_PX;
-const SIX_COLUMNS_AT = 6 * MIN_PANE_WIDTH_PX;
-
-describe("workspaceWidthFor", () => {
- it("is exactly the window while the columns are readable in it", () => {
- // Nothing scrolls in the ordinary case: four columns in a window wide
- // enough for six are four columns of a quarter of the window each.
- expect(workspaceWidthFor(4, SIX_COLUMNS_AT)).toBe(SIX_COLUMNS_AT);
- });
-
- it("grows past the window rather than squeezing the columns", () => {
- // The 2026-08-03 report: a sixth terminal on a five-column window used to
- // wrap onto a second line, which halved the five panes the user was already
- // reading. Now the workspace is six columns wide and the grid scrolls.
- const window = 5 * MIN_PANE_WIDTH_PX;
- expect(workspaceWidthFor(6, window)).toBe(6 * MIN_PANE_WIDTH_PX);
- });
-
- it("never lets a column fall below the readable floor, at any count", () => {
- // Measured against a real agent on 2026-07-25: below ~380 px Claude Code
- // truncates every line and breaks single words across rows.
- for (const columns of [1, 2, 6, 7, 12, 40, 100]) {
- const width = workspaceWidthFor(columns, 1440);
- expect(width / columns).toBeGreaterThanOrEqual(MIN_PANE_WIDTH_PX);
- }
- });
+const FOUR_COMFORTABLE_AT = 4 * COMFORTABLE_PANE_WIDTH_PX;
- it("is the window itself for an empty workspace", () => {
- expect(workspaceWidthFor(0, 1440)).toBe(1440);
+describe("paneWidthAt", () => {
+ it("divides the window between the columns, whatever the count", () => {
+ // The rule this whole module now serves (maintainer, 2026-08-04): the
+ // workspace is always one screenful, so a pane is a SHARE of the window and
+ // never a fixed size the window has to grow to accommodate.
+ const outer = FOUR_COMFORTABLE_AT + GRID_HORIZONTAL_PADDING_PX;
+ expect(paneWidthAt(4, outer)).toBe(COMFORTABLE_PANE_WIDTH_PX);
+ expect(paneWidthAt(8, outer)).toBe(COMFORTABLE_PANE_WIDTH_PX / 2);
+ expect(paneWidthAt(40, outer)).toBe(COMFORTABLE_PANE_WIDTH_PX / 10);
});
-});
-describe("columnsWithoutScrolling", () => {
- it("uses the grid content width on both sides of the four-column threshold", () => {
- const outer = FOUR_COLUMNS_AT + GRID_HORIZONTAL_PADDING_PX;
- expect(columnsWithoutScrolling(outer - 1)).toBe(3);
- expect(columnsWithoutScrolling(outer)).toBe(4);
+ it("answers for the grid's content width, not the element around it", () => {
+ // The wizard measures an unpadded element; the running grid pads itself.
+ // A helper that ignored that would quote a width the workspace never has.
+ expect(paneWidthAt(1, 1000)).toBe(1000 - GRID_HORIZONTAL_PADDING_PX);
});
- it("uses the grid content width on both sides of the six-column threshold", () => {
- const outer = SIX_COLUMNS_AT + GRID_HORIZONTAL_PADDING_PX;
- expect(columnsWithoutScrolling(outer - 1)).toBe(5);
- expect(columnsWithoutScrolling(outer)).toBe(6);
+ it("has nothing to divide for an empty or unmeasured workspace", () => {
+ expect(paneWidthAt(0, 1440)).toBe(0);
+ expect(paneWidthAt(4, 0)).toBe(0);
+ expect(paneWidthAt(4, Number.NaN)).toBe(0);
});
+});
- it("gives a laptop fewer visible columns than a large display", () => {
- expect(columnsWithoutScrolling(1440)).toBeLessThan(
- columnsWithoutScrolling(2560),
- );
+describe("panesAreComfortable", () => {
+ it("turns on either side of the readable width, measured against a real agent", () => {
+ // 2026-07-25, against Claude Code: below ~380 px it truncates every line and
+ // breaks single words across rows ("Clau/de/Max"). That is now ADVICE the
+ // wizard gives before anything opens — it no longer moves a single pixel.
+ const outer = FOUR_COMFORTABLE_AT + GRID_HORIZONTAL_PADDING_PX;
+ expect(panesAreComfortable(4, outer)).toBe(true);
+ expect(panesAreComfortable(5, outer)).toBe(false);
});
- it("never returns zero — one cramped column still beats none", () => {
- expect(columnsWithoutScrolling(120)).toBe(1);
- expect(columnsWithoutScrolling(0)).toBe(1);
- expect(columnsWithoutScrolling(Number.NaN)).toBe(1);
+ it("is about the pane, not the count — the same eight differ by display", () => {
+ const laptop = 1440;
+ const wall = 8 * COMFORTABLE_PANE_WIDTH_PX + GRID_HORIZONTAL_PADDING_PX;
+ expect(panesAreComfortable(8, laptop)).toBe(false);
+ expect(panesAreComfortable(8, wall)).toBe(true);
});
- it("has no ceiling — a wide enough window shows however many there are", () => {
- // The old capacity helper stopped at ten whatever the display. A 4K wall
- // really does fit more than ten readable columns, and nothing about the
- // count is capped any more.
- expect(columnsWithoutScrolling(100_000)).toBeGreaterThan(10);
+ it("says nothing rather than warning while the container is unmeasured", () => {
+ // A first paint reports 0. Rendering that as "these panes will be cramped"
+ // means every user is shouted at once, for a reading that was never taken.
+ expect(panesAreComfortable(12, 0)).toBe(true);
});
});
@@ -110,31 +94,6 @@ describe("wizardPanes", () => {
});
});
-describe("widthForAllVisible", () => {
- it("names the width at which a count stops needing a sideways scroll", () => {
- // What the readout tells the user, so a workspace that scrolls is never a
- // surprise: eight panes need 8 × 380 px plus the grid padding.
- expect(widthForAllVisible(8)).toBe(
- 8 * MIN_PANE_WIDTH_PX + GRID_HORIZONTAL_PADDING_PX,
- );
- // And it agrees with the helper the wizard measures through, rather than
- // being a second opinion about the same threshold.
- expect(columnsWithoutScrolling(widthForAllVisible(8) as number)).toBe(8);
- });
-
- it("has an answer for every count — no width is ever 'not enough'", () => {
- // The old helper returned null past ten, where the wrap was unavoidable.
- // Nothing wraps now, so every count has a width that shows all of it.
- expect(widthForAllVisible(24)).toBe(
- 24 * MIN_PANE_WIDTH_PX + GRID_HORIZONTAL_PADDING_PX,
- );
- });
-
- it("has nothing to offer when one column is the whole workspace", () => {
- expect(widthForAllVisible(1)).toBeNull();
- });
-});
-
describe("paneGrid", () => {
const pane = (column: number, slot: number) => ({ column, slot });
diff --git a/jarvis/ui/web/frontend/src/components/agentic/layout.ts b/jarvis/ui/web/frontend/src/components/agentic/layout.ts
index 70d1f63248..0778c8267a 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/layout.ts
+++ b/jarvis/ui/web/frontend/src/components/agentic/layout.ts
@@ -35,106 +35,77 @@
* only ever a change of numbers on each pane. Nothing is re-parented, so
* nothing remounts.
*
- * ## One line of columns, however many there are
+ * ## One line of columns, however many there are — and ALWAYS one screenful
*
* The workspace never wraps. Opening a column always puts it beside the last
* one, and a workspace of twenty columns is twenty columns across.
*
- * It used to wrap at the point where the panes would fall below
- * `MIN_PANE_WIDTH_PX` — six on a normal desktop — and that was the wrong
- * trade. Wrapping does not create room; it takes the height of every existing
- * pane to pay for the new one, so the sixth split silently halved the five
- * panes the user was already reading and dropped the new one onto a second
- * line. The arrangement the user built changed SHAPE because of a pane they
- * added at the end, which is exactly what a workspace must not do (reported
- * 2026-08-03).
- *
- * Readability is still a floor — it is just paid for the same way the vertical
- * one is. Below `MIN_PANE_WIDTH_PX` per column the workspace grows WIDER than
- * the window and scrolls sideways, the way it already grows taller and scrolls
- * down when the stacks get short (`MIN_PANE_HEIGHT_PX`). A workspace larger
- * than the window is an ordinary thing that every editor does; a workspace
- * that rearranges itself is not.
+ * It also never scrolls. The whole workspace is exactly the area it is given:
+ * open a pane and every pane gets a little smaller, on whichever axis the split
+ * was. That is the maintainer's standing rule for this screen (2026-08-04), and
+ * it settles the two failures that came before it:
+ *
+ * * **Wrapping** (until 2026-08-03) paid for a new pane with the HEIGHT of every
+ * existing one, so the sixth split silently halved the five panes the user was
+ * already reading and dropped the new one onto a second line. The arrangement
+ * changed SHAPE because of a pane added at the end.
+ * * **Scrolling** (its replacement) kept the shape and moved the panes off the
+ * screen instead — a seventh terminal was opened somewhere to the right, and
+ * watching eight agents meant scrolling between them. A wall of terminals you
+ * have to scroll is not a wall of terminals.
+ *
+ * So neither axis has a floor that grows the canvas any more. Readability is a
+ * thing the user manages themselves, with the two controls that already exist:
+ * open fewer panes, or maximize the one being read. `COMFORTABLE_PANE_WIDTH_PX`
+ * survives ONLY as the number the wizard's readout warns from — advice before
+ * anything opens, never a layout decision.
*/
/**
- * Narrowest a pane may get before its agent's output stops being readable.
+ * Below this a pane is cramped for an agent's output — ADVICE, not a floor.
*
* An agent TUI draws boxes, file trees and status rows; below roughly 45
* characters it truncates them and the pane becomes decoration. At the default
* 13 px monospace a character is ~7.8 px wide, so 45 characters plus the pane's
- * frame and padding lands near 380 px. Deliberately a floor on WIDTH rather than
- * a count, so the same rule holds on a laptop and on a 4K display.
- *
- * It is the width the workspace stops SHRINKING at, not a count it stops
- * growing at: past it the columns keep their width and the workspace scrolls
- * sideways. Measured against a real agent on 2026-07-25 — at ~18 characters
- * Claude Code truncates every line and breaks single words across rows
- * ("Clau/de/Max"), which is what this number exists to prevent.
- */
-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.
+ * frame and padding lands near 380 px. Measured against a real agent on
+ * 2026-07-25 — at ~18 characters Claude Code truncates every line and breaks
+ * single words across rows ("Clau/de/Max").
+ *
+ * Nothing lays out by it. The workspace is always one screenful (see the header
+ * above), so this number's only job is to let the wizard say "twelve panes on
+ * this window is about 130 px each, which is tight" BEFORE the user commits to
+ * twelve — the honest form of a warning, rather than a workspace that quietly
+ * grows a scrollbar.
*/
-export const MIN_PANE_HEIGHT_PX = 240;
+export const COMFORTABLE_PANE_WIDTH_PX = 380;
/**
* Horizontal padding of the rendered grid — 4 px on each side.
*
* It mirrors `GRID_GAP_PX` in AgenticGrid, and the two must not drift: the
- * column count is computed from the grid's CONTENT width, so a padding the
- * layout module does not know about makes the wizard's preview and the running
- * grid disagree about how many panes fit at a given window width.
+ * wizard estimates a pane's width from the grid's CONTENT width, so a padding
+ * the layout module does not know about makes the preview's advice slightly
+ * wrong about the workspace it is previewing.
*/
export const GRID_HORIZONTAL_PADDING_PX = 8;
/**
- * How wide the workspace has to be drawn to hold ``columns`` readable columns.
- *
- * The horizontal twin of the canvas height rule: normally the workspace is
- * exactly the width it was given and nothing scrolls, and once the columns
- * would be squeezed below `MIN_PANE_WIDTH_PX` it grows past the window instead
- * and the grid scrolls sideways.
- *
- * ``availableWidthPx`` is the grid's CONTENT width, so the return value is one
- * too — the caller's padding is already off both.
- */
-export function workspaceWidthFor(
- columns: number,
- availableWidthPx: number,
-): number {
- const wanted = Math.max(0, columns) * MIN_PANE_WIDTH_PX;
- return Math.max(availableWidthPx, wanted);
-}
-
-/**
- * How many columns are visible at ``containerWidthPx`` before it scrolls.
+ * How wide each of ``columns`` panes ends up at ``containerWidthPx``.
*
- * Nothing lays out by this — it is what the wizard's readout says out loud, so
- * someone picking twelve terminals on a laptop learns they are getting a
- * workspace they scroll rather than one that silently rearranged itself.
+ * The workspace is always exactly its window (see the header), so this is a
+ * plain division — and that is the point: it is the number the wizard's readout
+ * quotes, so "twelve terminals" is a decision made with its consequence in view
+ * rather than one discovered afterwards.
*
* Takes an OUTER width (the wizard measures an unpadded element) and subtracts
* the padding the grid will have, so it answers for the same physical window
- * the running grid does. Never 0: one cramped column still beats none.
+ * the running grid does. Never negative, and 0 for an empty workspace.
*/
-export function columnsWithoutScrolling(containerWidthPx: number): number {
+export function paneWidthAt(columns: number, containerWidthPx: number): number {
const content = Math.max(0, containerWidthPx - GRID_HORIZONTAL_PADDING_PX);
- if (!Number.isFinite(content) || content <= 0) return 1;
- return Math.max(1, Math.floor(content / MIN_PANE_WIDTH_PX));
+ const count = Math.max(0, Math.trunc(columns));
+ if (count === 0 || !Number.isFinite(content) || content <= 0) return 0;
+ return content / count;
}
/**
@@ -176,17 +147,21 @@ export function wizardPanes(count: number): Positioned[] {
}
/**
- * Window width at which ``count`` terminals are all visible at once.
+ * Is ``count`` panes comfortable on a window this wide, or merely possible?
*
- * The arrangement no longer depends on the window — `count` terminals are
- * `count` columns at every size — but how much of it you can SEE does, and the
- * preview says so rather than letting a workspace that scrolls come as a
- * surprise. Returns null when one column is the whole workspace and there is
- * nothing to scroll past.
+ * Every count fits — the workspace is always one screenful — so the only thing
+ * left to say is how much room each pane gets, and this is where that turns
+ * into a yes or no. Deliberately about the PANE rather than the count: the same
+ * eight terminals are roomy on a 4K display and cramped on a laptop.
*/
-export function widthForAllVisible(count: number): number | null {
- if (count <= 1) return null;
- return count * MIN_PANE_WIDTH_PX + GRID_HORIZONTAL_PADDING_PX;
+export function panesAreComfortable(
+ count: number,
+ containerWidthPx: number,
+): boolean {
+ const width = paneWidthAt(count, containerWidthPx);
+ // An unmeasured container says nothing yet — and "we have not measured" must
+ // not render as a warning, or the wizard opens shouting at every user once.
+ return width === 0 || width >= COMFORTABLE_PANE_WIDTH_PX;
}
/** Where one pane sits in the CSS grid. All values are 1-based, as CSS wants. */
diff --git a/jarvis/ui/web/frontend/src/components/agentic/layout.width.test.ts b/jarvis/ui/web/frontend/src/components/agentic/layout.width.test.ts
index 46facc0cd2..2d9f640fe3 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
@@ -1,49 +1,61 @@
import { describe, expect, it } from "vitest";
import {
- MIN_PANE_WIDTH_PX,
- columnsWithoutScrolling,
+ COMFORTABLE_PANE_WIDTH_PX,
+ GRID_HORIZONTAL_PADDING_PX,
paneGrid,
- workspaceWidthFor,
+ paneWidthAt,
+ panesAreComfortable,
+ wizardPanes,
} from "./layout";
/**
- * Readability is a floor on WIDTH, and the two reports that shaped it pull in
- * opposite directions.
+ * The workspace is ALWAYS one screenful — the rule, and the two failures it
+ * replaced.
*
* Reported 2026-07-25: eight terminals sharing one window left each pane about
- * 18 characters wide. Claude Code then truncates every line and breaks single
- * words across rows ("Clau/de/Max") — measured directly against a real agent.
+ * 18 characters wide, and Claude Code truncated every line.
*
- * Reported 2026-08-03: the answer to that, a wrap onto a second line, was
- * worse. It paid for the new pane with the HEIGHT of every existing one, so a
- * sixth terminal silently halved the five the user was reading and changed the
- * shape of a workspace they had arranged themselves.
+ * Reported 2026-08-03: the first answer to that — wrapping onto a second line —
+ * was worse. It paid for the new pane with the HEIGHT of every existing one, so
+ * a sixth terminal silently halved the five the user was reading.
*
- * So the floor stayed and the wrap went: past it the workspace is drawn wider
- * than the window and scrolls, exactly as it already grows taller and scrolls
- * down when the stacks get short.
+ * Reported 2026-08-04: the second answer — growing the canvas past the window
+ * and scrolling to the rest — was worse again. The seventh terminal was opened
+ * somewhere off to the right, and watching eight agents at once became a matter
+ * of scrolling between them. A wall of terminals you scroll is not a wall of
+ * terminals.
+ *
+ * So the panes shrink, and the readable width survives only as advice the
+ * wizard gives BEFORE the user commits to a count.
*/
-describe("the readable floor under every column", () => {
- it("holds at every window size and every count", () => {
+describe("the workspace never grows past its window", () => {
+ it("gives every pane a share of the window, at every size and count", () => {
for (const width of [800, 1280, 1440, 1920, 2560, 3840]) {
for (const columns of [1, 4, 8, 16, 60]) {
- const canvas = workspaceWidthFor(columns, width);
- expect(canvas / columns).toBeGreaterThanOrEqual(MIN_PANE_WIDTH_PX);
+ const content = width - GRID_HORIZONTAL_PADDING_PX;
+ // Every pane on screen, and the panes together are exactly the window:
+ // never wider (a scrollbar), never narrower (wasted room).
+ expect(paneWidthAt(columns, width) * columns).toBeCloseTo(content, 6);
}
}
});
- it("would have prevented the 2026-07-25 case, by scrolling rather than squeezing", () => {
- // The workspace in the report was ~2400 px wide with eight panes across.
- const canvas = workspaceWidthFor(8, 2400);
- expect(canvas).toBeGreaterThan(2400);
- expect(canvas / 8).toBeGreaterThanOrEqual(MIN_PANE_WIDTH_PX);
+ it("makes the seventh terminal narrow the other six rather than land off screen", () => {
+ // The 2026-08-04 report in its exact shape: six panes, one more opened, and
+ // the maintainer having to scroll sideways to see it.
+ const window = 6 * COMFORTABLE_PANE_WIDTH_PX + GRID_HORIZONTAL_PADDING_PX;
+ const before = paneWidthAt(6, window);
+ const after = paneWidthAt(7, window);
+ expect(after).toBeLessThan(before);
+ expect(after * 7).toBeCloseTo(before * 6, 6);
});
- it("costs nothing while the workspace fits", () => {
- // Four panes on a 2K desktop: the canvas is the window, and no scrollbar
- // appears for a workspace that was never too big.
- expect(workspaceWidthFor(4, 2048)).toBe(2048);
+ it("still says out loud when that leaves the panes cramped", () => {
+ // Shrinking without saying so would be the 2026-07-25 report again, just
+ // quieter. The wizard warns; nothing about the layout changes.
+ const laptop = 1440;
+ expect(panesAreComfortable(3, laptop)).toBe(true);
+ expect(panesAreComfortable(8, laptop)).toBe(false);
});
});
@@ -52,14 +64,9 @@ describe("splitting never re-deals the workspace", () => {
// Reported 2026-07-31 as a re-wrap at the fourth split, and again
// 2026-08-03 at the sixth. Both had one cause: the layout decided how many
// panes may share a line. It does not any more — the split buttons ARE the
- // user's arrangement, and the window only decides how much of it is on
- // screen.
+ // user's arrangement, and the window is simply divided between them.
for (const count of [4, 6, 7, 12, 30]) {
- const panes = Array.from({ length: count }, (_, i) => ({
- column: i,
- slot: 0,
- }));
- const grid = paneGrid(panes);
+ const grid = paneGrid(wizardPanes(count));
expect(grid.columns).toBe(count);
expect(grid.placements.every((p) => p.row === 1)).toBe(true);
}
@@ -68,10 +75,7 @@ describe("splitting never re-deals the workspace", () => {
it("puts the seventh terminal beside the sixth on a five-column window", () => {
// The exact case reported on 2026-08-03, with the maintainer's screenshot:
// five panes across, and the sixth landing on a row of its own below.
- const window = 5 * MIN_PANE_WIDTH_PX;
- expect(columnsWithoutScrolling(window)).toBeLessThan(7);
- const panes = Array.from({ length: 7 }, (_, i) => ({ column: i, slot: 0 }));
- const grid = paneGrid(panes);
+ const grid = paneGrid(wizardPanes(7));
expect(grid.placements[5]).toEqual({ column: 6, row: 1, rowSpan: 1 });
expect(grid.placements[6]).toEqual({ column: 7, row: 1, rowSpan: 1 });
});
diff --git a/jarvis/ui/web/frontend/src/components/agentic/paneLayout.test.ts b/jarvis/ui/web/frontend/src/components/agentic/paneLayout.test.ts
index c290f0a817..4abddd24fb 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/paneLayout.test.ts
+++ b/jarvis/ui/web/frontend/src/components/agentic/paneLayout.test.ts
@@ -96,22 +96,23 @@ describe("paneLayout", () => {
expect(seams).toHaveLength(7);
});
- it("reports the height below which the workspace scrolls instead of shrinking", () => {
- // The tallest stack in the workspace: two panes deep, so two minimum pane
- // heights — not the six a least-common-multiple row grid used to demand.
+ it("keeps a stacked column inside the workspace instead of overflowing it", () => {
+ // Until 2026-08-04 the tallest stack was reported back so the grid could
+ // draw the canvas taller than the window and scroll down to the rest. Panes
+ // are shares of the visible area now, on both axes: four deep is four
+ // quarters, however short the window is.
const panes = [
pane("A", 0),
pane("B", 0, 1),
- pane("C", 1),
- pane("D", 2),
- pane("E", 3),
+ pane("C", 0, 2),
+ pane("D", 0, 3),
];
- expect(paneLayout(panes).minHeightUnits).toBe(2);
+ const { boxes } = paneLayout(panes);
+ expect(boxes.map((box) => round(box.h))).toEqual([0.25, 0.25, 0.25, 0.25]);
+ expect(round(boxes[3].y + boxes[3].h)).toBe(1);
});
- it("reports the columns the canvas has to be wide enough for", () => {
- // What the grid multiplies by MIN_PANE_WIDTH_PX to decide whether the
- // workspace is bigger than its window.
+ it("reports the columns the workspace holds", () => {
const panes = Array.from({ length: 7 }, (_, i) => pane(`T${i}`, i));
expect(paneLayout(panes).columns).toBe(7);
// Stacked panes share a column and do not widen the workspace.
@@ -124,12 +125,7 @@ describe("paneLayout", () => {
});
it("has nothing to lay out for an empty workspace", () => {
- expect(paneLayout([])).toEqual({
- boxes: [],
- seams: [],
- columns: 0,
- minHeightUnits: 0,
- });
+ expect(paneLayout([])).toEqual({ boxes: [], seams: [], columns: 0 });
});
});
diff --git a/jarvis/ui/web/frontend/src/components/agentic/paneLayout.ts b/jarvis/ui/web/frontend/src/components/agentic/paneLayout.ts
index 8f87d01f2f..05364be139 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/paneLayout.ts
+++ b/jarvis/ui/web/frontend/src/components/agentic/paneLayout.ts
@@ -133,17 +133,13 @@ export interface WorkspaceLayout {
boxes: PaneBox[];
seams: PaneSeam[];
/**
- * Columns the workspace holds, left to right — also the width below which it
- * stops shrinking and scrolls sideways instead, in multiples of one minimum
- * pane width. See `MIN_PANE_WIDTH_PX` in `./layout` for why there is a floor.
+ * Columns the workspace holds, left to right.
+ *
+ * Purely informational now: the workspace is drawn at exactly the size it was
+ * given on both axes, so nothing multiplies this by a minimum width any more
+ * (see the header of `./layout`).
*/
columns: number;
- /**
- * Height below which panes stop shrinking and the workspace scrolls instead,
- * in multiples of one minimum pane height — the tallest stack in the
- * workspace. See `MIN_PANE_HEIGHT_PX` in `./layout` for why there is a floor.
- */
- minHeightUnits: number;
}
function weightAt(list: readonly number[], index: number): number {
@@ -160,16 +156,17 @@ function paneWeight(weights: PaneWeights, name: string): number {
* Lay a workspace out.
*
* Every column the panes name gets a place on ONE line, however many there are:
- * the workspace never re-arranges itself to fit a window (see the header of
- * `./layout`). `columns` comes back with the boxes so the caller can decide how
- * wide to draw the canvas, which is where the readability floor is paid now.
+ * the workspace never re-arranges itself to fit a window, and never grows past
+ * it either (see the header of `./layout`). The boxes are fractions of whatever
+ * area the caller draws them in, so "one more pane" is always "everything a
+ * little smaller" and never "scroll to find it".
*/
export function paneLayout<T extends Sized>(
panes: readonly T[],
weights: PaneWeights = evenWeights(),
): WorkspaceLayout {
if (panes.length === 0) {
- return { boxes: [], seams: [], columns: 0, minHeightUnits: 0 };
+ return { boxes: [], seams: [], columns: 0 };
}
// Columns in left-to-right order with gaps closed, exactly as `paneGrid` does
@@ -189,12 +186,10 @@ export function paneLayout<T extends Sized>(
const boxes: PaneBox[] = new Array(panes.length);
const seams: PaneSeam[] = [];
- let tallest = 1;
let xCursor = 0;
stacks.forEach((stack, index) => {
const width = columnWeights[index] / columnTotal;
- tallest = Math.max(tallest, stack.length);
// --------------------------------------------------- panes in this column
const stackWeights = stack.map((pane) => paneWeight(weights, panes[pane].name));
@@ -248,7 +243,7 @@ export function paneLayout<T extends Sized>(
xCursor += width;
});
- return { boxes, seams, columns: stacks.length, minHeightUnits: tallest };
+ return { boxes, seams, columns: stacks.length };
}
// ---------------------------------------------------------------- dragging
diff --git a/jarvis/ui/web/frontend/src/views/AgenticIdeView.test.tsx b/jarvis/ui/web/frontend/src/views/AgenticIdeView.test.tsx
index 97e96d0ec0..486cf8de85 100644
--- a/jarvis/ui/web/frontend/src/views/AgenticIdeView.test.tsx
+++ b/jarvis/ui/web/frontend/src/views/AgenticIdeView.test.tsx
@@ -112,10 +112,7 @@ vi.mock("@/lib/agenticIdeApi", () => ({
import { AgenticIdeView } from "./AgenticIdeView";
import * as api from "@/lib/agenticIdeApi";
-import {
- GRID_HORIZONTAL_PADDING_PX,
- MIN_PANE_WIDTH_PX,
-} from "@/components/agentic/layout";
+import { GRID_HORIZONTAL_PADDING_PX } from "@/components/agentic/layout";
const AGENTS: api.AgentsResponse = {
terminal_available: true,
@@ -558,24 +555,16 @@ describe("Agentic IDE launcher", () => {
const columnsOf = (stage: HTMLElement) => stage.style.gridTemplateColumns;
const rowsOf = (stage: HTMLElement) => stage.style.gridTemplateRows;
/**
- * How much wider than its frame the stage draws the workspace.
+ * The width the stage draws the workspace at — always its own frame.
*
- * The frame is the WINDOW and the grid inside it is the workspace, so
- * anything over 100 % is the part that will be a sideways scroll away — the
- * preview's way of saying "this many fit, the rest are to the right".
+ * It used to be set inline to more than 100 % when the workspace was wider
+ * than the window, which was the honest preview of a grid you scrolled
+ * sideways. Nothing scrolls now (maintainer, 2026-08-04), so an inline width
+ * appearing here at all would mean the preview is promising a workspace the
+ * running grid will not build.
*/
const widthOf = (stage: HTMLElement) => stage.style.width;
- /**
- * A pixel width the way the readout writes it.
- *
- * Widths are grouped with a NARROW NO-BREAK SPACE (U+202F) so a number
- * never breaks across two lines. Spelled as an escape rather than pasted:
- * the two characters are indistinguishable in an editor, and only one of
- * them matches.
- */
- const grouped = (digits: string) => digits.replace(/ /g, "\u202F");
-
it("sets any count from one control instead of cards plus a custom row", async () => {
// Two ways to set one number meant two competing "selected" states. One
// control now covers every value, and its two grips must never disagree.
@@ -665,25 +654,24 @@ describe("Agentic IDE launcher", () => {
).toBe(true);
});
- it("previews 12 terminals as 12 columns, six of them on screen", async () => {
- // 2328 px of workspace minus the grid's padding fits six 380 px panes. All
- // twelve are still ONE line — the workspace is twice the window and scrolls
- // — because a wrap would have paid for the new panes with the height of the
- // ones already open (reported 2026-08-03).
+ it("previews 12 terminals as 12 columns, all of them on one screen", async () => {
+ // One line, and one screenful. A wrap would have paid for the new panes
+ // with the height of the ones already open (2026-08-03); a scroll would
+ // have put half of them off the side (2026-08-04). Twelve columns share
+ // the window instead.
const stage = await stageAt(2328, "12");
expect(columnsOf(stage)).toBe("repeat(12, minmax(0, 1fr))");
expect(rowsOf(stage)).toBe("repeat(1, minmax(0, 1fr))");
- expect(widthOf(stage)).toBe("200%");
+ expect(widthOf(stage)).toBe("");
});
- it("previews the same twelve in a narrow window, fewer of them on screen", async () => {
- // The arrangement does not depend on the window any more — only the view
- // onto it does. A 1314 px workspace shows three of the twelve columns at
- // the same readable width, and the rest are a scroll to the right.
+ it("previews the same twelve in a narrow window, still all on one screen", async () => {
+ // Neither the arrangement nor how much of it you see depends on the window
+ // any more — only how wide each pane ends up, which the readout says.
const stage = await stageAt(1314, "12");
expect(columnsOf(stage)).toBe("repeat(12, minmax(0, 1fr))");
expect(rowsOf(stage)).toBe("repeat(1, minmax(0, 1fr))");
- expect(widthOf(stage)).toBe("400%");
+ expect(widthOf(stage)).toBe("");
});
it("keeps a small workspace on one line at any usable width", async () => {
@@ -691,7 +679,7 @@ describe("Agentic IDE launcher", () => {
expect(columnsOf(stage)).toBe("repeat(3, minmax(0, 1fr))");
expect(rowsOf(stage)).toBe("repeat(1, minmax(0, 1fr))");
// Nothing to scroll past, so the stage is an ordinary full-width grid.
- expect(widthOf(stage)).toBe("100%");
+ expect(widthOf(stage)).toBe("");
});
it("previews four terminals side by side in a 2K workspace", async () => {
@@ -701,56 +689,48 @@ describe("Agentic IDE launcher", () => {
const stage = await stageAt(2048, "4", 1164);
expect(columnsOf(stage)).toBe("repeat(4, minmax(0, 1fr))");
expect(rowsOf(stage)).toBe("repeat(1, minmax(0, 1fr))");
- expect(widthOf(stage)).toBe("100%");
+ expect(widthOf(stage)).toBe("");
});
it("draws one pane per terminal and never grows the box to fit them", async () => {
// The old dot preview sat in a fixed 40×40 px box with nothing bounding it,
// so a high count in a narrow window grew a tall column of dots straight out
// through the card, over the buttons above and below. The stage is a FIXED
- // frame that clips instead — the panes past the window are drawn outside it
- // and cut off at its edge, which is what the workspace itself does.
+ // frame, and every pane is drawn inside it however many there are.
const stage = await stageAt(800, "12");
expect(stage.children.length).toBe(12);
expect(columnsOf(stage)).toBe("repeat(12, minmax(0, 1fr))");
expect(rowsOf(stage)).toBe("repeat(1, minmax(0, 1fr))");
- expect(widthOf(stage)).toBe("600%");
+ expect(widthOf(stage)).toBe("");
});
- it("names the window width at which nothing has to be scrolled to", async () => {
+ it("names the width each pane ends up with, and warns when that is tight", async () => {
// The reported bug behind this readout: an arrangement stated without its
- // condition. The condition changed on 2026-08-03 — the arrangement is fixed
- // now and the window decides how much of it is visible — so the sentence
- // has to say that instead.
+ // consequence. The consequence changed on 2026-08-04 — nothing scrolls, so
+ // a high count is paid for in pane WIDTH — and the sentence says that.
await stageAt(1050, "8");
const readout = screen.getByTestId("workspace-stage-readout");
expect(readout.textContent).toContain("8 across");
- expect(readout.textContent).toContain("2 of them on screen");
- // 8 panes × the readable minimum + the grid's own padding — the width at
- // which they are all visible at once. Computed rather than written out,
- // because tightening the grid's padding moves this number without changing
- // anything the test is actually about.
- //
- // `grouped` spells out the narrow no-break space the readout separates
- // thousands with: an invisible literal here reads as a plain space,
- // passes review, and fails the run.
- const allVisibleWidth = 8 * MIN_PANE_WIDTH_PX + GRID_HORIZONTAL_PADDING_PX;
- expect(readout.textContent).toContain(
- grouped(String(allVisibleWidth).replace(/\B(?=(\d{3})+(?!\d))/g, " ")),
- );
- // 1 056, not 1 050: the view rounds the measured width to 16 px steps so a
- // one-pixel drift cannot churn the layout, and the readout reports the width
- // it actually answered for rather than a truer-looking one.
- expect(readout.textContent).toContain(grouped("1 056"));
+ expect(readout.textContent).toContain("All on one screen");
+ // Never a promise of somewhere else to look: every pane is on this screen.
+ expect(readout.textContent).not.toMatch(/scroll/i);
+ // 1 056, not 1 050: the view rounds the measured width to 16 px steps, and
+ // 8 panes share it minus the grid's own padding. Computed rather than
+ // written out, because tightening that padding moves the number without
+ // changing anything the test is about.
+ const each = Math.round((1056 - GRID_HORIZONTAL_PADDING_PX) / 8);
+ expect(readout.textContent).toContain(`${each} px each`);
+ expect(readout.textContent).toMatch(/narrow for an agent/i);
});
- it("says all side by side once the window really is wide enough", async () => {
+ it("drops the warning once the panes really are roomy", async () => {
await stageAt(3200, "8");
const readout = screen.getByTestId("workspace-stage-readout");
expect(readout.textContent).toContain("8 across");
- expect(readout.textContent).toMatch(/wide enough/i);
+ expect(readout.textContent).toContain("All on one screen");
+ expect(readout.textContent).not.toMatch(/narrow for an agent/i);
expect(readout.textContent).not.toMatch(/scroll/i);
});