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
fix(brain): let hand-offs to the user's own agents pass the research guard (#777)
Ruben Lütke674833b1b49a
diff --git a/dodaios/brain/manager.py b/dodaios/brain/manager.pyindex d359a8e840..b03ebfe393 100644--- a/dodaios/brain/manager.py+++ b/dodaios/brain/manager.py@@ -2104,7 +2104,8 @@ _DEPTH_CONFIRM: dict[str, dict[str, str]] = i18n_catalog.nested_table("brain.dep# cached system prefix stays byte-stable._CORE_CONTRACT = ("Never claim an action or result unless a tool call in this turn returned it; "- "otherwise say it has not happened.\n"+ "otherwise say it has not happened. A denied or failed call returned nothing: "+ "never supply its answer yourself; say what was blocked and why.\n""Research and fresh facts (news, prices, weather): search_web, never cli_*; cli_* ""and plugin tools act on the user's own accounts; evergreen knowledge needs no tool. ""Work for one of your agents: delegate_to_agent; spawn_worker only for heavy "diff --git a/dodaios/brain/tool_use_loop.py b/dodaios/brain/tool_use_loop.pyindex 6e9da79914..65670a792a 100644--- a/dodaios/brain/tool_use_loop.py+++ b/dodaios/brain/tool_use_loop.py@@ -518,6 +518,12 @@ def _is_action_tool(tool: Any) -> bool:return bool(getattr(tool, "is_action_tool", False))+# Handing work to one of the user's own agents is never a query against a+# connected system: a research agent asked to research is the intended route,+# so the research guard below must not turn the hand-off into a denial.+_AGENT_HANDOFF_TOOLS = frozenset({"delegate_to_agent", "message_agent", "ask_agent"})++def _should_block_action_as_research(tool: Any,tool_name: str,@@ -547,6 +553,8 @@ def _should_block_action_as_research("""if tool is None or not _is_action_tool(tool):return False+ if tool_name in _AGENT_HANDOFF_TOOLS:+ return Falseif tool_name and tool_name == evidence_required_tool:return Falseif _is_own_data_request(user_utterance):diff --git a/tests/unit/brain/test_research_guard_evidence_override.py b/tests/unit/brain/test_research_guard_evidence_override.pyindex ff45d12bc1..e9a2e3b92b 100644--- a/tests/unit/brain/test_research_guard_evidence_override.py+++ b/tests/unit/brain/test_research_guard_evidence_override.py@@ -60,3 +60,24 @@ def test_non_action_tool_never_blocked() -> None:assert _should_block_action_as_research(tool, "search_web", _RESEARCH, "deep", evidence_required_tool="") is False+++class _FakeActionTool(_FakeTool):+ is_action_tool = True+++def test_handoff_to_an_own_agent_is_never_blocked_as_research() -> None:+ # Live 2026-10-20: "Create an agent named Vega whose job is web research,+ # then ask Vega to introduce itself" had every message_agent /+ # delegate_to_agent call denied as research, and the lead then made up+ # the agent's answer. Handing work to one of the user's own agents is not a+ # query against a connected system.+ utterance = "Ask Vega, the web research agent, to introduce itself"+ for name in ("message_agent", "delegate_to_agent", "ask_agent"):+ assert _should_block_action_as_research(+ _FakeActionTool(name), name, utterance, "deep", evidence_required_tool=""+ ) is False+ assert _should_block_action_as_research(+ _FakeActionTool("cli_gcloud"), "cli_gcloud", utterance, "deep",+ evidence_required_tool="",+ ) is True