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(ui): health dots re-read after key and provider events, never force a sweep

rubenluetke10-beep4f50dbb5dadb
diff --git a/jarvis/ui/web/frontend/src/components/ReadyCelebration.tsx b/jarvis/ui/web/frontend/src/components/ReadyCelebration.tsx
index 634bdc20e4..63d47783a3 100644
--- a/jarvis/ui/web/frontend/src/components/ReadyCelebration.tsx
+++ b/jarvis/ui/web/frontend/src/components/ReadyCelebration.tsx
@@ -9,8 +9,9 @@ import { cn } from "@/lib/utils";
* The one-time "all lights green" note.
*
* Shown exactly once: the first time every section the active voice mode
- * needs answers `ok` in the section-health rollup (Pipeline: brain, tool
- * model, voice out, voice in — Realtime: live voice, tool model, agents).
+ * needs is set up with no known failure in the section-health rollup
+ * (Pipeline: brain, tool model, voice out, voice in — Realtime: live voice,
+ * tool model, agents). The backend decides `ready`.
* The backend remembers the moment, so it never reappears — not after a
* restart, not when a key is rotated later. Inline inside onboarding, a
* banner above the top bar afterwards; same component, same truth.
@@ -49,8 +50,10 @@ export function ReadyCelebration({ inline = false }: { inline?: boolean }) {
let timer: number | undefined;
const onChange = () => {
window.clearTimeout(timer);
- // The section-health refresh runs real probes; collapse bursts.
- timer = window.setTimeout(() => void reload(true), 600);
+ // A plain re-read: readiness reads key presence and the outcomes of
+ // real calls, never a probe, and the server drops its cache on every
+ // key/provider change. Bursts are still collapsed into one read.
+ timer = window.setTimeout(() => void reload(false), 600);
};
REFRESH_EVENTS.forEach((e) => window.addEventListener(e, onChange));
return () => {
diff --git a/jarvis/ui/web/frontend/src/hooks/useProviders.section-health.test.tsx b/jarvis/ui/web/frontend/src/hooks/useProviders.section-health.test.tsx
index 5a5cf093fb..17cd4c4806 100644
--- a/jarvis/ui/web/frontend/src/hooks/useProviders.section-health.test.tsx
+++ b/jarvis/ui/web/frontend/src/hooks/useProviders.section-health.test.tsx
@@ -214,4 +214,27 @@ describe("provider-bound section health", () => {
expect(result.current.health.brain).toBeUndefined();
expect(fetchMock).toHaveBeenCalledTimes(1);
});
+
+ it("re-reads after a key save without forcing a server-side recompute", async () => {
+ // The rollup never probes a provider; every window hears a key save, so
+ // the follow-up is a plain read of what the server already knows.
+ const fetchMock = vi.fn().mockResolvedValue(
+ jsonResponse(
+ responseFor({ status: "unknown", reason: "unverified", detail: "", subject_id: "openai" }),
+ ),
+ );
+ vi.stubGlobal("fetch", fetchMock);
+ renderHook(() => useSectionHealth());
+ await waitFor(() => expect(fetchMock).toHaveBeenCalledTimes(1));
+
+ act(() => {
+ window.dispatchEvent(
+ new CustomEvent("jarvis:secret-configured", { detail: { key: "openai_api_key" } }),
+ );
+ });
+
+ await waitFor(() => expect(fetchMock).toHaveBeenCalledTimes(2));
+ const urls = fetchMock.mock.calls.map((call) => String(call[0]));
+ expect(urls.every((url) => !url.includes("refresh=true"))).toBe(true);
+ });
});
diff --git a/jarvis/ui/web/frontend/src/hooks/useProviders.ts b/jarvis/ui/web/frontend/src/hooks/useProviders.ts
index fd14e3d43c..b04bcc5923 100644
--- a/jarvis/ui/web/frontend/src/hooks/useProviders.ts
+++ b/jarvis/ui/web/frontend/src/hooks/useProviders.ts
@@ -482,9 +482,11 @@ export interface SectionHealthResponse {
}
/**
- * Fetches the per-tab health rollup. `refresh=true` bypasses the server-side
- * TTL cache — used right after a key save / provider switch so the dot reflects
- * the change immediately instead of a stale cached result.
+ * Fetches the per-tab health rollup. The server never probes a provider for
+ * it: it reads key presence and the outcomes of real calls (plus explicit
+ * Test clicks). Its cache is dropped by every key save, provider switch and
+ * newly recorded outcome, so a plain read is always current; `refresh=true`
+ * only recomputes the cheap local checks.
*/
export async function getSectionHealth(
refresh = false,
@@ -499,10 +501,11 @@ export async function getSectionHealth(
}
/**
- * Drives the tab status dots in the API-Keys view. Fetches once on mount (the
- * server runs the REAL connectivity test of each tier's active provider, cached
- * briefly) and re-fetches with `refresh=true` whenever a key is saved, a provider
- * is switched, or a manual per-card test completes — so the dot tracks live.
+ * Drives the tab status dots in the API-Keys view, the sidebar and the dock.
+ * Fetches once on mount and re-reads whenever a key is saved, a provider is
+ * switched, or a manual per-card test completes — so the dot tracks live.
+ * Every read is free: the server reports the last REAL outcome of each tier's
+ * active provider and never sends a request to find out (2026-09-30).
*
* Health is best-effort: a failed fetch leaves the map empty (no dots), never
* breaking the page.
@@ -535,8 +538,10 @@ export function useSectionHealth() {
useEffect(() => {
void reload(false);
// Debounced: one action can fire several of these events back-to-back
- // (switch + refetch + test). Each refresh runs REAL connectivity tests
- // server-side, so bursts are collapsed into a single trailing reload.
+ // (switch + refetch + test), and every window hears them; bursts are
+ // collapsed into a single trailing re-read. The re-read is a plain read —
+ // the server dropped its cache on the change itself, and nothing it does
+ // for this request reaches a provider.
let timer: number | undefined;
const clearSection = (section?: string) => {
setHealth((previous) => {
@@ -573,7 +578,7 @@ export function useSectionHealth() {
window.clearTimeout(timer);
if (event.type === "jarvis:provider-selection-pending") return;
- timer = window.setTimeout(() => void reload(true), 400);
+ timer = window.setTimeout(() => void reload(false), 400);
};
const events = [
"jarvis:secret-configured",
diff --git a/jarvis/ui/web/frontend/src/lib/agentChatApi.ts b/jarvis/ui/web/frontend/src/lib/agentChatApi.ts
index b3dc379e4b..4703f1e3f5 100644
--- a/jarvis/ui/web/frontend/src/lib/agentChatApi.ts
+++ b/jarvis/ui/web/frontend/src/lib/agentChatApi.ts
@@ -246,9 +246,10 @@ export async function fetchTypeahead(
}
/**
- * Which seats actually answer. Slow by nature — it makes one real request per
- * provider — so callers fire it beside the catalog and never await it before
- * painting. The backend caches a sweep for five minutes.
+ * Which seats actually answer, from the outcome of each seat's last real call
+ * (the backend never probes a provider for this). It still reads CLI logins,
+ * so callers fire it beside the catalog and never await it before painting.
+ * The backend reuses a sweep until a new outcome is recorded.
*/
export async function fetchProviderHealth(
surface: AgentChatSurface,
diff --git a/jarvis/ui/web/frontend/src/store/agentChat.ts b/jarvis/ui/web/frontend/src/store/agentChat.ts
index 7057290ef8..64c788b786 100644
--- a/jarvis/ui/web/frontend/src/store/agentChat.ts
+++ b/jarvis/ui/web/frontend/src/store/agentChat.ts
@@ -439,11 +439,11 @@ export function createAgentChatStore(surface: AgentChatSurface, draftNamespace =
})),
};
set({ catalog, connections, catalogError: null, backendOutdated });
- // Deliberately not awaited: the sweep makes one real request per
- // provider and can take seconds. The composer paints from the
- // catalog now and the dots appear when the answers arrive.
- // The society picker has no health dots. Opening its card must not
- // send model test requests to every configured provider.
+ // 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
+ // from the catalog now and the dots appear when the answer arrives.
+ // The society picker has no health dots, so it skips the sweep.
if (surface !== "society") void get().loadHealth();
// Settle the draft: an empty or unknown provider becomes the active
// sub-agent (else the first connected one); blank picks take the