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.
Python agent-orchestrationai-agentai-coding-assistantclaude-codecoding-agentcomputer-usedesktop-applocal-firstmcppersonal-jarvisvoice-assistantvoice-coding
fix(wiki): keep memory work on subscriptions, never the voice API key
rubenluetke10-beep150cb17b208a
diff --git a/jarvis/memory/wiki/consolidator.py b/jarvis/memory/wiki/consolidator.pyindex e02dccf59b..3c2b398573 100644--- a/jarvis/memory/wiki/consolidator.py+++ b/jarvis/memory/wiki/consolidator.py@@ -499,9 +499,9 @@ class Consolidator:start_ns = time.time_ns()from jarvis.memory.wiki.provider_chain import (+ background_wiki_providers,build_wiki_provider_chain,complete_with_fallback,- credential_ready_wiki_providers,)available = set(self._registry.available())@@ -510,7 +510,7 @@ class Consolidator:model_override=self._curator_cfg.model,available=available,credential_ready=(- credential_ready_wiki_providers(+ background_wiki_providers(available=available,config=self._root_cfg,)diff --git a/jarvis/memory/wiki/curator_llm.py b/jarvis/memory/wiki/curator_llm.pyindex 8a08595221..88f948b518 100644--- a/jarvis/memory/wiki/curator_llm.py+++ b/jarvis/memory/wiki/curator_llm.py@@ -533,9 +533,9 @@ class WikiCuratorLLM:start_ns = time.time_ns()from jarvis.memory.wiki.provider_chain import (+ background_wiki_providers,build_wiki_provider_chain,complete_with_fallback,- credential_ready_wiki_providers,)# Key-aware fallback (AP-22/23): cross to a reachable family instead of@@ -546,7 +546,7 @@ class WikiCuratorLLM:model_override=self._cfg.model,available=available,credential_ready=(- credential_ready_wiki_providers(+ background_wiki_providers(available=available,config=self._config,)diff --git a/jarvis/memory/wiki/extractor.py b/jarvis/memory/wiki/extractor.pyindex 0f60ac79a5..e5a6c857a2 100644--- a/jarvis/memory/wiki/extractor.py+++ b/jarvis/memory/wiki/extractor.py@@ -855,9 +855,9 @@ class ConversationFactExtractor:start_ns = time.time_ns()from jarvis.memory.wiki.provider_chain import (+ background_wiki_providers,build_wiki_provider_chain,complete_with_fallback,- credential_ready_wiki_providers,)# Key-aware fallback (AP-22/23): try the configured provider, then cross@@ -869,7 +869,7 @@ class ConversationFactExtractor:model_override=self._curator_cfg.model,available=available,credential_ready=(- credential_ready_wiki_providers(+ background_wiki_providers(available=available,config=self._root_cfg,)diff --git a/jarvis/memory/wiki/provider_chain.py b/jarvis/memory/wiki/provider_chain.pyindex 310354877d..9abe364464 100644--- a/jarvis/memory/wiki/provider_chain.py+++ b/jarvis/memory/wiki/provider_chain.py@@ -218,6 +218,32 @@ def credential_ready_wiki_providers(return ready+def background_wiki_providers(+ *,+ available: set[str] | frozenset[str],+ config: Any,+ is_subscription: Callable[[str], bool] | None = None,+) -> set[str]:+ """Providers wiki background work may bill: subscriptions before any key.++ Memory curation is background work the user never waits on, so while any+ subscription login is connected it runs ONLY on subscriptions plus keyless+ local providers and never touches a per-token key (live 2026-09-29: an+ OpenAI key added for voice paid ~$0.30 of wiki calls after a two-minute+ chat). With no subscription connected the full credential-ready set stays+ in play, so a single-key install keeps a working wiki (AP-21/AP-22).+ """+ from jarvis.core.config import PROVIDER_SECRET_CANDIDATES++ ready = credential_ready_wiki_providers(available=available, config=config)+ probe = is_subscription or (lambda name: subscription_login_ready(name) is True)+ subscriptions = {name for name in ready if probe(name)}+ if not subscriptions:+ return ready+ keyless = {name for name in ready if name not in PROVIDER_SECRET_CANDIDATES}+ return subscriptions | keyless++def build_wiki_provider_chain(*,primary: str,@@ -617,6 +643,7 @@ async def complete_with_fallback(__all__ = [+ "background_wiki_providers","build_wiki_provider_chain","complete_with_fallback","credential_ready_wiki_providers",diff --git a/jarvis/memory/wiki/recurate.py b/jarvis/memory/wiki/recurate.pyindex 486ccf10c8..aebbbb5654 100644--- a/jarvis/memory/wiki/recurate.py+++ b/jarvis/memory/wiki/recurate.py@@ -179,9 +179,9 @@ async def recurate_profile()from jarvis.memory.wiki.provider_chain import (+ background_wiki_providers,build_wiki_provider_chain,complete_with_fallback,- credential_ready_wiki_providers,)# An injected registry (tests) skips the credential filter — the same@@ -198,7 +198,7 @@ async def recurate_profile(model_override=wiki_cfg.curator.model,available=available,credential_ready=(- credential_ready_wiki_providers(available=available, config=config)+ background_wiki_providers(available=available, config=config)if credential_filterelse available),diff --git a/jarvis/memory/wiki/search_aliases.py b/jarvis/memory/wiki/search_aliases.pyindex e7392e4793..dcf4e77626 100644--- a/jarvis/memory/wiki/search_aliases.py+++ b/jarvis/memory/wiki/search_aliases.py@@ -262,9 +262,9 @@ async def generate_aliases(from jarvis.core.protocols import BrainMessage, BrainRequest # noqa: PLC0415from jarvis.memory.wiki.provider_chain import ( # noqa: PLC0415+ background_wiki_providers,build_wiki_provider_chain,complete_with_fallback,- credential_ready_wiki_providers,)# Same key-aware chain the curator uses: lead with the configured wiki@@ -272,11 +272,15 @@ async def generate_aliases(# credential (AP-22 — never a single-provider brick).try:available = set(registry.available())+ curator = getattr(getattr(getattr(cfg, "memory", None), "wiki", None), "curator", None)+ primary = str(getattr(curator, "provider", "") or "").strip() or str(+ getattr(getattr(cfg, "brain", None), "primary", "") or ""+ )chain = build_wiki_provider_chain(- primary=str(getattr(getattr(cfg, "brain", None), "primary", "") or ""),+ primary=primary,model_override="",available=available,- credential_ready=credential_ready_wiki_providers(+ credential_ready=background_wiki_providers(available=available, config=cfg),)diff --git a/jarvis/plugins/brain/codex.py b/jarvis/plugins/brain/codex.pyindex 208c1fe3b0..45f9c70550 100644--- a/jarvis/plugins/brain/codex.py+++ b/jarvis/plugins/brain/codex.py@@ -751,7 +751,9 @@ class CodexBrain:# OPENAI_API_KEY, so without this a key added for voice silently# billed every memory pass on the most expensive model (live# 2026-09-29: ~$0.30 of wiki calls after a two-minute voice chat).- # The key stays the fallback when the subscription turn fails.+ # A failed subscription turn raises instead of crossing to the key:+ # background callers walk their own chain to the next subscription,+ # and the maintainer wants the key spent only on the live voice call.if (api_keyand self._structured_prompts@@ -762,25 +764,14 @@ class CodexBrain:"CodexBrain.complete: structured request on the ChatGPT subscription (model=%s)",self._cli_model or "default",)- sub_emitted = False- try:- stream = (- self._complete_via_cli(req)- if self._subscription_text_only- else self._complete_via_app_server(req)- )- async for delta in stream:- if delta.content:- sub_emitted = True- yield delta- return- except Exception as exc: # noqa: BLE001 — re-raised once output was emitted- if sub_emitted:- raise- log.warning(- "CodexBrain: subscription path failed (%s) — using the API key",- type(exc).__name__,- )+ stream = (+ self._complete_via_cli(req)+ if self._subscription_text_only+ else self._complete_via_app_server(req)+ )+ async for delta in stream:+ yield delta+ returnif api_key:log.info("CodexBrain.complete: API-key path (model=%s)", self._model)client = self._ensure_client(api_key)diff --git a/tests/unit/brain/test_codex_brain.py b/tests/unit/brain/test_codex_brain.pyindex 8182959886..3465ea58ec 100644--- a/tests/unit/brain/test_codex_brain.py+++ b/tests/unit/brain/test_codex_brain.py@@ -152,7 +152,7 @@ async def test_structured_request_prefers_subscription_over_paid_key(@pytest.mark.asyncio-async def test_structured_request_falls_back_to_key_when_subscription_fails(+async def test_structured_request_never_crosses_to_the_paid_key(monkeypatch: pytest.MonkeyPatch,) -> None:api_calls: list[str] = []@@ -166,10 +166,11 @@ async def test_structured_request_falls_back_to_key_when_subscription_fails(brain = CodexBrain(structured_prompts=True)req = BrainRequest(messages=(BrainMessage(role="user", content="extract facts"),))- text = "".join([d.content or "" async for d in brain.complete(req)])+ with pytest.raises(RuntimeError, match="app server down"):+ async for _delta in brain.complete(req):+ pass- assert text == "from-api"- assert api_calls == ["api"]+ assert api_calls == []@pytest.mark.asynciodiff --git a/tests/unit/memory/wiki/test_curator_llm.py b/tests/unit/memory/wiki/test_curator_llm.pyindex 38210ebf9b..6a0ffd6b5c 100644--- a/tests/unit/memory/wiki/test_curator_llm.py+++ b/tests/unit/memory/wiki/test_curator_llm.py@@ -764,6 +764,11 @@ async def test_propose_updates_uses_default_registry_if_none_injected("jarvis.memory.wiki.provider_chain.credential_ready_wiki_providers",lambda *, available, **_kwargs: set(available),)+ # This host's real CLI logins must not reorder the chain under test.+ monkeypatch.setattr(+ "jarvis.memory.wiki.provider_chain.subscription_login_ready",+ lambda _provider, **_kwargs: None,+ )llm = WikiCuratorLLM(config=cfg,diff --git a/tests/unit/memory/wiki/test_provider_chain.py b/tests/unit/memory/wiki/test_provider_chain.pyindex b7019a1b6a..52b11cc476 100644--- a/tests/unit/memory/wiki/test_provider_chain.py+++ b/tests/unit/memory/wiki/test_provider_chain.py@@ -173,6 +173,40 @@ def test_credential_probe_uses_core_portable_storage_and_keeps_oauth(assert ready == {"nvidia", "future-oauth"}+def test_background_work_skips_paid_keys_while_a_subscription_is_connected(+ monkeypatch: pytest.MonkeyPatch,+) -> None:+ import jarvis.memory.wiki.provider_chain as chain_module++ monkeypatch.setattr(+ chain_module,+ "credential_ready_wiki_providers",+ lambda *, available, config: {"openai", "gemini", "codex", "ollama"},+ )+ ready = chain_module.background_wiki_providers(+ available={"openai", "gemini", "codex", "ollama"},+ config=object(),+ is_subscription=lambda name: name == "codex",+ )+ assert ready == {"codex", "ollama"} # subscription + keyless local only+++def test_background_work_keeps_keys_when_no_subscription_exists(+ monkeypatch: pytest.MonkeyPatch,+) -> None:+ import jarvis.memory.wiki.provider_chain as chain_module++ monkeypatch.setattr(+ chain_module,+ "credential_ready_wiki_providers",+ lambda *, available, config: {"openai"},+ )+ ready = chain_module.background_wiki_providers(+ available={"openai"}, config=object(), is_subscription=lambda _name: False+ )+ assert ready == {"openai"} # a single-key install keeps a working wiki++# --- the fallback loop -------------------------------------------------------