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-06-30 14:03)
Ruben Lütke367c2c21968b
diff --git a/jarvis/core/config.py b/jarvis/core/config.pyindex f0b0753fd8..7c93be6db6 100644--- a/jarvis/core/config.py+++ b/jarvis/core/config.py@@ -473,6 +473,20 @@ class BrainRoutingConfig(BaseModel):# delegation). See manager._build_fallback_chain / the router fall-through.intelligent_router: bool = True+ # Per-mission MCP relevance filter (mirror of the router's plugin-relevance+ # gate, one layer below). A mission WORKER runs --permission-mode+ # bypassPermissions, so every exported MCP server is actually reachable; an+ # off-topic server (e.g. NotebookLM on a flight question) would re-introduce+ # the ~35 s wrong-MCP stall the router gate removed. When True (default), the+ # servers exported to a worker are filtered to those RELEVANT to that+ # mission's task text via the SAME relevance definition the router uses+ # (jarvis.marketplace.plugin_relevance.plugin_is_relevant). This flag is the+ # reversible kill switch: set false → exactly the prior behaviour (every+ # enabled MCP server + every connected plugin exported to every mission). A+ # relevance fault always degrades to exporting (never strips). See+ # jarvis.missions.init._assemble_worker_mcp_servers.+ worker_mcp_relevance_filter: bool = True+# Heavy-research force-spawn (live bug 2026-06-14, the Berlin→Melbourne# turn): a multi-step research/analysis request must be OFFLOADED to a# background mission, not run inline on the deep brain where it blows thediff --git a/tests/missions/test_worker_mcp_assembly.py b/tests/missions/test_worker_mcp_assembly.pyindex c2e3670984..7dec384c8e 100644--- a/tests/missions/test_worker_mcp_assembly.py+++ b/tests/missions/test_worker_mcp_assembly.py@@ -4,6 +4,14 @@connected marketplace plugins and produces the claude-cli ``mcpServers`` mapfor ClaudeDirectWorker. It must NEVER raise — a marketplace / keyring hiccupmust degrade to "worker runs without plugins", not crash mission dispatch.++It also filters the exported servers down to those RELEVANT to the mission's+task text (the same plugin-relevance gate the router uses), one layer below the+router. The worker runs ``--permission-mode bypassPermissions``, so an exported+off-topic server is actually reachable and would re-introduce the ~35 s+wrong-MCP stall. The filter is reversible (``relevance_filter=False`` or the+``[brain.routing].worker_mcp_relevance_filter`` kill-switch) and ALWAYS degrades+to exporting on a fault (never silently strips a mission's MCPs)."""from __future__ import annotations@@ -35,7 +43,8 @@ def test_failure_degrades_to_empty_not_raise() -> None:def test_mcp_json_servers_reach_the_worker() -> None:- # self-added MCP server (the "MCPs" section) with NO marketplace plugin+ # self-added MCP server (the "MCPs" section) with NO marketplace plugin.+ # No task_text => no relevance context => full export (degraded/back-compat).ts = TokenStore(InMemoryBackend())mcp_json = {"my-srv": {"command": "npx", "args": ["-y", "x"], "enabled": True}}servers = _assemble_worker_mcp_servers(token_store=ts, mcp_json_servers=mcp_json)@@ -44,8 +53,101 @@ def test_mcp_json_servers_reach_the_worker() -> None:def test_marketplace_and_mcp_json_merge() -> None:+ # No task_text => no relevance context => full export (degraded/back-compat).ts = TokenStore(InMemoryBackend())ts.save("github", Tokens(access="ghp_X"))mcp_json = {"my-srv": {"command": "npx", "enabled": True}}servers = _assemble_worker_mcp_servers(token_store=ts, mcp_json_servers=mcp_json)assert "github" in servers and "my-srv" in servers+++# --- Per-task relevance filter ------------------------------------------------+++def test_relevant_task_exports_named_server() -> None:+ # The task NAMES the server ("weather mcp"), so it is exported even with the+ # filter ON.+ ts = TokenStore(InMemoryBackend())+ mcp_json = {"weather-mcp": {"command": "npx", "enabled": True}}+ servers = _assemble_worker_mcp_servers(+ token_store=ts,+ mcp_json_servers=mcp_json,+ task_text="check the weather forecast for tomorrow",+ relevance_filter=True,+ )+ assert "weather-mcp" in servers+++def test_topical_tool_noun_exports_server() -> None:+ # The server id does NOT name-match, but a distinctive noun mined from its+ # OWN tools ("flashcards") matches the task — the smart relevance stage.+ ts = TokenStore(InMemoryBackend())+ mcp_json = {"srv-x": {"command": "npx", "enabled": True}}+ tools = {+ "srv-x": [+ {+ "name": "srv-x/flashcards_create",+ "description": "make flashcards from your sources",+ }+ ]+ }+ servers = _assemble_worker_mcp_servers(+ token_store=ts,+ mcp_json_servers=mcp_json,+ task_text="please create some flashcards for me",+ relevance_filter=True,+ server_tools=tools,+ )+ assert "srv-x" in servers+++def test_unrelated_task_drops_server() -> None:+ # An off-topic mission must NOT export an unrelated server (the over-trigger+ # hole this fix closes).+ ts = TokenStore(InMemoryBackend())+ mcp_json = {"weather-mcp": {"command": "npx", "enabled": True}}+ servers = _assemble_worker_mcp_servers(+ token_store=ts,+ mcp_json_servers=mcp_json,+ task_text="refactor the authentication module and add unit tests",+ relevance_filter=True,+ server_tools={"weather-mcp": []},+ )+ assert "weather-mcp" not in servers+++def test_kill_switch_off_restores_full_export() -> None:+ # relevance_filter=False reproduces the prior behaviour exactly: the+ # unrelated server is exported (no filtering).+ ts = TokenStore(InMemoryBackend())+ mcp_json = {"weather-mcp": {"command": "npx", "enabled": True}}+ servers = _assemble_worker_mcp_servers(+ token_store=ts,+ mcp_json_servers=mcp_json,+ task_text="refactor the authentication module and add unit tests",+ relevance_filter=False,+ server_tools={"weather-mcp": []},+ )+ assert "weather-mcp" in servers+++def test_relevance_fault_falls_back_to_export(monkeypatch) -> None: # noqa: ANN001+ # A fault inside the relevance step must NEVER strip a mission's MCPs — the+ # server is exported (degrade to the old full-export behaviour).+ import jarvis.marketplace.plugin_relevance as pr++ def _boom(*_a, **_k): # noqa: ANN002, ANN003+ raise RuntimeError("relevance engine exploded")++ monkeypatch.setattr(pr, "plugin_is_relevant", _boom)++ ts = TokenStore(InMemoryBackend())+ mcp_json = {"weather-mcp": {"command": "npx", "enabled": True}}+ servers = _assemble_worker_mcp_servers(+ token_store=ts,+ mcp_json_servers=mcp_json,+ task_text="refactor the authentication module", # would normally drop+ relevance_filter=True,+ server_tools={"weather-mcp": []},+ )+ assert "weather-mcp" in servers