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.

perf(wiki): opening the Wiki section no longer waits on probes nothing reads

rubenluetke10-beepf57dd5c2d74c
diff --git a/docs/BUGS.md b/docs/BUGS.md
index 7cc891915c..f7591b349d 100644
--- a/docs/BUGS.md
+++ b/docs/BUGS.md
@@ -12271,6 +12271,12 @@ nothing renders those legs — only the Ultra body does, and it is not mounted
so the wait bought nothing. A visit with no remembered mode paid it in full,
staring at an empty section.
+The leg probe was only half of it. `UltraWikiService.status()` also ran the
+three capability-slot probes on every call - embedding, distill and rerank,
+each walking the keyring / `.env` or an endpoint. Removing the leg probe alone
+took the route from 2.1 s to 0.9 s and no further; the slots were the rest.
+They are read by the Ultra body too, and by nothing else.
+
**Fix.**
* `jarvis/commands/capabilities.py` resolves a command's `requires` against the
@@ -12292,8 +12298,14 @@ staring at an empty section.
one missing-tool bug for its mirror image.
* `/api/ultrawiki/status` skips the leg probe while the mode is off and says
`search_legs.probed: false` with a reason, rather than reporting legs nobody
- measured. `/health` — which grades those legs, and would read an absent
- keyword leg as "search cannot answer" — asks for the probe explicitly.
+ measured. `/health` - which grades those legs, and would read an absent
+ keyword leg as "search cannot answer" - asks for the probe explicitly.
+* `status(probe_slots=False)` skips the credential probes on the same
+ condition. The stored CHOICES still come back, so a client can always say
+ which provider was picked; it is simply not told "ready" about a mode
+ nobody switched on. Measured end to end on a dev backend with the mode
+ off: **2.1 s -> 0.22 s**, level with `/api/wiki/tree` (0.26 s) and
+ `/api/wiki/health` (0.24 s) on the same process.
**Tests.** `tests/unit/commands/test_capabilities.py` pins mode-off, fail-open,
that the steer names tools that actually work, and — the one that matters in a
diff --git a/jarvis/ui/web/ultrawiki_routes.py b/jarvis/ui/web/ultrawiki_routes.py
index a891e83bf2..3eba6129e7 100644
--- a/jarvis/ui/web/ultrawiki_routes.py
+++ b/jarvis/ui/web/ultrawiki_routes.py
@@ -483,9 +483,14 @@ async def _status_payload(
"starting or its init failed"
],
}
- data = await service.status()
+ # The slot probes are three credential walks. They are skipped on the same
+ # condition as the leg probe and for the same reason: only the Ultra body
+ # renders them, and it is not mounted while the mode is off. The stored
+ # choices still come back, so a client can always say WHICH provider was
+ # picked — it simply is not told "ready" about a mode nobody switched on.
+ data = await service.status(probe_slots=want_legs)
backend = dict(data.get("backend") or {})
- slots = dict(data.get("slots") or {})
+ slots = dict(data.get("slots") or {}) or _slots_from_config(uw)
started = bool(data.get("started"))
reembed = dict(data.get("reembed") or {})
slots["storage"] = {
diff --git a/jarvis/ultrawiki/service.py b/jarvis/ultrawiki/service.py
index 50ce4c389b..a2cc62de8a 100644
--- a/jarvis/ultrawiki/service.py
+++ b/jarvis/ultrawiki/service.py
@@ -749,8 +749,16 @@ class UltraWikiService:
# -- status --------------------------------------------------------------
- async def status(self) -> dict[str, Any]:
- """Honest capability + backlog report for the settings surface."""
+ async def status(self, *, probe_slots: bool = True) -> dict[str, Any]:
+ """Honest capability + backlog report for the settings surface.
+
+ ``probe_slots=False`` returns an empty ``slots`` map instead of running
+ the three credential probes, and the caller fills in the stored choices.
+ Only the Ultra body renders those reports, and it is not mounted while
+ the mode is off — but this route is what the Wiki section asks before it
+ can draw EITHER body, so a dormant install was paying a keyring walk per
+ poll for a payload nothing read (measured 0.9 s of the route's total).
+ """
started = self._store is not None
counts = PipelineCounts()
sources: list[dict[str, Any]] = []
@@ -788,7 +796,9 @@ class UltraWikiService:
)
# Every slot probe walks credentials (keyring / .env) or an endpoint —
# all three go to a worker thread together, never on the event loop.
- slots = await asyncio.to_thread(self._slot_statuses)
+ slots = (
+ await asyncio.to_thread(self._slot_statuses) if probe_slots else {}
+ )
# What the WORKER has actually been told by the provider. The slot
# probe above is a credential check by contract (AP-21), so it cannot
# see a key that exists and is refused; only the worker can, and
diff --git a/tests/unit/web/test_ultrawiki_routes.py b/tests/unit/web/test_ultrawiki_routes.py
index 3e362c570a..db6da7c348 100644
--- a/tests/unit/web/test_ultrawiki_routes.py
+++ b/tests/unit/web/test_ultrawiki_routes.py
@@ -2005,3 +2005,29 @@ def test_switching_the_mode_tells_the_live_brain_its_tools_changed(env) -> None:
response = env.client.post("/api/ultrawiki/deactivate")
assert response.status_code == 200, response.text
assert any(reason == "ultrawiki_mode:off" for reason in seen), seen
+
+
+def test_status_does_not_probe_the_slots_while_the_mode_is_off(env, monkeypatch) -> None:
+ """The other half of the same wait: three credential walks per poll.
+
+ `_slot_statuses` probes the embedding, distill and rerank credentials
+ (keyring / .env / an endpoint). Only the Ultra body renders those reports,
+ and it is not mounted while the mode is off — but the section asks this
+ route before it can draw EITHER body. Measured on a dormant install: ~0.9 s
+ of the route's total, paid on every poll for a payload nothing read.
+ """
+ probes: list[int] = []
+
+ def _never(): # pragma: no cover - the assertion is that this is unused
+ probes.append(1)
+ return {}
+
+ monkeypatch.setattr(env.service, "_slot_statuses", _never)
+
+ body = env.client.get("/api/ultrawiki/status").json()
+
+ assert probes == []
+ # The stored CHOICES still come back — a client can always say which
+ # provider was picked, it is simply not told "ready" about a dormant mode.
+ assert "embedding" in body["slots"]
+ assert body["slots"]["embedding"]["ready"] is False