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(voice): a confirmed action that fails says why it failed
Haraldb4a2ca296dd4
diff --git a/jarvis/brain/manager.py b/jarvis/brain/manager.pyindex 56cdb52ad4..6694029922 100644--- a/jarvis/brain/manager.py+++ b/jarvis/brain/manager.py@@ -9618,8 +9618,15 @@ class BrainManager:)except Exception as exc: # noqa: BLE001log.warning("voice-confirm execute failed: %s", exc)+ # The user just said YES to this action; hearing only "that+ # didn't work" leaves them nothing to correct with. The same+ # opaque-token gate the result branch below relies on decides+ # whether the exception text is speakable at all.return format_confirm_outcome(- "failed", pending.tool_name, language=pending.lang+ "failed",+ pending.tool_name,+ language=pending.lang,+ detail=extract_speakable_reason(str(exc), None),)kind = "done" if getattr(result, "success", False) else "failed"return format_confirm_outcome(@@ -9627,7 +9634,15 @@ class BrainManager:pending.tool_name,language=pending.lang,detail=(- None if kind == "done" else getattr(result, "error", None)+ None+ if kind == "done"+ # Raw ``error`` is routinely the opaque ``exit N`` token the+ # tool layer emits; the gate turns that into no detail at+ # all rather than a machine word in the user's ear.+ else extract_speakable_reason(+ getattr(result, "error", None),+ getattr(result, "output", None),+ )),)diff --git a/tests/unit/brain/test_voice_confirm_flow.py b/tests/unit/brain/test_voice_confirm_flow.pyindex cceb7f541f..781eea1dfb 100644--- a/tests/unit/brain/test_voice_confirm_flow.py+++ b/tests/unit/brain/test_voice_confirm_flow.py@@ -146,6 +146,54 @@ async def test_resume_reports_failure_when_action_fails() -> None:assert mgr._pending_voice_confirm is None+async def test_confirmed_failure_names_the_reason() -> None:+ """A YES the user gave deserves the cause, not just "that didn't work"."""++ class _ReasonExecutor(_FakeExecutor):+ async def execute_confirmed(self, trace_id, *, user_utterance="", **_): # type: ignore[no-untyped-def]+ self.confirmed.append(trace_id)+ return SimpleNamespace(+ success=False,+ output=None,+ error="Gmail is not connected — connect it in the Plugins view.",+ )++ mgr = _manager(_ReasonExecutor())+ _arm(mgr, uuid4())+ out = await mgr._resume_voice_confirm("ja")+ assert "Gmail is not connected" in out+++async def test_confirmed_failure_never_speaks_an_exit_token() -> None:+ """The opaque token the tool layer emits stays out of the spoken line."""++ class _ExitExecutor(_FakeExecutor):+ async def execute_confirmed(self, trace_id, *, user_utterance="", **_): # type: ignore[no-untyped-def]+ self.confirmed.append(trace_id)+ return SimpleNamespace(success=False, output=None, error="exit 1")++ mgr = _manager(_ExitExecutor())+ _arm(mgr, uuid4())+ out = await mgr._resume_voice_confirm("ja")+ assert "exit" not in out.lower()+ assert out.strip() != ""+++async def test_a_raising_executor_still_names_what_broke() -> None:+ class _RaisingExecutor(_FakeExecutor):+ async def execute_confirmed(self, trace_id, *, user_utterance="", **_): # type: ignore[no-untyped-def]+ self.confirmed.append(trace_id)+ raise RuntimeError("The mailbox is locked by another client")++ mgr = _manager(_RaisingExecutor())+ _arm(mgr, uuid4())+ out = await mgr._resume_voice_confirm("ja")+ assert "mailbox is locked" in out++@pytest.mark.asyncioasync def test_resume_without_pending_returns_none() -> None:mgr = _manager(_FakeExecutor())