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(realtime): map run_skill to run-skill so voice-loaded skills run

Harald7e2810b0d032
diff --git a/jarvis/realtime/tools.py b/jarvis/realtime/tools.py
index 179b2e7c4d..daa2dfaffc 100644
--- a/jarvis/realtime/tools.py
+++ b/jarvis/realtime/tools.py
@@ -89,6 +89,20 @@ def _wire_name(name: str) -> str:
return f"{normalized[:52]}_{digest}"
+def _plain_wire_alias(name: str) -> str:
+ """Hyphen-to-underscore form without the uniqueness hash.
+
+ Vertex Live declares hyphenated catalog names as ``run_skill_<digest>``
+ because ``run-skill`` is not a legal identifier. Models routinely drop
+ the digest and call ``run_skill``. Live 2026-08-20: that miss surfaced as
+ "unknown realtime tool" and the user heard that the skill could not load.
+ """
+ alias = re.sub(r"[^A-Za-z0-9_]", "_", str(name or "")).strip("_")
+ if not alias or not _VALID_WIRE_NAME.fullmatch(alias):
+ return ""
+ return alias
+
+
def canonical_tool_wire_name(name: str) -> str:
"""Strip a Gemini/Vertex tool-set prefix from a function-call name.
@@ -511,6 +525,13 @@ class RealtimeToolBridge:
continue
self._wire_to_name[wire] = str(name)
rendered.append((str(name), self._render_declaration(wire, descriptor)))
+ # Second pass: hyphenated catalog names also answer to the un-hashed
+ # underscore alias the live model actually sends. Never overwrite a
+ # real tool that already owns that identifier.
+ for name in sorted(self._descriptors):
+ alias = _plain_wire_alias(str(name))
+ if alias and alias not in self._wire_to_name:
+ self._wire_to_name[alias] = str(name)
kept, dropped = _apply_declaration_budget(
rendered, self._declaration_budget_chars
)
diff --git a/jarvis/skills/registry.py b/jarvis/skills/registry.py
index fe3d7a565e..bc2d7cb978 100644
--- a/jarvis/skills/registry.py
+++ b/jarvis/skills/registry.py
@@ -65,6 +65,8 @@ log = logging.getLogger(__name__)
#: Namespace prefixes a speaker or a model naturally drops ("the gmail skill").
#: Mirrors ``jarvis.skills.explicit_request._DROPPABLE_NAME_PREFIXES``.
_DROPPABLE_NAME_PREFIXES = frozenset({"plugin", "cli"})
+#: Trailing tokens a model tacks onto a skill name ("the morning routine skill").
+_DROPPABLE_NAME_SUFFIXES = frozenset({"skill", "skills"})
class SkillRegistry:
@@ -165,11 +167,15 @@ class SkillRegistry:
if _slug_of(skill) == key:
return skill
+ from .builtin import BUILTIN_SKILL_NAMES
from .relevance import skill_name_tokens
wanted = skill_name_tokens(key)
if not wanted:
raise KeyError(f"Skill '{name}' not in registry")
+ wanted_forms = [wanted]
+ if len(wanted) > 1 and wanted[-1] in _DROPPABLE_NAME_SUFFIXES:
+ wanted_forms.append(wanted[:-1])
def _forms(skill: Skill) -> list[tuple[str, ...]]:
"""Token tuples this skill answers to, widest last."""
@@ -183,12 +189,42 @@ class SkillRegistry:
shortened = tokens[1:]
if shortened not in out:
out.append(shortened)
+ # Clash suffix from create-skill ("Morning Routine 2"): the
+ # user still says the name they asked for, without the number.
+ if len(tokens) > 1 and tokens[-1].isdigit():
+ shortened = tokens[:-1]
+ if shortened not in out:
+ out.append(shortened)
return out
- for skill in ordered:
- if wanted in _forms(skill):
- return skill
- raise KeyError(f"Skill '{name}' not in registry")
+ hits: list[Skill] = []
+ seen: set[str] = set()
+ for form in wanted_forms:
+ for skill in ordered:
+ skill_key = str(skill.name)
+ if skill_key in seen:
+ continue
+ if form in _forms(skill):
+ hits.append(skill)
+ seen.add(skill_key)
+ if not hits:
+ raise KeyError(f"Skill '{name}' not in registry")
+
+ _live = {
+ SkillLifecycleState.ACTIVE,
+ SkillLifecycleState.VALIDATED,
+ }
+
+ def _rank(skill: Skill) -> tuple[int, int, str]:
+ # Prefer a live user skill over a bundled one with the same
+ # tokens. Live 2026-08-20: "Morning Routine" resolved to the
+ # disabled builtin while Morning Routine 2 was the active one.
+ active = 0 if skill.state in _live else 1
+ bundled = 0 if skill.name not in BUILTIN_SKILL_NAMES else 1
+ return (active, bundled, str(skill.name))
+
+ hits.sort(key=_rank)
+ return hits[0]
def list(self) -> list[Skill]:
return list(self._skills.values())
diff --git a/tests/unit/realtime/test_tools.py b/tests/unit/realtime/test_tools.py
index 33d61eb2f1..f1d77840dc 100644
--- a/tests/unit/realtime/test_tools.py
+++ b/tests/unit/realtime/test_tools.py
@@ -163,6 +163,32 @@ async def test_vertex_prefix_on_a_hashed_wire_name_still_runs():
assert executor.execute_calls[0][0] is tool
+async def test_underscore_alias_runs_a_hyphenated_tool():
+ """Live models drop the hash and call ``run_skill`` for ``run-skill``.
+
+ Live 2026-08-20: that miss was "unknown realtime tool" and the user
+ heard that the skill could not be loaded.
+ """
+ bridge, tool, executor = _bridge(name="run-skill")
+ await bridge.handle_user_transcript("Open Calculator")
+
+ name, result = await bridge.execute(
+ wire_name="run_skill", arguments={"app_name": "Calculator"}
+ )
+
+ assert name == "run-skill"
+ assert result["success"] is True
+ assert executor.execute_calls[0][0] is tool
+
+ name, result = await bridge.execute(
+ wire_name="default:run_skill",
+ arguments={"app_name": "Calculator"},
+ )
+ assert name == "run-skill"
+ assert result["success"] is True
+
+
@pytest.mark.asyncio
async def test_missing_required_argument_is_denied_before_executor():
bridge, _tool, executor = _bridge()
diff --git a/tests/unit/skills/test_registry_resolve.py b/tests/unit/skills/test_registry_resolve.py
index 3b856afd29..5c63e0c801 100644
--- a/tests/unit/skills/test_registry_resolve.py
+++ b/tests/unit/skills/test_registry_resolve.py
@@ -107,6 +107,35 @@ def test_resolve_finds_a_skill_by_its_directory_slug(tmp_path: Path) -> None:
assert reg.resolve("Morning Routine 2").name == "Morning Routine 2"
+def test_resolve_prefers_the_live_user_skill_over_a_disabled_builtin(
+ tmp_path: Path,
+) -> None:
+ """Voice-authored 'Morning Routine 2' is what the user asked for.
+
+ create-skill suffixes the display name on a collision with the builtin.
+ The model still sends 'Morning Routine'. A disabled bundled skill with
+ the same tokens must not win, and a trailing 'skill' from the model
+ must not miss.
+ """
+ _write(tmp_path, "morning-routine", "morning-routine")
+ folder = tmp_path / "morning-routine"
+ text = (folder / "SKILL.md").read_text(encoding="utf-8")
+ (folder / "SKILL.md").write_text(
+ text.replace(
+ "name: morning-routine\n",
+ "name: morning-routine\nstate: disabled\n",
+ ),
+ encoding="utf-8",
+ )
+ _write(tmp_path, "morning-routine-2", "Morning Routine 2")
+ reg = SkillRegistry(tmp_path)
+ reg.reload_sync()
+
+ assert reg.resolve("Morning Routine").name == "Morning Routine 2"
+ assert reg.resolve("morning routine skill").name == "Morning Routine 2"
+ assert reg.resolve("Morning-Routine").name == "Morning Routine 2"
+
+
def test_resolve_is_deterministic_under_an_ambiguous_name(tmp_path: Path) -> None:
"""Two skills folding to the same tokens always resolve to the same one,
never to whichever the dict happened to yield first."""