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(chat): show the picked model at once in the Jarvis composer
rubenluetke10-beep08784e8492c3
diff --git a/jarvis/ui/web/agent_chat_routes.py b/jarvis/ui/web/agent_chat_routes.pyindex e4bd51d1bc..1212c6c9b0 100644--- a/jarvis/ui/web/agent_chat_routes.py+++ b/jarvis/ui/web/agent_chat_routes.py@@ -331,7 +331,6 @@ async def get_catalog(brain plugin drives — and no CLI is probed for its model list either."""svc = _service(request)- rows: list[dict[str, Any]] = []cli_seats = kit_for(surface).cli_seatsfrom jarvis.agent_chat.runner_cli import cli_catalog_scope@@ -353,6 +352,22 @@ async def get_catalog(ignore_user_config=kit_for(surface).brain_runner and cli_seats,):live_models = await _live_cli_models() if cli_seats else {}+ # Off the event loop: every CLI row resolves its binary on PATH, and that+ # many ``shutil.which`` walks cost ~0.3 s on a Windows PATH — a stall the+ # whole app shared on every composer open (AP-26 spirit, async-def freeze).+ rows = await asyncio.to_thread(_catalog_rows, surface, live_models)+ return {+ "providers": rows,+ "default_cwd": svc.default_cwd(surface),+ "shell": shell_label(),+ }+++def _catalog_rows(+ surface: str, live_models: dict[str, list[dict[str, Any]]]+) -> list[dict[str, Any]]:+ """The provider rows for ``surface`` with this machine's runner facts."""+ rows: list[dict[str, Any]] = []for row in rows_for(surface):d = row.to_dict()runner = resolve_runner(row.id, surface=surface)@@ -383,11 +398,7 @@ async def get_catalog(# to a seat that would read it as plain text.d["typeahead"] = list(typeahead.triggers_for(runner, surface))rows.append(d)- return {- "providers": rows,- "default_cwd": svc.default_cwd(surface),- "shell": shell_label(),- }+ return rows# ----------------------------------------------------------- typeaheaddiff --git a/jarvis/ui/web/frontend/src/components/agentchat/AgentComposer.tsx b/jarvis/ui/web/frontend/src/components/agentchat/AgentComposer.tsxindex d9acbf8058..e7f3c8d559 100644--- a/jarvis/ui/web/frontend/src/components/agentchat/AgentComposer.tsx+++ b/jarvis/ui/web/frontend/src/components/agentchat/AgentComposer.tsx@@ -136,6 +136,7 @@ export function AgentComposer({ autoFocus = false }: { autoFocus?: boolean }) {const surface = useAgentChat((s) => s.surface);const catalog = useAgentChat((s) => s.catalog);+ const catalogStale = useAgentChat((s) => s.catalogStale);const catalogError = useAgentChat((s) => s.catalogError);const backendOutdated = useAgentChat((s) => s.backendOutdated);const connections = useAgentChat((s) => s.connections);@@ -160,9 +161,10 @@ export function AgentComposer({ autoFocus = false }: { autoFocus?: boolean }) {const minimal: boolean = String(surface) === "jarvis";const voiceMode = useVoiceModeSwitch();+ // A copy from before paints the picks at once; the fresh read still runs.useEffect(() => {- if (!catalog) void loadCatalog();- }, [catalog, loadCatalog]);+ if (!catalog || catalogStale) void loadCatalog();+ }, [catalog, catalogStale, loadCatalog]);// A real call changed a seat's recorded health, or a key was saved or// removed somewhere: re-read the dots (a plain read — the server never@@ -495,6 +497,8 @@ export function AgentComposer({ autoFocus = false }: { autoFocus?: boolean }) {if (next !== draft.effort) void setDraft({ effort: next });}, [provider, effortLevels, draft.effort, setDraft]);+ const showEffort = Boolean(provider) && effortLevels.length > 1;+const effortGroups = useMemo<ComboboxGroup[]>(() => [{@@ -539,6 +543,7 @@ export function AgentComposer({ autoFocus = false }: { autoFocus?: boolean }) {const permissionValue = planOn ? draft.buildMode || provider?.default_permission_mode || "" : draft.permissionMode;const permissionDescription =(provider?.permission_modes ?? []).find((m) => m.id === draft.permissionMode)?.description ?? "";+ const permissionLabel = permissionModes.find((m) => m.id === permissionValue)?.label ?? "";const canSend =commands.isCommand || connected &&@@ -571,7 +576,7 @@ export function AgentComposer({ autoFocus = false }: { autoFocus?: boolean }) {className={cn("relative flex flex-col transition-[border-color,box-shadow]",minimal- ? "gap-1 rounded-2xl border border-border bg-card px-2.5 pb-2 pt-2.5 shadow-rim focus-within:border-border-strong"+ ? "gap-2 rounded-[22px] border border-border bg-card px-3 pb-2.5 pt-3 shadow-rim focus-within:border-border-strong": "gap-2 rounded-2xl border border-border-strong bg-card p-3 shadow-rim focus-within:border-primary/40",files.dragging && "border-primary/60",)}@@ -620,7 +625,7 @@ export function AgentComposer({ autoFocus = false }: { autoFocus?: boolean }) {pasteRescue.onPaste();files.onPaste(e);}}- className={cn("max-h-[50vh] scrollbar-jarvis", minimal ? "min-h-[44px] px-1.5 text-base" : "text-reading")}+ className={cn("max-h-[50vh] scrollbar-jarvis", minimal ? "min-h-[48px] px-1.5 text-base" : "text-reading")}/>{minimal ? (<div className="flex items-center gap-1" data-testid="composer-row">@@ -644,23 +649,27 @@ export function AgentComposer({ autoFocus = false }: { autoFocus?: boolean }) {}disabled={!connected || busy}/>- {/* The stance in words, like the Codex app: a person should read- "Full access" before sending, not decode a glyph. A stance that- asks for nothing wears the warning hue. */}+ {/* The stance as its glyph alone (maintainer, 2026-10-03): the+ front page runs on Bypass by default, and its shield in the+ warning hue already says "nothing asks" — spelling it out took+ half the row. The name stays in the tooltip and the list. */}{provider && permissionModes.length > 0 && (- <span title={locks?.permissionMode ?? permissionDescription} className="inline-flex min-w-0">+ <span+ title={locks?.permissionMode ?? [permissionLabel, permissionDescription].filter(Boolean).join(" — ")}+ className="inline-flex"+ ><Comboboxvalue={permissionValue}groups={permissionGroups}onChange={(v) => void setDraft({ permissionMode: v })}- ariaLabel={t("agent_chat.pick_permission")}+ ariaLabel={permissionLabel ? `${t("agent_chat.pick_permission")}: ${permissionLabel}` : t("agent_chat.pick_permission")}fallbackLabel={t("agent_chat.pick_permission")}disabled={Boolean(locks?.permissionMode)}testId="composer-permission"triggerHint={false}- chevron={false}+ iconOnlyclassName={cn(- "h-8 w-auto max-w-[200px] gap-1.5 rounded-full bg-transparent px-2 py-0 text-xs font-medium shadow-none hover:bg-secondary focus-visible:ring-1 [&_svg]:h-3.5 [&_svg]:w-3.5",+ "h-8 w-8 justify-center gap-0 rounded-full bg-transparent p-0 shadow-none hover:bg-secondary focus-visible:ring-1 [&_svg]:h-4 [&_svg]:w-4",permissionModeIcon(permissionValue) === ShieldOff? "text-warning [&_svg]:text-warning": "text-muted-foreground",@@ -690,6 +699,10 @@ export function AgentComposer({ autoFocus = false }: { autoFocus?: boolean }) {</button>)}<span className="flex-1" />+ {/* Model and effort read as one label — "Sonnet 5.5 High ⌄" — the+ way the Codex app draws its brain pick; each half still opens+ its own list. */}+ <span className="inline-flex min-w-0 items-center" data-testid="composer-brain"><PicktestId="composer-model"ariaLabel={t("agent_chat.pick_model")}@@ -715,9 +728,10 @@ export function AgentComposer({ autoFocus = false }: { autoFocus?: boolean }) {// The model reads as a word; the provider's mark (with its red// dot) only joins it when that seat is failing.triggerIcon={Boolean(provider?.connected && liveHealthFor(provider, health[provider.id])?.status === "error")}- chevron={false}+ chevron={!showEffort}+ compact/>- {provider && effortLevels.length > 1 && (+ {showEffort && (<PicktestId="composer-effort"ariaLabel={t("agent_chat.pick_effort")}@@ -728,8 +742,10 @@ export function AgentComposer({ autoFocus = false }: { autoFocus?: boolean }) {disabled={Boolean(locks?.effort)}title={locks?.effort}muted+ compact/>)}+ </span><inputref={fileInputRef}type="file"@@ -1141,6 +1157,7 @@ function Pick({muted = false,triggerIcon = true,chevron = true,+ compact = false,}: {testId: string;ariaLabel: string;@@ -1157,6 +1174,8 @@ function Pick({muted?: boolean;triggerIcon?: boolean;chevron?: boolean;+ /** Half of a joined label (the front page's model + effort): no side padding between the halves. */+ compact?: boolean;}) {// The Combobox draws the selected option's own icon; the leading glyph here// is the column's, shown when the option has none (model, effort, permission).@@ -1181,10 +1200,12 @@ function Pick({triggerIcon={triggerIcon}chevron={chevron}className={cn(- "h-7 w-auto max-w-[200px] gap-1.5 rounded-lg border-transparent bg-transparent py-0 pr-1.5 text-xs font-medium shadow-none",+ compact+ ? "h-8 w-auto max-w-[200px] gap-1 rounded-lg border-transparent bg-transparent px-1 py-0 text-sm font-medium shadow-none [&>svg:last-child]:h-3.5 [&>svg:last-child]:w-3.5"+ : "h-7 w-auto max-w-[200px] gap-1.5 rounded-lg border-transparent bg-transparent py-0 pr-1.5 text-xs font-medium shadow-none",muted ? "text-muted-foreground" : "text-foreground","hover:border-transparent hover:bg-secondary focus-visible:ring-1",- icon && !selectedHasIcon ? "pl-7" : "pl-1.5",+ compact ? undefined : icon && !selectedHasIcon ? "pl-7" : "pl-1.5",)}/></span>diff --git a/jarvis/ui/web/frontend/src/components/home/ChatStage.tsx b/jarvis/ui/web/frontend/src/components/home/ChatStage.tsxindex 03d80eec80..bee87ef10c 100644--- a/jarvis/ui/web/frontend/src/components/home/ChatStage.tsx+++ b/jarvis/ui/web/frontend/src/components/home/ChatStage.tsx@@ -69,16 +69,18 @@ function ChatStageContent() {const view = useTranscriptView(surface === "jarvis" ? activeSessionId : null, allItems);const items = view.items;const catalog = useAgentChat((s) => s.catalog);+ const catalogStale = useAgentChat((s) => s.catalogStale);const decide = useAgentChat((s) => s.decide);const loadCatalog = useAgentChat((s) => s.loadCatalog);const loadSessions = useAgentChat((s) => s.loadSessions);const voiceThreadId = useEventStore((s) => (s.activeKind === "voice" ? s.activeThreadId : null));const hasContent = items.length > 0;+ // A copy from before paints the picks at once; the fresh read still runs.useEffect(() => {- if (!catalog) void loadCatalog();+ if (!catalog || catalogStale) void loadCatalog();void loadSessions();- }, [catalog, loadCatalog, loadSessions]);+ }, [catalog, catalogStale, loadCatalog, loadSessions]);const providerLabel = useCallback((id: string) => catalog?.providers.find((p) => p.id === id)?.label ?? id,diff --git a/jarvis/ui/web/frontend/src/components/society/card/LeadSections.tsx b/jarvis/ui/web/frontend/src/components/society/card/LeadSections.tsxindex 4a5c8e6f48..a07eff9162 100644--- a/jarvis/ui/web/frontend/src/components/society/card/LeadSections.tsx+++ b/jarvis/ui/web/frontend/src/components/society/card/LeadSections.tsx@@ -30,9 +30,10 @@ export function LeadBrain() {const providerById = useAgentChatStore((s) => s.providerById);const loadCatalog = useAgentChatStore((s) => s.loadCatalog);const catalog = useAgentChatStore((s) => s.catalog);+ const catalogStale = useAgentChatStore((s) => s.catalogStale);useEffect(() => {- if (!catalog) void loadCatalog();- }, [catalog, loadCatalog]);+ if (!catalog || catalogStale) void loadCatalog();+ }, [catalog, catalogStale, loadCatalog]);const provider = providerById(draft.provider);return (<div className="flex flex-col gap-1.5">diff --git a/jarvis/ui/web/frontend/src/store/agentChat.test.ts b/jarvis/ui/web/frontend/src/store/agentChat.test.tsindex 54c27a3114..7c10632daf 100644--- a/jarvis/ui/web/frontend/src/store/agentChat.test.ts+++ b/jarvis/ui/web/frontend/src/store/agentChat.test.ts@@ -129,6 +129,31 @@ describe("agent-chat store surfaces", () => {expect(draft.buildMode).toBe("ask");expect(draft.effort).toBe("high");});++ it("paints the last catalog at once and keeps it across a new chat while it refreshes", async () => {+ // The composer showed "Provider" for seconds on every start and every new+ // chat: the catalog began empty and the route waits on CLI model lists.+ const calls = stubFetch([]);+ const first = createAgentChatStore("jarvis");+ expect(first.getState().catalog).toBeNull();+ await first.getState().loadCatalog();++ const next = createAgentChatStore("jarvis");+ expect(next.getState().catalog).toEqual(first.getState().catalog);+ expect(next.getState().catalogStale).toBe(true);+ await next.getState().loadCatalog();+ expect(next.getState().catalogStale).toBe(false);++ const before = calls.filter((c) => c.url.startsWith("/api/agent-chat/catalog")).length;+ next.getState().newChat();+ expect(next.getState().catalog).not.toBeNull();+ expect(next.getState().catalogStale).toBe(true);+ await vi.waitFor(() => expect(next.getState().catalogStale).toBe(false));+ expect(calls.filter((c) => c.url.startsWith("/api/agent-chat/catalog")).length).toBeGreaterThan(before);+ // Each surface keeps its own copy.+ expect(createAgentChatStore("agent").getState().catalog).toBeNull();+ });+beforeEach(() => {window.localStorage.clear();vi.stubGlobal("WebSocket", FakeSocket);diff --git a/jarvis/ui/web/frontend/src/store/agentChat.ts b/jarvis/ui/web/frontend/src/store/agentChat.tsindex ded42336cf..6749f689b0 100644--- a/jarvis/ui/web/frontend/src/store/agentChat.ts+++ b/jarvis/ui/web/frontend/src/store/agentChat.ts@@ -114,6 +114,14 @@ export interface AgentChatStore {readonly surface: AgentChatSurface;catalog: AgentChatCatalog | null;connections: AgentConnectionRow[];+ /**+ * The catalog on hand is a copy from before (the last start, or the chat+ * left behind), painted at once while a fresh read is on its way. The+ * composer used to show "Provider" for seconds on every start and every new+ * chat because the catalog route waits on CLI model lists; the picks now+ * read from this copy and settle when the fresh one lands.+ */+ catalogStale: boolean;catalogError: string | null;/*** The catalog answered without the fields this bundle reads (no permission@@ -200,6 +208,39 @@ function writeDraft(key: string, draft: ComposerDraft): void {}}+/** Where the last catalog a surface read is kept between starts. */+function catalogCacheKey(surface: AgentChatSurface): string {+ return `jarvis.agentChat.catalog.${surface}.v1`;+}++interface CatalogSnapshot {+ catalog: AgentChatCatalog;+ connections: AgentConnectionRow[];+}++function readCatalogSnapshot(surface: AgentChatSurface): CatalogSnapshot | null {+ try {+ const raw = window.localStorage.getItem(catalogCacheKey(surface));+ if (!raw) return null;+ const parsed = JSON.parse(raw) as Partial<CatalogSnapshot>;+ if (!parsed.catalog || !Array.isArray(parsed.catalog.providers)) return null;+ return {+ catalog: parsed.catalog,+ connections: Array.isArray(parsed.connections) ? parsed.connections : [],+ };+ } catch {+ return null; // storage blocked or a damaged copy — wait for the route+ }+}++function writeCatalogSnapshot(surface: AgentChatSurface, snapshot: CatalogSnapshot): void {+ try {+ window.localStorage.setItem(catalogCacheKey(surface), JSON.stringify(snapshot));+ } catch {+ /* storage blocked or full — the next start just waits for the route */+ }+}+function errorText(err: unknown): string {return err instanceof Error ? err.message : String(err);}@@ -411,10 +452,12 @@ export function createAgentChatStore(surface: AgentChatSurface, draftNamespace =};}+ const snapshot = readCatalogSnapshot(surface);return {surface,- catalog: null,- connections: [],+ catalog: snapshot?.catalog ?? null,+ connections: snapshot?.connections ?? [],+ catalogStale: snapshot !== null,catalogError: null,backendOutdated: false,liveModels: {},@@ -457,7 +500,8 @@ export function createAgentChatStore(surface: AgentChatSurface, draftNamespace =default_model: p.default_model ?? "",})),};- set({ catalog, connections, catalogError: null, backendOutdated });+ set({ catalog, connections, catalogStale: false, catalogError: null, backendOutdated });+ if (!backendOutdated) writeCatalogSnapshot(surface, { catalog, connections });// Deliberately not awaited: the sweep reads CLI logins and can take// a moment. It never sends a request to a provider — the dots show// the outcome of each seat's last real call. The composer paints@@ -510,7 +554,9 @@ export function createAgentChatStore(surface: AgentChatSurface, draftNamespace =}if (draft.provider) void get().loadModels(draft.provider);} catch (err) {- if (requestId === catalogRequest && sessionId === get().activeSessionId) set({ catalogError: errorText(err) });+ if (requestId === catalogRequest && sessionId === get().activeSessionId) {+ set({ catalogError: errorText(err), catalogStale: false });+ }}},@@ -627,7 +673,10 @@ export function createAgentChatStore(surface: AgentChatSurface, draftNamespace =timeline: EMPTY_TIMELINE,socketState: "idle",lastError: null,- catalog: null,+ // The chat left behind keeps the picks painted while this one's+ // fresh read runs; blanking the catalog showed "Provider" for+ // seconds on every new chat.+ catalogStale: get().catalog !== null,});bindVoice(null, opts?.voiceSessionId ?? null);void get().loadCatalog();diff --git a/jarvis/ui/web/frontend/src/store/newPaneChat.ts b/jarvis/ui/web/frontend/src/store/newPaneChat.tsindex aa62aac47c..9007062ff7 100644--- a/jarvis/ui/web/frontend/src/store/newPaneChat.ts+++ b/jarvis/ui/web/frontend/src/store/newPaneChat.ts@@ -184,6 +184,7 @@ export function createNewPaneChatStore(options: NewPaneChatOptions) {startable,catalog,connections: [],+ catalogStale: false,catalogError: null,backendOutdated: false,liveModels: {},diff --git a/jarvis/ui/web/frontend/src/store/paneChat.ts b/jarvis/ui/web/frontend/src/store/paneChat.tsindex 288fe44677..2d3f5b3d5e 100644--- a/jarvis/ui/web/frontend/src/store/paneChat.ts+++ b/jarvis/ui/web/frontend/src/store/paneChat.ts@@ -296,6 +296,7 @@ export function createPaneChatStore(options: PaneChatStoreOptions) {return {catalog: src.catalog,connections: src.connections,+ catalogStale: src.catalogStale,catalogError: src.catalogError,backendOutdated: src.backendOutdated,liveModels: src.liveModels,diff --git a/jarvis/workspace/launch_picks.py b/jarvis/workspace/launch_picks.pyindex 0457e2d126..07cc752b1d 100644--- a/jarvis/workspace/launch_picks.py+++ b/jarvis/workspace/launch_picks.py@@ -247,15 +247,23 @@ async def live_models() -> dict[str, list[dict[str, Any]]]:)out: dict[str, list[dict[str, Any]]] = {}- if _installed("claude-cli"):+ readers = {+ "agy-cli": read_agy_models,+ "codex-cli": read_codex_models,+ "grok-cli": read_grok_models,+ "opencode-cli": read_opencode_models,+ }+ # One trip off the loop for every installed-check: each is a PATH walk.+ found = await _off_loop(lambda: [r for r in ("claude-cli", *readers) if _installed(r)])+ if "claude-cli" in found:# A plan login publishes no model list; the public discovery feed is# what brings a new Claude release into the picker (claude_code_models).- from jarvis.brain.model_catalog import shared_catalog-- try:- await asyncio.wait_for(shared_catalog().refresh_discovery(), 3.0)- except Exception as exc: # noqa: BLE001 — the cached/curated list stands in- _log.debug("launch picks: model discovery unavailable: %s", exc)+ # Refreshed in the background: the picker answers from the copy on+ # hand (memory, else disk) and the next read carries the fresh feed.+ # Awaiting it here held every expired-cache catalog request for up+ # to three seconds, on top of the CLI budget below — the composer+ # showed "Provider" for most of that (2026-10-03).+ _refresh_discovery_in_background()# Every reader runs at once, and the answer waits at most# ``_LIVE_MODELS_BUDGET_S``: a cold ``agy models`` has taken well over a# minute on a real box, and summing the readers one after another kept the@@ -264,13 +272,7 @@ async def live_models() -> dict[str, list[dict[str, Any]]]:# so the next catalog request answers from it; this one leaves that# runner's curated fallback standing (its key stays absent, never an empty# list that would blank the picker).- readers = {- "agy-cli": read_agy_models,- "codex-cli": read_codex_models,- "grok-cli": read_grok_models,- "opencode-cli": read_opencode_models,- }- installed = await _off_loop(lambda: [r for r in readers if _installed(r)])+ installed = [r for r in found if r in readers]reads = {runner: _shared_read(runner, readers[runner]) for runner in installed}tasks = {runner: task for runner, (task, _) in reads.items()}# A read an EARLIER request started (still running past its budget) is not@@ -308,6 +310,28 @@ async def live_models() -> dict[str, list[dict[str, Any]]]:#: How long a catalog request waits for the CLIs' own model lists._LIVE_MODELS_BUDGET_S: Final = 3.0+#: The discovery-feed refresh in flight, so concurrent requests start one.+_DISCOVERY_REFRESH: Any = None+++def _refresh_discovery_in_background() -> None:+ """Start one refresh of the public model feed unless one is running."""+ import asyncio++ global _DISCOVERY_REFRESH+ if _DISCOVERY_REFRESH is not None and not _DISCOVERY_REFRESH.done():+ return+ from jarvis.brain.model_catalog import shared_catalog++ _DISCOVERY_REFRESH = asyncio.ensure_future(shared_catalog().refresh_discovery())+ _DISCOVERY_REFRESH.add_done_callback(_finish_discovery_refresh)+++def _finish_discovery_refresh(task: Any) -> None:+ if not task.cancelled() and task.exception() is not None:+ # The cached/curated list stands in; discovery only ever adds models.+ _log.debug("launch picks: model discovery unavailable: %s", task.exception())+#: Model-list reads that outlived their request, kept alive until they finish._BACKGROUND_READS: set[Any] = set()