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(brain): desktop vehicle outranks topical skill match (BUG-039)

Ruben Lütke64d2efd0521c
diff --git a/docs/BUGS.md b/docs/BUGS.md
index bb434b6d27..43d6b0d380 100644
--- a/docs/BUGS.md
+++ b/docs/BUGS.md
@@ -2851,3 +2851,71 @@ degrade safely): the Windows hit-test may be flaky across COM apartments
rich editor can still read as "did not land"; legacy Zaphod X11 multihead
under-reports the virtual bounds; Linux foreground-follow costs ~6 xdotool
spawns per perceive frame.
+
+## BUG-039: Explicit desktop request hijacked by a topical skill match — "mir fehlt das passende Werkzeug" despite computer_use being available (HIGH, 2026-07-02)
+
+**Symptom.** Voice session 20:28, turn 1: "Kannst du bitte … ein Terminal
+öffnen, Cloud-Code öffnen, … und für mich ein Prompt geben, … kompletten <!-- i18n-allow: forensic quote of the live German voice turn -->
+Deep-Dive machen … ob es irgendwelche Bugs gibt" (STT-garbled "Claude Code" →
+"Cloud-Code") — an unambiguous desktop request. Jarvis spoke the preamble
+"Okay, ich starte cloud-debug." and then refused: "Das kann ich gerade nicht <!-- i18n-allow: forensic quote of the live German refusal -->
+ausführen — mir fehlt dafür das passende Werkzeug." No terminal was opened; <!-- i18n-allow: forensic quote of the live German refusal -->
+nothing happened.
+
+**Forensics (sessions.db, session 62198a59, turn auto-1).** The turn had the
+FULL router tool surface (computer_use present; `_looks_like_pc_control`
+matches the transcript, so no hide-gate stripped it). `tool_calls_json` shows
+exactly one call: `run-skill` → `ActionExecuted success=true` with
+`skill_name='cloud-debug', execution='mission'`, returning the mission
+directive "Call the spawn_worker tool NOW …". The model (gemini-3.5-flash,
+58k-token context) followed neither the directive nor computer_use and
+emitted the system-prompt-dictated capability refusal (manager.py "STRENGE
+REGEL" sentence). Turn 2 ("Thank you for watching!") was Whisper silence
+hallucination.
+
+**Root cause — a precedence gap, the desktop twin of BUG-035.** The router
+prompt's SKILLS-FIRST clause ("check skills BEFORE classifying; when in
+doubt, call the skill; a matching skill ALWAYS beats the free answer and
+spawn_worker") had only ONE counter-rule: an explicitly named heavy vehicle
+("Sub-Agent", "deep dive") wins. There was NO rule for the explicitly named
+DESKTOP vehicle ("open an app/terminal, click, type"), and none of the
+deterministic tool-hide gates (knowledge-question, signalless-turn,
+plugin-tool) ever constrained `run-skill`. So a loose CONTENT match ("find
+bugs" ≈ cloud-debug's when_to_use) hijacked a turn whose named VEHICLE was
+the desktop — and the utterance's own "Deep-Dive" pointed the heavy-vehicle
+rule at spawn_worker, doubly away from computer_use. The deterministic layer
+already got this right (`_trigger_names_vehicle` partition: a depth marker
+must not override a pc-control signal); the LLM-facing layer had no
+equivalent.
+
+**Fix (deterministic gate + prompt precedence, provider-agnostic).**
+- `jarvis/brain/manager.py::_hide_run_skill_on_pc_control_turn` — on a turn
+ with a deterministic pc-control/open-app signal, `run-skill` leaves the
+ tool surface so computer_use stays authoritative. Narrow: fires only when
+ `computer_use` is actually present (a CU-less host keeps run-skill);
+ stands down when the user literally says "Skill" (an explicit skill
+ request is its own vehicle, mirrors AD-S9); the AD-S4 inline trigger-match
+ path is untouched; any fault returns the tools unchanged.
+- `jarvis/brain/router.py` SYSTEM_PROMPT — three amendments: (1) SKILLS-FIRST
+ exception: an explicit SCREEN action beats every skill match unless the
+ skill is named; (2) "VEHIKEL SCHLAEGT INHALT": open/click/type requests are
+ computer_use even when the CONTENT of what gets typed sounds like heavy
+ work or a skill ("öffne ein Terminal, starte Claude Code und gib ihm den <!-- i18n-allow: quote of the German router-prompt example under change -->
+ Prompt: mach einen Deep-Dive …" → computer_use(goal=verbatim)); (3) "KEIN <!-- i18n-allow: quote of the German router-prompt rule under change -->
+ SKILL-DEAD-END": if a called skill's returned instructions do not fit the
+ actual request, ignore them and use the other tools — never answer "mir
+ fehlt das passende Werkzeug" while a present tool can do the job. <!-- i18n-allow: quotes of the German router-prompt rules under change -->
+
+**Guards.** `tests/unit/brain/test_routing.py::
+test_pc_control_turn_hides_run_skill_keeps_computer_use` (includes the live
+incident transcript verbatim), `…_non_pc_control_turn_keeps_run_skill`,
+`…_explicit_skill_request_keeps_run_skill_even_on_pc_control_turn`,
+`…_run_skill_stays_when_computer_use_absent`, and a fault-tolerance test.
+
+**Class rule (generalize, per the maintainer).** The vehicle the user NAMES
+outranks any semantic CONTENT match — for skills, spawns, and future
+integrations alike. "Open X and have it do Y" means: operate the desktop
+(computer_use); Y is the OTHER program's job, not Jarvis's. This is also the
+routing foundation for the planned "Jarvis drives CLI coding agents (Claude
+Code / OpenCode)" capability: those turns are Computer-Use tasks today, never
+"feature not available".
diff --git a/jarvis/brain/manager.py b/jarvis/brain/manager.py
index 008b0a0e50..0cb0897177 100644
--- a/jarvis/brain/manager.py
+++ b/jarvis/brain/manager.py
@@ -706,6 +706,13 @@ _DETERMINISTIC_WRITE_TOOL_NAMES: frozenset[str] = frozenset({
"call-contact",
})
+# The user literally names a skill ("nutz den Skill cloud-debug", "run the
+# skill …"). An explicit skill request is its own vehicle and always keeps
+# ``run-skill`` visible — the pc-control run-skill hide below must never veto
+# it. Same word in DE/EN; matched with word boundaries so unrelated words
+# ("skillful") don't trip it.
+_EXPLICIT_SKILL_REQUEST_RE = re.compile(r"\bskills?\b", re.IGNORECASE)
+
# Interrogative opener (DE / EN / ES) — the leading question word of a plain
# "what/which/who/how/…"-style factual question. Anchored at the start after an
# optional wake/greeting/politeness run so "Jarvis, welche Firmen …" still
@@ -4210,6 +4217,53 @@ class BrainManager:
log.debug("plugin-tool spawn-hide gate failed", exc_info=True)
return tools
+ def _hide_run_skill_on_pc_control_turn(
+ self, tools: dict[str, "Tool"], user_text: str
+ ) -> dict[str, "Tool"]:
+ """Hide ``run-skill`` when the turn explicitly asks to operate THIS
+ computer's screen (open an app/terminal, click, type into a program),
+ so ``computer_use`` stays authoritative for the named desktop vehicle.
+
+ Forensic 2026-07-02 (voice session 20:28, turn 1): "ein Terminal
+ öffnen, Cloud-Code öffnen, … und für mich ein Prompt geben …
+ kompletten Deep-Dive machen … ob es irgendwelche Bugs gibt" — an
+ unambiguous desktop request (open a terminal, open Claude Code, type a
+ prompt into it). The SKILLS-FIRST router rule ("when in doubt, call
+ the skill") let the semantically-similar ``cloud-debug`` skill hijack
+ the turn: run-skill returned its mission directive, the model followed
+ neither it nor computer_use and spoke the dictated capability refusal
+ ("mir fehlt dafür das passende Werkzeug"). The vehicle the user NAMED
+ (the desktop) must outrank a loose skill CONTENT match — and the
+ surest way to stop a wrong tool call is to not offer the tool (mirrors
+ the knowledge-question / plugin-tool hides above).
+
+ Narrow on purpose: fires ONLY when a deterministic pc-control /
+ open-app signal is present AND ``computer_use`` is actually in the
+ surface (a host without the CU harness keeps run-skill so the turn
+ stays handleable). Stands down when the user literally says "skill" —
+ an explicit skill request is its own vehicle. The deterministic
+ trigger-match inline path (AD-S4) is untouched: a skill whose OWN
+ trigger phrase matched rides the turn context before this gate and
+ needs no run-skill call. Pure regex + existing detectors (AP-11 safe,
+ provider-agnostic). Defensive: any fault returns the tools unchanged
+ so a gate bug can never blind the brain.
+ """
+ if not isinstance(tools, dict):
+ return tools
+ try:
+ t = (user_text or "").strip()
+ if not t or "run-skill" not in tools or "computer_use" not in tools:
+ return tools
+ if not (is_open_app_intent(t) or _looks_like_pc_control(t)):
+ return tools
+ # User literally named a skill → that request wins, keep run-skill.
+ if _EXPLICIT_SKILL_REQUEST_RE.search(t):
+ return tools
+ return {n: tool for n, tool in tools.items() if n != "run-skill"}
+ except Exception: # noqa: BLE001 — gate must never blind the brain
+ log.debug("pc-control run-skill-hide gate failed", exc_info=True)
+ return tools
+
def _apply_plugin_relevance(
self, user_text: str, tools: dict[str, "Tool"]
) -> dict[str, "Tool"]:
@@ -6670,6 +6724,16 @@ class BrainManager:
_turn_tools = self._hide_spawn_when_plugin_tool_handles_turn(
_turn_tools, user_text
)
+ # PC-control run-skill hide (forensic 2026-07-02, voice 20:28): "ein
+ # Terminal öffnen, Cloud-Code öffnen, … ein Prompt geben" — an
+ # explicit desktop request — was hijacked by the semantically-similar
+ # cloud-debug skill via the SKILLS-FIRST rule and dead-ended in the
+ # capability refusal. When the user names the desktop vehicle,
+ # computer_use is authoritative — drop run-skill from the surface.
+ if isinstance(_turn_tools, dict):
+ _turn_tools = self._hide_run_skill_on_pc_control_turn(
+ _turn_tools, user_text
+ )
# AI Pointer: on a deictic pointer turn the cursor crop is already the
# only attached image, so drop the redundant ``inspect-pointer`` PULL
# tool (calling it produced an empty spoken answer — observed live).
diff --git a/jarvis/brain/router.py b/jarvis/brain/router.py
index 8670fc783c..95c0a53dc0 100644
--- a/jarvis/brain/router.py
+++ b/jarvis/brain/router.py
@@ -63,9 +63,14 @@ gelisteten Skill — auch nur locker, auch in neuer Formulierung, die nicht die
Triggerphrase ist —, dann ist dein ERSTER Zug ``run-skill`` mit dessen Namen;
danach folgst du den zurueckgegebenen Anweisungen. Das ueberschreibt "antworte
direkt": ein Skill ist Rubens gespeicherte Art, genau das zu tun. Behaupte
-NIEMALS, einen Skill ausgefuehrt zu haben, ohne run-skill zu rufen. AUSNAHME:
-eine reine Wissensfrage, die ein Thema bloss nennt ("was ist X"), ist KEIN
-Skill-Fall. Details unten unter SKILLS.
+NIEMALS, einen Skill ausgefuehrt zu haben, ohne run-skill zu rufen. AUSNAHMEN:
+(1) eine reine Wissensfrage, die ein Thema bloss nennt ("was ist X"), ist KEIN
+Skill-Fall. (2) Beschreibt Ruben ausdruecklich eine BILDSCHIRM-Aktion (eine
+App / ein Terminal oeffnen, klicken, tippen, ein Programm auf dem Bildschirm
+bedienen), gewinnt computer_use ueber JEDEN Skill-Treffer — auch wenn der
+INHALT der Aufgabe (z.B. Bug-Suche, Recherche) nach einem Skill klingt. Der
+Skill gewinnt dann nur, wenn Ruben ihn beim Namen nennt ("nutz den Skill X").
+Details unten unter SKILLS.
SCREEN-CONTEXT
Wenn ein Screenshot anhaengt, siehst du Rubens Bildschirm als Bild im Kontext.
@@ -185,6 +190,21 @@ SKILLS — ZUERST PRUEFEN, BEVOR DU ANTWORTEST ODER DELEGIERST (HOHE PRIORITAET)
neuen Mails" schon. Nennt Ruben ausdruecklich ein schweres Vehikel
("Sub-Agent", "im Hintergrund", "deep dive"), gewinnt das (spawn_worker),
nicht der Skill. Passen mehrere Skills: nimm den spezifischsten.
+ VEHIKEL SCHLAEGT INHALT: beschreibt Ruben ausdruecklich, WIE etwas passieren
+ soll — eine App oder ein Terminal oeffnen, in ein Programm klicken/tippen,
+ etwas auf dem Bildschirm bedienen —, dann ist DIESES Vehikel der Auftrag:
+ computer_use, kein Skill und kein spawn_worker. Das gilt auch, wenn der
+ INHALT dessen, was er dort tippen/ausfuehren lassen will, nach schwerer
+ Arbeit oder einem Skill klingt. Beispiel: "oeffne ein Terminal, starte
+ Claude Code und gib ihm den Prompt: mach einen kompletten Deep-Dive und such
+ Bugs" → computer_use(goal=<verbatim>). Der Deep-Dive ist hier der PROMPT fuer
+ das andere Programm, nicht deine Aufgabe — NICHT run-skill(cloud-debug),
+ NICHT spawn_worker.
+ KEIN SKILL-DEAD-END: hast du run-skill gerufen und die zurueckgegebenen
+ Anweisungen passen NICHT zu dem, was Ruben wirklich verlangt hat, dann
+ ignoriere sie und erledige die Anfrage mit deinen anderen Tools (z.B.
+ computer_use). Antworte NIE "mir fehlt das passende Werkzeug", solange ein
+ vorhandenes Tool die Aufgabe kann.
Beispiel: "wie sieht mein Tag aus" / "Tagesueberblick" →
run-skill(skill_name="morning-routine"), dann die Anweisungen ausfuehren und
mit dem ERGEBNIS antworten.
@@ -281,6 +301,10 @@ Du sortierst jede Ruben-Nachricht in genau eine von drei Kategorien:
DAS ist der Weg, eine App zu oeffnen oder den Bildschirm zu bedienen —
NICHT open_app, NICHT spawn_worker (das laeuft in einem isolierten
Workspace und kann den Desktop NICHT anfassen).
+ Auch MEHRSCHRITTIGE Bildschirm-Auftraege bleiben EIN computer_use-Call:
+ "oeffne ein Terminal, starte Claude Code darin und gib ihm den Prompt X"
+ → computer_use(goal=<verbatim>), selbst wenn der Prompt-INHALT (X) nach
+ schwerer Arbeit klingt — das andere Programm arbeitet, nicht du.
- Shell-Kommando: "ls im Desktop", "starte notepad" (run_shell)
- Bildschirm beschreiben: "was siehst du auf meinem Screen" (screenshot)
- "merk dir X": KEIN Tool — beginne deine Antwort mit "Notiert" (siehe
diff --git a/tests/unit/brain/test_routing.py b/tests/unit/brain/test_routing.py
index 110bb8e90c..60ee528c46 100644
--- a/tests/unit/brain/test_routing.py
+++ b/tests/unit/brain/test_routing.py
@@ -3101,3 +3101,129 @@ def test_actionable_turn_keeps_computer_use(utterance: str) -> None:
assert "computer_use" in gated, (
f"computer_use must stay for an actionable turn: {utterance!r}"
)
+
+
+# ---------------------------------------------------------------------------
+# PC-control run-skill hide (forensic 2026-07-02, voice session 20:28): the
+# explicit desktop request "ein Terminal oeffnen, Cloud-Code oeffnen, … und
+# fuer mich ein Prompt geben …" (STT-garbled "Claude Code") ALSO mentioned
+# looking for bugs, so the SKILLS-FIRST router rule ("when in doubt, call the
+# skill") let the semantically-similar cloud-debug skill hijack the turn:
+# run-skill returned its mission directive, the model followed neither it nor
+# computer_use, and spoke the dictated capability refusal ("mir fehlt dafuer
+# das passende Werkzeug"). The vehicle the user NAMES (the desktop) must
+# outrank a loose skill CONTENT match — run-skill leaves the surface on such a
+# turn so computer_use stays authoritative.
+# ---------------------------------------------------------------------------
+
+
+class _FakeRunSkillTool:
+ name = "run-skill"
+ schema: dict[str, Any] = {}
+
+
+def _manager_with_cu_runskill_search() -> BrainManager:
+ executor = _RecordingExecutor()
+ return BrainManager(
+ config=JarvisConfig(),
+ bus=EventBus(),
+ tools={
+ "computer_use": _FakeCuTool(),
+ "run-skill": _FakeRunSkillTool(),
+ "search_web": _FakeSearchTool(),
+ },
+ tool_executor=executor, # type: ignore[arg-type]
+ )
+
+
+# The live incident transcript (STT-garbled: "Cloud-Code" = Claude Code) plus
+# simpler members of the same class: the user names the DESKTOP as vehicle.
+PC_CONTROL_TURNS_THAT_MUST_NOT_REACH_RUN_SKILL = [
+ (
+ # i18n-allow: live incident transcript under test
+ "Kannst du bitte für mich mal für mich ein Terminal öffnen, Cloud-Code "
+ "öffnen, in den Jarvis-Vorordnern, in das Jarvis-Directly-Renavigieren "
+ "und für mich ein Prompt geben, und zwar, dass er mal einen kompletten "
+ "Deep-Dive machen soll und gucken, ob es irgendwelche Bugs gibt. Er soll "
+ "nur ein Report schreiben und keine einzige Datei verändern oder löschen "
+ "oder sowas etc."
+ ),
+ "Oeffne ein Terminal und starte Claude Code", # i18n-allow: German voice command under test
+ "Klick auf den Play-Button", # i18n-allow: German voice command under test
+ "Open a terminal and type npm install",
+]
+
+
[email protected]("utterance", PC_CONTROL_TURNS_THAT_MUST_NOT_REACH_RUN_SKILL)
+def test_pc_control_turn_hides_run_skill_keeps_computer_use(utterance: str) -> None:
+ """An explicit desktop request (open an app/terminal, click, type) must not
+ be hijackable by a semantically-similar skill: run-skill leaves the surface,
+ computer_use stays."""
+ manager = _manager_with_cu_runskill_search()
+ gated = manager._hide_run_skill_on_pc_control_turn(
+ dict(manager._tools), utterance
+ )
+ assert "run-skill" not in gated, (
+ f"run-skill must be hidden on a pc-control turn: {utterance!r}"
+ )
+ assert "computer_use" in gated, "computer_use must stay authoritative"
+ assert "search_web" in gated, "unrelated tools must be untouched"
+
+
+NON_PC_CONTROL_SKILL_TURNS = [
+ "Wie sieht mein Tag aus?", # i18n-allow: morning-routine skill trigger under test
+ "Finde den Bug im Login-Test", # i18n-allow: cloud-debug-shaped task, no desktop vehicle
+ "What does my day look like?",
+]
+
+
[email protected]("utterance", NON_PC_CONTROL_SKILL_TURNS)
+def test_non_pc_control_turn_keeps_run_skill(utterance: str) -> None:
+ """A turn without a desktop-vehicle signal keeps run-skill — skills stay
+ first-class for the kind of task they exist for."""
+ manager = _manager_with_cu_runskill_search()
+ gated = manager._hide_run_skill_on_pc_control_turn(
+ dict(manager._tools), utterance
+ )
+ assert "run-skill" in gated, (
+ f"run-skill must stay on a non-pc-control turn: {utterance!r}"
+ )
+
+
+def test_explicit_skill_request_keeps_run_skill_even_on_pc_control_turn() -> None:
+ """The user literally naming a skill is its own vehicle — it must never be
+ vetoed, even when the same turn opens an app (mirrors AD-S9 for spawn)."""
+ manager = _manager_with_cu_runskill_search()
+ gated = manager._hide_run_skill_on_pc_control_turn(
+ dict(manager._tools),
+ # i18n-allow: German voice command under test
+ "Oeffne Chrome und nutz den Skill browser-tabs",
+ )
+ assert "run-skill" in gated, "an explicit skill request must keep run-skill"
+
+
+def test_run_skill_stays_when_computer_use_absent() -> None:
+ """On a host without the CU harness the gate must stand down — hiding
+ run-skill there would leave the desktop request with NO handler at all."""
+ executor = _RecordingExecutor()
+ manager = BrainManager(
+ config=JarvisConfig(),
+ bus=EventBus(),
+ tools={"run-skill": _FakeRunSkillTool(), "search_web": _FakeSearchTool()},
+ tool_executor=executor, # type: ignore[arg-type]
+ )
+ gated = manager._hide_run_skill_on_pc_control_turn(
+ # i18n-allow: German voice command under test
+ dict(manager._tools), "Oeffne ein Terminal und starte Claude Code"
+ )
+ assert "run-skill" in gated, (
+ "without computer_use in the surface the gate must not hide run-skill"
+ )
+
+
+def test_pc_control_run_skill_gate_is_fault_tolerant() -> None:
+ """Any fault (non-dict surface) returns the tools unchanged — a gate bug
+ must never blind the brain."""
+ manager = _manager_with_cu_runskill_search()
+ sentinel = object()
+ assert manager._hide_run_skill_on_pc_control_turn(sentinel, "Oeffne Chrome") is sentinel # type: ignore[arg-type] # i18n-allow: German voice command under test