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(ide): keep a displaced pane on the agent's geometry and reconnect at the current size
rubenluetke10-beep7e8f57345c3c
diff --git a/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.test.tsx b/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.test.tsxindex 33d2544cbe..d84ad6854e 100644--- a/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.test.tsx+++ b/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.test.tsx@@ -1628,6 +1628,48 @@ describe("pane refit", () => {);});+ it("keeps the owner's geometry on a refit while its own tile has not changed", () => {+ // Refitting back to the tile and then staying quiet left xterm at the+ // tile's width while the agent drew for the owner's — rows drawn over+ // rows, worst on returning to the IDE, where every pane refits+ // (2026-09-29). The grid holds what the agent really draws for.+ render(pane(false));+ settle();+ displacedBy(30, 10);+ vi.spyOn(document, "hasFocus").mockReturnValue(false);+ terminalHarness.fit.mockClear();+ terminalHarness.resize.mockClear();++ act(() => {+ window.dispatchEvent(new Event("resize"));+ vi.advanceTimersByTime(600);+ });++ expect(terminalHarness.fit).not.toHaveBeenCalled();+ expect(terminalHarness.resize).not.toHaveBeenCalled();+ expect(terminalHarness.send).not.toHaveBeenCalled();+ });++ it("asks again when a displaced pane's tile really changes", () => {+ render(pane(false));+ settle();+ displacedBy(30, 10);+ vi.spyOn(document, "hasFocus").mockReturnValue(false);++ terminalHarness.size = { cols: 100, rows: 30 };+ act(() => {+ window.dispatchEvent(new Event("resize"));+ vi.advanceTimersByTime(600);+ });++ // The server answers a refused request with the owner's size again.+ expect(terminalHarness.send).toHaveBeenCalledWith({+ t: "r",+ cols: 100,+ rows: 30,+ });+ });+it("claims once, not on every pass of a settling layout", () => {// Three passes follow a maximize (see the effect). Holding the size after// the first, the pane has nothing to add on the next two.@@ -1901,6 +1943,21 @@ describe("pane refit", () => {expect(term?.options.fontSize).toBe(13);});+ it("reconnects with the size its tile has now, not the one it mounted with", () => {+ // The socket reconnects on its own. A handshake carrying the mount-time+ // size resized the agent to a grid the pane had long left (2026-09-29).+ render(pane(false));+ settle();+ expect(terminalHarness.opened.current).toEqual(+ expect.objectContaining({ cols: 80, rows: 24 }),+ );++ terminalHarness.size = { cols: 120, rows: 40 };++ expect(terminalHarness.opened.current?.cols).toBe(120);+ expect(terminalHarness.opened.current?.rows).toBe(40);+ });+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 4b8af0e712..1db2c3a8d7 100644--- a/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.tsx+++ b/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.tsx@@ -1658,6 +1658,23 @@ export function AgenticTerminal({* narrow that will be, and how many panes to open stays the user's call.*/const size = measured;+ // A pane showing another viewer's geometry keeps showing it while its+ // own tile has not changed since it last asked. Fitting it back to the+ // tile here and then staying quiet (the request below would repeat one+ // already turned down) left xterm at the tile's width while the agent+ // went on drawing for the owner's: rows drawn over rows, word tails left+ // at the end of other lines, worst on returning to the IDE, where every+ // pane refits (2026-09-29). The geometry `onGeometry` applied is the one+ // the agent really draws for, so it is the one this grid must hold.+ if (+ !claimOwner &&+ displaced &&+ sentSize &&+ sentSize.cols === size.cols &&+ sentSize.rows === size.rows+ ) {+ return;+ }try {if (size.cols === proposed.cols && size.rows === proposed.rows) {fit.fit();@@ -1667,6 +1684,8 @@ export function AgenticTerminal({} catch {return;}+ // The grid now comes from a tile, so a reconnect may hand it over.+ mountMeasured = true;// Already delivered and unchanged: the fit above was the whole job.// Re-announcing a size makes the agent on the other end redraw its// entire screen, and a pane refits several times per settling layout.@@ -1815,29 +1834,59 @@ export function AgenticTerminal({window.addEventListener("pointerdown", reclaimOnGesture, true);window.addEventListener("keydown", reclaimOnGesture, true);- const openedWithClaim = viewerMayOwn();+ /*+ * The size this socket connects with. The tile's own measurement when there+ * was one: the mount-time fit above already clamped the grid to the floors,+ * so the terminal's geometry is safe to hand over as-is. When that fit+ * could not run at all — a grid cell still mid-layout, a pane mounted+ * hidden on the chat stage — the terminal still holds what it was+ * constructed with, and THAT must not go out as if a tile had measured it:+ * a running agent would be re-wrapped for 80 columns no tile has, and again+ * for the real ones a moment later (ConPTY re-flows the whole screen on+ * each). `UNMEASURED_SIZE` says so on the wire instead; the real size+ * follows from `onOpen`'s fit as soon as the cell settles.+ *+ * Read on EVERY connect, not once at mount. The socket reconnects on its+ * own (a backend restart, sleep and wake), and a handshake carrying the+ * size the pane had when it mounted resized the agent to a grid the pane+ * had long left — its frame drawn for that width into this one, until the+ * next repaint happened to come (2026-09-29).+ */+ let openedWithClaim = viewerMayOwn();+ const connectSize = () => {+ if (!mountMeasured || !measurable()) return UNMEASURED_SIZE;+ let proposed: { cols: number; rows: number } | undefined;+ try {+ proposed = fit.proposeDimensions();+ } catch {+ proposed = undefined;+ }+ const cols = proposed?.cols ?? term.cols;+ const rows = proposed?.rows ?? term.rows;+ if (!Number.isFinite(cols) || !Number.isFinite(rows)) return UNMEASURED_SIZE;+ // The same floors `applyResize` puts on the grid.+ return {+ cols: Math.max(cols, MIN_REAL_COLS),+ rows: Math.max(rows, MIN_REAL_ROWS),+ };+ };socket = openPaneSocket({name,workspaceId,- // The connect-time size is the tile's own measurement when there was- // one. The mount-time fit above already clamped the grid to the- // floors, so the terminal's geometry is safe to hand over as-is.- // When that fit could not run at all — a grid cell still mid-layout,- // a pane mounted hidden on the chat stage — the terminal still holds- // what it was constructed with, and THAT must not go out as if a tile- // had measured it: a running agent would be re-wrapped for 80- // columns no tile has, and again for the real ones a moment later- // (ConPTY re-flows the whole screen on each). `UNMEASURED_SIZE` says- // so on the wire instead; the real size follows from `onOpen`'s fit- // as soon as the cell settles.- ...(mountMeasured &&- term.cols >= MIN_REAL_COLS &&- term.rows >= MIN_REAL_ROWS- ? { cols: term.cols, rows: term.rows }- : UNMEASURED_SIZE),+ get cols() {+ return connectSize().cols;+ },+ get rows() {+ return connectSize().rows;+ },appearance: appearanceRef.current,- claimOwner: openedWithClaim,+ // Decided per connect as well, and remembered: `onOpen` settles+ // ownership from what THIS handshake claimed.+ get claimOwner() {+ openedWithClaim = viewerMayOwn();+ return openedWithClaim;+ },},{onOpen: () => {