Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.
Python agent-orchestrationai-agentai-coding-assistantclaude-codecoding-agentcomputer-usedesktop-applocal-firstmcppersonal-jarvisvoice-assistantvoice-coding
fix(agentic-ide): stop a crowded grid from squeezing agents out of drawing
rubenluetke10-beep221c587203df
diff --git a/jarvis/agentic_ide/session.py b/jarvis/agentic_ide/session.pyindex 1a88fba0c5..8246ec4e33 100644--- a/jarvis/agentic_ide/session.py+++ b/jarvis/agentic_ide/session.py@@ -213,18 +213,35 @@ MAX_TERMINALS = 100# pane header that may be a quarter of a screen wide. Long enough for "Frontend# rewrite", short enough that it stays a name rather than a description.MAX_TERMINAL_NAME = 40-# The narrowest geometry a viewer can honestly have measured. The grid never-# lays a real pane out under 120 px (`MIN_SEAM_PANE_PX` in the frontend), which-# is at least ~10 columns even at the largest font — so a reported size below-# these floors is a mid-layout measurement artifact (a grid cell caught before-# flexbox settled), not a pane anybody is looking at. Resizing the shared PTY-# to such a sliver makes the agent print its entire screen one character per-# line, and that output stays wrecked in the scrollback long after the-# geometry recovers. Attach and resize both refuse sizes under these floors,-# because the viewer that sent one will report its real size the moment its-# cell settles.-MIN_VIEWER_COLS = 8-MIN_VIEWER_ROWS = 2+# The narrowest geometry the shared PTY may be asked to work in.+#+# A floor on what a coding CLI can still lay its interface out in — NOT a+# plausibility check on the viewer's measurement, which is the question these+# floors used to answer at 8x2 and the reason they never fired. A grid of a+# dozen panes measures 17 columns per cell entirely correctly, clears a floor+# of 8, and squeezes the agent into a strip it cannot draw in.+#+# Measured on the maintainer's own workspace (2026-08-09, thirteen panes): one+# pane had printed its whole answer ONE CHARACTER PER LINE, and six more had+# simply stopped drawing — a Claude Code holding "Discombobulating…" on screen,+# its process visibly burning CPU, with not one byte reaching the app for five+# minutes. Their last outputs shared a millisecond, which is a single layout+# change squeezing every pane at once rather than agents falling quiet.+#+# That silence is also what made the status badge lie. The badge reads whether+# a pane's screen MOVES (:mod:`.activity`), so an agent squeezed out of drawing+# reads as one that finished — the "working panes shown as done" reported over+# and over. The detector was honest; this floor is what gives it something+# honest to read.+#+# 60x15 is where both installed coding CLIs still render a usable frame, under+# the 80x24 a viewer already falls back to before it has measured anything.+# Sizes below are REFUSED rather than clamped: the PTY keeps its last honest+# geometry and the narrow viewer shows as much of it as fits, which costs a+# clipped line and keeps the agent alive. Clamping would instead hand the agent+# a geometry no window is showing.+MIN_VIEWER_COLS = 60+MIN_VIEWER_ROWS = 15# Where a pane may land when it is dragged onto another one, in the same two# axes the grid is built from (columns of stacked panes). "swap" is listed first# because it is the one a user reaches for most: two panes are the wrong way@@ -2561,15 +2578,20 @@ class Registry:raise SessionError(f"Unknown terminal: {key}")session, term = foundif cols < MIN_VIEWER_COLS or rows < MIN_VIEWER_ROWS:- # The handshake geometry is a best effort measured before the grid- # cell settled, and a sliver slipping through here is how a whole- # conversation ends up printed one character per line (the resize- # path already refuses these — see the floors' comment). Fall back- # to the geometry the pane already has: for a live agent that means- # "no geometry change", for a fresh spawn the transcript's default,- # and either way the viewer reports its real size right after- # mounting.- cols, rows = term.transcript.cols, term.transcript.rows+ # A handshake tile too narrow for the agent to draw in, which is how+ # a whole conversation ends up printed one character per line (the+ # resize path refuses the same sizes — see the floors' comment).+ # Fall back to the geometry the pane already has: for a live agent+ # that means "no geometry change", for a fresh spawn the+ # transcript's default.+ #+ # Floored, because that fallback is not always sound: a pane+ # squeezed by an earlier crowded grid carries a broken geometry of+ # its own, and handing it back here would reconnect the agent to+ # the very strip it stopped drawing in. Reattaching is the moment+ # such a pane can be put right.+ cols = max(term.transcript.cols, MIN_VIEWER_COLS)+ rows = max(term.transcript.rows, MIN_VIEWER_ROWS)if appearance in THEME_COLOURS:term.queries.appearance = appearance@@ -3376,16 +3398,40 @@ class Registry:Passing nothing keeps the old unconditional behaviour, which is what aninternal caller (a repaint nudge, a test) means by it."""+ found = self._locate(key, workspace_id)if cols < MIN_VIEWER_COLS or rows < MIN_VIEWER_ROWS:- # A sliver is a measurement artifact, never a request (see the- # floors' comment). Refusing it — rather than clamping — keeps the- # PTY at the last honest size; the viewer re-reports the real one- # as soon as its grid cell settles.- logger.debug(- "Agentic IDE: refused an implausible {}x{} resize for {}", cols, rows, key+ # A tile too narrow for the agent to draw in (see the floors). The+ # PTY keeps whatever working geometry it already has, and the tile+ # shows as much of that frame as fits.+ #+ # Unless the PTY is ALREADY under the floor, which is the state a+ # crowded grid used to leave behind and the one nothing else can+ # get a pane out of: every later measurement of the same small tile+ # is refused by this very branch, so a pane squeezed once stayed+ # squeezed for its whole life — agent silent, badge reading that+ # silence as "done". A pane below the floor is therefore lifted TO+ # the floor rather than left there. It is the one place a clamp is+ # right: no window is showing a workable frame anyway, so there is+ # no honest geometry left to preserve.+ current = found[1].transcript if found is not None else None+ if current is None or (+ current.cols >= MIN_VIEWER_COLS and current.rows >= MIN_VIEWER_ROWS+ ):+ logger.debug(+ "Agentic IDE: kept {}'s working geometry instead of a {}x{} tile",+ key,+ cols,+ rows,+ )+ return False+ logger.info(+ "Agentic IDE: lifting {} off a {}x{} terminal its agent cannot draw in",+ key,+ current.cols,+ current.rows,)- return False- found = self._locate(key, workspace_id)+ cols = max(cols, MIN_VIEWER_COLS)+ rows = max(rows, MIN_VIEWER_ROWS)if found is None:return Falseterm = found[1]diff --git a/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.test.tsx b/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.test.tsxindex 42e05b33ba..51c87e3b0c 100644--- a/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.test.tsx+++ b/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.test.tsx@@ -1167,6 +1167,41 @@ describe("pane refit", () => {});});+ it("never hands the agent a tile too narrow to draw in", () => {+ // The failure behind "working panes are shown as done" (maintainer,+ // 2026-08-09, thirteen panes open). A crowded grid measures ~17 columns+ // per cell — a CORRECT measurement, which is why the old 8x2 floor waved+ // it through. The agent, squeezed into a strip it cannot lay its+ // interface out in, stops drawing altogether; the status badge reads that+ // silence as a finished job, because movement is all it can read.+ //+ // So the size is refused and the PTY keeps the last one a viewer really+ // had. The narrow tile shows a clipped frame; the agent stays alive.+ const view = render(pane(false));+ settle();+ terminalHarness.send.mockClear();++ terminalHarness.size = { cols: 17, rows: 6 };+ view.rerender(pane(true));+ settle();++ expect(terminalHarness.send).not.toHaveBeenCalledWith(+ expect.objectContaining({ cols: 17 }),+ );++ // A tile the agent can work in is still announced, or this floor would+ // have swapped a broken pane for a frozen one.+ terminalHarness.size = { cols: 90, rows: 30 };+ view.rerender(pane(false));+ settle();++ expect(terminalHarness.send).toHaveBeenCalledWith({+ t: "r",+ cols: 90,+ rows: 30,+ });+ });+it("tells a fresh socket the pane's size whatever the last one heard", () => {render(pane(false));settle();diff --git a/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.tsx b/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.tsxindex e5ce8901ba..2384403ec5 100644--- a/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.tsx+++ b/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.tsx@@ -211,23 +211,39 @@ export const REBUILD_SETTLE_MAX_MS = 450;const MAX_TERMINAL_NAME = 40;/**- * The narrowest geometry a REAL pane can measure.+ * The narrowest geometry that may be announced to a pane's REAL terminal.*- * The grid never lays a pane out below `MIN_SEAM_PANE_PX` (120 px), which is- * at least ~10 columns even at the largest font — so a fit that comes back- * with fewer than this many columns did not measure a pane, it measured a- * moment: a grid cell mid-animation, a layout that has not settled, a- * container the browser reported before flexbox finished. Announcing such a- * size resizes the shared PTY to a sliver and the agent then prints its whole- * screen one character per line — output that stays wrecked in the scrollback- * long after the geometry recovers, because the agent will not repaint what it- * already said. Both the resize path and the connect-time handshake below- * refuse to report anything under these floors; the backend enforces the same- * ones (`jarvis/agentic_ide/session.py`), so a stale or older client cannot- * do the damage either.+ * Not a plausibility check on the measurement — a floor on what a coding CLI+ * can still be asked to work in. Those are two different questions, and+ * answering only the first is what this constant used to do at 8x2: a grid of+ * a dozen panes measures 17 columns per cell perfectly correctly, sails past a+ * floor of 8, and resizes the shared PTY to a strip the agent cannot lay its+ * interface out in. Measured on the maintainer's own workspace (2026-08-09,+ * thirteen panes): one pane printed its whole answer ONE CHARACTER PER LINE,+ * and six others simply stopped drawing — a Claude Code holding `Discombobu-+ * lating…` on screen, its process visibly burning CPU, while not one byte+ * reached the app for five minutes.+ *+ * That silence is also what broke the status badge. The badge reads whether a+ * pane's screen is moving (`jarvis/agentic_ide/activity.py`), so an agent that+ * has been squeezed out of drawing reads as one that has finished — the+ * "working panes shown as done" the maintainer kept reporting. The badge was+ * telling the truth; this floor is what makes the truth worth reading.+ *+ * 60x15 is where both installed coding CLIs still render a usable frame, with+ * room under the 80x24 the handshake already falls back to when nothing has+ * been measured yet. Below it a size is REFUSED rather than clamped: the PTY+ * keeps its last honest geometry and the viewer shows as much of it as fits,+ * which costs a clipped line in a narrow tile and keeps the agent alive. A+ * clamp would instead hand the agent a size no window is actually showing.+ *+ * Both the resize path and the connect-time handshake below refuse anything+ * under these floors; the backend enforces the same ones+ * (`jarvis/agentic_ide/session.py`), so a stale or older client cannot do the+ * damage either.*/-const MIN_REAL_COLS = 8;-const MIN_REAL_ROWS = 2;+const MIN_REAL_COLS = 60;+const MIN_REAL_ROWS = 15;export type PaneStatus = "connecting" | "live" | "exited" | "error";diff --git a/tests/unit/agentic_ide/test_session.py b/tests/unit/agentic_ide/test_session.pyindex 0ed145c710..b3f5b42aad 100644--- a/tests/unit/agentic_ide/test_session.py+++ b/tests/unit/agentic_ide/test_session.py@@ -354,6 +354,75 @@ async def test_a_geometry_change_rebases_an_intact_replay_and_repaints(assert sizes == [(100, 30), (100, 29), (100, 30)]+async def test_a_crowded_grid_never_squeezes_the_agent_out_of_drawing(+ registry: Registry, fake_pty: FakePtyManager, tmp_path: Path+) -> None:+ """A dozen panes side by side must not shrink the PTY below working size.++ The failure this pins is the one behind "working panes are shown as done"+ (maintainer, 2026-08-09, thirteen panes open). A crowded grid measures ~17+ columns per cell — a perfectly CORRECT measurement, which is why the old+ 8x2 plausibility floor let it straight through. The agent, handed a strip+ it cannot lay its interface out in, stops drawing: one pane printed its+ whole answer a character per line, six others fell silent for five minutes+ while their processes visibly burned CPU.++ The status badge then reads that silence as a finished job, because it+ reads screen MOVEMENT (:mod:`jarvis.agentic_ide.activity`) and there is+ none. So the badge cannot be fixed where it is wrong — the geometry has to+ stop lying to the agent first, which is what this test holds.++ Refused, not clamped: the PTY keeps the last size a viewer really measured,+ so the agent goes on drawing a frame some window is actually showing.+ """+ session = await _open(registry, tmp_path, [{"agent": "claude"}])+ term = session.terminals[0]+ await registry.attach(term.name, 120, 40, _noop_output, _noop_exit)+ pty = term.pty_id+ fake_pty.resizes.clear()++ # Thirteen panes across a laptop screen. Nothing here is an artifact — this+ # is what the cell honestly measures.+ assert registry.resize(term.name, 17, 6) is False++ assert fake_pty.resizes == [], "the agent must never be told it has 17 columns"+ assert (term.transcript.cols, term.transcript.rows) == (120, 40), (+ "the pane keeps the last geometry a viewer really had"+ )++ # And a size the agent CAN work in still gets through, or the floor would+ # have replaced a broken pane with a frozen one.+ assert registry.resize(term.name, 90, 30) is True+ assert (pty, 90, 30) in fake_pty.resizes+++async def test_a_pane_already_squeezed_is_lifted_back_to_a_workable_size(+ registry: Registry, fake_pty: FakePtyManager, tmp_path: Path+) -> None:+ """A pane stuck under the floor must not be trapped there by the floor.++ The state a crowded grid leaves behind, and the one nothing else gets a+ pane out of: the PTY is already a strip, so every later measurement of that+ same small tile is refused for keeping "the last honest geometry" — which+ here is the broken one. The pane stays silent and the badge goes on reading+ that silence as a finished job.+ """+ session = await _open(registry, tmp_path, [{"agent": "claude"}])+ term = session.terminals[0]+ await registry.attach(term.name, 120, 40, _noop_output, _noop_exit)+ pty = term.pty_id+ # However it got there — an older client, a session that predates the floor.+ term.transcript.resize(20, 5)+ fake_pty.resizes.clear()++ assert registry.resize(term.name, 17, 6) is True++ assert (term.transcript.cols, term.transcript.rows) == (60, 15), (+ "a pane below the floor is lifted to it, not left there"+ )+ assert (pty, 60, 15) in fake_pty.resizes, "the agent must be told it has room again"++async def test_closing_a_workspace_stops_only_its_own_agents(registry: Registry, fake_pty: FakePtyManager, tmp_path: Path) -> None: