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(agentic-ide): closing tabs one at a time no longer shrinks the offer
Ruben Lütke28c16ce11b1c
diff --git a/jarvis/agentic_ide/session.py b/jarvis/agentic_ide/session.pyindex aa832a61b4..f8c6cd6d12 100644--- a/jarvis/agentic_ide/session.py+++ b/jarvis/agentic_ide/session.py@@ -157,8 +157,12 @@ PASTE_START = "\x1b[200~"PASTE_END = "\x1b[201~"# What an agent TUI draws instead of the text when it collapses a paste into a-# placeholder ("[Pasted text #1 +12 lines]").-_PASTE_PLACEHOLDER_RE = re.compile(r"\[\s*pasted?\s+text[^\]]*\]", re.IGNORECASE)+# placeholder. The wording is per-TUI and changes between releases — Claude Code+# draws "[Pasted text #1 +12 lines]", Codex "[Pasted Content 2497 chars]" — so+# this matches the SHAPE (a bracketed summary that mentions pasting) rather than+# one vendor's phrasing. Keying on Claude Code's wording alone is what let a+# prompt sit visibly in a Codex box while the user was told it had been sent.+_PASTE_PLACEHOLDER_RE = re.compile(r"\[[^\]]*\bpaste\w*\b[^\]]*\]", re.IGNORECASE)def _opens_completion(payload: str) -> bool:@@ -1151,7 +1155,14 @@ class Registry:self._active = survivor.id if survivor else Noneif survivor is not None:self._focus_locked(survivor)- await self._persist()+ # Deliberately NOT re-written here. The restore point is refreshed by+ # activity — opening a workspace, adding a pane, connecting one — and+ # closing is not activity. Rewriting on close made the offer shrink one+ # workspace at a time: closing four of four left a restore point holding+ # one, which is the shape of "I closed everything for the day and got a+ # third of it back tomorrow". The cost of the other direction is a+ # workspace that lingers in the offer until something else happens, and+ # reopening one workspace too many is trivially undone.logger.info("Agentic IDE session ended: {}", session.id)def set_focus_mode(self, enabled: bool) -> bool:@@ -1717,13 +1728,25 @@ class Registry:submitted = await self._write_and_confirm(term, payload, manager, multiline)if not submitted and multiline:- logger.warning(- "Agentic IDE: {} did not accept a multi-line prompt — re-sending it on one line",- term.name,- )- payload = sanitize_prompt(payload)- multiline = False- submitted = await self._write_and_confirm(term, payload, manager, False)+ # Re-typing is only ever right for a pane that never RECEIVED the+ # paste. When the text is demonstrably still in the input box, a+ # second copy would land BEHIND the first and the next Enter would+ # submit both — so a stuck prompt is answered with Enter alone.+ if _input_line_holds(term.transcript.tail(10), _submit_needle(payload)):+ logger.warning(+ "Agentic IDE: {} still has the prompt in its input box — "+ "leaving it there rather than typing a second copy",+ term.name,+ )+ else:+ logger.warning(+ "Agentic IDE: {} did not accept a multi-line prompt — "+ "re-sending it on one line",+ term.name,+ )+ payload = sanitize_prompt(payload)+ multiline = False+ submitted = await self._write_and_confirm(term, payload, manager, False)term.prompts_sent += 1term.last_prompt = payloaddiff --git a/tests/unit/agentic_ide/test_resume_session.py b/tests/unit/agentic_ide/test_resume_session.pyindex 57158bd13a..5aef3ef124 100644--- a/tests/unit/agentic_ide/test_resume_session.py+++ b/tests/unit/agentic_ide/test_resume_session.py@@ -518,6 +518,50 @@ async def test_closing_every_workspace_still_keeps_them_resumable(assert {w.folder for w in saved.workspaces} == {str(first), str(second)}+async def test_closing_workspaces_one_by_one_keeps_all_of_them_on_offer(+ registry: ide.Registry, tmp_path: Path+) -> None:+ """The bug that survived the first fix, measured live.++ Closing used to re-write the restore point, so shutting four workspaces down+ one at a time narrowed the offer with every click and left a single workspace+ behind. The restore point is refreshed by activity, never by closing.+ """+ folders = []+ for index in range(3):+ folder = tmp_path / f"repo{index}"+ folder.mkdir()+ folders.append(folder)+ await registry.start(+ str(folder), [{"agent": "claude", "name": f"Pane{index}"}]+ )++ # One at a time, the way a person closes tabs.+ while await registry.end():+ pass++ saved = resume_store.load()+ assert saved is not None+ assert {w.folder for w in saved.workspaces} == {str(f) for f in folders}+++async def test_opening_something_new_refreshes_what_is_on_offer(+ registry: ide.Registry, tmp_path: Path+) -> None:+ """The other side of that coin: the offer must not accumulate forever."""+ old, new = tmp_path / "old", tmp_path / "new"+ old.mkdir()+ new.mkdir()+ await registry.start(str(old), [{"agent": "claude", "name": "Alex"}])+ await registry.end()++ await registry.start(str(new), [{"agent": "claude", "name": "Blake"}])++ saved = resume_store.load()+ assert saved is not None+ assert [w.folder for w in saved.workspaces] == [str(new)]++async def test_only_starting_fresh_discards_the_restore_point(registry: ide.Registry, tmp_path: Path) -> None:@@ -557,10 +601,15 @@ async def test_every_open_workspace_is_remembered_front_one_first(assert [w.folder for w in saved.workspaces] == [str(first), str(second)]-async def test_closing_one_of_two_leaves_the_survivor_resumable(+async def test_closing_one_of_two_leaves_both_on_offer(registry: ide.Registry, tmp_path: Path) -> None:- """Closing must never leave a restore point pointing at nothing."""+ """Closing must never leave a restore point pointing at nothing.++ It holds both: the survivor because it is still open, and the closed one+ because closing does not rewrite the offer. Reopening one workspace too many+ is trivially undone; losing one is not.+ """first = tmp_path / "first"second = tmp_path / "second"first.mkdir()@@ -572,9 +621,7 @@ async def test_closing_one_of_two_leaves_the_survivor_resumable(saved = resume_store.load()assert saved is not None- # The closed one is no longer open, so it is no longer remembered as open —- # the survivor is, and it is the one on screen.- assert [w.folder for w in saved.workspaces] == [str(first)]+ assert {w.folder for w in saved.workspaces} == {str(first), str(second)}assert registry.active_id == one.id