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): a split follows the subscription switch unless its anchor's seat was chosen deliberately
rubenluetke10-beep27d78c1f65c0
diff --git a/jarvis/agentic_ide/resume_store.py b/jarvis/agentic_ide/resume_store.pyindex 92936069d3..e80de8c8f4 100644--- a/jarvis/agentic_ide/resume_store.py+++ b/jarvis/agentic_ide/resume_store.py@@ -74,6 +74,12 @@ class SnapshotTerminal:# and silently start fresh. An absent value (an older snapshot) means "the# account that is active when it reopens" — the old behaviour exactly.account: str | None = None+ # True when that seat was chosen deliberately (wizard picker, explicit API+ # request, split of such a pane) rather than merely following the active+ # default. Splits of a restored pane consult it — see ``Terminal.account_pinned``.+ # Missing on older snapshots means False: an unpinned pane's splits follow+ # the switcher, which is the safe direction to fail in.+ account_pinned: bool = False# True only when the pane was observed actively working when its last live# state was checkpointed. This is the evidence the Continue control needs:# a conversation existing does not mean its last turn was interrupted.@@ -91,6 +97,7 @@ class SnapshotTerminal:"resume": self.resume.to_dict() if self.resume else None,"prompts_sent": self.prompts_sent,"account": self.account,+ "account_pinned": self.account_pinned,"continuation_needed": self.continuation_needed,}@@ -116,6 +123,7 @@ class SnapshotTerminal:if isinstance(data.get("account"), str)else None),+ account_pinned=data.get("account_pinned") is True,continuation_needed=data.get("continuation_needed") is True,)@@ -406,9 +414,7 @@ def _merged_with_stored(snapshot: Snapshot) -> Snapshot:Ordered newest-first and trimmed, so the file cannot grow without limit andthe offer leads with what was most recently worked in."""- stamped = [- w if w.saved_at else _restamp(w, snapshot.saved_at) for w in snapshot.workspaces- ]+ stamped = [w if w.saved_at else _restamp(w, snapshot.saved_at) for w in snapshot.workspaces]live_folders = {folder_key(w.folder) for w in stamped}try:stored = load()@@ -605,9 +611,7 @@ def _display_names() -> dict[str, str]:return {}-def snapshot_now(- workspaces: list[SnapshotWorkspace], *, active_session_id: str = ""-) -> Snapshot:+def snapshot_now(workspaces: list[SnapshotWorkspace], *, active_session_id: str = "") -> Snapshot:"""A snapshot of every open workspace, stamped with the current time."""now = time.time()return Snapshot(diff --git a/jarvis/agentic_ide/session.py b/jarvis/agentic_ide/session.pyindex fc2f1a7a9e..c52a072745 100644--- a/jarvis/agentic_ide/session.py+++ b/jarvis/agentic_ide/session.py@@ -113,9 +113,7 @@ if TYPE_CHECKING: # pragma: no cover - typing only## argv is built here rather than reused from jarvis.workspace.agents because the# IDE runs the agent as the PTY's OWN process, not inside a persistent shell.-AGENT_BINARIES: dict[str, str] = {- a.name: a.executable for a in workspace_agents.coding_agents()-}+AGENT_BINARIES: dict[str, str] = {a.name: a.executable for a in workspace_agents.coding_agents()}def is_coding_agent(agent: str) -> bool:@@ -142,6 +140,7 @@ def has_accounts(agent: str) -> bool:return agent in agent_accounts.platforms()+# A pane that runs the machine's own shell and nothing else — see `agent_argv`.# It is NOT in AGENT_BINARIES on purpose: it has no account, no conversation to# resume, and (deliberately) no prompt injection, and every one of those falls@@ -199,6 +198,7 @@ def _unavailable(agent: str) -> str:)return f"{pretty} cannot open: this machine has no shell Jarvis can start."+# How many panes one workspace may hold.## Raised from 12 on maintainer directive (2026-07-26): "you can open as many as@@ -793,9 +793,7 @@ def agent_argv(agent: str) -> tuple[str, ...] | None:return (exe, *spec.launch_args)-def _behind_win_shim(- spec: workspace_agents.WorkspaceAgent, shim: str-) -> tuple[str, ...] | None:+def _behind_win_shim(spec: workspace_agents.WorkspaceAgent, shim: str) -> tuple[str, ...] | None:"""What the Windows ``.cmd`` shim would have launched, launched directly.``cmd /c <shim>`` works and stays the fallback, but it wedges a second@@ -878,6 +876,16 @@ class Terminal:# that is already on screen — least of all one mid-conversation, which would# hand a resumed transcript to an account that has never seen it.account: str | None = None+ # True only when `account` was DELIBERATELY chosen — named in the wizard's+ # per-pane picker, passed explicitly to the API, or carried over by+ # splitting such a pane. False for a pane that simply followed the+ # workspace's active account at creation. Splits consult this: only a+ # deliberate seat is worth propagating. Without the distinction every pane+ # inherited its anchor's account, so in a workspace whose panes all shared+ # one seat the subscription switcher could never reach a single new pane —+ # the 2026-08-12 report: "I changed my subscriptions twice and it doesn't+ # change", with every split resurrecting the seat the user had just left.+ account_pinned: bool = Falsestatus: Status = "pending"pty_id: str | None = None# The geometry the PTY ACTUALLY holds, as last handed to `setwinsize`.@@ -1257,6 +1265,7 @@ class Terminal:resume=self.resume,prompts_sent=self.prompts_sent,account=self.account,+ account_pinned=self.account_pinned,continuation_needed=self.resume_continuation_needed,)@@ -1815,6 +1824,8 @@ class Registry:wanted = str(entry.get("name") or "").strip() or pool[index]name = _unique_name(wanted, used)used.add(normalize(name))+ requested_account = _requested_account(entry)+ resolved_account = resolve_account(agent, requested_account)terminals.append(Terminal(key=normalize(name) or f"t{index}",@@ -1828,7 +1839,13 @@ class Registry:# workspace that appears is the one that was shown.column=index // WIZARD_COLUMN_HEIGHT,slot=index % WIZARD_COLUMN_HEIGHT,- account=resolve_account(agent, _requested_account(entry)),+ account=resolved_account,+ # A seat named in the wizard is a deliberate choice and+ # travels through later splits; one that merely fell to+ # the active default (or an id that no longer resolves)+ # is not, and vouches for nothing.+ account_pinned=requested_account is not None+ and resolved_account == requested_account,))@@ -2087,8 +2104,13 @@ class Registry:except OSError as exc:raise SessionError(f"Cannot open {root}: {exc}") from exc- terminals = [- Terminal(+ def _restored(index: int, entry: resume_store.SnapshotTerminal) -> Terminal:+ # The remembered account, re-validated: a pane must come back on+ # the subscription whose history holds its conversation, and an+ # account deleted in the meantime falls back to the active one+ # rather than failing the reopen.+ account = resolve_account(entry.agent, entry.account)+ return Terminal(key=entry.key or normalize(entry.name) or f"t{index}",name=entry.name,agent=entry.agent,@@ -2100,14 +2122,14 @@ class Registry:resume=entry.resume,prompts_sent=entry.prompts_sent,resume_continuation_needed=entry.continuation_needed,- # The remembered account, re-validated: a pane must come back- # on the subscription whose history holds its conversation,- # and an account deleted in the meantime falls back to the- # active one rather than failing the reopen.- account=resolve_account(entry.agent, entry.account),+ account=account,+ # The pin survives the restart only while the seat it vouches+ # for does — a fallback onto the active account is not the+ # choice the snapshot remembered.+ account_pinned=entry.account_pinned and account == entry.account,)- for index, entry in enumerate(space.terminals)- ]++ terminals = [_restored(index, entry) for index, entry in enumerate(space.terminals)]# Which of them will come back mid-task, decided HERE rather than when# each pane's agent happens to start.#@@ -2453,9 +2475,7 @@ class Registry:session.surface_terminal = selected.name if selected is not None else ""prompt = session.find(prompt_target or "") if session.surface_on_screen else Nonesession.surface_prompt_target = (- prompt.name- if prompt is not None and accepts_prompts(prompt.agent)- else ""+ prompt.name if prompt is not None and accepts_prompts(prompt.agent) else "")return True@@ -2504,15 +2524,11 @@ class Registry:started = Truefinally:if started:- asyncio.get_running_loop().call_later(- COLD_START_SETTLE_S, gate.release- )+ asyncio.get_running_loop().call_later(COLD_START_SETTLE_S, gate.release)else:gate.release()- async def _acquire_agent_cold_start(- self, term: Terminal- ) -> asyncio.Semaphore | None:+ 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.The machine-wide gate protects CPU and process count. This narrower gate@@ -2822,9 +2838,7 @@ class Registry:# raising the flag again during attach would let a second click enqueue# the same nudge while the first is waiting for the input line.term.continuation_pending = (- term.resumed- and term.resume_continuation_needed- and not term.continue_when_ready+ term.resumed and term.resume_continuation_needed and not term.continue_when_ready)if not term.resumed:term.resume_continuation_needed = False@@ -2938,13 +2952,9 @@ class Registry:env = await asyncio.to_thread(self._prepare_spawn, term, session.folder)else:account_key = os.path.normcase(str(redirected_home))- account_gate = self._account_prepare_locks.setdefault(- account_key, asyncio.Lock()- )+ account_gate = self._account_prepare_locks.setdefault(account_key, asyncio.Lock())async with account_gate:- env = await asyncio.to_thread(- self._prepare_spawn, term, session.folder- )+ env = await asyncio.to_thread(self._prepare_spawn, term, session.folder)except SessionError as exc:term.status = "error"term.error = str(exc)@@ -3080,6 +3090,7 @@ class Registry:closing that workspace cancels it rather than leaving a nudge in flightfor a pane that no longer exists."""+async def _nudge() -> None:try:await self.send_prompt(@@ -3465,9 +3476,7 @@ class Registry:# Most recently foregrounded last: if this owner closes, ``detach`` can# promote the viewer the user interacted with most recently before it.term.watchers = [- watched- for watched in term.watchers- if not _same_viewer(watched.output, viewer)+ watched for watched in term.watchers if not _same_viewer(watched.output, viewer)]term.watchers.append(claimed)term.viewer_output = claimed.output@@ -3480,9 +3489,7 @@ class Registry:viewer=claimed.output,)- def pty_geometry(- self, key: str, workspace_id: str | None = None- ) -> tuple[int, int] | None:+ def pty_geometry(self, key: str, workspace_id: str | None = None) -> tuple[int, int] | None:"""The size this pane's agent is really drawing in, or ``None``.The answer a viewer needs to keep its own grid honest. ``resize`` is@@ -3563,9 +3570,7 @@ class Registry:if term_found is not None and term_found.pty_colselse None)- if current is None or (- current[0] >= MIN_VIEWER_COLS and current[1] >= MIN_VIEWER_ROWS- ):+ if current is None or (current[0] >= MIN_VIEWER_COLS and current[1] >= MIN_VIEWER_ROWS):logger.debug("Agentic IDE: kept {}'s working geometry instead of a {}x{} tile",key,@@ -3736,11 +3741,13 @@ class Registry:installed agent, which is how the UI offers a choice of coding CLI.``account`` names which subscription of that agent to run on. Without- one, a pane split off a NAMED anchor inherits that anchor's account —- splitting a pane that runs the second plan should stay on the second- plan, or a "split" would quietly move the work onto a different bill —- while every other new pane opens on the workspace's active account- (``set_active_account``).+ one, every new pane opens on the workspace's active account+ (``set_active_account``) — with one exception: a pane split off an+ anchor whose seat was DELIBERATELY chosen (wizard picker, explicit+ ``account``, or itself split off such a pane) stays on that seat, so+ multiplying a second-plan pane cannot quietly move the work onto a+ different bill. An anchor that merely followed the default vouches for+ nothing, and its splits follow the switch like every other new pane."""async with self._lock:session = self.session@@ -3776,31 +3783,51 @@ class Registry:final = _unique_name(wanted, used)# Which subscription the new pane opens on, when the caller named- # none. Two different questions, so two different answers:+ # none. The rule, in priority order:#- # * **A named anchor is a split** — "another one of these". It- # inherits, and only when the CLI matches (a Claude account id- # means nothing to Codex), so splitting a pane that runs the- # second plan cannot quietly move the work onto a different bill.- # * **Everything else is a NEW terminal** — the batch behind "open- # five more", the empty grid's button, the CLI. Those follow the- # workspace's active account, which is exactly the promise the- # account switcher makes: switching applies to new terminals.+ # * **An explicit ``account`` wins** and marks the pane as pinned —+ # this seat was chosen on purpose, so splits of it may carry it on.+ # * **A split of a PINNED pane inherits that seat** (only when the+ # CLI matches — a Claude account id means nothing to Codex), so a+ # pane deliberately opened on the second plan can be multiplied+ # without quietly moving the work onto a different bill.+ # * **Everything else follows the workspace's active account** —+ # the batch behind "open five more", the empty grid's button, the+ # CLI, and a split of a pane that itself only followed the default.#- # Anchor-less used to inherit from whatever pane happened to be last,- # which made the switch reach nothing a user could predict: flipping- # to the second seat and opening a terminal still billed the first.- if anchor and base is not None and base.agent == chosen:- inherited = base.account- else:- inherited = self.active_account_id(chosen)+ # That last clause is the 2026-08-12 fix. Splits used to inherit+ # their anchor's account unconditionally, and in a workspace whose+ # panes all shared one seat that made the subscription switcher+ # unreachable: the user switched twice, opened panes by splitting —+ # the dominant gesture — and every one resurrected the seat they had+ # just left ("I changed my subscriptions twice and it doesn't+ # change"). A pane that merely followed the default is not a+ # deliberate deviation, so it has no seat worth propagating; only a+ # chosen one does. (Anchor-less adds learned the same lesson+ # earlier: inheriting from whatever pane happened to be last made+ # the switch reach nothing a user could predict.)+ requested_account = (account or "").strip() or None+ if (+ requested_account is None+ and anchor+ and base is not None+ and base.agent == chosen+ and base.account_pinned+ ):+ requested_account = base.account+ resolved_account = resolve_account(chosen, requested_account)term = Terminal(key=normalize(final) or f"t{len(session.terminals)}",name=final,agent=chosen,display_name=agent_display(chosen),index=len(session.terminals),- account=resolve_account(chosen, account or inherited),+ account=resolved_account,+ # An unknown requested id falls back to the active account+ # (see resolve_account) — a fallback is not a choice, so it+ # must not be pinned as one.+ account_pinned=requested_account is not None+ and resolved_account == requested_account,)session.terminals.append(term)# Where it goes is the tree's business, and the distinction is the@@ -3868,9 +3895,7 @@ class Registry:breakreturn created, len(created) < wanted- async def move_terminal(- self, wanted: str, *, target: str, position: str = "swap"- ) -> Terminal:+ async def move_terminal(self, wanted: str, *, target: str, position: str = "swap") -> Terminal:"""Put an existing pane somewhere else in the grid.The rearranging half of the two-axis model ``add_terminal`` builds: no@@ -3917,9 +3942,7 @@ class Registry:# the four sides carve the TARGET's own rectangle — the same local# meaning the split buttons have, at any depth. The moved pane's# old room dissolves to its former siblings on the way out.- session.layout = layout_tree.move_pane(- session.layout, moved.key, anchor.key, position- )+ session.layout = layout_tree.move_pane(session.layout, moved.key, anchor.key, position)self._renumber(session)await self._persist()logger.info(@@ -3976,9 +3999,7 @@ class Registry:# a whole-workspace re-deal by definition, and carrying dragged# weights from an arrangement that no longer exists would re-fold# into something nobody has seen before.- session.layout = layout_tree.wizard_tree(- [t.key for t in session.terminals], depth- )+ session.layout = layout_tree.wizard_tree([t.key for t in session.terminals], depth)self._renumber(session)await self._persist()logger.info(@@ -4011,9 +4032,7 @@ class Registry:proposed = layout_tree.from_dict(layout)except ValueError as exc:raise SessionError(f"Unreadable layout: {exc}") from exc- if session.layout is not None and layout_tree.same_shape(- session.layout, proposed- ):+ if session.layout is not None and layout_tree.same_shape(session.layout, proposed):session.layout = layout_tree.adopt_weights(session.layout, proposed)await self._persist()else:@@ -4052,9 +4071,7 @@ class Registry:if not cleaned:raise SessionError("Give the terminal a name.")if len(cleaned) > MAX_TERMINAL_NAME:- raise SessionError(- f"Terminal names can be at most {MAX_TERMINAL_NAME} characters."- )+ raise SessionError(f"Terminal names can be at most {MAX_TERMINAL_NAME} characters.")if not normalize(cleaned):raise SessionError("Give the terminal a name with letters or numbers in it.")async with self._lock:@@ -4556,9 +4573,7 @@ def _unique_name(wanted: str, used: set[str]) -> str:if normalize(wanted) not in used:return wantedif position_of(wanted) is not None:- return free_positions(- [name for name in used if position_of(name) is not None], 1- )[0]+ return free_positions([name for name in used if position_of(name) is not None], 1)[0]suffix = 2while normalize(f"{wanted} {suffix}") in used:suffix += 1diff --git a/jarvis/ui/web/frontend/src/components/agentic/WorkspaceSettings.tsx b/jarvis/ui/web/frontend/src/components/agentic/WorkspaceSettings.tsxindex 2af32ca73d..cb3f4732ad 100644--- a/jarvis/ui/web/frontend/src/components/agentic/WorkspaceSettings.tsx+++ b/jarvis/ui/web/frontend/src/components/agentic/WorkspaceSettings.tsx@@ -171,10 +171,11 @@ export function WorkspaceSettings({<AgentAccountsPanelonActivate={activate}note={- "Switching applies to terminals opened from now on — the panes " +- "you already have keep the account they started with, so no " +- "running agent loses its conversation. Splitting a pane keeps " +- "that pane's account."+ "Switching applies to every terminal opened from now on, splits " ++ "included — the panes you already have keep the account they " ++ "started with, so no running agent loses its conversation. Only " ++ "a pane whose subscription was chosen deliberately (in the " ++ "workspace wizard) passes that choice on when you split it."}/></div>diff --git a/tests/unit/agentic_ide/test_account_spawn.py b/tests/unit/agentic_ide/test_account_spawn.pyindex 397070e742..3568ce7e2d 100644--- a/tests/unit/agentic_ide/test_account_spawn.py+++ b/tests/unit/agentic_ide/test_account_spawn.py@@ -230,7 +230,7 @@ async def test_switching_to_an_account_of_another_cli_is_refused(async def test_a_batch_of_terminals_opens_on_the_active_account(registry: Registry, tmp_path: Path) -> None:- """"Open five more" is five new terminals, so all five follow the switch."""+ """ "Open five more" is five new terminals, so all five follow the switch."""second = agent_accounts.create_account("claude", "Second seat")await registry.start(str(tmp_path), [{"agent": "claude"}])await registry.set_active_account("claude", second.id)@@ -239,16 +239,50 @@ async def test_a_batch_of_terminals_opens_on_the_active_account(assert [t.account for t in created] == [second.id] * 3-async def test_a_split_still_stays_on_its_anchor_after_a_switch(+async def test_a_split_of_a_default_pane_follows_the_switch(registry: Registry, tmp_path: Path) -> None:- """The switch governs NEW terminals; a split is "another one of these"."""+ """A pane that merely followed the default has no seat worth propagating.++ Splits used to inherit their anchor's account unconditionally, and in a+ workspace whose panes all shared one seat that made the switcher+ unreachable: every new pane was a split, every split resurrected the seat+ the user had just left, and the switch changed nothing anyone could see —+ the 2026-08-12 report, "I changed my subscriptions twice and it doesn't+ change". Only a DELIBERATELY chosen seat is inherited (the test below).+ """second = agent_accounts.create_account("claude", "Second seat")await registry.start(str(tmp_path), [{"agent": "claude"}])anchor = registry.session.terminals[0]await registry.set_active_account("claude", second.id)split = await registry.add_terminal(anchor=anchor.name, direction="down")- assert split.account == anchor.account+ assert split.account == second.id+++async def test_a_split_of_a_deliberately_seated_pane_keeps_that_seat(+ registry: Registry, tmp_path: Path+) -> None:+ """An explicitly chosen seat survives both the split and a later switch."""+ second = agent_accounts.create_account("claude", "Second seat")+ third = agent_accounts.create_account("claude", "Third seat")+ await registry.start(str(tmp_path), [{"agent": "claude", "account": second.id}])+ anchor = registry.session.terminals[0]+ await registry.set_active_account("claude", third.id)+ split = await registry.add_terminal(anchor=anchor.name, direction="down")+ assert split.account == second.id+++async def test_the_pin_travels_through_generations_of_splits(+ registry: Registry, tmp_path: Path+) -> None:+ """Splitting a split of a chosen seat is still "another one of these"."""+ second = agent_accounts.create_account("claude", "Second seat")+ await registry.start(str(tmp_path), [{"agent": "claude", "account": second.id}])+ first_split = await registry.add_terminal(+ anchor=registry.session.terminals[0].name, direction="down"+ )+ second_split = await registry.add_terminal(anchor=first_split.name, direction="down")+ assert second_split.account == second.idasync def test_the_state_names_the_active_account_in_words(@@ -447,8 +481,7 @@ async def test_same_account_setup_waiters_do_not_fill_the_default_executor(monkeypatch.setattr(registry, "_prepare_spawn", _blocking_prepare)tasks = [- asyncio.create_task(_attach(registry, term.name))- for term in registry.session.terminals+ asyncio.create_task(_attach(registry, term.name)) for term in registry.session.terminals]for _ in range(100):if entered.is_set():@@ -531,11 +564,14 @@ async def test_a_remembered_pane_carries_its_account_through_the_store() -> Nonesecond = agent_accounts.create_account("codex", "Second plan")pane = resume_store.SnapshotTerminal(- key="alex", name="Alex", agent="codex", account=second.id+ key="alex", name="Alex", agent="codex", account=second.id, account_pinned=True)restored = resume_store.SnapshotTerminal.from_dict(pane.to_dict())assert restored is not Noneassert restored.account == second.id+ # The pin rides along: a deliberately chosen seat must still be worth+ # propagating to splits after the app restarts.+ assert restored.account_pinned is Trueasync def test_an_older_snapshot_without_an_account_still_reopens() -> None:@@ -547,3 +583,6 @@ async def test_an_older_snapshot_without_an_account_still_reopens() -> None:)assert restored is not Noneassert restored.account is None+ # No pin on older snapshots: an unpinned pane's splits follow the+ # switcher, which is the safe direction to fail in.+ assert restored.account_pinned is False