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(browser): keep denied CLI retries within the same user turn
rubenluetke10-beep8bac59e08e80
diff --git a/jarvis/mcp/jarvis_tools_server.py b/jarvis/mcp/jarvis_tools_server.pyindex 62ca4b299b..f6e2b21485 100644--- a/jarvis/mcp/jarvis_tools_server.py+++ b/jarvis/mcp/jarvis_tools_server.py@@ -33,7 +33,7 @@ import jsonimport loggingfrom contextvars import ContextVarfrom typing import Any, Final-from uuid import uuid4+from uuid import NAMESPACE_URL, UUID, uuid4, uuid5log = logging.getLogger(__name__)@@ -254,8 +254,16 @@ def build_server() -> Any:return [types.TextContent(type="text", text="The task grant has expired.")]if task_scope is not None and name not in task_scope.names:return [types.TextContent(type="text", text="Tool outside the task grant.")]+ trace_id = task_scope.trace_id if task_scope else uuid4()+ if name == "society_browser" and turn is not None and task_scope is None:+ try:+ trace_id = UUID(str(turn.trace_id))+ except ValueError:+ # Older callers can omit the UUID, but the session/turn+ # identity still keeps denial effective across retries.+ trace_id = uuid5(NAMESPACE_URL, f"jarvis:{turn.session_id}:{turn.turn_id}")request = SupervisorToolRequest(- trace_id=task_scope.trace_id if task_scope else uuid4(),+ trace_id=trace_id,origin=CHAT_ORIGIN,user_utterance=turn.user_text if turn else "",rationale="agent chat tool call",diff --git a/tests/contract/test_browser_desktop_mcp.py b/tests/contract/test_browser_desktop_mcp.pyindex 5ff735cb4f..fbb6f3257b 100644--- a/tests/contract/test_browser_desktop_mcp.py+++ b/tests/contract/test_browser_desktop_mcp.py@@ -238,3 +238,47 @@ async def test_failed_browser_mcp_preserves_partial_outcome_and_error_flag(monkeassert body["result"] == partialassert body["error"] == "Model timed out after navigation"assert "Inspect current state" in body["retry"]+++async def test_cli_browser_retries_keep_the_user_turn_trace(monkeypatch):+ import mcp.types as types++ from jarvis.agent_chat.tool_context import register_turn, unregister_turn+ from jarvis.core.protocols import ChatTurn, current_chat_turn+ from jarvis.mcp import jarvis_tools_server as server++ seen = []+ tool = SimpleNamespace(+ name="society_browser",+ description="Browser",+ risk_tier="monitor",+ is_action_tool=True,+ input_schema={"type": "object"},+ )++ async def execute(name, args, request):+ seen.append(request.trace_id)+ return ToolResult(True, {}, None)++ monkeypatch.setattr(+ server, "_gateway", lambda: SimpleNamespace(catalog=lambda: [tool], execute=execute)+ )+ instance = server.build_server()+ request = types.CallToolRequest(+ params=types.CallToolRequestParams(name="society_browser", arguments={"task": "Read"})+ )+ first, second = uuid4(), uuid4()+ token = current_chat_turn.set(ChatTurn("chat", "first", "Read", True, str(first)))+ ref = server.CHAT_SESSION_REF.set("chat")+ registered = register_turn("chat")+ try:+ await instance.request_handlers[types.CallToolRequest](request)+ await instance.request_handlers[types.CallToolRequest](request)+ current_chat_turn.set(ChatTurn("chat", "second", "Try again", True, str(second)))+ registered = register_turn("chat")+ await instance.request_handlers[types.CallToolRequest](request)+ finally:+ unregister_turn("chat", registered)+ server.CHAT_SESSION_REF.reset(ref)+ current_chat_turn.reset(token)+ assert seen == [first, first, second]