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): replay a full-screen agent from its last whole-screen erase
rubenluetke10-beep7c450a113cf0
diff --git a/jarvis/agentic_ide/transcript.py b/jarvis/agentic_ide/transcript.pyindex f0e14d8786..143c246444 100644--- a/jarvis/agentic_ide/transcript.py+++ b/jarvis/agentic_ide/transcript.py@@ -250,6 +250,20 @@ class ReplayBuffer:# The tail is shorter than the sequence, so no erase is counted twice.self.clears += scanned.count(_FULL_CLEAR)self._clear_scan_tail = scanned[-(len(_FULL_CLEAR) - 1) :]+ erase = chunk.rfind(_FULL_CLEAR) if self.holds_screen else -1+ if erase >= 0:+ # A full-screen agent just emptied its screen, so everything it+ # drew before this is gone from it — and what follows is a frame+ # built from nothing, the one replay that rebuilds a viewer on its+ # own. Keeping the older bytes instead is what let the tail lose+ # its front: a busy agent's 128 KB fill within minutes, and a+ # viewer re-joining then got partial row updates for a frame it+ # never saw, rows drawn over rows until a repaint nudge was+ # answered — which a busy Claude Code does only half the time+ # (2026-09-29). The modes the dropped bytes negotiated are kept+ # the same way ``rebase_for_resize`` keeps them.+ self._rebase(chunk[erase:])+ returnself._chunks.append(chunk)self._size += len(chunk)while self._size > self.limit and len(self._chunks) > 1:@@ -326,13 +340,24 @@ class ReplayBuffer:those together with the stale drawing would repair the text whilesilently breaking the pane's mouse and scrollbar."""+ return self._rebase("")++ def _rebase(self, frame: str) -> str:+ """Start a fresh replay epoch: the negotiated modes, then ``frame``."""prologue = self._mode_prologue() + "\x1b[0m"self._chunks.clear()- self._size = 0self.truncated = Falseself._open_escape = Falseself._chunks.append(prologue)self._size = len(prologue)+ if frame:+ self._chunks.append(frame)+ self._size += len(frame)+ while self._size > self.limit and len(self._chunks) > 1:+ dropped = self._chunks.popleft()+ self._size -= len(dropped)+ self.truncated = True+ self._open_escape = _ends_mid_escape(dropped)return prologuedef clear(self) -> None:diff --git a/tests/unit/agentic_ide/test_transcript.py b/tests/unit/agentic_ide/test_transcript.pyindex 858cc2979a..13ac21d387 100644--- a/tests/unit/agentic_ide/test_transcript.py+++ b/tests/unit/agentic_ide/test_transcript.py@@ -342,6 +342,40 @@ def test_whole_screen_erases_are_counted_even_split_across_reads() -> None:assert buffer.clears == 2, "a rebase changes what is replayed, not what went past"+def test_a_whole_screen_erase_starts_a_replay_that_rebuilds_on_its_own() -> None:+ """Everything a full-screen agent drew before erasing its screen is gone.++ Kept anyway, those bytes filled the budget and pushed the frame's front out,+ so a re-joining viewer got row updates for a frame it never saw (2026-09-29).+ """+ buffer = ReplayBuffer(limit=200)+ buffer.feed("\x1b[?1049h\x1b[?1006h")+ buffer.feed("old frame " * 30)+ buffer.feed("spinner\x1b[2J\x1b[H> prompt box\r\n")+ buffer.feed("\x1b[1A\x1b[Kworking")++ replay = buffer.text()++ assert buffer.truncated is False, "the frame is whole, no repaint is needed"+ assert "old frame" not in replay+ assert "spinner" not in replay, "bytes before the erase in the same read go too"+ assert "\x1b[?1049h" in replay and "\x1b[?1006h" in replay+ assert replay.index("\x1b[?1049h") < replay.index("\x1b[2J")+ assert replay.endswith("\x1b[2J\x1b[H> prompt box\r\n\x1b[1A\x1b[Kworking")+ screen = ScreenBuffer(40, 6)+ screen.feed(replay)+ assert any("working" in row for row in screen.display())+++def test_a_line_mode_cli_erasing_its_screen_keeps_its_scrollback() -> None:+ """Only the alternate screen is repainted whole; a shell's history stays."""+ buffer = ReplayBuffer()+ buffer.feed("earlier output\r\n")+ buffer.feed("\x1b[2J\x1b[Hafter clear")++ assert buffer.text() == "earlier output\r\n\x1b[2J\x1b[Hafter clear"++def test_only_an_alternate_screen_agent_holds_the_screen() -> None:buffer = ReplayBuffer()buffer.feed("plain shell output")