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): stop fitting panes to a minimized window and re-nudge ignored resize repaints
rubenluetke10-beep51386b48d9d4
diff --git a/jarvis/agentic_ide/session.py b/jarvis/agentic_ide/session.pyindex 0d5b61a57f..c18579cce0 100644--- a/jarvis/agentic_ide/session.py+++ b/jarvis/agentic_ide/session.py@@ -1960,6 +1960,8 @@ class Registry:# The follow-ups checking that a repaint nudge was answered (see# ``_confirm_repaint``), held for the same weak-reference reason.self._repaint_checks: set[asyncio.Task[None]] = set()+ # The newest of those per pane, so a burst of resizes keeps one alive.+ self._repaint_check_by_pane: dict[str, object] = {}# Whether panes may live in the PTY host (``jarvis.terminal.pty_host``)# instead of this process. Off until the app turns it on through# ``boot_restore``: a registry built by a test, a script or the CLI@@ -4601,21 +4603,47 @@ class Registry:clears_before = term.replay.clearsif not await self._resize_there_and_back(term, cols, rows):return+ self._watch_repaint(term, clears_before)++ def _watch_repaint(self, term: Terminal, clears_before: int) -> None:+ """Check in the background that a size change was answered by a repaint.++ Only for a full-screen agent: a line-mode CLI or a shell answers with no+ whole-screen erase at all, and waiting for one would only nudge it four+ more times. Needs a running loop; a synchronous caller without one (a+ test, a script) simply goes unchecked.+ """if not term.replay.holds_screen:- # A line-mode CLI or a shell answers with no whole-screen erase at- # all; waiting for one would only nudge it four more times.return- task = asyncio.get_running_loop().create_task(self._confirm_repaint(term, clears_before))+ try:+ loop = asyncio.get_running_loop()+ except RuntimeError:+ return+ # One check per pane: a dragged seam resizes many times a second, and+ # only the newest size's repaint is worth waiting for. An older check is+ # retired by the token below rather than cancelled — cancelling one in+ # the middle of its own nudge would leave the PTY a row short.+ token = object()+ self._repaint_check_by_pane[term.key] = token+ task = loop.create_task(self._confirm_repaint(term, clears_before, token))self._repaint_checks.add(task)task.add_done_callback(self._repaint_checks.discard)- async def _confirm_repaint(self, term: Terminal, clears_before: int) -> None:+ def _forget(_done: asyncio.Task[None], key: str = term.key) -> None:+ if self._repaint_check_by_pane.get(key) is token:+ del self._repaint_check_by_pane[key]++ task.add_done_callback(_forget)++ async def _confirm_repaint(+ self, term: Terminal, clears_before: int, token: object | None = None+ ) -> None:"""Repeat the nudge until the agent's screen has really been redrawn.Each retry uses the size the pane has NOW: a viewer may have resized itmeanwhile, and nudging back to the size captured earlier would undothat. A new process in the pane ends the check — its first paint is- whole anyway.+ whole anyway — and so does a newer check for the same pane (``token``)."""pty_id = term.pty_idgeneration = term.process_generation@@ -4632,6 +4660,8 @@ class Registry:returnif not term.pty_cols or not term.pty_rows:return+ if token is not None and self._repaint_check_by_pane.get(term.key) is not token:+ returnif attempt == REPAINT_NUDGE_ATTEMPTS:breakclears_before = term.replay.clears@@ -4842,9 +4872,17 @@ class Registry:# transcript keeps wrapping at the old width.if (term.transcript.cols, term.transcript.rows) == (cols, rows):return True+ clears_before = term.replay.clearsif not self._pool(term).resize(term.pty_id, cols, rows):return Falseterm.pty_cols, term.pty_rows = cols, rows+ # A viewer's resize is a repaint request like any nudge, and a busy+ # full-screen agent may let it pass (see ``REPAINT_CONFIRM_S``). The+ # viewer has already reflowed its grid, so an unanswered one leaves the+ # old frame shredded across the new rows until something else makes the+ # agent paint (seen after restoring a minimized window, 2026-09-28).+ # Checked, and re-nudged, like a re-join.+ self._watch_repaint(term, clears_before)# The TUI answers the new size with a full redraw — shadow it so a# finished pane does not read as "working" every time the grid# re-lays itself out (chat view toggle, maximize, a dragged seam).@@ -5274,9 +5312,7 @@ class Registry:term.computer_id = computer_idterm.remote_folder = placement.remote_folderterm.offload_snapshot = placement.offload_snapshot or ""- return (- "Moved with its conversation." if carried else "Moved; the agent starts fresh there."- )+ return "Moved with its conversation." if carried else "Moved; the agent starts fresh there."async def _bring_back_locked(self, session: Session, term: Terminal) -> str:from jarvis.computers.remote_terminal import pool_for, tmux_session_namediff --git a/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.tsx b/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.tsxindex 9595aadbee..5288d449a2 100644--- a/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.tsx+++ b/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.tsx@@ -383,6 +383,36 @@ function documentHidden(): boolean {return typeof document !== "undefined" && document.hidden === true;}+/**+ * The smallest window a pane will still measure itself in.+ *+ * Far below any window a person reads a terminal in, and far above the stub+ * a minimized desktop window leaves behind: WebView2 on Windows shrinks the+ * page to about 158x26 px while the app sits in the taskbar (measured+ * 2026-09-28). A pane measured in that stub is not a real measurement — the+ * full-width top pane still came out at the 10x4 floor, its agent redrew its+ * whole interface ten columns wide, and restoring the window left that frame+ * shredded over the real one until a click made the agent paint again.+ */+const MIN_WINDOW_WIDTH_PX = 320;+const MIN_WINDOW_HEIGHT_PX = 160;++/**+ * Is the window itself collapsed to a size no pane can honestly be fitted to?+ *+ * Deliberately not `document.hidden`: the desktop shell can report a window+ * that is plainly on screen as hidden for minutes (see `viewerMayOwn`), and a+ * pane that refused to fit then could not follow a real resize. The viewport's+ * own size cannot be wrong that way. A window that restores comes back through+ * the ResizeObserver, which measures again.+ */+export function windowCollapsed(+ width: number = typeof window !== "undefined" ? window.innerWidth : Infinity,+ height: number = typeof window !== "undefined" ? window.innerHeight : Infinity,+): boolean {+ return width < MIN_WINDOW_WIDTH_PX || height < MIN_WINDOW_HEIGHT_PX;+}+/*** A coding CLI a split may start.*@@ -1007,7 +1037,9 @@ export function AgenticTerminal({});/** Is this pane's tile something that can honestly be measured right now? */const measurable = () =>- container.clientWidth >= 8 && container.clientHeight >= 8;+ !windowCollapsed() &&+ container.clientWidth >= 8 &&+ container.clientHeight >= 8;/** Did the grid below come from the tile, or is it still the constructed default? */let mountMeasured = false;diff --git a/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.windowCollapsed.test.ts b/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.windowCollapsed.test.tsnew file mode 100644index 0000000000..3eb47fa2de--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.windowCollapsed.test.ts@@ -0,0 +1,17 @@+import { describe, expect, it } from "vitest";++import { windowCollapsed } from "./AgenticTerminal";++describe("windowCollapsed", () => {+ it("treats a minimized desktop window's stub as unmeasurable", () => {+ // WebView2 shrinks the page to about 158x26 px while minimized.+ expect(windowCollapsed(158, 26)).toBe(true);+ expect(windowCollapsed(0, 0)).toBe(true);+ });++ it("measures any window a person could read a terminal in", () => {+ expect(windowCollapsed(1265, 762)).toBe(false);+ expect(windowCollapsed(2560, 1392)).toBe(false);+ expect(windowCollapsed(320, 160)).toBe(false);+ });+});diff --git a/tests/unit/agentic_ide/test_session.py b/tests/unit/agentic_ide/test_session.pyindex 9729c210d1..fe07316bc6 100644--- a/tests/unit/agentic_ide/test_session.py+++ b/tests/unit/agentic_ide/test_session.py@@ -427,6 +427,39 @@ async def test_repaint_nudges_stop_at_the_bound_and_leave_the_real_size(assert sizes[-1] == (80, 24), "the pane must be left at the size it really is"+async def test_a_viewer_resize_the_agent_ignored_is_nudged_again(+ registry: Registry,+ fake_pty: FakePtyManager,+ tmp_path: Path,+ monkeypatch: pytest.MonkeyPatch,+) -> None:+ """A resize is a repaint request too, and an ignored one must not stick.++ Restoring a minimized window resizes every pane; a full-screen agent that+ let that pass left its old frame shredded across the new grid until a+ click made it paint (2026-09-28).+ """+ monkeypatch.setattr(session_mod, "REPAINT_CONFIRM_S", 0.02)+ monkeypatch.setattr(session_mod, "REPAINT_POLL_S", 0.005)+ await _open(registry, tmp_path, [{"agent": "claude"}])+ await registry.attach("T1", 80, 24, _noop_output, _noop_exit)+ term = registry.session.terminals[0]+ pty = term.pty_id+ await fake_pty.emit(pty, "\x1b[?1049h\x1b[2J\x1b[Hthe frame")+ fake_pty.resizes.clear()++ assert registry.resize(term.key, 120, 40) is True+ # The agent ignores the resize, then answers the first nudge.+ await asyncio.sleep(0.04)+ await fake_pty.emit(pty, "\x1b[2J\x1b[Hthe whole frame again")+ await asyncio.gather(*registry._repaint_checks)++ sizes = [(cols, rows) for tid, cols, rows in fake_pty.resizes if tid == pty]+ assert sizes[:3] == [(120, 40), (120, 39), (120, 40)]+ assert sizes[-1] == (120, 40), "the pane must be left at the size it really is"+ assert not registry._repaint_check_by_pane++async def test_a_line_mode_agent_is_nudged_once(registry: Registry, fake_pty: FakePtyManager, tmp_path: Path) -> None: