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(skills): sync paired capabilities on every registry reload; ship plugin-google_calendar

Ruben Lütke92f62b8d856d
diff --git a/jarvis/skills/builtin/__init__.py b/jarvis/skills/builtin/__init__.py
index 41db34cce2..8da015068a 100644
--- a/jarvis/skills/builtin/__init__.py
+++ b/jarvis/skills/builtin/__init__.py
@@ -37,6 +37,7 @@ _PLUGIN_PAIRED_SKILLS: tuple[str, ...] = (
"plugin-asana",
"plugin-supabase",
"plugin-cloudflare",
+ "plugin-google_calendar",
"plugin-google_drive",
"plugin-vercel",
)
diff --git a/jarvis/skills/plugin_coupling.py b/jarvis/skills/plugin_coupling.py
index e972cbdb8b..10d37b06a2 100644
--- a/jarvis/skills/plugin_coupling.py
+++ b/jarvis/skills/plugin_coupling.py
@@ -74,3 +74,44 @@ def register_paired_capabilities(
n += 1
log.info("plugin_coupling: registered %d paired capabilities", n)
return n
+
+
+def sync_paired_capabilities(
+ registry: CapabilityRegistry, skills: list[Skill]
+) -> int:
+ """Replace the whole paired-capability set with the given skills'. Returns count.
+
+ Called after every SkillRegistry (re)load. The one-shot registration at
+ boot is timing-fragile: since the serve-first fast boot (2026-06-22) the
+ registry's disk scan is DEFERRED, so ``set_skill_context`` registered the
+ paired capabilities from a still-EMPTY skill list ("registered 0 paired
+ capabilities" on every boot) and nothing ever re-registered them after the
+ scan landed. The evidence gate then found no capability for the email /
+ calendar domains and spoke its deterministic "no access" refusal although
+ the plugins were connected and healthy (live 2026-07-17 voice session).
+
+ Unlike ``register_paired_capabilities`` this also WITHDRAWS orphans —
+ paired capabilities whose skill vanished or left a live state since the
+ last load — via the shared ``PAIRED_CAP_PREFIX`` namespace, so a hot
+ reload after a skill edit converges instead of only ever growing the set.
+ """
+ stale = {
+ cap.id
+ for cap in registry.all()
+ if cap.id.startswith(PAIRED_CAP_PREFIX)
+ }
+ n = 0
+ for skill in skills:
+ cap = capability_from_skill(skill)
+ if cap is not None:
+ registry.register(cap)
+ stale.discard(cap.id)
+ n += 1
+ for cap_id in stale:
+ registry.deregister(cap_id)
+ log.info(
+ "plugin_coupling: synced %d paired capabilities (%d withdrawn)",
+ n,
+ len(stale),
+ )
+ return n
diff --git a/jarvis/skills/registry.py b/jarvis/skills/registry.py
index 79a6004b58..9b6d8cb579 100644
--- a/jarvis/skills/registry.py
+++ b/jarvis/skills/registry.py
@@ -292,6 +292,7 @@ class SkillRegistry:
skills = self._apply_state_overrides(discover_skills(self.root))
with self._thread_lock:
self._skills = {s.name: s for s in skills}
+ self._sync_paired_capabilities()
self._emit_reloaded()
async def reload(self) -> None:
@@ -303,8 +304,30 @@ class SkillRegistry:
skills = self._apply_state_overrides(skills)
with self._thread_lock:
self._skills = {s.name: s for s in skills}
+ self._sync_paired_capabilities()
self._emit_reloaded()
+ def _sync_paired_capabilities(self) -> None:
+ """Mirror the paired-skill capabilities after every (re)load.
+
+ The boot registers paired capabilities when the skill context is set,
+ but since the serve-first fast boot the disk scan is deferred — that
+ registration ran against an EMPTY registry and nothing repaired the
+ capability surface afterwards, so the evidence gate refused connected
+ plugin domains for the whole session (live 2026-07-17). Hooking the
+ sync into the registry's own reload covers every load source with one
+ code path: the deferred boot scan, the watchdog hot reload, and the
+ explicit reload_sync callers. Best-effort by design — a capability
+ fault must never break a skill reload.
+ """
+ try:
+ from jarvis.core.capabilities import get_registry
+ from jarvis.skills.plugin_coupling import sync_paired_capabilities
+
+ sync_paired_capabilities(get_registry(), self.list())
+ except Exception: # noqa: BLE001
+ log.debug("paired-capability sync failed", exc_info=True)
+
def _emit_reloaded(self) -> None:
if self.bus is None:
return
diff --git a/tests/unit/skills/test_builtin_skills.py b/tests/unit/skills/test_builtin_skills.py
index 8c4a8bda84..2b8f0a9673 100644
--- a/tests/unit/skills/test_builtin_skills.py
+++ b/tests/unit/skills/test_builtin_skills.py
@@ -104,6 +104,28 @@ def test_expected_builtin_count() -> None:
assert len(set(BUILTIN_SKILL_NAMES)) == len(BUILTIN_SKILL_NAMES), "duplicate skill name"
+def test_every_bundled_plugin_skill_is_shipped() -> None:
+ """Every plugin-* directory under builtin/ must be in BUILTIN_SKILL_NAMES.
+
+ ensure_user_skills_dir() only copies LISTED skills into the user skills
+ dir — an unlisted bundle directory is never loaded, its paired capability
+ never registers, and the evidence gate refuses the plugin's domain although
+ the plugin is connected. Live 2026-07-17: plugin-google_calendar existed on
+ disk but was missing from the list, so a connected Google Calendar was
+ answered with the deterministic "no calendar access" refusal.
+ """
+ from jarvis.skills.builtin import BUILTIN_SKILLS_DIR
+
+ bundled = {
+ p.parent.name
+ for p in BUILTIN_SKILLS_DIR.glob("plugin-*/SKILL.md")
+ }
+ unlisted = bundled - set(BUILTIN_SKILL_NAMES)
+ assert not unlisted, (
+ f"bundled plugin skill(s) missing from BUILTIN_SKILL_NAMES: {unlisted}"
+ )
+
+
def test_control_api_specifics() -> None:
"""The shipped Control-API skill is documentation for coding agents.
diff --git a/tests/unit/skills/test_registry_paired_cap_sync.py b/tests/unit/skills/test_registry_paired_cap_sync.py
new file mode 100644
index 0000000000..d5026644f4
--- /dev/null
+++ b/tests/unit/skills/test_registry_paired_cap_sync.py
@@ -0,0 +1,124 @@
+"""Every SkillRegistry (re)load mirrors the paired-skill capability surface.
+
+Forensic origin (voice session 2026-07-17 10:32): since the serve-first fast
+boot the registry's disk scan is deferred, so the one-shot paired-capability
+registration at ``set_skill_context`` time ran against an EMPTY skill list
+("registered 0 paired capabilities" on every boot) and nothing ever repaired
+the capability surface after the scan landed. The evidence gate then found no
+capability for the email/calendar domains and spoke its deterministic
+"no access" refusal although the plugins were connected and healthy.
+
+Contract under test:
+ 1. ``reload_sync()`` registers the paired capability of every live paired
+ skill it discovered — the deferred boot scan repairs the surface.
+ 2. A later reload WITHDRAWS orphans (skill removed since the last load),
+ so hot reload converges instead of only ever growing the set.
+ 3. Non-paired skills never contribute a capability.
+"""
+from __future__ import annotations
+
+import shutil
+from pathlib import Path
+
+import pytest
+
+from jarvis.core.capabilities import _reset_registry_for_tests, get_registry
+from jarvis.skills.plugin_coupling import PAIRED_CAP_PREFIX
+from jarvis.skills.registry import SkillRegistry
+
+
+def skills_root(tmp_path: Path) -> Path:
+ root = tmp_path / "user_skills"
+ root.mkdir()
+ return root
+
+
[email protected](autouse=True)
+def _isolated_capability_registry():
+ _reset_registry_for_tests()
+ yield
+ _reset_registry_for_tests()
+
+
+def _write_paired_skill(root: Path, name: str, plugin_id: str) -> None:
+ d = root / name
+ d.mkdir()
+ (d / "SKILL.md").write_text(
+ "---\n"
+ 'schema_version: "1"\n'
+ f"name: {name}\n"
+ "description: test paired skill\n"
+ f"plugin_id: {plugin_id}\n"
+ "intent_verbs: [lies, check]\n" # i18n-allow: intent vocabulary under test
+ "intent_objects: [postfach, inbox]\n" # i18n-allow: intent vocabulary under test
+ "risk_policy:\n"
+ " default_tier: ask\n"
+ "---\n\n## Body\n",
+ encoding="utf-8",
+ )
+
+
+def _write_plain_skill(root: Path, name: str) -> None:
+ d = root / name
+ d.mkdir()
+ (d / "SKILL.md").write_text(
+ "---\n"
+ 'schema_version: "1"\n'
+ f"name: {name}\n"
+ "description: plain skill without pairing\n"
+ "---\n\n## Body\n",
+ encoding="utf-8",
+ )
+
+
+def _paired_cap_ids() -> set[str]:
+ return {
+ cap.id
+ for cap in get_registry().all()
+ if cap.id.startswith(PAIRED_CAP_PREFIX)
+ }
+
+
+def test_reload_sync_registers_paired_caps_after_deferred_scan(
+ skills_root: Path,
+) -> None:
+ _write_paired_skill(skills_root, "plugin-gmail", "gmail")
+ _write_plain_skill(skills_root, "morning-routine")
+ reg = SkillRegistry(skills_root, bus=None)
+
+ # Boot shape: the capability surface is still empty before the deferred scan…
+ assert _paired_cap_ids() == set()
+
+ reg.reload_sync()
+
+ # …and the scan itself repairs it — no second registration pass needed.
+ assert _paired_cap_ids() == {f"{PAIRED_CAP_PREFIX}gmail"}
+
+
+def test_reload_withdraws_orphaned_paired_caps(skills_root: Path) -> None:
+ _write_paired_skill(skills_root, "plugin-gmail", "gmail")
+ _write_paired_skill(skills_root, "plugin-github", "github")
+ reg = SkillRegistry(skills_root, bus=None)
+ reg.reload_sync()
+ assert _paired_cap_ids() == {
+ f"{PAIRED_CAP_PREFIX}gmail",
+ f"{PAIRED_CAP_PREFIX}github",
+ }
+
+ shutil.rmtree(skills_root / "plugin-github")
+ reg.reload_sync()
+
+ assert _paired_cap_ids() == {f"{PAIRED_CAP_PREFIX}gmail"}
+
+
+def test_resolve_intent_reaches_the_paired_plugin_after_scan(
+ skills_root: Path,
+) -> None:
+ _write_paired_skill(skills_root, "plugin-gmail", "gmail")
+ reg = SkillRegistry(skills_root, bus=None)
+ reg.reload_sync()
+
+ # i18n-allow: German utterance under test
+ cap = get_registry().resolve_intent("check mein Postfach")
+ assert cap is not None and cap.id == f"{PAIRED_CAP_PREFIX}gmail"