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(voice): seat a chat opened by a call on the person's chat model
rubenluetke10-beepaec6962e39a0
diff --git a/jarvis/agent_chat/voice_mirror.py b/jarvis/agent_chat/voice_mirror.pyindex 026336328e..3398e7ec77 100644--- a/jarvis/agent_chat/voice_mirror.py+++ b/jarvis/agent_chat/voice_mirror.py@@ -117,29 +117,58 @@ class VoiceChatMirror:@staticmethoddef _ensure_session(svc: Any, event: Any) -> Any | None:- """Create the first Jarvis chat so early voice turns are not lost.-- The provider is the voice turn's own when the chat offers it, else- the surface's first row. A caller that never opened the chat finds- the spoken history waiting instead of an empty page.+ """Create the Jarvis chat a call without one files into.++ The chat is seated on the person's own chat pick, never on the voice+ model: going back to typing must find the model they chose for the+ chat, not the realtime voice (whose model id is no chat model at+ all). In order: the last explicit chat pick, the seat of the newest+ Jarvis chat, the voice turn's provider when the chat offers it (with+ its default model), the surface's first row. A caller that never+ opened the chat finds the spoken history waiting instead of an empty+ page."""try:from jarvis.agent_chat.catalog import offers, rows_for- provider = str(getattr(event, "provider", "") or "").strip().lower()- if not offers(SURFACE, provider):- rows = rows_for(SURFACE)- provider = rows[0].id if rows else ""- if not provider:- return None- return svc.create_session(- provider=provider,- model=str(getattr(event, "model", "") or ""),- surface=SURFACE,- )+ seat = VoiceChatMirror._chat_seat(svc)+ if seat is None:+ provider = str(getattr(event, "provider", "") or "").strip().lower()+ if not offers(SURFACE, provider):+ rows = rows_for(SURFACE)+ provider = rows[0].id if rows else ""+ if not provider:+ return None+ seat = {"provider": provider}+ return svc.create_session(surface=SURFACE, **seat)except Exception as exc: # noqa: BLE001log.debug("voice chat mirror could not create a session: %s", exc)return None+ @staticmethod+ def _chat_seat(svc: Any) -> dict[str, str] | None:+ """The provider / model / effort the person last picked for the chat."""+ from jarvis.agent_chat.catalog import offers++ read_selection = getattr(svc.store, "chat_selection", None)+ selection = read_selection() if callable(read_selection) else None+ if selection is not None and offers(SURFACE, selection.provider):+ seat = {+ "provider": selection.provider,+ "model": selection.model,+ "effort": selection.effort,+ }+ if getattr(selection, "account_id", ""):+ seat["account_id"] = selection.account_id+ return seat+ newest = svc.store.list_sessions(limit=1, surface=SURFACE)+ if newest and offers(SURFACE, newest[0].provider):+ session = newest[0]+ seat = {"provider": session.provider, "model": session.model, "effort": session.effort}+ if getattr(session, "account_id", ""):+ seat["account_id"] = session.account_id+ return seat+ return None+__all__ = ["SURFACE", "VoiceChatMirror"]diff --git a/tests/unit/agent_chat/test_voice_mirror.py b/tests/unit/agent_chat/test_voice_mirror.pyindex 2e8b4ae4ca..8f33f59583 100644--- a/tests/unit/agent_chat/test_voice_mirror.py+++ b/tests/unit/agent_chat/test_voice_mirror.py@@ -228,3 +228,29 @@ def test_binding_rejects_unknown_and_foreign_surface_chats(tmp_path: Path) -> Nosvc.bind_voice_chat("missing")with pytest.raises(NoSuchSession):svc.bind_voice_chat(coding.session_id)+++def test_a_chat_opened_by_a_call_keeps_the_persons_chat_model(tmp_path: Path) -> None:+ async def scenario() -> None:+ svc = _service(tmp_path)+ typed = _open_session(svc)+ svc.bind_voice_chat(None)+ bus = EventBus()+ VoiceChatMirror(lambda: svc).attach(bus)+ await bus.publish(+ VoiceTurnCompleted(+ session_id="call-1",+ turn_id="t1",+ user_text="hello",+ jarvis_text="hi",+ provider="openai",+ model="gpt-realtime",+ )+ )+ created = svc.store.get_session(svc.voice_chat_id or "")+ assert created is not None and created.session_id != typed.session_id+ # Back on the keyboard, the chat runs on the seat picked for typing,+ # never on the realtime voice model.+ assert (created.provider, created.model) == (typed.provider, typed.model)++ asyncio.run(scenario())