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(ide): repaint a pane that was resized while its agent was still loading

rubenluetke10-beep5f002dae85b0
diff --git a/jarvis/agentic_ide/session.py b/jarvis/agentic_ide/session.py
index 5892c3567b..0f572d28d3 100644
--- a/jarvis/agentic_ide/session.py
+++ b/jarvis/agentic_ide/session.py
@@ -1086,6 +1086,11 @@ class Terminal:
# Movement in the shadow of this stamp is the pane being redrawn, not the
# agent working — see `activity._resize_shadowed`.
last_resize_at: float | None = None
+ # Resized while its agent was still loading, before it had taken the whole
+ # screen — so no repaint check could run for that size, and a CLI that was
+ # not listening yet may still be drawing for the size it was born with.
+ # Settled once the input line appears (see `_prompt_ready_then_settle`).
+ resized_while_booting: bool = False
prompts_sent: int = 0
last_prompt: str = ""
# The current process's records are kept as a fallback if the local history
@@ -3656,6 +3661,35 @@ class Registry:
)
return term.name in ready
+ async def _prompt_ready_then_settle(self, session: Session, term: Terminal) -> bool:
+ """Wait for the input line, then repaint a pane resized while it loaded.
+
+ A fresh pane is spawned at the size its tile measured on mount, and the
+ grid settles a moment later — so its real size reaches the PTY while the
+ CLI is still booting. A CLI that is not listening for size changes yet
+ keeps drawing for the size it was born with: an interface narrower or
+ shorter than its pane, the input box floating mid-pane (reported
+ 2026-09-29, four panes opened together). The repaint check cannot catch
+ this, because it only runs once the agent has taken the whole screen.
+ One nudge after the input line appears — when the CLI certainly listens
+ — makes it lay out for the size the pane really has.
+ """
+ generation = term.process_generation
+ ready = await self._prompt_ready(session, term)
+ if (
+ ready
+ and term.process_generation == generation
+ and term.resized_while_booting
+ and term.replay.holds_screen
+ and term.pty_cols
+ and term.pty_rows
+ ):
+ term.resized_while_booting = False
+ # Shielded: the slot's ceiling may cancel this wait, and a nudge
+ # cut between its two resizes leaves the PTY a row short.
+ await asyncio.shield(self._nudge_repaint(term, term.pty_cols, term.pty_rows))
+ return ready
+
async def _acquire_agent_cold_start(self, term: Terminal) -> asyncio.Semaphore | None:
"""Take this CLI/account's boot slot when its registry entry needs one.
@@ -4052,6 +4086,7 @@ class Registry:
# can inherit the previous PTY's settled-screen evidence.
term.process_generation += 1
term.idle_seen = False
+ term.resized_while_booting = False
term.transcript.resize(cols, rows)
# Readiness belongs to this process. Keeping the dead process's screen
# here leaves old prompt sigils visible to the readiness probe and makes
@@ -4230,7 +4265,9 @@ class Registry:
try:
# One of a few starts at a time (see COLD_START_LIMIT), and the
# slot stays taken until this pane's input line appears.
- async with self._cold_start_slot(ready=lambda: self._prompt_ready(session, term)):
+ async with self._cold_start_slot(
+ ready=lambda: self._prompt_ready_then_settle(session, term)
+ ):
try:
identity = "pane:" + term.history_id
if term.stopping or self._locate(identity, session.id) != (session, term):
@@ -4678,6 +4715,9 @@ class Registry:
test, a script) simply goes unchecked.
"""
if not term.replay.holds_screen:
+ # Either a line-mode CLI, or a full-screen one still loading. The
+ # second cannot be checked yet, so it is settled after boot.
+ term.resized_while_booting = True
return
try:
loop = asyncio.get_running_loop()
diff --git a/tests/unit/agentic_ide/test_session.py b/tests/unit/agentic_ide/test_session.py
index e157f7b22b..65dcf42cf3 100644
--- a/tests/unit/agentic_ide/test_session.py
+++ b/tests/unit/agentic_ide/test_session.py
@@ -427,6 +427,63 @@ 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 _ready_now(_session: object, _term: object) -> bool:
+ return True
+
+
+async def test_a_pane_resized_while_its_agent_loaded_is_repainted_once_ready(
+ registry: Registry,
+ fake_pty: FakePtyManager,
+ tmp_path: Path,
+ monkeypatch: pytest.MonkeyPatch,
+) -> None:
+ """The grid settles while the CLI boots; its real size must be drawn for.
+
+ Four panes opened together were spawned at the mount-time size and resized
+ a moment later, before Claude Code listened for size changes — so it kept
+ laying out for the old size (2026-09-29). No repaint check can run before
+ the agent takes the whole screen, so the pane is nudged once it is ready.
+ """
+ monkeypatch.setattr(session_mod, "REPAINT_CONFIRM_S", 0.02)
+ monkeypatch.setattr(session_mod, "REPAINT_POLL_S", 0.005)
+ monkeypatch.setattr(registry, "_prompt_ready", _ready_now)
+ session = await _open(registry, tmp_path, [{"agent": "claude"}])
+ term = session.terminals[0]
+ await registry.attach(term.name, 114, 30, _noop_output, _noop_exit)
+ pty = term.pty_id
+ # Still loading: nothing has taken the screen yet.
+ assert registry.resize(term.key, 104, 30, session.id)
+ assert term.resized_while_booting
+ await fake_pty.emit(pty, "\x1b[?1049h\x1b[2J\x1b[Hdrawn for 114 columns")
+ fake_pty.resizes.clear()
+
+ assert await registry._prompt_ready_then_settle(session, term)
+
+ sizes = [(cols, rows) for tid, cols, rows in fake_pty.resizes if tid == pty]
+ assert sizes[:2] == [(104, 29), (104, 30)]
+ assert not term.resized_while_booting
+ await asyncio.gather(*registry._repaint_checks)
+ assert fake_pty.resizes[-1][1:] == (104, 30)
+
+
+async def test_a_pane_never_resized_while_loading_is_not_nudged(
+ registry: Registry,
+ fake_pty: FakePtyManager,
+ tmp_path: Path,
+ monkeypatch: pytest.MonkeyPatch,
+) -> None:
+ monkeypatch.setattr(registry, "_prompt_ready", _ready_now)
+ session = await _open(registry, tmp_path, [{"agent": "claude"}])
+ term = session.terminals[0]
+ await registry.attach(term.name, 104, 30, _noop_output, _noop_exit)
+ await fake_pty.emit(term.pty_id, "\x1b[?1049h\x1b[2J\x1b[Hdrawn for 104 columns")
+ fake_pty.resizes.clear()
+
+ assert await registry._prompt_ready_then_settle(session, term)
+
+ assert fake_pty.resizes == []
+
+
async def test_a_viewer_resize_the_agent_ignored_is_nudged_again(
registry: Registry,
fake_pty: FakePtyManager,