Skip to content

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.

fix(providers): stop asking for a choice that does not exist (local model picker)

Ruben Lütkef7390c964a98
diff --git a/jarvis/ui/web/frontend/src/components/BrainModelSelector.fixed-catalog.test.tsx b/jarvis/ui/web/frontend/src/components/BrainModelSelector.fixed-catalog.test.tsx
new file mode 100644
index 0000000000..713bd80e94
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/BrainModelSelector.fixed-catalog.test.tsx
@@ -0,0 +1,132 @@
+/**
+ * A closed catalog must not be rendered as a choice.
+ *
+ * Field report 2026-07-29: the local Whisper card showed a MODEL dropdown with
+ * a search box and a "type a custom id" row — for a provider that offers
+ * exactly one model, the one the installer downloads. Two defects in one
+ * control:
+ *
+ * - a picker with a single entry asks the user to make a decision that does
+ * not exist;
+ * - the custom-id escape hatch let them name a model that is not on the
+ * machine, which for an on-device provider fails at the next spoken word.
+ *
+ * With `fixedCatalog` the control states what runs, and the custom row is gone
+ * even when several voices ARE installed.
+ */
+import { afterEach, describe, expect, it, vi } from "vitest";
+import { cleanup, fireEvent, render, screen, waitFor } from "@testing-library/react";
+
+import { BrainModelSelector } from "@/components/BrainModelSelector";
+
+vi.mock("@/i18n", () => ({
+ useT: () => (key: string) =>
+ ({
+ "apikeys_model.heading": "MODEL",
+ "apikeys_model.heading_voice": "VOICE",
+ "apikeys_model.choose_placeholder": "Choose a model…",
+ "apikeys_model.choose_voice": "Choose a voice…",
+ "apikeys_model.refresh": "Refresh",
+ "apikeys_model.no_models": "No models found",
+ "apikeys_model.loading": "Loading…",
+ "apikeys_model.search_placeholder": "Search models or type a custom id…",
+ "apikeys_model.use_custom": "Use {0}",
+ "apikeys_model.model_label": "Model",
+ })[key] ?? key,
+}));
+
+vi.mock("@/store/events", () => ({
+ useEventStore: (selector: (s: unknown) => unknown) =>
+ selector({ pushToast: () => {} }),
+}));
+
+function loader(ids: string[], selects: "model" | "voice" = "model") {
+ return async () => ({
+ provider: "faster-whisper",
+ current_model: "",
+ models: ids.map((id) => ({ id, label: id })),
+ source: "static" as const,
+ fetched_at: 0,
+ selects,
+ });
+}
+
+afterEach(() => {
+ cleanup();
+ vi.restoreAllMocks();
+});
+
+describe("fixed catalog", () => {
+ it("states the single model instead of offering a dropdown", async () => {
+ render(
+ <BrainModelSelector
+ providerId="faster-whisper"
+ fixedCatalog
+ loadModels={loader(["large-v3"])}
+ />,
+ );
+
+ await waitFor(() => {
+ expect(screen.getByTestId("fixed-model").textContent).toBe("large-v3");
+ });
+ expect(screen.queryByRole("button", { name: /model/i })).toBeNull();
+ expect(screen.queryByPlaceholderText(/custom id/i)).toBeNull();
+ });
+
+ it("still offers a picker when several voices are installed", async () => {
+ render(
+ <BrainModelSelector
+ providerId="piper-local"
+ fixedCatalog
+ loadModels={loader(["de-thorsten", "en-ryan", "es-dave"], "voice")}
+ />,
+ );
+
+ await waitFor(() => {
+ expect(screen.queryByTestId("fixed-model")).toBeNull();
+ });
+ expect(screen.getByRole("button", { name: /model/i })).toBeTruthy();
+ });
+
+ it("never offers a custom id on a closed catalog", async () => {
+ render(
+ <BrainModelSelector
+ providerId="piper-local"
+ fixedCatalog
+ loadModels={loader(["de-thorsten", "en-ryan"], "voice")}
+ />,
+ );
+
+ await waitFor(() => {
+ expect(screen.getByRole("button", { name: /model/i })).toBeTruthy();
+ });
+ fireEvent.click(screen.getByRole("button", { name: /model/i }));
+ const search = screen.getByPlaceholderText(/custom id/i);
+ fireEvent.change(search, { target: { value: "some-model-nobody-downloaded" } });
+
+ await waitFor(() => {
+ expect(screen.queryByTestId("use-custom-row")).toBeNull();
+ });
+ });
+
+ it("keeps the custom id for normal (cloud) providers", async () => {
+ render(
+ <BrainModelSelector
+ providerId="openrouter"
+ loadModels={loader(["a-model", "b-model"])}
+ />,
+ );
+
+ await waitFor(() => {
+ expect(screen.getByRole("button", { name: /model/i })).toBeTruthy();
+ });
+ fireEvent.click(screen.getByRole("button", { name: /model/i }));
+ fireEvent.change(screen.getByPlaceholderText(/custom id/i), {
+ target: { value: "org/some-new-model" },
+ });
+
+ await waitFor(() => {
+ expect(screen.getByTestId("use-custom-row")).toBeTruthy();
+ });
+ });
+});
diff --git a/jarvis/ui/web/frontend/src/components/BrainModelSelector.tsx b/jarvis/ui/web/frontend/src/components/BrainModelSelector.tsx
index 013b7ff93c..14c6d58bcb 100644
--- a/jarvis/ui/web/frontend/src/components/BrainModelSelector.tsx
+++ b/jarvis/ui/web/frontend/src/components/BrainModelSelector.tsx
@@ -113,6 +113,7 @@ export function BrainModelSelector({
controlled,
visionOnly,
loadModels,
+ fixedCatalog = false,
}: {
providerId: string;
currentModel?: string;
@@ -171,6 +172,16 @@ export function BrainModelSelector({
* brain catalog, so every existing call site is unchanged.
*/
loadModels?: (refresh: boolean) => Promise<BrainModelsResult>;
+ /**
+ * This provider's list is CLOSED: it is what is installed on the machine, and
+ * there is no custom id to type. On-device providers set it.
+ *
+ * With a single option it also drops the picker entirely and states what will
+ * run. A dropdown holding one entry — plus a search box inviting a "custom
+ * id" that would resolve to a model nobody downloaded — asks the user to make
+ * a choice that does not exist, and offers a way to break it.
+ */
+ fixedCatalog?: boolean;
}) {
const t = useT();
const pushToast = useEventStore((s) => s.pushToast);
@@ -363,6 +374,28 @@ export function BrainModelSelector({
}
}
+ // A closed catalog with one entry is not a choice. Say what runs and stop.
+ // (While the list is still loading, `models` is empty and we fall through to
+ // the normal control rather than flashing a wrong single-model line.)
+ if (fixedCatalog && models.length === 1) {
+ const only = models[0];
+ return (
+ <div
+ className="space-y-1.5"
+ onClick={(e) => e.stopPropagation()}
+ onDoubleClick={(e) => e.stopPropagation()}
+ >
+ <span className="text-[10px] uppercase tracking-wide text-muted-foreground">
+ {headingLabel ??
+ (selects === "voice" ? t("apikeys_model.heading_voice") : t("apikeys_model.heading"))}
+ </span>
+ <p className="text-xs text-foreground" data-testid="fixed-model">
+ {only.label || only.id}
+ </p>
+ </div>
+ );
+ }
+
return (
<div
ref={rootRef}
@@ -547,7 +580,11 @@ export function BrainModelSelector({
);
})}
- {trimmed && !exactMatch && (
+ {/* No custom-id escape hatch on a closed catalog: the options ARE
+ the files on this machine, so a typed id could only name
+ something that is not downloaded — an instant, self-inflicted
+ failure the moment the user speaks. */}
+ {trimmed && !exactMatch && !fixedCatalog && (
<li>
<button
type="button"
diff --git a/jarvis/ui/web/frontend/src/components/providers/ProviderTierSection.tsx b/jarvis/ui/web/frontend/src/components/providers/ProviderTierSection.tsx
index 13304d09b0..6e6f9919af 100644
--- a/jarvis/ui/web/frontend/src/components/providers/ProviderTierSection.tsx
+++ b/jarvis/ui/web/frontend/src/components/providers/ProviderTierSection.tsx
@@ -716,6 +716,40 @@ export function ProviderCard({
const isBrainSwitchable =
descriptor.tier !== "brain" || descriptor.brain_switchable !== false;
+ /**
+ * Prove the polish provider the user just picked can actually answer, and
+ * say so when it cannot.
+ *
+ * Runs AFTER the switch, never as a gate: a probe that fails for its own
+ * reasons must not be able to block a preference the user is entitled to
+ * set. Never throws — a verification that breaks has to stay quieter than
+ * the switch it is checking.
+ */
+ async function verifyPolishProvider() {
+ let result: ProviderTestResult;
+ try {
+ result = await testProvider(descriptor.id);
+ } catch (e) {
+ // Not the user's problem and not evidence about the provider: say
+ // nothing rather than raise a false alarm about a working switch.
+ console.debug("polish provider verification failed to run", e);
+ return;
+ }
+ if (result.status === "ok") return;
+ // The backend's sentence already names the cause AND the fix ("no credits",
+ // "model not pulled", "slower than the 1200 ms limit — raise it or pick a
+ // faster provider"), so it is shown verbatim instead of being flattened
+ // into a generic "does not work".
+ pushToast(
+ "warning",
+ `${descriptor.label} is selected, but it did not answer: ${
+ result.detail || result.status
+ }`,
+ );
+ // Let the card repaint with the health this test just produced.
+ onChanged();
+ }
+
async function activate(assumeConfigured = false) {
if (descriptor.active) return;
if (!isBrainSwitchable) {
@@ -787,6 +821,15 @@ export function ProviderCard({
await switchDictationPolishProvider(descriptor.polish_family || descriptor.id);
pushToast("success", `Dictation wording → ${descriptor.label}`);
window.dispatchEvent(new CustomEvent("jarvis:dictation-polish-switched"));
+ // A stored key is not a working provider, and this tier is where the
+ // gap bites hardest: the pass is INVISIBLE when it fails (it delivers
+ // the raw transcript), so an out-of-credits account, a model the host
+ // never pulled, or a family too slow for the latency budget all look
+ // exactly like "active and fine" on the card. Measured on a real
+ // install, four of five cards that read "ready" could not polish a
+ // sentence. So the switch verifies itself and says what it found —
+ // cheap here (a handful of tokens) and the only honest signal.
+ void verifyPolishProvider();
} else {
const result = await switchRealtimeProvider(descriptor.id);
const note = result.restart_required
@@ -1006,6 +1049,9 @@ export function ProviderCard({
recommendedModel={descriptor.recommended_model}
healthSection={descriptor.tier}
healthActive={descriptor.active}
+ // An on-device provider's list is what is installed here, so there
+ // is nothing to type — and with a single entry, nothing to pick.
+ fixedCatalog={Boolean(descriptor.local_runtime)}
/>
))}
diff --git a/jarvis/ui/web/provider_routes.py b/jarvis/ui/web/provider_routes.py
index 5f2fe76936..f9bebce392 100644
--- a/jarvis/ui/web/provider_routes.py
+++ b/jarvis/ui/web/provider_routes.py
@@ -369,6 +369,41 @@ def _local_runtime_payload(
}
+def _installed_local_models(provider_id: str, models: list[Any]) -> list[Any]:
+ """Drop catalog entries whose files are not on this machine.
+
+ A no-op for cloud providers and for any local entry the model catalog does
+ not describe as a downloadable bundle, so it can be applied unconditionally
+ (AP-21: locality is a catalog fact, not a provider name).
+ """
+ try:
+ from jarvis.speech.local_models import (
+ SHERPA_BUNDLES,
+ bundle_present,
+ get_local_provider,
+ )
+
+ if get_local_provider(provider_id) is None:
+ return models
+ kept = [
+ m
+ for m in models
+ if getattr(m, "id", "") not in SHERPA_BUNDLES
+ or bundle_present(getattr(m, "id", ""))
+ ]
+ except Exception as exc: # noqa: BLE001 — the picker must never 500
+ log.debug("Local model filter for %s failed (%s); listing all.", provider_id, exc)
+ return models
+ if len(kept) != len(models):
+ log.debug(
+ "Local provider %s: %d of %d catalogued models are downloaded.",
+ provider_id,
+ len(kept),
+ len(models),
+ )
+ return kept
+
+
def _spec_to_payload(
spec: ProviderSpec,
*,
@@ -1806,16 +1841,23 @@ async def list_brain_models(
catalog = _get_model_catalog(request)
result = await catalog.list_models(provider_id, force_refresh=refresh)
cfg = _resolve_cfg(request)
+ # On-device providers may only offer what is DOWNLOADED. The catalog lists
+ # every voice/model the provider can use, but a picker entry whose files are
+ # absent is an option that produces silence (TTS) or an error (STT) when
+ # chosen — the same "offered but not there" defect as a card claiming ready
+ # before it is installed. Filtered here rather than in the catalog so the
+ # catalog stays the complete list a download route can work from.
+ models = _installed_local_models(provider_id, result.models)
current = _current_selection(cfg, provider_id, cat)
# Safety net: for a curated TTS/STT list, never echo a value that isn't in the
# list (e.g. a stale global value belonging to a different provider) — show the
# placeholder instead. Brain keeps its value (custom model ids are allowed).
- if cat.tier != "brain" and current and current not in {m.id for m in result.models}:
+ if cat.tier != "brain" and current and current not in {m.id for m in models}:
current = ""
return BrainModelsResponse(
provider=provider_id,
current_model=current,
- models=[_brain_model_info(m) for m in result.models],
+ models=[_brain_model_info(m) for m in models],
source=result.source,
fetched_at=result.fetched_at,
selects=result.selects,