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
perf: cut idle CPU — 25fps bar that settles when silent, slower self-probes, paced hotkey poll, calmer grid
rubenluetke10-beepc045ec87b3b1
diff --git a/jarvis/realtime/local_server/supervisor.py b/jarvis/realtime/local_server/supervisor.pyindex 9173c4090c..68c3d9a48d 100644--- a/jarvis/realtime/local_server/supervisor.py+++ b/jarvis/realtime/local_server/supervisor.py@@ -69,12 +69,18 @@ RUNTIME_READY_POLL_S = 0.5OWNED_STARTUP_TIMEOUT_S = RUNTIME_READY_TIMEOUT_S# The managed process is meant to be warm before a user calls. Poll its-# ownership cheaply once a second so an idle native crash starts recovering-# immediately; probe the full model pool often enough that an abandoned+# ownership every few seconds so an idle native crash starts recovering+# promptly (once a second cost ~1.6 % of a core on Windows, where each psutil+# status() walks the whole process table — CPU diet, 2026-08-22); probe the+# full model pool often enough that an abandoned# capacity-one session cannot make the next caller wait minutes. Replacement# still requires 30 seconds of continuously unavailable capacity and a second# generation-bound probe under the lifecycle lease.-RUNTIME_MONITOR_POLL_S = 1.0+RUNTIME_MONITOR_POLL_S = 5.0+#: Whether a crashed child can linger as a zombie that still answers+#: ``create_time()`` — POSIX yes, Windows never (module-level so a test can+#: exercise the POSIX path on any box).+_ZOMBIE_STATUS_POSSIBLE = os.name != "nt"RUNTIME_MONITOR_POOL_INTERVAL_S = 5.0RUNTIME_MONITOR_UNREADY_GRACE_S = 30.0@@ -476,11 +482,15 @@ def _process_create_time(pid: int) -> float | None:created = float(process.create_time())except Exception: # noqa: BLE001 — gone/denied both mean "not verifiable"return None- try:- if process.status() == psutil.STATUS_ZOMBIE:- return None- except Exception: # noqa: BLE001 — an unreadable status must not revoke ownership- log.debug("supervisor: process status probe failed for pid %s", pid, exc_info=True)+ # Zombies are a POSIX notion; on Windows ``status()`` is also by far the+ # most expensive psutil call (it enumerates every process on the box), so+ # the question is only asked where the answer can be "yes".+ if _ZOMBIE_STATUS_POSSIBLE:+ try:+ if process.status() == psutil.STATUS_ZOMBIE:+ return None+ except Exception: # noqa: BLE001 — an unreadable status must not revoke ownership+ log.debug("supervisor: process status probe failed for pid %s", pid, exc_info=True)return createddiff --git a/jarvis/trigger/backends/global_hotkeys.py b/jarvis/trigger/backends/global_hotkeys.pyindex 763375da28..94b5477406 100644--- a/jarvis/trigger/backends/global_hotkeys.py+++ b/jarvis/trigger/backends/global_hotkeys.py@@ -85,8 +85,8 @@ _KEY_MAP = {# and a jarvis.toml stay legible on every OS._MOUSE_TOKEN_TO_VK = {"mouse_middle": "0x04", # VK_MBUTTON- "mouse_x1": "0x05", # VK_XBUTTON1 (Back)- "mouse_x2": "0x06", # VK_XBUTTON2 (Forward)+ "mouse_x1": "0x05", # VK_XBUTTON1 (Back)+ "mouse_x2": "0x06", # VK_XBUTTON2 (Forward)}@@ -100,6 +100,7 @@ def _to_library_combo(normalized: str) -> str:parts = [p.strip() for p in normalized.split("+") if p.strip()]return " + ".join(_MOUSE_TOKEN_TO_VK.get(p, p) for p in parts)+# --------------------------------------------------------------------------# Module-level single-checker guard.#@@ -112,6 +113,49 @@ def _to_library_combo(normalized: str) -> str:_CHECKER_LOCK = threading.Lock()_CHECKER_REFCOUNT = 0+#: How often the library's checker thread samples the keyboard. The package+#: hardcodes ``time.sleep(0.02)`` in its polling loop — 50 ``GetAsyncKeyState``+#: sweeps a second for the life of the process, measured at ~0.9 % of one core+#: while nothing was pressed (CPU diet, 2026-08-22). A chord is HELD, not+#: tapped, so 20 samples a second detect it just as reliably at under half the+#: wake-ups; anything slower would start to feel late on press-to-talk.+HOTKEY_POLL_S = 0.05+++class _PacedTime:+ """``time`` stand-in for the library's checker module.++ Every sleep shorter than :data:`HOTKEY_POLL_S` is stretched to it; every+ other attribute (and every longer sleep, such as the library's 0.7 s+ checker-restart settle) passes straight through to the real module. Only+ the checker module sees this object — the process-wide ``time`` is untouched.+ """++ def __init__(self, real) -> None:+ self._real = real++ def sleep(self, seconds: float) -> None:+ self._real.sleep(seconds if seconds >= HOTKEY_POLL_S else HOTKEY_POLL_S)++ def __getattr__(self, name: str):+ return getattr(self._real, name)+++def _pace_checker_poll(gh) -> None:+ """Slow the library's checker loop to :data:`HOTKEY_POLL_S` — idempotent.++ The loop lives in ``global_hotkeys.hotkey_checker`` and reads ``time`` as a+ module global, so swapping that one name is the whole change. A library+ build without that module (or without a ``time`` global) is left alone.+ """+ checker = getattr(gh, "hotkey_checker", None)+ if checker is None:+ return+ current = getattr(checker, "time", None)+ if current is None or isinstance(current, _PacedTime):+ return+ checker.time = _PacedTime(current)+def _start_checker_once(gh) -> None:"""Start the shared checker on the 0->1 transition.@@ -122,6 +166,7 @@ def _start_checker_once(gh) -> None:global _CHECKER_REFCOUNTwith _CHECKER_LOCK:if _CHECKER_REFCOUNT == 0:+ _pace_checker_poll(gh)gh.start_checking_hotkeys()_CHECKER_REFCOUNT += 1@@ -360,9 +405,7 @@ class GlobalHotkeysBackend:# hand-written jarvis.toml could spell an existing chord differently and# slip past its duplicate check; comparing the token SETS ourselves is# what keeps that from arming one physical press twice.- taken = {- frozenset(c.replace(" ", "").split("+")) for c in registered_strings- }+ taken = {frozenset(c.replace(" ", "").split("+")) for c in registered_strings}for row in compat:keys = frozenset(row[0].replace(" ", "").split("+"))if keys in taken:@@ -423,8 +466,7 @@ class GlobalHotkeysBackend:# rows). Passing the rows is the bug that left stale state.gh.remove_hotkeys(self._combo_strings)except Exception: # noqa: BLE001 — teardown must never propagate- log.debug("remove_hotkeys during teardown failed (non-fatal)",- exc_info=True)+ log.debug("remove_hotkeys during teardown failed (non-fatal)", exc_info=True)self._registered = []self._combo_strings = []self._gh = Nonediff --git a/jarvis/ui/desktop_app.py b/jarvis/ui/desktop_app.pyindex df6208e526..b35ac8a3a0 100644--- a/jarvis/ui/desktop_app.py+++ b/jarvis/ui/desktop_app.py@@ -16,6 +16,7 @@ from __future__ import annotationsimport asyncioimport inspectimport json+import loggingimport osimport queueimport secrets@@ -1339,6 +1340,37 @@ def _make_conductor_announcer(# ---------------------------------------------------------------------------++class _HealthProbeLogFilter(logging.Filter):+ """Drop httpx's INFO line for the loopback ``/api/health`` probe.++ httpx logs one ``HTTP Request: GET …/api/health`` line per call. The+ blank-window watchdog probes on a timer for the whole life of the window,+ and that single line was 40 % of everything ``jarvis_desktop.log`` received+ while idle (2 011 of the last 5 000 lines on 2026-08-22) — noise that also+ costs the log-writer thread. Only the self-probe is dropped; every other+ httpx request (providers, Telegram, …) still logs as before.+ """++ def filter(self, record: logging.LogRecord) -> bool:+ try:+ message = record.getMessage()+ except Exception: # noqa: BLE001 — a malformed record is not ours to judge+ return True+ return not ("/api/health" in message and "127.0.0.1" in message)+++_health_probe_log_filter: _HealthProbeLogFilter | None = None+++def _silence_health_probe_log() -> None:+ """Install the filter once, on the logger httpx actually emits through."""+ global _health_probe_log_filter+ if _health_probe_log_filter is not None:+ return+ _health_probe_log_filter = _HealthProbeLogFilter()+ logging.getLogger("httpx").addFilter(_health_probe_log_filter)+class DesktopApp:"""Orchestrates the pywebview window + backend thread.@@ -4815,14 +4847,15 @@ class DesktopApp:# the attribute must also be allowed to go back to None on shutdown.client: Any = httpx.Client(timeout=1.0)self._health_http = client+ _silence_health_probe_log()return clientdef _backend_healthy(self) -> bool:"""One quick ``/api/health`` probe — is the server answering right now?- Deliberately single-shot and short: the blank-window watchdog asks once- a second and needs the ANSWER, including the honest "no" while the loop- is frozen. ``_wait_for_backend``'s poll and the lock holder's four-try+ Deliberately single-shot and short: the blank-window watchdog asks every+ few seconds and needs the ANSWER, including the honest "no" while the+ loop is frozen. ``_wait_for_backend``'s poll and the lock holder's four-tryprobe both mean something else.The client behind it is reused rather than rebuilt per call; seediff --git a/jarvis/ui/jarvisbar/overlay.py b/jarvis/ui/jarvisbar/overlay.pyindex afc8f0f52b..c1d5cb641e 100644--- a/jarvis/ui/jarvisbar/overlay.py+++ b/jarvis/ui/jarvisbar/overlay.py@@ -150,14 +150,29 @@ FRAME_STALL_THRESHOLD_NS = 2_000_000_000 # 2 s of silence ⇒ the loop is dead# only the render()/PhotoImage()/itemconfig() work is skipped._IDLE_SETTLE_TICKS = 30-# Adaptive pacing: the nominal target stays 16ms (~60fps aspirational — the-# real ceiling is lower, see above), but the actual next delay is derived-# from how long THIS tick took, not a blind constant. In the common case-# (render cost << 16ms) this is indistinguishable from the old fixed delay.-# It only matters after an unusually slow tick, where it schedules the next-# one sooner instead of adding a full 16ms on top of the overrun — this-# bounds how much a single slow frame can widen the gap to the next one.-TARGET_FRAME_MS = 16+# Silent-active skip (CPU diet, 2026-08-22): the equalizer is deterministic in+# (t, level) and ``bar_heights`` collapses to a flat row of ``min_h`` strokes+# the moment the level is zero — so a ``listen``/``speak`` bar with no sound+# (the wake listener waiting, which is the bar's state for HOURS) repaints the+# same pixels every tick just like the idle pill does. Those ticks go through+# the same settle counter: once the eased pill size and display level have+# converged, the render/PhotoImage/itemconfig work is skipped until sound,+# playback, a mode flip, hover or mute changes the tick key. Measured before+# the change: the tk thread alone cost ~6 % of one core while nothing was+# happening. ``think`` (the travelling sweep) and drop feedback stay+# time-dependent and are never skipped.++# Adaptive pacing: the nominal target is 40ms (25fps). The bar is a row of+# five strokes and a sweep — 25 updates/s is visually indistinguishable from+# the earlier 16ms target on this window style (whose measured DWM ceiling was+# ~31 updates/s anyway, see above) and costs a little over a third of the+# wake-ups. The actual next delay is derived from how long THIS tick took, not+# a blind constant. In the common case (render cost << target) this is+# indistinguishable from a fixed delay. It only matters after an unusually+# slow tick, where it schedules the next one sooner instead of adding a full+# target interval on top of the overrun — this bounds how much a single slow+# frame can widen the gap to the next one.+TARGET_FRAME_MS = 40MIN_FRAME_DELAY_MS = 1# Once the close-X is accepted, suppress rapid follow-up clicks long enough for@@ -809,9 +824,7 @@ class JarvisBarOverlay:)from jarvis.overlay.drop_target import make_drop_target- if make_drop_target().register(- self._canvas, dispatch_drop, self._set_drop_active- ):+ if make_drop_target().register(self._canvas, dispatch_drop, self._set_drop_active):# Only claim the return leg once the target actually registered# — a host without tkdnd has no drops to confirm, and leaving a# stale sink installed would point at a bar that never sees one.@@ -1009,9 +1022,7 @@ class JarvisBarOverlay:# Clamp to the monitor the bar sits on (measured at the new centre), not# the primary screen, so a resize near a secondary-monitor edge stays on# that monitor.- work = self._work_area_for_point(- new_x + renderer.WIN_W // 2, new_y + renderer.WIN_H // 2- )+ work = self._work_area_for_point(new_x + renderer.WIN_W // 2, new_y + renderer.WIN_H // 2)new_x, new_y = interaction.clamp_to_work_area(new_x,new_y,@@ -1065,9 +1076,7 @@ class JarvisBarOverlay:# runs while still withdrawn so it is invisible.if self._follow_cursor and self._project_onto_cursor_monitor():try:- self._root.geometry(- f"{renderer.WIN_W}x{renderer.WIN_H}+{self._x}+{self._y}"- )+ self._root.geometry(f"{renderer.WIN_W}x{renderer.WIN_H}+{self._x}+{self._y}")except Exception: # noqa: BLE001log.debug("jarvisbar follow-monitor reveal move failed", exc_info=True)@@ -1264,34 +1273,46 @@ class JarvisBarOverlay:# long before a file arrives, so the very frames the tick lives in# are exactly the ones the fast path skips.drop_visual = self._current_drop_visual()- tick_key = (effective_mode, self._hovered, self._muted, drop_visual)+ # A stale level (the feed stopped without a zero) renders as+ # silence, never as frozen dancing bars. getattr default:+ # ``__new__``-built test/hot-reload instances skip __init__; a+ # missing stamp reads as "never received".+ level = renderer.effective_ext_level(+ self._ext_level,+ now - getattr(self, "_last_level_rx_t", 0.0),+ )+ # Silent-active skip (see the TARGET_FRAME_MS block above): with no+ # level and no playback the equalizer is a flat, time-independent+ # row, so a silent listen/speak bar settles exactly like the idle+ # pill. The silence flag is part of the tick key so the first+ # audible sample (or playback starting) resets the counter and+ # renders immediately.+ silent = level <= 0.0 and not playing+ static_capable = effective_mode == "idle" or (+ effective_mode in ("listen", "speak") and silent+ )+ tick_key = (effective_mode, self._hovered, self._muted, drop_visual, silent)if tick_key != self._static_tick_key:self._static_tick_key = tick_keyself._static_tick_count = 0else:self._static_tick_count += 1- is_settled_idle = (- effective_mode == "idle"+ is_settled_static = (+ static_capableand drop_visual == renderer.DROP_STATE_NONEand self._static_tick_count >= _IDLE_SETTLE_TICKS)- if not is_settled_idle:+ if not is_settled_static:# The level is fed live per ~60 ms TTS sub-block# (player._write_samples), so the equalizer reacts to Jarvis's# actual loudness — thin and lively, exactly like it reacts to# your mic. No synthetic floor (that made the bars look- # uniformly blocky). A stale sample (the feed stopped without a- # zero) renders as silence, never as frozen dancing bars.- # getattr default: ``__new__``-built test/hot-reload instances- # skip __init__; a missing stamp reads as "never received".+ # uniformly blocky).img = self._renderer.render(t,effective_mode,- renderer.effective_ext_level(- self._ext_level,- now - getattr(self, "_last_level_rx_t", 0.0),- ),+ level,hovered=self._hovered,muted=self._muted,drop_state=drop_visual,@@ -1471,13 +1492,9 @@ class JarvisBarOverlay:finally:if self._running and self._root is not None:try:- self._root.after(- CURSOR_MONITOR_POLL_MS, self._schedule_cursor_monitor_guard- )+ self._root.after(CURSOR_MONITOR_POLL_MS, self._schedule_cursor_monitor_guard)except Exception: # noqa: BLE001- log.warning(- "JarvisBar cursor-monitor guard re-arm skipped", exc_info=True- )+ log.warning("JarvisBar cursor-monitor guard re-arm skipped", exc_info=True)# ------------------------------------------------------------------ ## Drag (reposition) + click (start a voice session) #@@ -1579,9 +1596,7 @@ class JarvisBarOverlay:something: a drop that produced nothing usable is exactly the casewhere silence would leave the user guessing."""- state = (- renderer.DROP_STATE_OK if accepted else renderer.DROP_STATE_REJECTED- )+ state = renderer.DROP_STATE_OK if accepted else renderer.DROP_STATE_REJECTEDif self._root is None:# Not started (or already torn down) — nothing to animate on.returndiff --git a/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.tsx b/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.tsxindex fa89f0a94e..735189f38f 100644--- a/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.tsx+++ b/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.tsx@@ -343,6 +343,13 @@ const RECAP_POLL_MS = 5000;*/const ACTIVITY_POLL_MS = 1500;+/**+ * The badge poll's cadence while every pane's agent has stopped and no+ * just-sent prompt is waiting for confirmation. Nothing can flip on its own+ * then, so the fast beat would only re-read the same answer.+ */+const ACTIVITY_POLL_IDLE_MS = 5000;+/*** How long a just-sent prompt is allowed to claim "working" on its own.*@@ -1037,17 +1044,30 @@ export function AgenticGrid({*/const [sentAt, setSentAt] = useState<Record<string, number>>({});+ // Mirror of `sentAt` the poll can read without re-creating itself: a pending+ // bridge means a badge is waiting for the backend's confirmation, which is+ // exactly when the fast cadence earns its keep.+ const sentPendingRef = useRef(false);+ useEffect(() => {+ sentPendingRef.current = Object.keys(sentAt).length > 0;+ }, [sentAt]);+useEffect(() => {if (!pollRecaps) return;let cancelled = false;let pulling = false;- const pull = async () => {- if (pulling) return;+ let timer: number | undefined;+ // Returns whether anything is in flight — that decides the next delay.+ const pull = async (): Promise<boolean> => {+ if (pulling) return true;pulling = true;try {const answer = await fetchTerminalActivity(session.id);- if (cancelled) return;+ if (cancelled) return false;const next = Object.fromEntries(answer.terminals.map((row) => [row.name, row]));+ const busy =+ answer.terminals.some((row) => row.activity === "working") ||+ sentPendingRef.current;// Same keep-identity guard as the recap poll above: most ticks change// nothing, and a fresh-but-equal object every 1.5 seconds would// re-render this very large component forty times a minute for it.@@ -1070,18 +1090,31 @@ export function AgenticGrid({? current: Object.fromEntries(keep);});+ return busy;} catch {// The recap poll warns for both feeds; a second warning per tick from- // the fast poll would only drown it.+ // the fast poll would only drown it. Keep the fast cadence so a+ // backend coming back is noticed within a beat.+ return true;} finally {pulling = false;}};- void pull();- const timer = window.setInterval(() => void pull(), ACTIVITY_POLL_MS);+ // Adaptive cadence: the fast beat only while a pane is working (or a+ // just-sent prompt is waiting to be confirmed) — that is when a badge+ // flipping late reads as broken. With every agent stopped nothing can+ // flip except by the user's own Send, which the optimistic bridge shows+ // at once, so the idle beat costs a third of the requests for the same+ // picture (CPU diet, 2026-08-22).+ const run = async () => {+ const busy = await pull();+ if (cancelled) return;+ timer = window.setTimeout(() => void run(), busy ? ACTIVITY_POLL_MS : ACTIVITY_POLL_IDLE_MS);+ };+ void run();return () => {cancelled = true;- window.clearInterval(timer);+ if (timer !== undefined) window.clearTimeout(timer);};}, [session.id, pollRecaps]);@@ -1890,14 +1923,32 @@ export function AgenticGrid({}};- // Past the 300 ms glide, then a slow patrol — measuring a dozen rects is- // cheap, but forcing layout more often than this buys nothing.+ // Past the 300 ms glide, then re-check whenever the surface actually+ // changes size (a ResizeObserver fires once per real layout change, not on+ // a clock), with a slow patrol as the safety net for drift that no resize+ // announces. The old 3 s patrol forced a layout measurement of a dozen+ // rects twenty times a minute for a workspace nobody was touching (CPU+ // diet, 2026-08-22).const first = window.setTimeout(check, 450);- const patrol = window.setInterval(check, 3000);+ const patrol = window.setInterval(check, 15000);+ let settle: number | undefined;+ const surfaceNode = canvasRef.current;+ const observer =+ surfaceNode && typeof ResizeObserver !== "undefined"+ ? new ResizeObserver(() => {+ // Let the glide finish before measuring, and coalesce a burst of+ // resize notifications into one check.+ if (settle !== undefined) window.clearTimeout(settle);+ settle = window.setTimeout(check, 350);+ })+ : null;+ observer?.observe(surfaceNode as Element);return () => {cancelled = true;window.clearTimeout(first);window.clearInterval(patrol);+ if (settle !== undefined) window.clearTimeout(settle);+ observer?.disconnect();};}, [guardActive, layout, session.terminals]);diff --git a/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.tsx b/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.tsxindex 2d251e2195..2667632125 100644--- a/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.tsx+++ b/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.tsx@@ -681,6 +681,15 @@ export function AgenticTerminal({focusedRef.current = focused;layoutBusyRef.current = layoutBusy;+ // Only the focused pane's cursor blinks. A blinking cursor repaints its pane+ // twice a second forever, and on a wall of a dozen idle terminals that was+ // the renderer's biggest standing cost (CPU diet, 2026-08-22). The unfocused+ // panes keep a steady cursor, so where the agent is typing stays visible.+ useEffect(() => {+ const term = termRef.current;+ if (term) term.options.cursorBlink = focused;+ }, [focused]);+useEffect(() => {const region = terminalRegionRef.current;if (!region) return;@@ -737,7 +746,8 @@ export function AgenticTerminal({// and the text under it accumulate different sub-pixel offsets and the// frame visibly bends. Monospace legibility comes from the line height.letterSpacing: 0,- cursorBlink: true,+ // Only the focused pane blinks — see the `focused` effect above.+ cursorBlink: focusedRef.current,cursorStyle: "bar",scrollback: 10000,// Required by the Unicode 11 width provider below.diff --git a/jarvis/ui/web/frontend/src/components/agentic/VoiceOrb.test.tsx b/jarvis/ui/web/frontend/src/components/agentic/VoiceOrb.test.tsxindex f775da9dce..9862a6a22a 100644--- a/jarvis/ui/web/frontend/src/components/agentic/VoiceOrb.test.tsx+++ b/jarvis/ui/web/frontend/src/components/agentic/VoiceOrb.test.tsx@@ -117,8 +117,38 @@ describe("voice orb renderer", () => {return 21;});+ // Idle only breathes, so it paints at 10 fps (every 100 ms) — half the+ // live rate, see IDLE_FRAME_INTERVAL_MS.render(<VoiceOrb state="idle" />);expect(display.drawImage).toHaveBeenCalledTimes(1);+ nextFrame?.(50);+ expect(display.drawImage).toHaveBeenCalledTimes(1);+ nextFrame?.(99);+ expect(display.drawImage).toHaveBeenCalledTimes(1);+ nextFrame?.(100);+ expect(display.drawImage).toHaveBeenCalledTimes(2);+ nextFrame?.(600_150);+ expect(display.drawImage).toHaveBeenCalledTimes(3);++ const meanDelta = snapshots[1].reduce(+ (total, value, index) => total + Math.abs(value - snapshots[2][index]),+ 0,+ ) / snapshots[1].length;+ expect(meanDelta).toBeLessThan(2);+ });++ it("paints live states at the full 20 fps", () => {+ setReducedMotion(false);+ vi.spyOn(performance, "now").mockReturnValue(0);+ const { display } = installCanvasContexts();+ let nextFrame: FrameRequestCallback | undefined;+ vi.spyOn(window, "requestAnimationFrame").mockImplementation((callback) => {+ nextFrame = callback;+ return 21;+ });++ render(<VoiceOrb state="listening" />);+ expect(display.drawImage).toHaveBeenCalledTimes(1);nextFrame?.(49);expect(display.drawImage).toHaveBeenCalledTimes(1);nextFrame?.(50);@@ -127,14 +157,6 @@ describe("voice orb renderer", () => {expect(display.drawImage).toHaveBeenCalledTimes(2);nextFrame?.(100);expect(display.drawImage).toHaveBeenCalledTimes(3);- nextFrame?.(600_150);- expect(display.drawImage).toHaveBeenCalledTimes(4);-- const meanDelta = snapshots[2].reduce(- (total, value, index) => total + Math.abs(value - snapshots[3][index]),- 0,- ) / snapshots[2].length;- expect(meanDelta).toBeLessThan(2);});it("moves the internal weather faster while thinking than while idle", () => {diff --git a/jarvis/ui/web/frontend/src/components/agentic/VoiceOrb.tsx b/jarvis/ui/web/frontend/src/components/agentic/VoiceOrb.tsxindex c425a94730..8529518460 100644--- a/jarvis/ui/web/frontend/src/components/agentic/VoiceOrb.tsx+++ b/jarvis/ui/web/frontend/src/components/agentic/VoiceOrb.tsx@@ -146,6 +146,14 @@ const CLOUD_LIGHT: Rgb = [255, 249, 216];const TEXTURE_SIZE = 48;const NOISE_SIZE = 64;const FRAME_INTERVAL_MS = 1000 / 20;+/**+ * The idle orb only breathes — a slow sine the eye cannot tell apart at 10 or+ * 20 frames a second — yet each frame repaints the whole weather texture pixel+ * by pixel. Idle is the orb's state for hours; halving its frame rate halves+ * the single largest standing cost of the renderer process (CPU diet,+ * 2026-08-22). Every live state keeps the full rate.+ */+const IDLE_FRAME_INTERVAL_MS = 1000 / 10;function mix(a: number, b: number, amount: number): number {return a + (b - a) * amount;@@ -450,7 +458,8 @@ export function VoiceOrb({let lastPaint = performance.now();drawFrame(lastPaint);let raf = requestAnimationFrame(function loop(now: number) {- if (now - lastPaint >= FRAME_INTERVAL_MS) {+ const interval = stateRef.current === "idle" ? IDLE_FRAME_INTERVAL_MS : FRAME_INTERVAL_MS;+ if (now - lastPaint >= interval) {drawFrame(now);lastPaint = now;}diff --git a/jarvis/ui/window_watchdog.py b/jarvis/ui/window_watchdog.pyindex 2524316e0b..e4f7b458ae 100644--- a/jarvis/ui/window_watchdog.py+++ b/jarvis/ui/window_watchdog.py@@ -47,8 +47,11 @@ from typing import Any, Literalfrom loguru import logger-#: How often the window is asked what it is showing.-POLL_S = 1.0+#: How often the window is asked what it is showing. Five seconds: every tick+#: is a page-state query plus a loopback ``/api/health`` request, and the+#: grace periods below are measured in tens of seconds, so a 1 s cadence only+#: bought 3 600 health requests an hour (CPU diet, 2026-08-22).+POLL_S = 5.0#: How long a window may show nothing before that counts as a failure. A cold#: WebView2 on a busy machine needs several seconds before it paints the bootdiff --git a/tests/unit/realtime/local_server/test_supervisor.py b/tests/unit/realtime/local_server/test_supervisor.pyindex 5b079f4a65..1e4f04fc18 100644--- a/tests/unit/realtime/local_server/test_supervisor.py+++ b/tests/unit/realtime/local_server/test_supervisor.py@@ -1904,9 +1904,31 @@ def test_a_zombie_child_is_never_mistaken_for_a_live_server(monkeypatch) -> Nonereturn psutil.STATUS_ZOMBIEmonkeypatch.setattr(psutil, "Process", _Zombie)+ monkeypatch.setattr(supervisor, "_ZOMBIE_STATUS_POSSIBLE", True)assert supervisor._process_create_time(4711) is None+def test_windows_never_pays_for_a_status_probe(monkeypatch) -> None:+ """Windows has no zombies, and ``status()`` there walks the whole process+ table — the monitor asks it every few seconds, so the question is skipped+ where the answer cannot be "zombie" (CPU diet, 2026-08-22)."""+ import psutil++ class _Live:+ def __init__(self, pid: int) -> None:+ self.pid = pid++ def create_time(self) -> float:+ return 1000.0++ def status(self) -> str:+ raise AssertionError("status() must not be consulted on Windows")++ monkeypatch.setattr(psutil, "Process", _Live)+ monkeypatch.setattr(supervisor, "_ZOMBIE_STATUS_POSSIBLE", False)+ assert supervisor._process_create_time(4711) == 1000.0++def test_a_running_process_keeps_its_verified_ownership(monkeypatch) -> None:"""The zombie guard must not cost a healthy server its identity."""import psutildiff --git a/tests/unit/trigger/test_hotkey_backends.py b/tests/unit/trigger/test_hotkey_backends.pyindex 0eb78dba0c..ccd3de3688 100644--- a/tests/unit/trigger/test_hotkey_backends.py+++ b/tests/unit/trigger/test_hotkey_backends.py@@ -413,9 +413,7 @@ def test_noop_backend_logs_once_then_no_ops(caplog):with caplog.at_level(logging.INFO, logger="jarvis.trigger.backends.noop"):NoopBackend()NoopBackend() # second construction must NOT log again- explained = [- r for r in caplog.records if "Global hotkeys are unavailable" in r.getMessage()- ]+ explained = [r for r in caplog.records if "Global hotkeys are unavailable" in r.getMessage()]assert len(explained) == 1, "the explanation must log exactly once"@@ -503,9 +501,7 @@ def test_pynput_linux_right_alt_drives_one_ptt_edge_pair():edges: list[str] = []backend = PynputBackend()- backend.register(- [["alt + l", lambda: edges.append("down"), lambda: edges.append("up")]]- )+ backend.register([["alt + l", lambda: edges.append("down"), lambda: edges.append("up")]])right_alt = types.SimpleNamespace(char=None, name="alt_r")letter_l = types.SimpleNamespace(char="l", name=None)@@ -776,9 +772,7 @@ def test_quartz_backend_delivers_one_ptt_edge_pair() -> None:edges: list[str] = []backend = QuartzHotkeyBackend()backend._permission_check = lambda: True- backend.register(- [["alt + l", lambda: edges.append("down"), lambda: edges.append("up")]]- )+ backend.register([["alt + l", lambda: edges.append("down"), lambda: edges.append("up")]])backend._handle_flags(1 << 19) # Option/Alt downbackend._handle_key_down(0x25) # physical L@@ -851,8 +845,8 @@ def _install_fake_quartz(monkeypatch):quartz.CFRunLoopRun = _run_loopquartz.CFRunLoopStop = _stop_loopquartz.CFRunLoopWakeUp = _wake_loop- quartz.CFRunLoopRemoveSource = (- lambda loop, source, mode: quartz.removed_sources.append((loop, source, mode))+ quartz.CFRunLoopRemoveSource = lambda loop, source, mode: quartz.removed_sources.append(+ (loop, source, mode))quartz.CGEventTapEnable = lambda tap, enabled: setattr(tap, "enabled", enabled)quartz.CFMachPortInvalidate = lambda tap: setattr(tap, "invalidated", True)@@ -888,3 +882,43 @@ def test_quartz_rearm_fully_retires_old_event_tap(monkeypatch) -> None:assert quartz.taps[-1].enabled is Trueassert old_tap.enabled is Falsebackend.stop()+++# --- checker poll pacing (CPU diet, 2026-08-22) -------------------------------+++def test_checker_poll_is_paced_to_hotkey_poll_s() -> None:+ """The library hardcodes ``time.sleep(0.02)`` in its checker loop; the+ backend swaps the checker module's ``time`` for a paced stand-in so every+ short sleep becomes ``HOTKEY_POLL_S`` while longer sleeps (the 0.7 s+ restart settle) and every other ``time`` attribute pass straight through."""+ import types++ from jarvis.trigger.backends import global_hotkeys as ghb++ calls: list[float] = []+ real_time = types.SimpleNamespace(sleep=calls.append, monotonic=lambda: 42.0)+ checker = types.SimpleNamespace(time=real_time)+ gh = types.SimpleNamespace(hotkey_checker=checker)++ ghb._pace_checker_poll(gh)+ ghb._pace_checker_poll(gh) # idempotent: never wraps the wrapper+ assert isinstance(checker.time, ghb._PacedTime)+ assert checker.time._real is real_time++ checker.time.sleep(0.02)+ checker.time.sleep(0.7)+ assert calls == [ghb.HOTKEY_POLL_S, 0.7]+ assert checker.time.monotonic() == 42.0+++def test_checker_poll_pacing_leaves_a_library_without_checker_alone() -> None:+ import types++ from jarvis.trigger.backends import global_hotkeys as ghb++ gh = types.SimpleNamespace()+ ghb._pace_checker_poll(gh) # no hotkey_checker attribute → no-op, no raise+ checker = types.SimpleNamespace()+ ghb._pace_checker_poll(types.SimpleNamespace(hotkey_checker=checker))+ assert not hasattr(checker, "time")diff --git a/tests/unit/ui/jarvisbar/test_frame_pacing.py b/tests/unit/ui/jarvisbar/test_frame_pacing.pyindex 549261a5ed..136fe9663b 100644--- a/tests/unit/ui/jarvisbar/test_frame_pacing.py+++ b/tests/unit/ui/jarvisbar/test_frame_pacing.py@@ -318,3 +318,77 @@ def test_adaptive_pacing_keeps_the_full_target_delay_for_a_fast_tick(monkeypatchms, _fn = root.scheduled[-1]assert ms == TARGET_FRAME_MS+++# --- silent-active skip (CPU diet, 2026-08-22) --------------------------------+# The wake listener keeps the bar in ``listen`` for hours. With no sound the+# equalizer is a flat, time-independent row, so those ticks must settle and+# skip exactly like the idle pill — and wake up again the instant sound+# arrives.+++def test_silent_listen_settles_and_skips_render():+ renderer_obj = _CountingRenderer()+ bar, _root, canvas = _bare_bar(renderer_obj, mode="listen")+ # No level ever received → effective level 0, no playback → silent.+ for _ in range(_IDLE_SETTLE_TICKS):+ bar._schedule_frame()+ assert renderer_obj.calls > 0, "silent listen never rendered even once"++ calls_before = renderer_obj.calls+ itemconfig_before = canvas.itemconfig_calls+ for _ in range(20):+ bar._schedule_frame()+ assert renderer_obj.calls == calls_before, (+ "a settled silent listen bar kept re-rendering identical flat bars"+ )+ assert canvas.itemconfig_calls == itemconfig_before+++def test_audible_listen_never_skips_render(monkeypatch):+ """Sound present → level-driven bars jitter with ``t`` → every tick renders."""+ renderer_obj = _CountingRenderer()+ bar, _root, _canvas = _bare_bar(renderer_obj, mode="listen")+ bar._ext_level = 0.6+ # Keep the level sample fresh on every tick so it never goes stale.+ monkeypatch.setattr(renderer, "effective_ext_level", lambda level, age: level, raising=True)+ for _ in range(_IDLE_SETTLE_TICKS + 5):+ bar._schedule_frame()+ assert renderer_obj.calls == _IDLE_SETTLE_TICKS + 5, (+ "an audible listen bar skipped rendering — the equalizer would freeze"+ )+++def test_sound_arriving_after_a_silent_settle_renders_immediately(monkeypatch):+ renderer_obj = _CountingRenderer()+ bar, _root, _canvas = _bare_bar(renderer_obj, mode="listen")+ for _ in range(_IDLE_SETTLE_TICKS + 5):+ bar._schedule_frame()+ calls_while_settled = renderer_obj.calls++ bar._ext_level = 0.5+ monkeypatch.setattr(renderer, "effective_ext_level", lambda level, age: level, raising=True)+ bar._schedule_frame()+ assert renderer_obj.calls == calls_while_settled + 1, (+ "the first audible sample after a silent settle did not render"+ )+++def test_playback_keeps_a_silent_speak_bar_rendering(monkeypatch):+ """TTS playback is the player's authoritative signal (the level tap only+ fires at buffer-write time) — while it is active the bar never settles."""+ from jarvis.audio import level_tap++ renderer_obj = _CountingRenderer()+ bar, _root, _canvas = _bare_bar(renderer_obj, mode="speak")+ monkeypatch.setattr(level_tap, "playback_active", lambda: True)+ for _ in range(_IDLE_SETTLE_TICKS + 5):+ bar._schedule_frame()+ assert renderer_obj.calls == _IDLE_SETTLE_TICKS + 5+++def test_target_frame_is_25fps_not_60():+ """The bar is five strokes and a sweep; 25 updates/s is indistinguishable+ from the old 16 ms target on a layered window whose DWM ceiling was ~31/s,+ and costs a third of the wake-ups."""+ assert TARGET_FRAME_MS == 40