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): refuse sliver pane geometry so agents never render one char per line

rubenluetke10-beep4ef041ef506c
diff --git a/jarvis/agentic_ide/session.py b/jarvis/agentic_ide/session.py
index da35752029..8f564ffbf9 100644
--- a/jarvis/agentic_ide/session.py
+++ b/jarvis/agentic_ide/session.py
@@ -213,6 +213,18 @@ 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
# 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
@@ -2522,6 +2534,16 @@ class Registry:
raise SessionNotReady("No Agentic-IDE session is running.")
raise SessionError(f"Unknown terminal: {key}")
session, term = found
+ if 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
if appearance in THEME_COLOURS:
term.queries.appearance = appearance
@@ -3270,6 +3292,15 @@ class Registry:
Passing nothing keeps the old unconditional behaviour, which is what an
internal caller (a repaint nudge, a test) means by it.
"""
+ 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
+ )
+ return False
found = self._locate(key, workspace_id)
if found is None:
return False
diff --git a/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.tsx b/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.tsx
index f0301ff052..9df84cddbb 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.tsx
@@ -139,6 +139,25 @@ const RECEIPT_MAX_AGE_MS = 30 * 60 * 1000;
*/
const MAX_TERMINAL_NAME = 40;
+/**
+ * The narrowest geometry a REAL pane can measure.
+ *
+ * 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.
+ */
+const MIN_REAL_COLS = 8;
+const MIN_REAL_ROWS = 2;
+
export type PaneStatus = "connecting" | "live" | "exited" | "error";
/**
@@ -826,7 +845,7 @@ export function AgenticTerminal({
} catch {
return;
}
- if (term.cols < 2 || term.rows < 2) return;
+ if (term.cols < MIN_REAL_COLS || term.rows < MIN_REAL_ROWS) return;
// Resizing a pane is the other half of the un-park story. Maximizing one,
// dragging a seam, changing the font — all of them are a user opening up
// a pane to READ it, and the pane it opens must not be a parked one still
@@ -860,8 +879,15 @@ export function AgenticTerminal({
{
name,
workspaceId,
- cols: term.cols || 80,
- rows: term.rows || 24,
+ // The connect-time size is a best effort, and this is the one place a
+ // sliver could still slip through: the mount-time fit may have run
+ // against a grid cell mid-layout and left `term.cols` at 1 — a value
+ // `sendResize` refuses to SEND but which used to travel here as the
+ // handshake geometry, spawning (or resizing) the PTY one column wide.
+ // A size under the plausibility floor is treated as "not measured yet";
+ // the real one follows from `onOpen`'s fit as soon as the cell settles.
+ cols: term.cols >= MIN_REAL_COLS ? term.cols : 80,
+ rows: term.rows >= MIN_REAL_ROWS ? term.rows : 24,
appearance: appearanceRef.current,
claimOwner: viewerMayOwn(),
},