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): draft skills on the operation-pinned model before the chat brain

rubenluetke10-beep309d946f2fd1
diff --git a/jarvis/skills/creator_service.py b/jarvis/skills/creator_service.py
index 988e08abc2..c5767a97bd 100644
--- a/jarvis/skills/creator_service.py
+++ b/jarvis/skills/creator_service.py
@@ -738,6 +738,22 @@ class SkillCreatorService:
return True
bm = self._brain
+ # A caller that pinned a model for this operation (a GPT-Live call pins
+ # its thinking model) outranks the chat brain's active model: without
+ # this, a skill drafted from a cheap voice session ran on the chat
+ # tier's frontier model instead (live 2026-09-29: ~$0.06 per draft).
+ from jarvis.core.model_selection import operation_model
+
+ selection = operation_model.get()
+ get_brain = getattr(bm, "_get_brain", None) if bm is not None else None
+ if selection is not None and selection.model and callable(get_brain):
+ try:
+ pinned = get_brain(selection.provider, selection.model)
+ except Exception as exc: # noqa: BLE001
+ _LOG.info("creator: pinned operation model unavailable (%s)", exc)
+ pinned = None
+ if _fresh(pinned):
+ yield pinned, f"operation:{selection.provider}/{selection.model}"
if bm is not None:
getter = getattr(bm, "_get_or_create", None)
active = getattr(bm, "active_provider", None)
diff --git a/tests/unit/skills/test_creator_service.py b/tests/unit/skills/test_creator_service.py
index f4561da110..f76923ba19 100644
--- a/tests/unit/skills/test_creator_service.py
+++ b/tests/unit/skills/test_creator_service.py
@@ -209,6 +209,36 @@ async def test_draft_uses_active_provider_of_brain_manager(registry) -> None:
assert bm.requested == ["gemini"] # used the active provider
+class _PinnableBrainManager(_FakeBrainManager):
+ """Adds ``_get_brain(name, model)`` so an operation-pinned model resolves."""
+
+ def __init__(self, active, pinned) -> None: # noqa: ANN001
+ super().__init__(active, name="openai")
+ self._pinned = pinned
+ self.pinned_requests: list[tuple[str, str | None]] = []
+
+ def _get_brain(self, name: str, model: str | None = None): # noqa: ANN001
+ self.pinned_requests.append((name, model))
+ return self._pinned
+
+
+async def test_draft_uses_the_operation_pinned_model_first(registry) -> None:
+ """A voice session that pinned its (cheap) thinking model drafts skills on
+ it, not on the chat tier's active frontier model."""
+ from jarvis.core.model_selection import ModelSelection, use_operation_model
+
+ active = _FakeBrain("not json")
+ pinned = _FakeBrain(_GOOD_BRAIN_JSON)
+ bm = _PinnableBrainManager(active, pinned)
+ svc = SkillCreatorService(brain=bm, registry=registry)
+ with use_operation_model(ModelSelection("openai", "cheap-model")):
+ result = await svc.draft(SkillCreatorInput(intent="something"))
+ assert result.draft["name"] == "Brain Made Skill"
+ assert bm.pinned_requests == [("openai", "cheap-model")]
+ assert bm.requested == []
+
+
@pytest.mark.asyncio
async def test_draft_falls_back_when_brain_returns_garbage(registry) -> None:
svc = _service(registry, brain=_FakeBrain("I cannot help with that."))