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
chore: auto-save WIP via Claude stop-hook safety net (2026-07-07 16:36)
Ruben Lütkeb5ff2a20d857
diff --git a/jarvis/mcp/client.py b/jarvis/mcp/client.pyindex 3d73d2d1b8..5cd73fd6fc 100644--- a/jarvis/mcp/client.py+++ b/jarvis/mcp/client.py@@ -16,6 +16,7 @@ import asyncioimport loggingimport osimport re+import shutilimport timefrom contextlib import AsyncExitStackfrom pathlib import Path@@ -31,6 +32,34 @@ log = logging.getLogger(__name__)_CB_THRESHOLD = 3_CB_COOLDOWN_NS = 60_000_000_000 # 60 seconds+# Launcher binaries covered by a concrete "install Node.js" hint — the vast+# majority of stdio MCP servers are npm packages launched via ``npx``/``node``.+_NODE_LAUNCHERS = frozenset({"node", "npx", "npm"})+++def _stdio_launcher_missing_message(spec_name: str, command: str) -> str:+ """Actionable message for a stdio MCP server whose launcher binary is+ absent from PATH (AP-23 wave-2 finding 10).++ Without this, a missing ``npx``/``node`` surfaces as a raw+ ``FileNotFoundError: [Errno 2] No such file or directory: 'npx'`` on the+ plugin badge (caught generically at ``mcp/registry.py``'s+ ``except Exception as e: error_msg = f"{type(e).__name__}: {e}"``). Mirrors+ the honest launcher check already used at connect-time in+ ``marketplace_routes._mcp_live`` (``shutil.which`` on the stdio+ ``install`` command) so the badge and the live client agree on what+ "missing" means and both name the actual missing binary.+ """+ if command in _NODE_LAUNCHERS:+ return (+ f"{spec_name}: install Node.js 18+ to use this plugin "+ f"('{command}' not found on PATH)"+ )+ return (+ f"{spec_name}: '{command}' not found on PATH — install it to use "+ "this plugin"+ )+def _read_call_timeout_s() -> float:"""Per-call timeout (seconds), ENV-overridable with a safe fallback.@@ -95,6 +124,13 @@ class MCPClient:try:if self.spec.transport == "stdio":command, args, env = self._resolve_install_command()+ if shutil.which(command) is None:+ # Fail actionable, not raw: without this check+ # ``stdio_client`` spawns the launcher itself and a+ # missing binary surfaces as a bare FileNotFoundError.+ raise FileNotFoundError(+ _stdio_launcher_missing_message(self.spec.name, command)+ )params = StdioServerParameters(command=command,args=args,diff --git a/pyproject.toml b/pyproject.tomlindex 7d1d7588f8..83d1ce4d3f 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -469,6 +469,37 @@ jarvis = [# Node bot scripts shipped alongside their Python bridge tools (e.g. the# google_calendar bot). Not Python, so packages.find won't pick them up."plugins/tool/*.mjs",+ # AP-23 wave-2 finding 6: runtime data files read via `Path(__file__)` at+ # first use, missing from wheel installs — masked today only because+ # every dev install is editable (source tree == package tree).+ # SQLite bootstrap schemas + versioned migrations+ # (board/memory/missions/sessions/tasks/workflows). Every `.sql` file+ # under the package is a runtime schema/migration, never source config,+ # so one broad glob is safe (audited 2026-07-07: 9 files total).+ "**/*.sql",+ # Voice persona (brain/persona_loader.py), skill-authoring import+ # allowlist (skills/authoring/draft_writer.py), Jarvis-Agent critic+ # verdict JSON-schema (core/review/spawns.py).+ "brain/JARVIS_PERSONA.md",+ "skills/safe_imports.txt",+ "core/review/verdict_schema.json",+ # Seed catalogs (CLI tools / skills / marketplace plugins) — named+ # explicitly rather than a repo-wide "**/*.json" glob, which would also+ # sweep in jarvis/ui/web/frontend's SOURCE config (package.json,+ # tsconfig.json, .claude/settings.local.json — never meant to ship).+ "clis/catalog/seed_catalog.json",+ "skills/catalog/seed_catalog.json",+ "marketplace/seed_catalog.json",+ # Marketplace "how to use this plugin" cards shown in the UI+ # (marketplace/usage_cards/loader.py).+ "marketplace/usage_cards/*.md",+ # Wiki bootstrap templates for a new vault (memory/wiki/__init__.py's+ # TEMPLATES_DIR + integration.py's schema.md read).+ "memory/wiki/templates/*.md",+ # Built-in skills: SKILL.md plus their reference/asset/script support+ # files (e.g. skill-creator ships references/, scripts/, agents/,+ # assets/ alongside its SKILL.md).+ "skills/builtin/**/*",][tool.ruff]diff --git a/tests/unit/mcp/test_client.py b/tests/unit/mcp/test_client.pynew file mode 100644index 0000000000..2095fbaffe--- /dev/null+++ b/tests/unit/mcp/test_client.py@@ -0,0 +1,110 @@+"""Unit tests for jarvis/mcp/client.py — MCPClient lifecycle.++AP-23 wave-2 finding 10: a stdio MCP server whose launcher binary (typically+``npx``/``node``) is absent from PATH must fail with an actionable message+("install Node.js 18+ ...") instead of a raw ``FileNotFoundError`` string+reaching the plugin badge (caught generically at ``mcp/registry.py``).+"""+from __future__ import annotations++import shutil++import pytest++from jarvis.mcp.client import MCPClient, _stdio_launcher_missing_message+from jarvis.mcp.registry import MCPServerSpec+++def _stdio_spec(command: str = "npx", name: str = "some-plugin") -> MCPServerSpec:+ return MCPServerSpec(+ name=name,+ display=name.title(),+ description="Test stdio MCP server",+ install_command=[command, "-y", "@example/server"],+ transport="stdio",+ )+++# --- _stdio_launcher_missing_message (pure message shaping) -----------------+++def test_missing_message_names_node_for_npx() -> None:+ msg = _stdio_launcher_missing_message("some-plugin", "npx")+ assert "Node.js" in msg+ assert "npx" in msg+ assert "some-plugin" in msg+++def test_missing_message_names_node_for_node() -> None:+ msg = _stdio_launcher_missing_message("some-plugin", "node")+ assert "Node.js" in msg+++def test_missing_message_names_launcher_for_non_node_command() -> None:+ msg = _stdio_launcher_missing_message("docker-plugin", "docker")+ assert "docker" in msg+ assert "docker-plugin" in msg+ # No Node.js hint for a non-Node launcher.+ assert "Node.js" not in msg+++# --- MCPClient.start() — actionable failure on a missing launcher -----------+++async def test_start_raises_actionable_error_when_npx_missing(monkeypatch) -> None:+ monkeypatch.setattr(shutil, "which", lambda _cmd: None)+ client = MCPClient(_stdio_spec(command="npx", name="brave-search"))+ with pytest.raises(FileNotFoundError) as excinfo:+ await client.start()+ message = str(excinfo.value)+ # The actionable hint, not a raw errno string like+ # "[Errno 2] No such file or directory: 'npx'".+ assert "Node.js" in message+ assert "18" in message+ assert "brave-search" in message+ assert "Errno" not in message+++async def test_start_actionable_error_is_readable_via_registry_style_format(+ monkeypatch,+) -> None:+ """Mirrors how mcp/registry.py's start_enabled formats the failure:+ ``f"{type(e).__name__}: {e}"``. Must read as an instruction, not a raw+ OS error line.+ """+ monkeypatch.setattr(shutil, "which", lambda _cmd: None)+ client = MCPClient(_stdio_spec(command="npx", name="brave-search"))+ try:+ await client.start()+ pytest.fail("expected start() to raise")+ except Exception as e: # noqa: BLE001 — mirrors registry.py's catch-all+ formatted = f"{type(e).__name__}: {e}"+ assert "install Node.js 18+" in formatted+++async def test_start_does_not_which_check_when_launcher_present(monkeypatch) -> None:+ """When the launcher IS on PATH, the which()-check must not block startup+ — this test only proves the guard doesn't misfire on a present binary; the+ real transport handshake is exercised by higher-level/integration tests."""+ monkeypatch.setattr(shutil, "which", lambda _cmd: r"C:\fake\npx.cmd")++ class _BoomStdioClient:+ def __init__(self, *_a, **_k) -> None:+ pass++ async def __aenter__(self):+ raise RuntimeError("boom past the which()-check, as expected")++ async def __aexit__(self, *_exc):+ return False++ import mcp.client.stdio as stdio_mod++ monkeypatch.setattr(stdio_mod, "stdio_client", lambda params: _BoomStdioClient())++ client = MCPClient(_stdio_spec(command="npx", name="brave-search"))+ with pytest.raises(RuntimeError, match="boom past the which"):+ await client.start()