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(ui): sidebar footer follows the active voice mode
Ruben Lütke88911735bc04
diff --git a/jarvis/ui/web/frontend/src/components/layout/Sidebar.test.tsx b/jarvis/ui/web/frontend/src/components/layout/Sidebar.test.tsxindex 70d0c159d3..6cffddecf7 100644--- a/jarvis/ui/web/frontend/src/components/layout/Sidebar.test.tsx+++ b/jarvis/ui/web/frontend/src/components/layout/Sidebar.test.tsx@@ -32,6 +32,38 @@ vi.mock("@/hooks/usePluginAttention", () => ({: { count: 0, names: [] },}));+// useVoiceMode fetches /api/settings/voice-mode; mock it so the footer card's+// pipeline-vs-realtime split is driven by the test, not a fetch. The default+// mirrors a fresh pipeline install (the pre-existing footer tests rely on it).+const voiceModeMock = vi.hoisted(() => ({+ value: {+ mode: "pipeline",+ activeProvider: null as string | null,+ activeProviderLabel: null as string | null,+ activeModel: null as string | null,+ sessionActive: false,+ activeSessionMode: null as "pipeline" | "realtime" | null,+ activeSessionProvider: "",+ activeSessionModel: "",+ },+}));+vi.mock("@/hooks/useVoiceMode", () => ({+ useVoiceMode: () => voiceModeMock.value,+}));++function resetVoiceModeMock() {+ voiceModeMock.value = {+ mode: "pipeline",+ activeProvider: null,+ activeProviderLabel: null,+ activeModel: null,+ sessionActive: false,+ activeSessionMode: null,+ activeSessionProvider: "",+ activeSessionModel: "",+ };+}+function renderSidebar() {const client = new QueryClient({defaultOptions: {@@ -177,6 +209,91 @@ describe("Sidebar brain footer", () => {});});+describe("Sidebar footer in realtime voice mode", () => {+ beforeEach(() => {+ useEventStore.setState({+ voiceState: "idle",+ transcription: "",+ transcriptionFinal: true,+ connected: true,+ voiceReady: true,+ // The pipeline brain stays configured — it must NOT be what the footer+ // shows while the realtime engine owns the voice path.+ brainProvider: "openrouter",+ brainModel: "google/gemini-3.5-flash",+ });+ });++ afterEach(() => {+ cleanup();+ resetVoiceModeMock();+ });++ test("shows the realtime provider + model instead of the dormant pipeline brain", () => {+ // The bug: the footer said "OpenRouter / google/gemini-3.5-flash" while+ // Gemini Live was doing all the talking. In realtime mode the card must+ // follow the realtime engine.+ voiceModeMock.value = {+ ...voiceModeMock.value,+ mode: "realtime",+ activeProvider: "gemini-live",+ activeProviderLabel: "Gemini Live",+ activeModel: "gemini-3.1-flash-live-preview",+ };++ renderSidebar();++ expect(screen.getByTestId("sidebar-footer-tier").textContent).toBe("Realtime");+ expect(screen.getByText("Gemini Live")).toBeTruthy();+ expect(screen.getByTestId("sidebar-brain-model").textContent).toBe(+ "gemini-3.1-flash-live-preview",+ );+ expect(screen.queryByText("OpenRouter")).toBeNull();+ expect(screen.queryByText("google/gemini-3.5-flash")).toBeNull();+ });++ test("a RUNNING realtime session's live provider/model outrank the configured pick", () => {+ // Mid-call cross-family fallback (AP-22) must be visible: the session+ // crossed from Gemini to OpenAI, so the card shows the live engine.+ voiceModeMock.value = {+ ...voiceModeMock.value,+ mode: "realtime",+ activeProvider: "gemini-live",+ activeProviderLabel: "Gemini Live",+ activeModel: "gemini-3.1-flash-live-preview",+ sessionActive: true,+ activeSessionMode: "realtime",+ activeSessionProvider: "openai-realtime",+ activeSessionModel: "gpt-realtime-2.1",+ };++ renderSidebar();++ expect(screen.getByText("OpenAI Realtime")).toBeTruthy();+ expect(screen.getByTestId("sidebar-brain-model").textContent).toBe("gpt-realtime-2.1");+ });++ test("pipeline mode keeps the classic brain footer", () => {+ // Guard the split itself: mode "pipeline" must still show the brain card+ // even when a realtime provider is fully configured.+ voiceModeMock.value = {+ ...voiceModeMock.value,+ mode: "pipeline",+ activeProvider: "gemini-live",+ activeProviderLabel: "Gemini Live",+ activeModel: "gemini-3.1-flash-live-preview",+ };++ renderSidebar();++ expect(screen.getByTestId("sidebar-footer-tier").textContent).toBe("Brain");+ expect(screen.getByText("OpenRouter")).toBeTruthy();+ expect(screen.getByTestId("sidebar-brain-model").textContent).toBe(+ "google/gemini-3.5-flash",+ );+ });+});+describe("Sidebar assistant name header", () => {beforeEach(() => {useEventStore.setState({diff --git a/jarvis/ui/web/frontend/src/components/layout/Sidebar.tsx b/jarvis/ui/web/frontend/src/components/layout/Sidebar.tsxindex 34cce3f94c..4db86d04f4 100644--- a/jarvis/ui/web/frontend/src/components/layout/Sidebar.tsx+++ b/jarvis/ui/web/frontend/src/components/layout/Sidebar.tsx@@ -24,6 +24,7 @@ import {} from "lucide-react";import { useEventStore, type SectionId } from "@/store/events";import { useVoiceReadiness } from "@/hooks/useVoiceReadiness";+import { useVoiceMode } from "@/hooks/useVoiceMode";import { useSectionHealth } from "@/hooks/useProviders";import { usePluginAttention } from "@/hooks/usePluginAttention";import { cn } from "@/lib/utils";@@ -188,6 +189,36 @@ export function Sidebar() {const providerLabel = useMemo(() => prettyProviderName(brainProvider), [brainProvider]);+ // The footer card follows the VOICE MODE, not always the pipeline brain:+ // in realtime mode the pipeline brain is dormant, so showing it there+ // misled the user ("OpenRouter" while Gemini Live was doing all the talking).+ // A RUNNING realtime session's live provider/model outrank the configured+ // pick (a mid-call cross-family fallback must be visible, AP-22); when idle+ // the resolved provider + its pinned/default model are shown.+ const voiceMode = useVoiceMode();+ const realtimeFooter = voiceMode.mode === "realtime";+ const liveRealtimeSession =+ realtimeFooter &&+ voiceMode.sessionActive &&+ voiceMode.activeSessionMode === "realtime";+ const footerLabel = realtimeFooter+ ? t("sidebar.realtime_label")+ : t("sidebar.brain_label");+ const footerTooltip = realtimeFooter+ ? t("sidebar.realtime_tooltip")+ : t("sidebar.brain_tooltip");+ const footerProvider = realtimeFooter+ ? liveRealtimeSession && voiceMode.activeSessionProvider+ ? prettyProviderName(voiceMode.activeSessionProvider)+ : voiceMode.activeProviderLabel ??+ prettyProviderName(voiceMode.activeProvider ?? "unknown")+ : providerLabel;+ const footerModel = realtimeFooter+ ? liveRealtimeSession && voiceMode.activeSessionModel+ ? voiceMode.activeSessionModel+ : voiceMode.activeModel ?? ""+ : brainModel;+return (<aside className="flex h-full w-[280px] shrink-0 flex-col border-r border-border bg-card/40 backdrop-blur"><div className="border-b border-border px-4 py-4">@@ -285,23 +316,27 @@ export function Sidebar() {type="button"onClick={() => setActive("apikeys")}className="group flex w-full items-center gap-3 rounded-lg border border-border bg-background/40 px-3 py-2 text-left transition-colors hover:border-primary/40 hover:bg-background/60"- title={t("sidebar.brain_tooltip")}+ title={footerTooltip}><div className="h-2 w-2 rounded-full bg-primary shadow-[0_0_8px_rgba(255,214,10,0.7)]" /><div className="flex-1 min-w-0">- <div className="text-[10px] uppercase tracking-wider text-muted-foreground">- {t("sidebar.brain_label")}+ <div+ className="text-[10px] uppercase tracking-wider text-muted-foreground"+ data-testid="sidebar-footer-tier"+ >+ {footerLabel}</div>- <div className="text-xs font-medium truncate">{providerLabel}</div>- {/* The configured model id (e.g. "claude-opus-4-8") — the user asked- to see WHICH model is actually in use, not just the provider. */}- {brainModel && (+ <div className="text-xs font-medium truncate">{footerProvider}</div>+ {/* The model id actually in use (e.g. "claude-opus-4-8", or the+ realtime model in realtime mode) — the user asked to see WHICH+ model is in use, not just the provider. */}+ {footerModel && (<divclassName="text-[10px] text-muted-foreground/70 truncate"- title={brainModel}+ title={footerModel}data-testid="sidebar-brain-model">- {brainModel}+ {footerModel}</div>)}</div>@@ -402,6 +437,10 @@ function prettyProviderName(id: string): string {"openai": "OpenAI","codex": "Codex","mock": "Mock-Brain",+ // Realtime tier — used by the footer card in realtime voice mode when the+ // backend's pretty label is unavailable (cosmetic fallback only).+ "openai-realtime": "OpenAI Realtime",+ "gemini-live": "Gemini Live","unknown": "—",};return map[id] ?? id;diff --git a/jarvis/ui/web/frontend/src/hooks/useVoiceMode.ts b/jarvis/ui/web/frontend/src/hooks/useVoiceMode.tsindex d60605eb97..865da145e3 100644--- a/jarvis/ui/web/frontend/src/hooks/useVoiceMode.ts+++ b/jarvis/ui/web/frontend/src/hooks/useVoiceMode.ts@@ -7,6 +7,10 @@ type VoiceModeResp = {mode: string;realtime_available: boolean;active_provider: string | null;+ // Sidebar-footer display fields: pretty provider name + the model an idle+ // realtime session would use (configured pin or catalog default).+ active_provider_label: string | null;+ active_model: string | null;session_active: boolean;active_session_mode: "pipeline" | "realtime" | null;active_session_provider: string;@@ -88,6 +92,9 @@ export function useVoiceMode() {// false claim "Realtime needs an API key" and looked like a locked// toggle on a machine that merely had a slow/broken backend moment.statusKnown: q.isSuccess,+ activeProvider: q.data?.active_provider ?? null,+ activeProviderLabel: q.data?.active_provider_label ?? null,+ activeModel: q.data?.active_model ?? null,sessionActive: q.data?.session_active ?? false,activeSessionMode: q.data?.active_session_mode ?? null,activeSessionProvider: q.data?.active_session_provider ?? "",diff --git a/jarvis/ui/web/frontend/src/i18n/locales/de.json b/jarvis/ui/web/frontend/src/i18n/locales/de.jsonindex 21039ed2fe..a20c6b1072 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/de.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/de.json@@ -223,6 +223,8 @@"wake_hint": "Sag dein Wake-Word…","brain_label": "Brain","brain_tooltip": "Brain-Provider wechseln",+ "realtime_label": "Realtime",+ "realtime_tooltip": "Realtime-Provider wechseln","apikeys_alert": "Ein Anbieter ist eingerichtet, funktioniert aber nicht — zum Beheben API Keys öffnen","plugins_reconnect_alert": "Eine Plugin-Verbindung ist abgelaufen — zum Neuverbinden Skills & Tools öffnen","realtime_start": "Realtime-Sprache starten",diff --git a/jarvis/ui/web/frontend/src/i18n/locales/en.json b/jarvis/ui/web/frontend/src/i18n/locales/en.jsonindex e71b95b5d0..865e026164 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/en.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/en.json@@ -223,6 +223,8 @@"wake_hint": "Say your wake word…","brain_label": "Brain","brain_tooltip": "Switch brain provider",+ "realtime_label": "Realtime",+ "realtime_tooltip": "Switch Realtime provider","apikeys_alert": "A provider is set up but not working — open API Keys to fix it","plugins_reconnect_alert": "A plugin connection expired — open Skills & Tools to reconnect it","realtime_start": "Start Realtime Voice",diff --git a/jarvis/ui/web/frontend/src/i18n/locales/es.json b/jarvis/ui/web/frontend/src/i18n/locales/es.jsonindex 0da88a5f74..def3564459 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/es.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/es.json@@ -223,6 +223,8 @@"wake_hint": "Di tu palabra de activación…","brain_label": "Cerebro","brain_tooltip": "Cambiar proveedor de IA",+ "realtime_label": "Tiempo real",+ "realtime_tooltip": "Cambiar proveedor de tiempo real","apikeys_alert": "Un proveedor está configurado pero no funciona — abre API Keys para solucionarlo","plugins_reconnect_alert": "Una conexión de plugin expiró — abre Skills & Tools para volver a conectarla","realtime_start": "Iniciar Voz en Tiempo Real",diff --git a/jarvis/ui/web/settings_routes.py b/jarvis/ui/web/settings_routes.pyindex f86f7463d8..3cd313316e 100644--- a/jarvis/ui/web/settings_routes.py+++ b/jarvis/ui/web/settings_routes.py@@ -157,6 +157,43 @@ class VoiceModeBody(BaseModel):persist: bool = Field(default=True, description="Persist as boot default in jarvis.toml")+def _realtime_provider_display(+ cfg: object, provider_id: str | None+) -> tuple[str | None, str | None]:+ """(label, model) the sidebar shows for the resolved realtime provider.++ The label comes from the provider registry; the model is the pin in+ ``[brain.providers.<id>].model``, resolved to the curated catalog's default+ (always FIRST in its list) when unset — the same value an idle realtime+ session would actually connect with. Both are best-effort cosmetics: any+ failure degrades to ``None`` rather than breaking the status endpoint.+ """+ if not provider_id:+ return None, None+ label: str | None = None+ try:+ from jarvis.ui.web.provider_spec import get_spec++ spec = get_spec(provider_id)+ label = getattr(spec, "label", None) or None+ except Exception: # noqa: BLE001 — label is cosmetic, never fatal+ label = None+ model: str | None = None+ try:+ providers = getattr(getattr(cfg, "brain", None), "providers", None)+ pc = providers.get(provider_id) if isinstance(providers, dict) else None+ model = (getattr(pc, "model", None) or "") if pc is not None else ""+ if not model:+ from jarvis.brain.model_catalog import REALTIME_MODELS++ entries = REALTIME_MODELS.get(provider_id) or ()+ model = entries[0].id if entries else ""+ model = model or None+ except Exception: # noqa: BLE001 — model is cosmetic, never fatal+ model = None+ return label, model++@router.get("/voice-mode")async def get_voice_mode(request: Request) -> dict[str, object]:cfg = getattr(request.app.state, "config", None) or getattr(request.app.state, "cfg", None)@@ -166,6 +203,7 @@ async def get_voice_mode(request: Request) -> dict[str, object]:# session would actually build (Gemini-only users now get `true` too,# not just OpenAI — Feature A2).prov = _realtime_available_provider(cfg)+ prov_label, prov_model = _realtime_provider_display(cfg, prov)from jarvis.ui.web.voice_runtime import voice_engine_statusruntime = voice_engine_status(request)@@ -173,6 +211,12 @@ async def get_voice_mode(request: Request) -> dict[str, object]:"mode": mode,"realtime_available": prov is not None,"active_provider": prov,+ # Sidebar-footer display fields: the pretty provider name + the model+ # an idle realtime session would use (configured pin or catalog+ # default). A RUNNING session's live values are the separate+ # active_session_* fields below.+ "active_provider_label": prov_label,+ "active_model": prov_model,"session_active": bool(runtime.get("session_active", False)),"active_session_mode": runtime.get("active_session_mode"),"active_session_provider": str(diff --git a/tests/unit/web/test_voice_mode_route.py b/tests/unit/web/test_voice_mode_route.pyindex 09ebabe0ed..e8a5ce9133 100644--- a/tests/unit/web/test_voice_mode_route.py+++ b/tests/unit/web/test_voice_mode_route.py@@ -64,6 +64,10 @@ def test_get_voice_mode(monkeypatch):assert body["mode"] == "realtime"assert body["realtime_available"] is Trueassert body["active_provider"] == "openai-realtime"+ # Sidebar display fields: registry label + the catalog-default model (no+ # pin configured in this app fixture).+ assert body["active_provider_label"] == "OpenAI Realtime"+ assert body["active_model"] == "gpt-realtime"assert body["session_active"] is Falseassert body["active_session_mode"] is None@@ -84,6 +88,31 @@ def test_get_voice_mode_cross_family_gemini_only(monkeypatch):body = r.json()assert body["realtime_available"] is Trueassert body["active_provider"] == "gemini-live"+ assert body["active_provider_label"] == "Gemini Live"+ assert body["active_model"] == "gemini-3.1-flash-live-preview"+++def test_get_voice_mode_reports_pinned_realtime_model(monkeypatch):+ """A model pinned in [brain.providers.<id>].model outranks the catalog+ default in the sidebar display fields."""+ import jarvis.realtime.factory as rf++ def only_gemini(candidates):+ keys = {c[0] for c in candidates}+ return "sk-x" if "gemini_api_key" in keys else None++ monkeypatch.setattr(rf, "get_secret_any", only_gemini)+ app = _app(mode="realtime")+ app.state.config.brain = SimpleNamespace(+ providers={+ "gemini-live": SimpleNamespace(+ model="gemini-2.5-flash-native-audio-latest", voice=""+ )+ }+ )+ body = TestClient(app).get("/api/settings/voice-mode").json()+ assert body["active_provider"] == "gemini-live"+ assert body["active_model"] == "gemini-2.5-flash-native-audio-latest"def test_get_voice_mode_no_realtime_key_anywhere(monkeypatch):@@ -94,6 +123,8 @@ def test_get_voice_mode_no_realtime_key_anywhere(monkeypatch):body = r.json()assert body["realtime_available"] is Falseassert body["active_provider"] is None+ assert body["active_provider_label"] is None+ assert body["active_model"] is Nonedef test_put_voice_mode_invalid_is_400():