Skip to content

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.

fix(voice): run a requested coding-agent hand-off without asking again

rubenluetke10-beep0a7dcd1171e3
diff --git a/jarvis/brain/workspace_tool.py b/jarvis/brain/workspace_tool.py
index 8471895f1d..3995244bc0 100644
--- a/jarvis/brain/workspace_tool.py
+++ b/jarvis/brain/workspace_tool.py
@@ -55,6 +55,18 @@ class WorkspaceOrchestrationTool:
def risk_tier_for_args(self, args: dict) -> str:
return "safe" if args.get("action") in {"inspect", "resolve", "context"} else "ask"
+ def intent_confirms_args(self, args: dict, utterance: str) -> bool:
+ """True when the user's own words already ordered this hand-off.
+
+ Consulted by ``ToolExecutor`` before it arms a confirmation: a send the
+ user asked for ("let an agent in the workspace fix it") runs at once
+ instead of a second "shall I start it?". A send the brain chose while
+ the user talked about something else still confirms.
+ """
+ from jarvis.safety.explicit_intent import utterance_requests_agent_work
+
+ return args.get("action") == "send" and utterance_requests_agent_work(utterance)
+
def describe_args(self, args: dict) -> dict:
return {
"level": "read" if self.risk_tier_for_args(args) == "safe" else "modify",
diff --git a/jarvis/safety/explicit_intent.py b/jarvis/safety/explicit_intent.py
index 88f3d6c82b..4f5f60eed4 100644
--- a/jarvis/safety/explicit_intent.py
+++ b/jarvis/safety/explicit_intent.py
@@ -52,3 +52,59 @@ def utterance_confirms_destruction(utterance: str) -> bool:
if not utterance or not utterance.strip():
return False
return bool(_PATTERN.search(utterance))
+
+
+# Handing a task to a coding agent (live voice session 2026-10-01 18:11): the
+# user said "beauftrag einen Agenten im Workspace, das smoother zu machen",
+# Jarvis asked "soll ich ihn starten?", and on the next request ("da soll sich
+# ein anderer Agent drum kümmern, im selben Workspace") asked again — the
+# maintainer's verdict: "das hättest du einfach loslaufen lassen können". The
+# words below only appear when the speaker addresses agent work themselves:
+# the vehicle ("Agent", "worker"), a workspace target ("Terminal", "Session",
+# "T2"), a coding CLI by name, or a hand-off verb. A send the brain decides on
+# while the user talks about something else still confirms.
+_AGENT_WORK_STEMS: tuple[str, ...] = (
+ # Shared by de/en/es: agent/Agenten/agente, delegier/delegate/delega.
+ "agent", "subagent", "deleg", "terminal", "workspace", "coding",
+ # German
+ "beauftrag", "sitzung", "arbeitsbereich",
+ # English
+ "worker", "spawn", "session", "pane", "claude code", "codex",
+ # Spanish
+ "sesión", "sesion", "espacio de trabajo",
+)
+
+_AGENT_WORK_PATTERN = re.compile(
+ r"\b(?:"
+ + "|".join(re.escape(stem) + r"\w*" for stem in _AGENT_WORK_STEMS)
+ # Agentic-IDE call signs ("T2", "t 4").
+ + r"|t\s?\d{1,2}\b"
+ + r")",
+ re.IGNORECASE,
+)
+
+# "nicht an den Agenten", "don't send it to the agent", "kein Terminal": a
+# negation shortly before the target, inside the same clause, is a refusal,
+# not an order. A comma or full stop ends its reach ("nicht so, lass das
+# einen Agenten machen" still asks for an agent).
+_NEGATION_BEFORE = re.compile(
+ r"\b(?:nicht|kein\w*|nie|no|not|don't|dont|never|nada|ningún|ninguna)"
+ r"(?:[^\w,.;!?]+\w+){0,4}[^\w,.;!?]*$",
+ re.IGNORECASE,
+)
+
+
+def utterance_requests_agent_work(utterance: str) -> bool:
+ """True when the utterance itself asks to hand work to a coding agent.
+
+ Used by the workspace send hook: the user who just said "let an agent do
+ it" is not asked "shall I start it?" again. A target preceded by a
+ negation ("schick das nicht an den Agenten") does not count. Empty
+ utterances (API calls, missions) never confirm.
+ """
+ if not utterance or not utterance.strip():
+ return False
+ for match in _AGENT_WORK_PATTERN.finditer(utterance):
+ if not _NEGATION_BEFORE.search(utterance[: match.start()]):
+ return True
+ return False
diff --git a/scripts/ci/german-allowlist.txt b/scripts/ci/german-allowlist.txt
index d4bf378918..7a4f3b6546 100644
--- a/scripts/ci/german-allowlist.txt
+++ b/scripts/ci/german-allowlist.txt
@@ -270,6 +270,7 @@ jarvis/voice/tool_confirmation.py
# de/en/es, same speech-input-vocabulary rationale as the wake words ---
jarvis/safety/explicit_intent.py
tests/unit/safety/test_explicit_intent.py
+tests/unit/safety/test_workspace_send_intent.py
# --- manager.py + config.py: forensic comments quote the same German runtime
# phrase, and config.py carries the evidence-domain voice-intent keyword
diff --git a/tests/unit/safety/test_workspace_send_intent.py b/tests/unit/safety/test_workspace_send_intent.py
new file mode 100644
index 0000000000..7c497a6ea6
--- /dev/null
+++ b/tests/unit/safety/test_workspace_send_intent.py
@@ -0,0 +1,133 @@
+"""A coding-agent hand-off the user asked for runs without a second question.
+
+Live voice session 2026-10-01 18:11: the user asked Jarvis to hand the voice-bar
+flicker to an agent in the workspace, Jarvis asked "soll ich ihn starten?",
+then asked again for the follow-up agent the user requested by name — and the
+user's "Ja, aber das hättest du einfach loslaufen lassen können" was read as a
+veto, so the second agent never started. The workspace send now confirms only
+when the user's own turn did not ask for agent work.
+"""
+from __future__ import annotations
+
+from typing import Any
+from uuid import UUID
+
+import pytest
+
+from jarvis.brain.workspace_tool import WorkspaceOrchestrationTool
+from jarvis.core.bus import EventBus
+from jarvis.core.config import SafetyConfig
+from jarvis.safety.approval import ApprovalWorkflow
+from jarvis.safety.explicit_intent import utterance_requests_agent_work
+from jarvis.safety.risk_tier import RiskTierEvaluator
+from jarvis.safety.tool_executor import VOICE_CONFIRM_SENTINEL, ToolExecutor
+
+_SEND = {
+ "action": "send",
+ "project_id": "p",
+ "workspace_id": "w",
+ "terminal_id": "pane:1",
+ "request_id": "0" * 32,
+ "prompt": "Smooth out the voice bar indicators.",
+}
+
+
+class _Gateway:
+ def __init__(self) -> None:
+ self.calls: list[dict[str, Any]] = []
+
+ async def run(self, args: dict[str, Any], *, trace_id: str) -> dict[str, Any]:
+ self.calls.append(dict(args))
+ return {"status": "live", "success": True}
+
+
+class _Approval(ApprovalWorkflow):
+ async def wait(self, trace_id: UUID, timeout_s: float) -> tuple[bool, str]: # type: ignore[override]
+ raise AssertionError("a conversational turn never blocks on the UI approval")
+
+
+def _executor() -> ToolExecutor:
+ bus = EventBus()
+ return ToolExecutor(
+ bus=bus,
+ evaluator=RiskTierEvaluator(SafetyConfig()),
+ approval=_Approval(bus),
+ )
+
+
+ "utterance",
+ [
+ # The two requests from the live session, verbatim.
+ "Hmm, kannst du bitte mal nen Appshot machen und analysieren, da unten bei "
+ "diesen Indikatoren mit Jarvis spricht, ähm, geh einfach in Jarvis Workspace "
+ "rein ähm meinem Personal Jarvis Ordner. Und zwar siehst du das, dieses "
+ "Flackern. Ich möchte, dass du nen Agenten da beauftragst, dass es smoother "
+ "gemacht wird",
+ ". Und der soll dann bitte darauf schauen, dass ähm... Du, wenn man ähm wenn "
+ "man mit dir spricht, dass man dich zum Beispiel nicht wie beim vorigen "
+ "Beispiel, dass du dann erstmal fragst, ob das freigegeben werden muss. Das "
+ "kannst du automatisch machen. Da sollte ich nen anderer Agent drum kümmern, "
+ "im selben Workspace",
+ "Öffne ein neues Terminal mit einer Claude Code Session",
+ "Sag T2, er soll die Tests reparieren",
+ "Spawn a Codex agent that profiles the voice path",
+ "have the coding session fix the flicker",
+ "pídele al agente que revise el código",
+ "Nicht so, lass das einen Agenten machen",
+ ],
+)
+def test_agent_work_requests_are_recognized(utterance: str) -> None:
+ assert utterance_requests_agent_work(utterance) is True
+
+
+ "utterance",
+ [
+ "",
+ " ",
+ "Erzähl mir einen Witz",
+ "Was steht heute in meinem Kalender?",
+ "Schick das nicht an den Agenten",
+ "Kein Terminal bitte, mach es selbst",
+ "don't send it to the agent",
+ "what's the weather in Berlin",
+ ],
+)
+def test_other_turns_are_not_agent_work(utterance: str) -> None:
+ assert utterance_requests_agent_work(utterance) is False
+
+
+def test_hook_only_waives_the_send_action() -> None:
+ tool = WorkspaceOrchestrationTool(_Gateway())
+ assert tool.intent_confirms_args(_SEND, "lass das einen Agenten machen") is True
+ assert tool.intent_confirms_args(
+ {**_SEND, "action": "inspect"}, "lass das einen Agenten machen"
+ ) is False
+ assert tool.intent_confirms_args(_SEND, "erzähl mir einen Witz") is False
+
+
+async def test_requested_hand_off_runs_without_confirmation() -> None:
+ gateway = _Gateway()
+ result = await _executor().execute(
+ WorkspaceOrchestrationTool(gateway),
+ dict(_SEND),
+ user_utterance="Beauftrag einen Agenten im Workspace, das zu glätten",
+ config_snapshot={"voice_confirm": True},
+ )
+ assert result.success is True
+ assert len(gateway.calls) == 1
+
+
+async def test_unrequested_hand_off_still_confirms() -> None:
+ gateway = _Gateway()
+ result = await _executor().execute(
+ WorkspaceOrchestrationTool(gateway),
+ dict(_SEND),
+ user_utterance="Wie spät ist es?",
+ config_snapshot={"voice_confirm": True},
+ )
+ assert result.error == VOICE_CONFIRM_SENTINEL
+ assert gateway.calls == []