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): opening more terminals no longer blanks the ones already open

rubenluetke10-beep1f86622446e4
diff --git a/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.tsx b/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.tsx
index 6b29e17457..8f26c15e73 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.tsx
@@ -56,6 +56,13 @@ import { PaneActivityPill } from "./PaneActivityPill";
import { AgentPickerMenu, offersAgentChoice, type SplitAgentChoice } from "./AgentPicker";
import type { TerminalAppearance } from "./terminalThemes";
import { installZoomKeyBridge, type ZoomIntent } from "./terminalZoom";
+import {
+ FONT_DEFAULT,
+ FONT_KEY,
+ FONT_MAX,
+ FONT_MIN,
+ storedFontSize,
+} from "./paneFont";
import {
isEvenTree,
treeLayout,
@@ -230,13 +237,10 @@ interface AgenticGridProps {
}
/*
- * Terminal text size, in pixels — the same three numbers as
- * `jarvis/agentic_ide/ui_prefs.py`, which is what the backend clamps a saved
- * size to. `FONT_DEFAULT` is also where Ctrl/Cmd+0 lands.
+ * Terminal text size, in pixels. Moved to ./paneFont, which the workspace
+ * wizard also reads: it has to say how many terminals this window fits before
+ * any pane exists, and that answer depends on the text size.
*/
-const FONT_MIN = 10;
-const FONT_MAX = 20;
-const FONT_DEFAULT = 13;
/** The size one zoom step away from `from`, kept inside the bounds. */
export function zoomedFontSize(from: number, intent: ZoomIntent): number {
@@ -522,7 +526,6 @@ function writePosition(node: HTMLElement, style: React.CSSProperties): void {
* open at the remembered size instead of visibly resizing a moment later.
*/
const APPEARANCE_KEY = "jarvis.agenticIde.terminalAppearance";
-const FONT_KEY = "jarvis.agenticIde.terminalFontSize";
/**
* The two ways of looking at one workspace.
@@ -644,12 +647,6 @@ function storedAppearance(): TerminalAppearance | null {
return readStored(APPEARANCE_KEY, (raw) => (raw === "light" || raw === "dark" ? raw : null));
}
-function storedFontSize(): number | null {
- return readStored(FONT_KEY, (raw) => {
- const n = Number.parseInt(raw, 10);
- return Number.isFinite(n) && n >= FONT_MIN && n <= FONT_MAX ? n : null;
- });
-}
export function AgenticGrid({
session,
@@ -2968,6 +2965,13 @@ export function AgenticGrid({
generatedAt: recaps[term.name]?.generated_at,
}}
recapActions={recapActionsFor(term.name)}
+ // The backend's reading of what this agent is doing. Only a
+ // pane that has had to give up its terminal for a card reads
+ // them — see PaneTooNarrowCard — but they are cheap and already
+ // in the state this component polls.
+ activity={term.activity}
+ activitySince={term.activity_since}
+ worked={term.worked}
// Only the panes that are NOT on the default login carry a
// badge. Labelling every pane "Default Claude Code login" would
// be noise for the many; labelling the odd one out is the whole
diff --git a/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.test.tsx b/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.test.tsx
index efba07e49f..cf9bac8a08 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.test.tsx
@@ -1396,25 +1396,60 @@ describe("pane refit", () => {
* many as the user confirms, and a pane too narrow to be useful is now a pane
* they can see is too narrow.
*/
- it("fits the tile it is shown in, however narrow that is", () => {
+ it("fits the tile it is shown in, down to the width its agent can draw in", () => {
const view = render(pane(false));
settle();
terminalHarness.fit.mockClear();
terminalHarness.send.mockClear();
- // The crowded-grid measurement that used to be overruled (~17 columns per
- // cell, thirteen panes). It is a CORRECT measurement of a real tile, so it
- // is what both xterm and the agent are given.
- terminalHarness.size = { cols: 17, rows: 6 };
+ // Narrower than the pane opened at, and still a width a coding CLI lays a
+ // frame out in. The tile's own measurement is what everyone gets.
+ terminalHarness.size = { cols: 66, rows: 20 };
view.rerender(pane(true));
settle();
expect(terminalHarness.fit).toHaveBeenCalled();
expect(terminalHarness.send).toHaveBeenCalledWith({
t: "r",
- cols: 17,
+ cols: 66,
+ rows: 20,
+ });
+ });
+
+ /*
+ * Below that width the pane keeps its agent's columns instead.
+ *
+ * This is the half of the rule that was missing until 2026-08-13, and the bug
+ * it cost: opening five more terminals re-fits every pane already open, and
+ * at thirteen columns a coding CLI's own repaint erases more of its screen
+ * than it rewrites. Panes that had been working for an hour came back blank.
+ *
+ * The tile is still measured honestly and nothing is drawn past its edge —
+ * there is simply no terminal in it to be wrong about. See PaneTooNarrowCard.
+ */
+ it("holds its agent's columns when the tile stops being drawable", () => {
+ const view = render(pane(false));
+ settle();
+ terminalHarness.fit.mockClear();
+ terminalHarness.send.mockClear();
+ terminalHarness.resize.mockClear();
+
+ // The crowded-grid measurement (~17 columns per cell, thirteen panes).
+ terminalHarness.size = { cols: 17, rows: 6 };
+ view.rerender(pane(true));
+ settle();
+
+ // Never fitted to the tile — fit() is what would have handed the agent 17.
+ expect(terminalHarness.fit).not.toHaveBeenCalled();
+ // The width the pane opened at, kept. Height still follows the tile: a
+ // resize on that axis repaints in place and breaks nothing.
+ expect(terminalHarness.resize).toHaveBeenCalledWith(80, 6);
+ expect(terminalHarness.send).toHaveBeenCalledWith({
+ t: "r",
+ cols: 80,
rows: 6,
});
+ expect(screen.getByTestId("pane-too-narrow-Dana")).toBeTruthy();
});
it("gives xterm and the agent the same number, always", () => {
@@ -1422,22 +1457,37 @@ describe("pane refit", () => {
// width its xterm does not have re-wraps every one of them, and the TUI's
// cursor moves then land on rows that hold something else — a five-pane
// grid came back as panes full of shredded one-word fragments (2026-08-10).
+ // Held columns are no exception: the pane pins xterm to exactly the number
+ // it sends, which is why the terminal underneath a card is still correct.
for (const size of [
{ cols: 17, rows: 6 },
{ cols: 33, rows: 40 },
{ cols: 90, rows: 30 },
]) {
+ // Every pane in this loop OPENS with room, so the width it holds when a
+ // narrow tile arrives is the same 80 in each case.
+ terminalHarness.size = { cols: 80, rows: 24 };
const view = render(pane(false));
settle();
terminalHarness.send.mockClear();
+ terminalHarness.resize.mockClear();
terminalHarness.size = size;
view.rerender(pane(true));
settle();
+ // 80 is the width this pane opened at and therefore the one it holds.
+ const shown = size.cols >= 60 ? size.cols : 80;
+ expect(terminalHarness.send).toHaveBeenCalledWith({
+ t: "r",
+ cols: shown,
+ rows: size.rows,
+ });
// fit() sizes xterm to the tile, so the agent hearing the tile's own
- // measurement IS the two agreeing.
- expect(terminalHarness.send).toHaveBeenCalledWith({ t: "r", ...size });
+ // measurement IS the two agreeing; a held width says so explicitly.
+ if (shown !== size.cols) {
+ expect(terminalHarness.resize).toHaveBeenCalledWith(shown, size.rows);
+ }
view.unmount();
}
});
@@ -1475,9 +1525,12 @@ describe("pane refit", () => {
const term =
terminalHarness.instances[terminalHarness.instances.length - 1];
expect(term?.options.fontSize).toBe(13);
+ // The pane holds its agent's columns here rather than following the tile
+ // (see "holds its agent's columns" above) — but it does it without touching
+ // a single point of the reader's text size, which is what this pins.
expect(terminalHarness.send).toHaveBeenCalledWith({
t: "r",
- cols: 40,
+ cols: 80,
rows: 20,
});
});
@@ -1648,14 +1701,16 @@ describe("pane refit while the agent is drawing", () => {
terminalHarness.fit.mockClear();
terminalHarness.send.mockClear();
- terminalHarness.size = { cols: 40, rows: 12 };
+ // A width the agent can still draw in, so this measures the parse gate and
+ // nothing else — a narrow tile takes the held-columns path instead.
+ terminalHarness.size = { cols: 64, rows: 12 };
askForARefit();
finishDrawing();
expect(terminalHarness.fit).toHaveBeenCalled();
expect(terminalHarness.send).toHaveBeenCalledWith({
t: "r",
- cols: 40,
+ cols: 64,
rows: 12,
});
});
@@ -1673,7 +1728,7 @@ describe("pane refit while the agent is drawing", () => {
terminalHarness.fit.mockClear();
terminalHarness.send.mockClear();
- terminalHarness.size = { cols: 40, rows: 12 };
+ terminalHarness.size = { cols: 64, rows: 12 };
askForARefit();
act(() => {
vi.advanceTimersByTime(RESIZE_PARSE_WAIT_MS + 50);
@@ -1681,22 +1736,23 @@ describe("pane refit while the agent is drawing", () => {
expect(terminalHarness.send).toHaveBeenCalledWith({
t: "r",
- cols: 40,
+ cols: 64,
rows: 12,
});
});
/*
- * A pane too narrow for its agent SAYS so.
+ * A pane too narrow for its agent stops being a terminal and says what it is.
*
* The rule that a pane is exactly as wide as its tile is not in question
- * here — none of this changes a column. What it closes is the gap the rule
- * left open: a coding CLI below its usable width does not draw a small tidy
- * frame, it lays its interface out one and two characters wide, and that is
- * indistinguishable from this app rendering the terminal wrong. It was
- * reported as exactly that, twice, on a workspace doing what it was told.
+ * here — none of this draws a column past a tile edge. What it closes is the
+ * gap the rule left open: a coding CLI below its usable width does not draw a
+ * small tidy frame, it lays its interface out one and two characters wide and
+ * then repaints over rows that no longer hold what it drew. The pane comes
+ * back blank (reported 2026-08-13), and telling the user about it — which is
+ * all this used to do — left the wreckage on screen.
*/
- it("says when the tile is too narrow for the agent to draw in", () => {
+ it("shows what the agent is doing when the tile is too narrow to draw in", () => {
terminalHarness.size = { cols: 22, rows: 30 };
render(
<AgenticTerminal
@@ -1704,54 +1760,74 @@ describe("pane refit while the agent is drawing", () => {
displayName="Claude Code"
appearance="dark"
fontSize={13}
+ activity="working"
+ recap="Rewriting the prompt composer"
onToggleMaximize={() => undefined}
/>,
);
act(() => {
vi.advanceTimersByTime(600);
- });
-
- const notice = screen.getByTestId("pane-width-notice-Dana");
- expect(notice.dataset.cols).toBe("22");
- expect(notice.textContent).toContain("22 columns");
- // The notice informs, it never acts: the "Widen" button it once carried
- // was removed by the maintainer (2026-08-11). Ways out live in the header
- // and toolbar the pane already has.
- expect(screen.queryByTestId("pane-width-maximize-Dana")).toBeNull();
+ // A pane still opening its socket reports "starting" whatever the backend
+ // says about the agent — the same rule the header's pill follows.
+ terminalHarness.handlers.current?.onReady?.({
+ resumed: false,
+ reattached: false,
+ lastPrompt: null,
+ } as never);
+ });
+
+ const card = screen.getByTestId("pane-too-narrow-Dana");
+ expect(card.dataset.cols).toBe("22");
+ // The state in a word, the recap, and the arithmetic behind the decision.
+ expect(card.textContent).toContain("working");
+ expect(card.textContent).toContain("Rewriting the prompt composer");
+ expect(card.textContent).toContain("22 columns");
+ // One sentence, not two: the header notice says the same thing and would be
+ // on screen at the same time.
+ expect(screen.queryByTestId("pane-width-notice-Dana")).toBeNull();
});
- it("can be waved away, and stays away while the pane stays narrow", () => {
- // A crowded workspace shows this on every pane at once, and the trade may
- // well be one the user made on purpose. A warning they cannot switch off
- // would be the next thing reported.
+ it("hands the pane back at its tile's width when the reader insists", () => {
+ // A reader who wants to watch a 22-column terminal is not somebody this
+ // should argue with. "Show it anyway" restores exactly the behaviour a
+ // narrow pane had before the card existed — the tile's own width, handed to
+ // the agent, plus the notice saying what that costs.
terminalHarness.size = { cols: 22, rows: 30 };
render(pane());
act(() => {
vi.advanceTimersByTime(600);
});
+ terminalHarness.send.mockClear();
act(() => {
- screen.getByTestId("pane-width-dismiss-Dana").click();
+ screen.getByTestId("pane-too-narrow-anyway-Dana").click();
});
- expect(screen.queryByTestId("pane-width-notice-Dana")).toBeNull();
- // Narrower still, and still acknowledged.
+ expect(screen.queryByTestId("pane-too-narrow-Dana")).toBeNull();
+ expect(screen.getByTestId("pane-width-notice-Dana").dataset.cols).toBe("22");
+ expect(terminalHarness.send).toHaveBeenCalledWith({
+ t: "r",
+ cols: 22,
+ rows: 30,
+ });
+
+ // Narrower still, and still the reader's call.
terminalHarness.size = { cols: 14, rows: 30 };
act(() => {
window.dispatchEvent(new Event("resize"));
vi.advanceTimersByTime(600);
});
- expect(screen.queryByTestId("pane-width-notice-Dana")).toBeNull();
+ expect(screen.queryByTestId("pane-too-narrow-Dana")).toBeNull();
});
- it("speaks up again when a widened pane is crowded a second time", () => {
+ it("takes the card back once a widened pane is crowded a second time", () => {
terminalHarness.size = { cols: 22, rows: 30 };
render(pane());
act(() => {
vi.advanceTimersByTime(600);
});
act(() => {
- screen.getByTestId("pane-width-dismiss-Dana").click();
+ screen.getByTestId("pane-too-narrow-anyway-Dana").click();
});
// Given room…
@@ -1760,15 +1836,15 @@ describe("pane refit while the agent is drawing", () => {
window.dispatchEvent(new Event("resize"));
vi.advanceTimersByTime(600);
});
- // …and crowded again. A screen that has started shredding a second time is
- // worth a second sentence.
+ // …and crowded again. "Show it anyway" answered a question about the pane
+ // as it was then, not a standing waiver for the rest of its life.
terminalHarness.size = { cols: 22, rows: 30 };
act(() => {
window.dispatchEvent(new Event("resize"));
vi.advanceTimersByTime(600);
});
- expect(screen.getByTestId("pane-width-notice-Dana")).toBeTruthy();
+ expect(screen.getByTestId("pane-too-narrow-Dana")).toBeTruthy();
});
it("stays quiet on a pane with room to work", () => {
@@ -1779,15 +1855,17 @@ describe("pane refit while the agent is drawing", () => {
});
expect(screen.queryByTestId("pane-width-notice-Dana")).toBeNull();
+ expect(screen.queryByTestId("pane-too-narrow-Dana")).toBeNull();
});
- it("takes the notice away once the pane is given room", () => {
+ it("gives the terminal back once the pane is given room", () => {
terminalHarness.size = { cols: 22, rows: 30 };
render(pane());
act(() => {
vi.advanceTimersByTime(600);
});
- expect(screen.getByTestId("pane-width-notice-Dana")).toBeTruthy();
+ expect(screen.getByTestId("pane-too-narrow-Dana")).toBeTruthy();
+ terminalHarness.send.mockClear();
terminalHarness.size = { cols: 120, rows: 30 };
act(() => {
@@ -1795,7 +1873,15 @@ describe("pane refit while the agent is drawing", () => {
vi.advanceTimersByTime(600);
});
+ expect(screen.queryByTestId("pane-too-narrow-Dana")).toBeNull();
expect(screen.queryByTestId("pane-width-notice-Dana")).toBeNull();
+ // And the agent is told about the room, which is what makes the terminal
+ // underneath the card correct the moment it is uncovered.
+ expect(terminalHarness.send).toHaveBeenCalledWith({
+ t: "r",
+ cols: 120,
+ rows: 30,
+ });
});
it("still fits a quiet pane in the same pass", () => {
@@ -1808,13 +1894,13 @@ describe("pane refit while the agent is drawing", () => {
terminalHarness.fit.mockClear();
terminalHarness.send.mockClear();
- terminalHarness.size = { cols: 40, rows: 12 };
+ terminalHarness.size = { cols: 64, rows: 12 };
askForARefit();
expect(terminalHarness.fit).toHaveBeenCalled();
expect(terminalHarness.send).toHaveBeenCalledWith({
t: "r",
- cols: 40,
+ cols: 64,
rows: 12,
});
});
diff --git a/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.tsx b/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.tsx
index 34ac447d48..def25db6b3 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.tsx
@@ -68,6 +68,9 @@ import {
X,
} from "lucide-react";
import { SplitBelowIcon, SplitRightIcon } from "./splitIcons";
+// A leaf module with no DOM and no terminal in it, which is the point: the
+// wizard quotes this same number before any pane exists — see ./layout.
+import { WORKABLE_COLS } from "./layout";
import { cn } from "@/lib/utils";
import {
MINIMUM_CONTRAST_RATIO,
@@ -91,10 +94,10 @@ import {
type SplitAgentChoice,
} from "./AgentPicker";
import { describeExit, explainExit } from "./paneExit";
-import { PaneActivityPill } from "./PaneActivityPill";
+import { PaneActivityPill, paneActivityLabel } from "./PaneActivityPill";
import { PaneRecap } from "./PaneRecap";
import { attachToTerminal } from "@/lib/agenticIdeApi";
-import type { RecapReason, RecapSource } from "@/lib/agenticIdeApi";
+import type { PaneActivity, RecapReason, RecapSource } from "@/lib/agenticIdeApi";
import { attachTerminalBridge } from "@/lib/editActions";
import { robustCopy, robustPaste } from "@/lib/clipboard";
import {
@@ -305,32 +308,28 @@ const MAX_TERMINAL_NAME = 40;
const MIN_REAL_COLS = 10;
const MIN_REAL_ROWS = 4;
-/**
- * The width below which a coding CLI stops drawing a frame anyone can read.
- *
- * A NOTICE threshold, and nothing else — the distinction is the whole reason
- * this is allowed to exist again. Three attempts to act on this number were
- * shipped and rejected inside a day (2026-08-11): drawing the pane 60 columns
- * wide and clipping it read as terminals shoved behind one another, shrinking
- * the text until 60 fitted made the size controls look dead, and widening a
- * pane on hover shuffled the workspace under the cursor. The rule that
- * survived all three is the maintainer's: **a pane is exactly as wide as its
- * tile.** Nothing here changes a single column of that.
+/*
+ * The width below which a coding CLI stops drawing a frame anyone can read
+ * ({@link WORKABLE_COLS}) now lives in ./layout, because the wizard has to
+ * quote the same number before anything opens and must not import a terminal
+ * to do it. What it MEANS here has changed twice, and both are worth keeping:
*
- * What was left unanswered is what the user actually SEES. The rule was
- * shipped on the reasoning that "a pane too narrow to be useful is a pane they
- * can see is too narrow", and that turned out to be false. Below roughly this
- * width a coding CLI does not degrade gracefully — it reserves its gutter out
- * of what little there is and lays the remainder out in one- and two-character
- * columns, so a pane at 20 columns does not look narrow, it looks CORRUPTED
- * (reported 2026-08-11: a file listing printed one character per line, read as
- * a rendering bug in this app). The pane therefore says which it is.
+ * * It began as a floor the backend enforced, which kept agents alive by
+ * drawing every narrow pane wider than the window showing it. The maintainer
+ * read that as terminals shoved behind one another (2026-08-11) and it was
+ * removed, along with two other attempts on the same day — shrinking the text
+ * until 60 fitted made the size controls look dead, and widening a pane on
+ * hover shuffled the workspace under the cursor.
+ * * It then became a NOTICE and nothing else, on the rule that survived all
+ * three: a pane is exactly as wide as its tile. That rule still stands for
+ * every pane that HAS a terminal in it.
*
- * 60 is where both installed CLIs were measured to stop laying out a usable
- * frame (2026-08-09, thirteen panes) — the same number the backend's floor
- * used to enforce before enforcing it turned out to cost more than it bought.
+ * What the notice could not fix is that the wreckage stayed on screen. Below
+ * this width a coding CLI repaints over rows that no longer hold what it drew,
+ * and panes that had been working for an hour came back blank (2026-08-13). So
+ * a pane below it now holds its agent's columns and shows a card instead — see
+ * `PaneTooNarrowCard`, which is where the whole argument is written down.
*/
-const WORKABLE_COLS = 60;
export type PaneStatus = "connecting" | "live" | "exited" | "error";
@@ -412,6 +411,20 @@ interface AgenticTerminalProps {
recapMeta?: PaneRecapMeta;
/** Rewriting, resetting and re-summarizing it. Absent = read-only card. */
recapActions?: PaneRecapActions;
+ /*
+ * Is this agent still working, and since when — the backend's own reading of
+ * the pane's screen (`jarvis/agentic_ide/activity.py`).
+ *
+ * Only read by `PaneTooNarrowCard`, which is the one place in this component
+ * that has to SAY the state rather than badge it: a pane whose terminal is
+ * held back has nothing else on it to look at. Optional throughout, so every
+ * standalone use of this component keeps working without them.
+ */
+ activity?: PaneActivity;
+ /** When the pane entered that state (epoch seconds); 0 when unknown. */
+ activitySince?: number;
+ /** Has anything ever been asked of this pane? Separates "done" from "idle". */
+ worked?: boolean;
/**
* Which subscription this pane runs on ("Work seat"), when that is worth
* saying. Undefined for everyone with a single login — the header must not
@@ -515,6 +528,9 @@ export function AgenticTerminal({
recapDetail,
recapMeta,
recapActions,
+ activity = "",
+ activitySince = 0,
+ worked = false,
accountLabel,
promptCount = 0,
appearance,
@@ -603,6 +619,27 @@ export function AgenticTerminal({
* quiet about a screen that has started shredding again.
*/
const [widthNoticeDismissed, setWidthNoticeDismissed] = useState(false);
+ /*
+ * Has the reader asked to see the terminal anyway, at whatever width there is?
+ *
+ * The way out of the card below (see `PaneTooNarrowCard`). It restores exactly
+ * the behaviour a narrow pane had before the card existed — the tile's own
+ * width, handed to the agent, plus the notice saying so — for this one pane.
+ *
+ * Reset alongside `widthNoticeDismissed` once the pane has room again: the
+ * override answers "show me this pane as it is now", not "never hold this
+ * pane's columns again for the rest of its life".
+ */
+ const [narrowOverride, setNarrowOverride] = useState(false);
+ /*
+ * Is this pane's tile too narrow for its agent to draw in RIGHT NOW?
+ *
+ * Written by the fit (`applyResize`), which is the only thing that measures.
+ * Distinct from `paneCols < WORKABLE_COLS` on purpose: that comparison is what
+ * the fit decides FROM, and this is what it decided — including the case where
+ * a pane has been measured but the override is holding the terminal open.
+ */
+ const [tooNarrow, setTooNarrow] = useState(false);
// A parked chat pane may have a large asynchronous xterm write to parse when
// it takes the stage again. Keep its terminal surface out of the paint until
// that write and the final viewport restoration have both landed; otherwise xterm
@@ -695,6 +732,22 @@ export function AgenticTerminal({
// Read by the connect effect's resize scheduler, which is built once and
// therefore cannot see the prop change.
const layoutBusyRef = useRef(layoutBusy);
+ /*
+ * The last width this pane could honestly give its agent, in COLUMNS.
+ *
+ * The whole mechanism behind {@link PaneTooNarrowCard}. While a tile is too
+ * narrow to draw in, the pane keeps its terminal at this width instead of
+ * following the tile down — so the agent goes on formatting for a screen it
+ * can lay out, and the card is shown over the top rather than the wreckage.
+ *
+ * A ref because the fit reads it, and the fit is built once per terminal and
+ * cannot see state. Seeded with WORKABLE_COLS so a pane that OPENS into a
+ * narrow tile — the crowded workspace, which is the whole reported case — has
+ * a workable width to hold from its very first measurement.
+ */
+ const heldColsRef = useRef(WORKABLE_COLS);
+ // Read by the fit, which is built once per terminal — see `heldColsRef`.
+ const narrowOverrideRef = useRef(narrowOverride);
onStatusRef.current = onStatus;
onAttachErrorRef.current = onAttachError;
fontSizeRef.current = fontSize;
@@ -702,6 +755,7 @@ export function AgenticTerminal({
activeRef.current = active;
focusedRef.current = focused;
layoutBusyRef.current = layoutBusy;
+ narrowOverrideRef.current = narrowOverride;
useEffect(() => {
const region = terminalRegionRef.current;
@@ -1362,17 +1416,51 @@ export function AgenticTerminal({
// of them, and its cursor moves then land on rows that hold something
// else (shredded one-word fragments, 2026-08-10). Only the absurd is
// refused, which is all MIN_REAL_COLS is for now.
- const size = {
+ const measured = {
cols: Math.max(proposed.cols, MIN_REAL_COLS),
rows: Math.max(proposed.rows, MIN_REAL_ROWS),
};
- // What the pane is about to draw at — read by the width notice, which is
- // the one thing in this component that has an opinion about whether that
- // number is enough (see WORKABLE_COLS). Recorded whatever happens below:
- // a fit that changes nothing still measured the tile.
- setPaneCols(size.cols);
+ // What the TILE measures — read by the width notice and by the card, which
+ // are the two things in this component with an opinion about whether that
+ // number is enough (see WORKABLE_COLS). Recorded whatever happens below: a
+ // fit that changes nothing still measured the tile.
+ setPaneCols(measured.cols);
+ /*
+ * The decision this pane's card exists for.
+ *
+ * Everything above is unchanged: the tile is measured honestly and the
+ * floors only refuse the absurd. What changes is what happens when the
+ * honest answer is a width the agent cannot draw in.
+ *
+ * Following the tile down there was the bug reported on 2026-08-13 and
+ * measured once before on 2026-08-09: opening five more terminals re-fits
+ * every pane already open (`append_pane` gives each new one a full-height
+ * column), and at thirteen columns a coding CLI does not merely look
+ * cramped — it repaints by erasing the rows it last drew, its own line
+ * count no longer matches the screen, and the repaint wipes more than it
+ * rewrites. Panes that had been working for an hour came back BLANK, and
+ * no later output brought them back.
+ *
+ * So below the workable width the columns are HELD instead. The agent goes
+ * on formatting for the last width it could lay out in, its screen is
+ * never wrecked, and the pane shows a card saying what it is doing rather
+ * than a rectangle of shredded fragments. Nothing is drawn past the tile's
+ * edge, because nothing is drawn in the tile at all — which is what
+ * separates this from the clipping design rejected on 2026-08-11.
+ *
+ * ROWS still follow the tile. Height is not the axis that breaks a TUI —
+ * a resize on that axis repaints in place — and honouring it keeps xterm
+ * and the PTY in agreement, which is the rule this whole file is built on.
+ */
+ const narrow = measured.cols < WORKABLE_COLS && !narrowOverrideRef.current;
+ setTooNarrow(narrow);
+ // Only a width the agent could really draw in is worth holding on to.
+ // Recorded even while the override is on: the reader chose to watch a
+ // narrow pane, they did not choose what it should fall back to.
+ if (measured.cols >= WORKABLE_COLS) heldColsRef.current = measured.cols;
+ const size = narrow ? { cols: heldColsRef.current, rows: measured.rows } : measured;
try {
- if (size.cols === proposed.cols && size.rows === proposed.rows) {
+ if (!narrow && size.cols === proposed.cols && size.rows === proposed.rows) {
fit.fit();
} else if (term.cols !== size.cols || term.rows !== size.rows) {
term.resize(size.cols, size.rows);
@@ -1922,10 +2010,13 @@ export function AgenticTerminal({
}, [appearance, terminalEpoch]);
// A pane that has been given room again forgets that its narrowness was
- // acknowledged — see `widthNoticeDismissed`.
+ // acknowledged — see `widthNoticeDismissed` and `narrowOverride`. Both answer
+ // a question about the pane as it is NOW; a workspace that is widened and
+ // later crowded a second time is told a second time.
useEffect(() => {
if (paneCols !== null && paneCols >= WORKABLE_COLS) {
setWidthNoticeDismissed(false);
+ setNarrowOverride(false);
}
}, [paneCols]);
@@ -2174,9 +2265,14 @@ export function AgenticTerminal({
for the agent inside it. Second, because a pane that has stopped or
cannot be reached has a more specific answer and only one row to say it
in. See PaneWidthNotice.
+
+ Only while the terminal is actually being SHOWN at that width — which
+ now means only after the reader waved the card away (`narrowOverride`).
+ With the card up the same sentence would be on screen twice.
*/}
{visibleStatus !== "exited" &&
visibleStatus !== "error" &&
+ !tooNarrow &&
!widthNoticeDismissed && (
<PaneWidthNotice
name={name}
@@ -2217,8 +2313,51 @@ export function AgenticTerminal({
* edge, which is the thing that read as terminals standing on one
* another.
*/
- className="agentic-terminal-host h-full min-h-0 w-full overflow-hidden"
+ className={cn(
+ "agentic-terminal-host h-full min-h-0 w-full overflow-hidden",
+ // Out of sight while the card is up, but still LAID OUT — the fit
+ // measures this element, and a pane that stopped being measurable
+ // could never find out that its tile had grown back. Opacity rather
+ // than `visibility`, which the replay curtain writes imperatively
+ // on this same element and would fight over.
+ tooNarrow && "opacity-0",
+ )}
/>
+ {/*
+ The pane, when there is no room to be a terminal. Ahead of the receipt
+ and the starting spinner in the DOM so both still land on TOP of it —
+ proof that a prompt arrived is exactly as load-bearing on a pane that
+ is showing a card as on one that is showing its agent. See
+ PaneTooNarrowCard.
+ */}
+ {tooNarrow && (
+ <PaneTooNarrowCard
+ name={name}
+ displayName={displayName}
+ cols={paneCols}
+ status={visibleStatus}
+ activity={activity}
+ activitySince={activitySince}
+ worked={worked}
+ recap={recap}
+ appearance={appearance}
+ maximized={maximized}
+ onOpen={onToggleMaximize}
+ onShowAnyway={() => {
+ // The ref BEFORE the state, and not only for tidiness: the fit
+ // below runs in this same tick and reads the ref, which the next
+ // render would otherwise be the first to update. Setting only the
+ // state here left the pane deciding "still too narrow" one last
+ // time and the card never lifting.
+ narrowOverrideRef.current = true;
+ setNarrowOverride(true);
+ // Take the tile's real width immediately rather than waiting for
+ // the next layout change — the reader asked to see this pane NOW,
+ // and nothing else is going to measure it.
+ resizeRef.current?.();
+ }}
+ />
+ )}
<PaneConversationDialog
terminal={name}
open={historyOpen}
@@ -2257,7 +2396,9 @@ export function AgenticTerminal({
onDismiss={() => setDismissedAt(receipt.at)}
/>
)}
- {!painted && visibleStatus === "connecting" && (
+ {/* Not on a pane showing the card — that card already says "starting",
+ in the same vocabulary, and two spinners on one tile is noise. */}
+ {!painted && !tooNarrow && visibleStatus === "connecting" && (
<div
data-testid={`agentic-pane-starting-${name}`}
className="pointer-events-none absolute inset-0 flex items-center justify-center"
@@ -3179,6 +3320,179 @@ function PaneStatusNotice({
);
}
+/**
+ * What a pane shows when its tile is too narrow for the agent to draw in.
+ *
+ * ## The failure this replaces
+ *
+ * Opening more terminals re-fits every pane already open — the backend gives
+ * each new one a full-height column (`layout_tree.append_pane`), so seven panes
+ * become twelve and each one loses half its width. Below roughly
+ * {@link WORKABLE_COLS} a coding CLI does not degrade into a small tidy
+ * interface. It repaints by erasing the rows it last drew, and once its own
+ * line count stops matching the screen the repaint erases more than it rewrites:
+ * panes that had been working for an hour came back BLANK and nothing later
+ * brought them back (reported 2026-08-13 with two screenshots; the same pair of
+ * symptoms — one pane printing one character per line, the rest silently stuck
+ * — was measured on 2026-08-09 at thirteen panes).
+ *
+ * It is not a Claude Code bug to route around. Every full-screen TUI that
+ * repaints relatively has the same failure, which is why this is keyed on the
+ * measured width alone and names no product: Codex and any CLI added next year
+ * are covered with no code here and none there.
+ *
+ * ## Why a card instead of the four things tried before
+ *
+ * The rule this must not break is the maintainer's (2026-08-11): a terminal is
+ * exactly as wide as its tile, and every character in that tile is visible.
+ * Clipping broke it, auto-shrinking the font silently overrode the toolbar,
+ * widening on hover shuffled the workspace under the cursor, and simply telling
+ * the user (`PaneWidthNotice`) left the wreckage on screen.
+ *
+ * A card breaks none of it, because there is no terminal in the tile to be
+ * wrong about. The agent keeps the last width it could lay out in (see
+ * `heldColsRef`), so it is not squeezed, not repainted into a corner, and not
+ * wrecked — it is simply not SHOWN until there is room. Maximize the pane or
+ * close a few and the terminal comes back exactly as it was, mid-sentence.
+ *
+ * ## What it says
+ *
+ * The state, in a word, at a size that reads from across a wall of twelve
+ * panes — the header's own pill is eight pixels and fades out at rest. Then the
+ * pane's recap if it has one, then the arithmetic, then the two ways out. The
+ * second of those, "Show it anyway", restores precisely the old behaviour for
+ * this one pane: a reader who wants to watch a 40-column terminal is not
+ * somebody this should argue with.
+ */
+function PaneTooNarrowCard({
+ name,
+ displayName,
+ cols,
+ status,
+ activity,
+ activitySince,
+ worked,
+ recap,
+ appearance,
+ maximized,
+ onOpen,
+ onShowAnyway,
+}: {
+ name: string;
+ displayName: string;
+ cols: number | null;
+ status: PaneStatus;
+ activity: PaneActivity;
+ activitySince: number;
+ worked: boolean;
+ recap?: string;
+ appearance: TerminalAppearance;
+ maximized: boolean;
+ onOpen?: () => void;
+ onShowAnyway: () => void;
+}) {
+ const chrome = PANE_CHROME[appearance];
+ const brand = PANE_BRAND[appearance];
+ const state = paneActivityLabel(status, activity, worked);
+ return (
+ <div
+ data-testid={`pane-too-narrow-${name}`}
+ data-cols={cols ?? ""}
+ data-activity={activity || status}
+ role="status"
+ aria-live="polite"
+ /*
+ * Opaque, and covering the whole terminal region. The terminal underneath
+ * is still mounted, still parsing its agent's output and still being
+ * measured — it is only out of sight (see the `opacity-0` on its host) —
+ * so anything translucent here would show the very fragments this exists
+ * to keep off the screen.
+ */
+ className="absolute inset-0 flex flex-col items-start gap-1.5 overflow-hidden px-2 py-2 text-left"
+ // The terminal's OWN ground, from the same per-appearance table the pane
+ // is drawn with — never a hardcoded colour, and never one mode's.
+ style={{ background: themeFor(appearance).background }}
+ >
+ <div className="flex w-full min-w-0 items-center gap-1.5">
+ <PaneActivityPill
+ status={status}
+ activity={activity}
+ since={activitySince}
+ worked={worked}
+ />
+ <span
+ className="min-w-0 flex-1 truncate font-display text-[13px] font-medium"
+ style={{ color: brand.ink }}
+ >
+ {state}
+ </span>
+ </div>
+ {/*
+ The sentence the header already carries — repeated here because the
+ header truncates it to a single narrow line and this is the only surface
+ in the pane with room to let it wrap.
+ */}
+ {recap && (
+ <p
+ className="line-clamp-4 w-full text-[11px] leading-snug"
+ style={{ color: brand.inkMuted }}
+ title={recap}
+ >
+ {recap}
+ </p>
+ )}
+ <div className="flex-1" />
+ <p className="w-full text-[10px] leading-tight" style={{ color: brand.inkFaint }}>
+ {cols === null
+ ? `Too narrow for ${displayName} to draw in.`
+ : `${cols} columns — ${displayName} needs about ${WORKABLE_COLS}.`}
+ </p>
+ <div className="flex w-full flex-wrap items-center gap-1">
+ {/*
+ Not rendered on a pane that is already maximized: there is no bigger
+ it can be, and a button that cannot change anything is worse than no
+ button on a surface this small.
+ */}
+ {onOpen && !maximized && (
+ <button
+ type="button"
+ data-testid={`pane-too-narrow-open-${name}`}
+ onClick={(e) => {
+ e.stopPropagation();
+ onOpen();
+ }}
+ onMouseDown={(e) => e.stopPropagation()}
+ className={cn(
+ "rounded px-1.5 py-0.5 text-[10px] font-medium transition-colors duration-150",
+ "focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary/70",
+ )}
+ style={{ background: brand.accent, color: brand.onAccent }}
+ >
+ Open it
+ </button>
+ )}
+ <button
+ type="button"
+ data-testid={`pane-too-narrow-anyway-${name}`}
+ title={`Draw ${name} at whatever width it has`}
+ onClick={(e) => {
+ e.stopPropagation();
+ onShowAnyway();
+ }}
+ onMouseDown={(e) => e.stopPropagation()}
+ className={cn(
+ "rounded px-1.5 py-0.5 text-[10px] transition-colors duration-150 hover:bg-foreground/10",
+ "focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary/70",
+ )}
+ style={{ color: brand.inkFaint, boxShadow: `inset 0 0 0 1px ${chrome.border}` }}
+ >
+ Show it anyway
+ </button>
+ </div>
+ </div>
+ );
+}
+
/**
* Say that this pane is too narrow for its agent, rather than letting the agent
* prove it in one-character columns.
diff --git a/jarvis/ui/web/frontend/src/components/agentic/PaneActivityPill.tsx b/jarvis/ui/web/frontend/src/components/agentic/PaneActivityPill.tsx
index 7a0ebf8b9d..060be6568f 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/PaneActivityPill.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/PaneActivityPill.tsx
@@ -202,6 +202,27 @@ function lookFor(
return LOOK[activity];
}
+/**
+ * The word for this pane's state — "working", "done", "needs you".
+ *
+ * The pill itself is eight pixels of icon and says this only in its tooltip and
+ * its accessible name, which is the right size for a header. A pane that has
+ * given up its terminal to a card (see `PaneTooNarrowCard` in
+ * ./AgenticTerminal) has room to spell it out, and has to: the card IS the
+ * pane's state, and there is nothing else on it to read.
+ *
+ * Exported from here rather than restated there, so the vocabulary keeps one
+ * home. A value added to the Python `Activity` literal still fails to compile
+ * until `LOOK` is given a label for it, and now both readers inherit that.
+ */
+export function paneActivityLabel(
+ status: string,
+ activity: PaneActivity = "",
+ worked = false,
+): string {
+ return lookFor(status, activity, worked).label;
+}
+
/**
* How long it has been in this state — "45s", "3 min", "2 hours".
*
diff --git a/jarvis/ui/web/frontend/src/components/agentic/WorkspaceLauncher.crowded.test.tsx b/jarvis/ui/web/frontend/src/components/agentic/WorkspaceLauncher.crowded.test.tsx
index 8cf325247c..da8970af6f 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/WorkspaceLauncher.crowded.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/WorkspaceLauncher.crowded.test.tsx
@@ -30,6 +30,24 @@ vi.mock("./FolderPicker", () => ({
FolderPicker: () => <div data-testid="folder-picker" />,
}));
+/*
+ * The cell width the wizard measures, faked.
+ *
+ * jsdom has no 2D canvas, so the real `measureAdvance` answers null there and
+ * every measured branch of this screen is skipped — which is itself the
+ * behaviour a test below pins. The ones that exercise the measurement set this
+ * to a real advance instead: 12 px is what the maintainer's text size 20
+ * measured at, on the window the bug was reported from.
+ */
+const advance = { px: null as number | null };
+vi.mock("@/lib/terminalFont", () => ({
+ measureAdvance: () => advance.px,
+}));
+
+afterEach(() => {
+ advance.px = null;
+});
+
afterEach(cleanup);
function props(
@@ -143,3 +161,59 @@ describe("a crowded workspace has to be confirmed", () => {
expect(onStart).toHaveBeenCalledTimes(1);
});
});
+
+/**
+ * …and a workspace the WINDOW cannot carry has to be confirmed too.
+ *
+ * The fixed count of twenty is blind to both halves of the thing it guesses at.
+ * Twelve terminals on a 1 740 px stage at text size 20 land at thirteen columns
+ * each — a width no coding CLI can draw a frame in — and opened in complete
+ * silence, because twelve is not twenty (reported 2026-08-13). The same twelve
+ * on a video wall are fine and were never worth a word.
+ *
+ * So the measurement asks the second question. It blocks in exactly the same
+ * way, for the same reason, and is overruled by the same button: the count is
+ * still never refused.
+ */
+describe("a workspace this window cannot draw has to be confirmed", () => {
+ const REPORTED_WINDOW_PX = 1740;
+
+ it("stops a count that would leave every pane undrawable", () => {
+ advance.px = 12;
+ openLayoutStep(12, { workspaceWidthPx: REPORTED_WINDOW_PX });
+
+ const warning = screen.getByTestId("workspace-crowded-warning");
+ // The measured sentence, not the general one about "most displays".
+ expect(warning.textContent).toContain(
+ "workspace_launcher.crowded.measured",
+ );
+ expect(nextStep().closest("button")?.disabled).toBe(true);
+ });
+
+ it("says nothing when the same panes have room", () => {
+ // A wall display, or simply a smaller text size. Nothing is wrong here and
+ // a warning would be noise.
+ advance.px = 6;
+ openLayoutStep(4, { workspaceWidthPx: REPORTED_WINDOW_PX });
+
+ expect(screen.queryByTestId("workspace-crowded-warning")).toBeNull();
+ expect(nextStep().closest("button")?.disabled).toBe(false);
+ });
+
+ it("stays quiet where nothing can be measured", () => {
+ // No canvas to measure with. "We could not measure" must never render as a
+ // warning, or the wizard shouts at everyone once.
+ advance.px = null;
+ openLayoutStep(12, { workspaceWidthPx: REPORTED_WINDOW_PX });
+
+ expect(screen.queryByTestId("workspace-crowded-warning")).toBeNull();
+ });
+
+ it("is overruled by the same button, and opens the count asked for", () => {
+ advance.px = 12;
+ openLayoutStep(12, { workspaceWidthPx: REPORTED_WINDOW_PX });
+
+ fireEvent.click(screen.getByTestId("workspace-crowded-accept"));
+ expect(nextStep().closest("button")?.disabled).toBe(false);
+ });
+});
diff --git a/jarvis/ui/web/frontend/src/components/agentic/WorkspaceLauncher.tsx b/jarvis/ui/web/frontend/src/components/agentic/WorkspaceLauncher.tsx
index f9fd1013d2..7292ed9d70 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/WorkspaceLauncher.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/WorkspaceLauncher.tsx
@@ -24,7 +24,16 @@ import { ResumeCard } from "./ResumeCard";
import { AgentAllocation, type PlannedTerminal } from "./AgentAllocation";
import { Button, Notice, SectionLabel } from "./controls";
import { CountStepper, CountTrack, WorkspaceShape } from "./WorkspaceShape";
-import { CROWDED_TERMINAL_COUNT } from "./layout";
+import {
+ CROWDED_TERMINAL_COUNT,
+ WORKABLE_COLS,
+ paneColumnsAt,
+ paneGrid,
+ wizardPanes,
+ workableColumnCount,
+} from "./layout";
+import { paneFontSize } from "./paneFont";
+import { measureAdvance } from "@/lib/terminalFont";
import type { WorkspaceView } from "./AgenticGrid";
import type { AgentAccount } from "@/lib/agentAccountsApi";
import type {
@@ -158,7 +167,34 @@ export function WorkspaceLauncher({
* silent yes into a workspace that no longer needs one.
*/
const [crowdAccepted, setCrowdAccepted] = useState(false);
- const crowded = count >= CROWDED_TERMINAL_COUNT;
+ /*
+ * How narrow these panes really come out, on THIS window at THIS text size.
+ *
+ * The measured half of the question, and the reason the fixed count below is
+ * no longer the only one asked. Twenty is blind to both things that decide
+ * it: twelve terminals on a 1 920 px window at text size 20 land at thirteen
+ * columns each — a width no coding CLI can draw in — and opened in silence,
+ * because twelve is not twenty (reported 2026-08-13). Six on a 4K display at
+ * text size 11 are roomy and were never worth a question.
+ *
+ * `measureAdvance` returns null where nothing can be measured (jsdom, and any
+ * environment with no canvas). That reads as "no answer", never as a warning:
+ * a wizard that shouted at everybody once because it could not measure would
+ * be the next thing reported.
+ */
+ const fontSize = useMemo(() => paneFontSize(), []);
+ const cell = useMemo(() => measureAdvance(fontSize), [fontSize]);
+ const columns = useMemo(
+ () => paneGrid(wizardPanes(count)).columns,
+ [count],
+ );
+ const perPane = paneColumnsAt(columns, workspaceWidthPx, cell ?? 0);
+ const fitsAcross = workableColumnCount(workspaceWidthPx, cell ?? 0);
+ const tooNarrow = perPane > 0 && perPane < WORKABLE_COLS;
+ // Either question is enough to stop and ask. They catch different mistakes:
+ // the count is about the machine and the attention a wall of agents costs,
+ // the measurement is about whether these panes can be terminals at all.
+ const crowded = count >= CROWDED_TERMINAL_COUNT || tooNarrow;
useEffect(() => {
if (!crowded && crowdAccepted) setCrowdAccepted(false);
}, [crowded, crowdAccepted]);
@@ -331,6 +367,7 @@ export function WorkspaceLauncher({
count={count}
names={suggestedNames}
workspaceWidthPx={workspaceWidthPx}
+ fontSize={fontSize}
/>
<CountTrack
count={count}
@@ -340,6 +377,8 @@ export function WorkspaceLauncher({
{crowded && (
<CrowdedWarning
count={count}
+ perPane={tooNarrow ? perPane : 0}
+ fitsAcross={fitsAcross}
accepted={crowdAccepted}
onAccept={() => setCrowdAccepted(true)}
/>
@@ -439,13 +478,30 @@ export function WorkspaceLauncher({
* walked past without being read is decoration, and the count it is warning
* about is the one thing in this wizard that cannot be undone from inside the
* workspace without closing panes one at a time.
+ *
+ * ## The measured sentence
+ *
+ * `perPane` turns the general warning into a specific one. When the window has
+ * actually been measured and these panes come out below the width an agent can
+ * draw in, the warning says the number and what follows from it — the panes
+ * open as status cards, not terminals — instead of guessing at "most displays".
+ * That is the case twelve terminals hit on 2026-08-13 and walked straight past,
+ * because twelve is not twenty.
+ *
+ * 0 means there is nothing measured to say, and the general sentence stands.
*/
function CrowdedWarning({
count,
+ perPane,
+ fitsAcross,
accepted,
onAccept,
}: {
count: number;
+ /** Columns each pane comes out at, or 0 when that is not the problem. */
+ perPane: number;
+ /** How many panes this window fits at a workable width. */
+ fitsAcross: number;
accepted: boolean;
onAccept: () => void;
}) {
@@ -475,8 +531,13 @@ function CrowdedWarning({
>
{(accepted
? t("workspace_launcher.crowded.accepted")
- : t("workspace_launcher.crowded.warning")
- ).replace("{0}", String(count))}
+ : perPane > 0
+ ? t("workspace_launcher.crowded.measured")
+ : t("workspace_launcher.crowded.warning")
+ )
+ .replace("{0}", String(count))
+ .replace("{1}", String(perPane))
+ .replace("{2}", String(fitsAcross))}
</p>
{!accepted && (
<Button
diff --git a/jarvis/ui/web/frontend/src/components/agentic/WorkspaceShape.tsx b/jarvis/ui/web/frontend/src/components/agentic/WorkspaceShape.tsx
index 16808fc3ac..2b95a62fdf 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/WorkspaceShape.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/WorkspaceShape.tsx
@@ -37,12 +37,16 @@ import { Minus, Plus } from "lucide-react";
import { cn } from "@/lib/utils";
import { IconButton } from "./controls";
import {
+ WORKABLE_COLS,
+ paneColumnsAt,
paneGrid,
paneWidthAt,
panesAreComfortable,
wizardPanes,
+ workableColumnCount,
type PanePlacement,
} from "./layout";
+import { measureAdvance } from "@/lib/terminalFont";
/**
* Steps a labelled tick is allowed to land on, coarsest last.
@@ -165,12 +169,21 @@ interface WorkspaceShapeProps {
* panes out of the preview and the running workspace.
*/
workspaceWidthPx: number;
+ /**
+ * The text size the panes will open at, in px.
+ *
+ * Passed in rather than read here, so the readout and the wizard's blocking
+ * warning can never quote two different sizes for the same workspace. See
+ * ./paneFont for where the reader's choice is kept.
+ */
+ fontSize: number;
}
export function WorkspaceShape({
count,
names,
workspaceWidthPx,
+ fontSize,
}: WorkspaceShapeProps) {
const grid = useMemo(() => paneGrid(wizardPanes(count)), [count]);
@@ -183,7 +196,11 @@ export function WorkspaceShape({
count={count}
names={names}
/>
- <Readout columns={grid.columns} workspaceWidthPx={workspaceWidthPx} />
+ <Readout
+ columns={grid.columns}
+ workspaceWidthPx={workspaceWidthPx}
+ fontSize={fontSize}
+ />
</div>
);
}
@@ -594,18 +611,44 @@ function StagePane({
* The second half is the part that matters. An arrangement stated without its
* consequence is a bug this step actually had: correct on screen, and silent
* about the thing the user would notice a minute later.
+ *
+ * ## Why it counts COLUMNS and not only pixels
+ *
+ * "About 145 px each" is true and says nothing. A pixel width means one thing
+ * at 8 px text and the opposite at 20, and the number that decides whether a
+ * coding CLI can draw at all is its column count — below {@link WORKABLE_COLS}
+ * a pane holds its agent's columns and shows a card instead of a terminal (see
+ * `PaneTooNarrowCard` in ./AgenticTerminal).
+ *
+ * That is exactly what went unsaid on 2026-08-13: twelve terminals opened on a
+ * 1 920 px window at text size 20 with no warning at all, because the only
+ * question asked was "twenty or more?" — a fixed count, blind to both the
+ * window and the text size. The readout now measures the real font and says
+ * what the user is about to get, in the unit that decides it.
*/
function Readout({
columns,
workspaceWidthPx,
+ fontSize,
}: {
columns: number;
workspaceWidthPx: number;
+ fontSize: number;
}) {
// 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);
+ /*
+ * The real font, measured — never an assumed advance width. `null` where
+ * there is no canvas to measure with (jsdom, and any environment that cannot
+ * answer), and every branch below treats that as "no answer yet" rather than
+ * as a warning: a readout that shouted at everyone once because it could not
+ * measure would be the next thing reported.
+ */
+ const cell = useMemo(() => measureAdvance(fontSize), [fontSize]);
+ const perPane = paneColumnsAt(columns, workspaceWidthPx, cell ?? 0);
+ const affordable = workableColumnCount(workspaceWidthPx, cell ?? 0);
/*
* There is no longer an "and the rest are off screen" case to warn about —
@@ -616,6 +659,14 @@ function Readout({
let condition: string;
if (paneWidth === 0) {
condition = "All on one screen.";
+ } else if (perPane > 0 && perPane < WORKABLE_COLS) {
+ // The one case worth spelling out: these panes will not be terminals.
+ condition =
+ `All on one screen, about ${perPane} columns each — too narrow for an ` +
+ `agent to draw in, so they open as status cards. This window fits ` +
+ `${affordable} across at text size ${fontSize}.`;
+ } else if (perPane > 0) {
+ condition = `All on one screen, about ${perPane} columns each.`;
} else if (comfortable) {
condition = `All on one screen, about ${formatPx(paneWidth)} px each.`;
} else {
@@ -627,6 +678,7 @@ function Readout({
return (
<p
data-testid="workspace-stage-readout"
+ data-pane-cols={perPane || ""}
className="text-xs leading-relaxed text-muted-foreground"
>
<span className="font-mono tabular-nums text-foreground">
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 6149e21100..ba1f6311d0 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/layout.test.ts
+++ b/jarvis/ui/web/frontend/src/components/agentic/layout.test.ts
@@ -2,13 +2,87 @@ import { describe, expect, it } from "vitest";
import {
COMFORTABLE_PANE_WIDTH_PX,
GRID_HORIZONTAL_PADDING_PX,
+ PANE_TERMINAL_INSET_PX,
+ WORKABLE_COLS,
columnDepthFor,
+ paneColumnsAt,
paneGrid,
paneWidthAt,
panesAreComfortable,
wizardPanes,
+ workableColumnCount,
} from "./layout";
+/*
+ * The workspace the bug was reported on (2026-08-13), in numbers.
+ *
+ * A 1 920 px window with the section rail beside it, at the maintainer's own
+ * text size — where twelve terminals opened in silence and every pane landed at
+ * a width no coding CLI can draw in.
+ */
+const REPORTED_WINDOW_PX = 1740;
+const CELL_AT_SIZE_20 = 12;
+
+describe("how many columns a pane really gets", () => {
+ it("answers in the unit that decides, not in pixels", () => {
+ // Twelve across on that window: ~145 px each, which sounds survivable and
+ // is not — it is thirteen columns, and a coding CLI needs about sixty.
+ const cols = paneColumnsAt(12, REPORTED_WINDOW_PX, CELL_AT_SIZE_20);
+ expect(cols).toBeLessThan(WORKABLE_COLS);
+ expect(cols).toBe(
+ Math.floor(
+ (paneWidthAt(12, REPORTED_WINDOW_PX) - PANE_TERMINAL_INSET_PX) /
+ CELL_AT_SIZE_20,
+ ),
+ );
+ });
+
+ it("gives the same panes a different answer at a smaller text size", () => {
+ // The half a fixed count of twenty can never see: the SAME four panes on
+ // the SAME window are two different decisions, and only the text size
+ // separates them.
+ expect(paneColumnsAt(4, REPORTED_WINDOW_PX, CELL_AT_SIZE_20)).toBeLessThan(
+ WORKABLE_COLS,
+ );
+ expect(paneColumnsAt(4, REPORTED_WINDOW_PX, 6)).toBeGreaterThanOrEqual(
+ WORKABLE_COLS,
+ );
+ });
+
+ it("has nothing to say where nothing can be measured", () => {
+ // jsdom, and any environment with no canvas. "We could not measure" must
+ // never render as a warning.
+ expect(paneColumnsAt(12, REPORTED_WINDOW_PX, 0)).toBe(0);
+ expect(paneColumnsAt(12, 0, CELL_AT_SIZE_20)).toBe(0);
+ expect(paneColumnsAt(12, REPORTED_WINDOW_PX, Number.NaN)).toBe(0);
+ });
+});
+
+describe("how many panes a window fits", () => {
+ it("counts the panes that would still be drawable", () => {
+ const across = workableColumnCount(REPORTED_WINDOW_PX, CELL_AT_SIZE_20);
+ expect(across).toBeGreaterThan(0);
+ expect(paneColumnsAt(across, REPORTED_WINDOW_PX, CELL_AT_SIZE_20)).toBeGreaterThanOrEqual(
+ WORKABLE_COLS,
+ );
+ // And one more would not be.
+ expect(paneColumnsAt(across + 1, REPORTED_WINDOW_PX, CELL_AT_SIZE_20)).toBeLessThan(
+ WORKABLE_COLS,
+ );
+ });
+
+ it("never answers zero on a measured window", () => {
+ // A window too narrow for one workable pane cannot be fixed by opening
+ // fewer, and "0 across" is not an arrangement anyone can choose.
+ expect(workableColumnCount(200, CELL_AT_SIZE_20)).toBe(1);
+ });
+
+ it("has nothing to say where nothing can be measured", () => {
+ expect(workableColumnCount(REPORTED_WINDOW_PX, 0)).toBe(0);
+ expect(workableColumnCount(0, CELL_AT_SIZE_20)).toBe(0);
+ });
+});
+
/*
* The widths are expressed as "content width + the grid's own padding" rather
* than as the literal pixel numbers they come to.
diff --git a/jarvis/ui/web/frontend/src/components/agentic/layout.ts b/jarvis/ui/web/frontend/src/components/agentic/layout.ts
index cff8dd9162..5f1634d919 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/layout.ts
+++ b/jarvis/ui/web/frontend/src/components/agentic/layout.ts
@@ -84,6 +84,88 @@
*/
export const COMFORTABLE_PANE_WIDTH_PX = 380;
+/**
+ * The width below which a coding CLI stops drawing a frame anyone can read.
+ *
+ * 60 is where both installed CLIs were measured to stop laying out a usable
+ * frame (2026-08-09, thirteen panes). Below it a TUI does not shrink tidily —
+ * it reserves its gutter out of what little there is, lays the remainder out
+ * one and two characters wide, and then repaints over rows that no longer hold
+ * what it drew, which is how panes that had been working for an hour came back
+ * BLANK (reported 2026-08-13).
+ *
+ * It lives in this leaf module because THREE places have to agree on it and one
+ * of them must not import a terminal: the pane holds its agent's columns here
+ * (`MIN_REAL_COLS` and `PaneTooNarrowCard` in ./AgenticTerminal), and the wizard
+ * says so before anything opens (./WorkspaceShape). A wizard that quoted a
+ * different number from the one the panes act on would be advice about a
+ * different app.
+ */
+export const WORKABLE_COLS = 60;
+
+/**
+ * The pane chrome between a tile's edge and the terminal grid inside it, in px.
+ *
+ * Mirrors the horizontal padding on the terminal region in ./AgenticTerminal
+ * (`px-1.5`, so 6 px a side). Like {@link GRID_HORIZONTAL_PADDING_PX} the two
+ * must not drift: the wizard predicts a pane's COLUMN count from its tile, and
+ * an inset it does not know about makes that prediction wrong in the direction
+ * that matters — optimistic.
+ */
+export const PANE_TERMINAL_INSET_PX = 12;
+
+/**
+ * How many terminal COLUMNS each of ``columns`` panes gets, at this text size.
+ *
+ * The unit the decision is actually made in. A pane's width in pixels means
+ * nothing on its own — 145 px is roomy at 8 px text and unusable at 20 — and
+ * the number that decides whether a coding CLI can draw at all is its column
+ * count (see {@link WORKABLE_COLS}).
+ *
+ * ``cellWidthPx`` is measured from the real font by the caller
+ * (`measureAdvance` in @/lib/terminalFont), never assumed here: this module has
+ * no DOM and must not invent an advance width. 0 — an environment that cannot
+ * measure — gives 0 back, which every caller reads as "nothing to say yet".
+ *
+ * The same estimate the readout's pixel figure comes from, deliberately: the
+ * two numbers stand beside each other and may not disagree. A pane's own fit is
+ * the authority once it exists; this is what can be said before it does.
+ */
+export function paneColumnsAt(
+ columns: number,
+ containerWidthPx: number,
+ cellWidthPx: number,
+): number {
+ if (!Number.isFinite(cellWidthPx) || cellWidthPx <= 0) return 0;
+ const tile = paneWidthAt(columns, containerWidthPx);
+ if (tile <= 0) return 0;
+ return Math.max(0, Math.floor((tile - PANE_TERMINAL_INSET_PX) / cellWidthPx));
+}
+
+/**
+ * How many panes fit ACROSS this window before they stop being drawable.
+ *
+ * What the wizard's warning is built on, and the honest form of a question that
+ * used to be answered by a fixed count of twenty. Twenty is blind to both
+ * halves of the thing it is guessing at — the window and the reader's text size
+ * — which is why twelve terminals opened silently on a 1 920 px window at text
+ * size 20 and left every pane at thirteen columns.
+ *
+ * At least 1: a window too narrow for a single workable pane cannot be made
+ * wider by opening fewer, and 0 across is not an arrangement anyone can choose.
+ * 0 only for an unmeasured window, which means "no answer yet", not "none fit".
+ */
+export function workableColumnCount(
+ containerWidthPx: number,
+ cellWidthPx: number,
+): number {
+ if (!Number.isFinite(cellWidthPx) || cellWidthPx <= 0) return 0;
+ const content = Math.max(0, containerWidthPx - GRID_HORIZONTAL_PADDING_PX);
+ if (!Number.isFinite(content) || content <= 0) return 0;
+ const perPane = WORKABLE_COLS * cellWidthPx + PANE_TERMINAL_INSET_PX;
+ return Math.max(1, Math.floor(content / perPane));
+}
+
/**
* The count from which opening a workspace has to be confirmed out loud.
*
diff --git a/jarvis/ui/web/frontend/src/components/agentic/paneFont.ts b/jarvis/ui/web/frontend/src/components/agentic/paneFont.ts
new file mode 100644
index 0000000000..53bb2112a4
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/agentic/paneFont.ts
@@ -0,0 +1,51 @@
+/**
+ * The terminal text size the reader has chosen, and where it is kept.
+ *
+ * Extracted from ./AgenticGrid, which owned all of this while it was the only
+ * thing that needed it. It is no longer: the workspace WIZARD has to answer
+ * "how many terminals does this window fit?" before a single pane exists, and
+ * that question cannot be answered without the text size — 145 px is roomy at
+ * 10 px text and unusable at 20 (see `workableColumnCount` in ./layout).
+ *
+ * A leaf module on purpose. The wizard importing the running grid to read one
+ * number would drag a terminal emulator into a screen that shows none, so the
+ * number moved to where both can reach it and neither owns it.
+ *
+ * The three bounds mirror `jarvis/agentic_ide/ui_prefs.py`, which is what the
+ * backend clamps a saved size to. They must not drift: a size the frontend
+ * offers and the backend refuses comes back as a control that silently does
+ * nothing.
+ */
+
+export const FONT_MIN = 10;
+export const FONT_MAX = 20;
+/** Where a fresh install starts, and where Ctrl/Cmd+0 lands. */
+export const FONT_DEFAULT = 13;
+
+export const FONT_KEY = "jarvis.agenticIde.terminalFontSize";
+
+/**
+ * The stored size, or `null` when there is none to read.
+ *
+ * `null` rather than the default, so a caller can tell "the reader has never
+ * chosen" from "the reader chose 13" — the grid follows the backend's preference
+ * only in the first case.
+ *
+ * Never throws: private mode and disabled storage both read as "no preference",
+ * which is a workspace that opens rather than one that fails over a setting.
+ */
+export function storedFontSize(): number | null {
+ try {
+ const raw = window.localStorage.getItem(FONT_KEY);
+ if (raw === null) return null;
+ const size = Number.parseInt(raw, 10);
+ return Number.isFinite(size) && size >= FONT_MIN && size <= FONT_MAX ? size : null;
+ } catch {
+ return null;
+ }
+}
+
+/** The size a pane will actually open at — the stored one, or the default. */
+export function paneFontSize(): number {
+ return storedFontSize() ?? FONT_DEFAULT;
+}
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/de.json b/jarvis/ui/web/frontend/src/i18n/locales/de.json
index 04e64022d6..db807b3c1c 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/de.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/de.json
@@ -3863,6 +3863,7 @@
},
"crowded": {
"warning": "{0} Terminals nebeneinander sind auf den meisten Bildschirmen zu klein zum Lesen, und der Arbeitsbereich kann träge werden. Öffne ihn trotzdem, wenn dein Bildschirm den Platz hat.",
+ "measured": "{0} Terminals wären auf diesem Fenster etwa {1} Spalten breit — zu schmal, als dass ein Agent darin zeichnen könnte, also öffnen sie sich als Status-Karten statt als Terminals. In dieses Fenster passen bei deiner Schriftgröße {2} nebeneinander.",
"accept": "Trotzdem öffnen",
"accepted": "{0} Terminals werden trotzdem geöffnet."
},
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/en.json b/jarvis/ui/web/frontend/src/i18n/locales/en.json
index 93ff4c76c0..9b6483624a 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/en.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/en.json
@@ -3863,6 +3863,7 @@
},
"crowded": {
"warning": "{0} terminals side by side will be too small to read on most displays, and the workspace may feel sluggish. Open it anyway if your screen has the room.",
+ "measured": "{0} terminals would be about {1} columns each on this window — too narrow for an agent to draw in, so they open as status cards instead of terminals. This window fits {2} across at your text size.",
"accept": "Open it anyway",
"accepted": "Opening {0} terminals anyway."
},
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/es.json b/jarvis/ui/web/frontend/src/i18n/locales/es.json
index 8faefabb61..a64f49a35b 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/es.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/es.json
@@ -3863,6 +3863,7 @@
},
"crowded": {
"warning": "{0} terminales en paralelo serán demasiado pequeños para leerlos en la mayoría de las pantallas, y el espacio de trabajo puede volverse lento. Ábrelo de todos modos si tu pantalla tiene sitio.",
+ "measured": "{0} terminales tendrían unas {1} columnas cada uno en esta ventana — demasiado estrechos para que un agente dibuje en ellos, así que se abren como tarjetas de estado en lugar de terminales. En esta ventana caben {2} en paralelo con tu tamaño de texto.",
"accept": "Abrir de todos modos",
"accepted": "Se abrirán {0} terminales de todos modos."
},