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(marketplace): live-badge downgrade waits for registry bootstrap — boot window stays fail-open

Ruben Lütke794542131417
diff --git a/jarvis/ui/web/marketplace_routes.py b/jarvis/ui/web/marketplace_routes.py
index dbbd86fc55..81c176e63d 100644
--- a/jarvis/ui/web/marketplace_routes.py
+++ b/jarvis/ui/web/marketplace_routes.py
@@ -184,17 +184,23 @@ def _mcp_live(
Bug 14: an http plugin's connect-time ``list_tools()`` can 401 and be
swallowed, leaving status "connected" with ZERO live tools — a green
- "Connected · Live" badge over a dead session. When a live registry is
- reachable AND the plugin is "connected" AND it reports zero tools, the
- session is dead (expired token, 401 at list_tools) and the badge goes
- honest. No registry reachable (early boot / headless) -> fail open, exactly
+ "Connected · Live" badge over a dead session. When a BOOTSTRAPPED live
+ registry is reachable AND the plugin is "connected" AND it reports zero
+ tools, the session is dead (expired token, 401 at list_tools) and the badge
+ goes honest. No registry reachable (headless), or a registry that is
+ published but still bootstrapping in the background (the boot window where
+ every count reads 0 although nothing is dead) -> fail open, exactly
today's behaviour.
"""
transport = str(mcp.get("transport", "")).lower()
if transport == "http":
if status == "connected":
reg = _live_plugin_registry() # the same accessor refresh uses
- if reg is not None and reg.live_tool_count(plugin_id) == 0:
+ if (
+ reg is not None
+ and reg.is_bootstrapped()
+ and reg.live_tool_count(plugin_id) == 0
+ ):
hint = reg.last_connect_error(plugin_id) or "no tools loaded — reconnect"
return False, hint
return True, None
diff --git a/tests/unit/marketplace/test_mcp_liveness_runtime_gate.py b/tests/unit/marketplace/test_mcp_liveness_runtime_gate.py
index 78ca3223a6..f5d4a71fc2 100644
--- a/tests/unit/marketplace/test_mcp_liveness_runtime_gate.py
+++ b/tests/unit/marketplace/test_mcp_liveness_runtime_gate.py
@@ -31,6 +31,7 @@ def test_http_connected_with_zero_live_tools_is_not_live(monkeypatch):
from jarvis.ui.web import marketplace_routes as mr
class _Reg:
+ def is_bootstrapped(self): return True
def live_tool_count(self, pid): return 0
def last_connect_error(self, pid): return "HTTP 401 unauthorized"
@@ -46,3 +47,19 @@ def test_http_without_registry_stays_live(monkeypatch):
monkeypatch.setattr(mr, "_live_plugin_registry", lambda: None)
live, hint = mr._mcp_live({"transport": "http"}, plugin_id="notion", status="connected")
assert live is True and hint is None
+
+
+def test_http_with_unbootstrapped_registry_stays_live(monkeypatch):
+ """Boot window: the registry is published before its background bootstrap
+ has connected any plugin, so every live_tool_count() reads 0 although
+ nothing is dead. The downgrade must wait for is_bootstrapped()."""
+ from jarvis.ui.web import marketplace_routes as mr
+
+ class _Reg:
+ def is_bootstrapped(self): return False
+ def live_tool_count(self, pid): return 0
+ def last_connect_error(self, pid): return None
+
+ monkeypatch.setattr(mr, "_live_plugin_registry", lambda: _Reg())
+ live, hint = mr._mcp_live({"transport": "http"}, plugin_id="notion", status="connected")
+ assert live is True and hint is None