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(brain): a pick answering after its router lead is not a brain switch
rubenluetke10-beepbdbb2bdb4e7f
diff --git a/jarvis/agent_chat/runner_cli.py b/jarvis/agent_chat/runner_cli.pyindex 6478944aef..00e360ca8a 100644--- a/jarvis/agent_chat/runner_cli.py+++ b/jarvis/agent_chat/runner_cli.py@@ -42,6 +42,7 @@ from pathlib import Pathfrom typing import Any, Finalfrom jarvis.agent_chat import jarvis_harness+from jarvis.agent_chat.approval_bridge import approval_reffrom jarvis.agent_chat.effort import normalize_effort, snap_to_ladderfrom jarvis.agent_chat.events import make_eventfrom jarvis.agent_chat.permissions import normalize_permission@@ -1342,7 +1343,7 @@ async def run_cli_turn(session = handle.sessionresume = session.vendor_sessionident: jarvis_harness.Identity | None = None- ref = f"agent-chat:{session.session_id}"+ ref = approval_ref(session.session_id)if identity:ident = await jarvis_harness.build_identity(session_id=session.session_id,@@ -1425,7 +1426,7 @@ async def _run_cli_once(bridge: Any | None = None,) -> _Outcome:session = handle.session- approval_ref = f"agent-chat:{session.session_id}"+ chat_ref = approval_ref(session.session_id)cwd = Path(session.cwd or Path.home())effort = normalize_effort(session.provider, session.effort)planner = _PLANNERS[runner]@@ -1591,7 +1592,7 @@ async def _run_cli_once(if bridge is not None and subtype == "can_use_tool":# A Jarvis tool the CLI just asked about will hit the executor's# own gate over MCP in a moment; the person has answered once.- bridge.note_cli_approval(approval_ref, tool_name)+ bridge.note_cli_approval(chat_ref, tool_name)else:body = {"behavior": "deny", "message": message}frame = {diff --git a/jarvis/brain/manager.py b/jarvis/brain/manager.pyindex ff1466a809..b4e9eafaf6 100644--- a/jarvis/brain/manager.py+++ b/jarvis/brain/manager.py@@ -11906,10 +11906,15 @@ class BrainManager:"Fallback-Hit: %s(%s) — %d provider übersprungen",prov_name, model, idx,)- await self._bus.publish(BrainProviderSwitched(- from_provider=self._active_name,- to_provider=prov_name,- ))+ # Under an override the pick answering after its router+ # lead is the plan, not a fallback: the sidebar and its+ # "Brain -> X" toast follow this event, and the live brain+ # did not move (review 2026-08-25).+ if turn_override is None:+ await self._bus.publish(BrainProviderSwitched(+ from_provider=self._active_name,+ to_provider=prov_name,+ ))breakexcept Exception as exc: # noqa: BLE001last_exc = excdiff --git a/tests/unit/brain/test_turn_override.py b/tests/unit/brain/test_turn_override.pyindex cab364eab6..c94fb16949 100644--- a/tests/unit/brain/test_turn_override.py+++ b/tests/unit/brain/test_turn_override.py@@ -161,6 +161,42 @@ async def test_a_failing_override_turn_does_not_dead_list_the_provider_for_the_vassert (PICK, PICK_MODEL) not in mgr._dead_provider_models+async def test_a_fall_through_to_the_pick_never_announces_a_brain_switch() -> None:+ """Review 2026-08-25: the router lead falls through to the pick at chain index 1,+ and that used to publish BrainProviderSwitched — the sidebar then showed+ "Brain -> <chat model>" although the live brain had not moved."""+ from jarvis.core.events import BrainProviderSwitched++ mgr = _manager()+ scoped, unscoped = _seed(mgr, scoped_text="PICK_ANSWER")+ unscoped.supports_tools = False # the pick cannot call tools -> a lead runs first+ lead = FakeBrain(text_response="LEAD_TALKED") # picks no tool -> falls through+ # The lead runs under the chat's scope too (every instance of an overridden turn does).+ mgr._brain_cache[("gemini@agent", "gemini-flash")] = lead+ mgr._brain_cache[("gemini", "gemini-flash")] = FakeBrain(text_response="UNSCOPED_LEAD")+ mgr._first_tool_capable_provider = ( # type: ignore[assignment]+ lambda level, *, exclude=None: ("gemini", "gemini-flash")+ )+ switches: list[BrainProviderSwitched] = []++ async def _capture(event: BrainProviderSwitched) -> None:+ switches.append(event)++ mgr._bus.subscribe(BrainProviderSwitched, _capture)++ reply = await mgr.generate(+ "Erzähl mir bitte etwas über die Geschichte von Rom", # i18n-allow: a substantive turn+ use_history=False,+ turn_override=TurnOverride(provider=PICK, model=PICK_MODEL),+ )++ assert "PICK_ANSWER" in reply and "LEAD_TALKED" not in reply+ assert lead.calls and scoped.calls, "the lead ran first, the pick answered"+ assert switches == [], "a pick answering after its lead is the plan, not a switch"+ assert mgr._active_name == TALKER++# ------------------------------------------------------- tools and kwargs