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(ide): write pane recaps on the subscription before any paid key

rubenluetke10-beepf7747d241243
diff --git a/jarvis/agentic_ide/recap_engine.py b/jarvis/agentic_ide/recap_engine.py
index 91f3bb67a9..62b179d4f8 100644
--- a/jarvis/agentic_ide/recap_engine.py
+++ b/jarvis/agentic_ide/recap_engine.py
@@ -818,6 +818,13 @@ def _resolve_brains() -> list[Any]:
from jarvis.core.config import load_config
config = load_config()
+ # Recaps are background work: a connected subscription writes them and
+ # no per-token key is touched (live 2026-09-29: recaps billed the
+ # OpenAI key meant for the voice call). If the subscription cannot
+ # answer, the deterministic floor writes the title instead.
+ subscription = _resolve_subscription(config)
+ if subscription is not None:
+ return [subscription]
candidates: list[Any] = []
for brain in frontier_brain_candidates(config):
candidates.append(brain)
@@ -826,23 +833,8 @@ def _resolve_brains() -> list[Any]:
except Exception as exc: # noqa: BLE001 - no brain is an answer, not an error
logger.info("Agentic IDE recap: no brain reachable ({})", exc)
return []
- # Every family above needs an API key, and the install this feature broke
- # on live had exactly one — depleted. A connected coding subscription is a
- # credential too (§3), and often the STRONGEST model the user has: the very
- # CLI running in the panes. It goes LAST because a CLI call costs a process
- # spawn and seconds where an API call costs milliseconds — it should write
- # the recap only when everything cheaper is dead.
- #
- # Appended UNCONDITIONALLY, not into a spare slot. It used to be skipped
- # whenever MAX_PROVIDER_TRIES API families were configured — which made it
- # unreachable on exactly the install it was built for: three configured but
- # broken keys occupied every slot, and the one credential provably working
- # (the CLI running in the panes) was never asked. Resolving it here only
- # instantiates the brain; the expensive CLI call happens solely when every
- # API family has already failed.
- subscription = _resolve_subscription(config)
- if subscription is not None:
- candidates.append(subscription)
+ # Reached only with no subscription connected: the keyed families are
+ # then the whole chain, so a single-key install still gets model recaps.
return candidates
diff --git a/tests/unit/agentic_ide/test_recap_engine.py b/tests/unit/agentic_ide/test_recap_engine.py
index d90e7c869d..7f6c1c8f5b 100644
--- a/tests/unit/agentic_ide/test_recap_engine.py
+++ b/tests/unit/agentic_ide/test_recap_engine.py
@@ -777,33 +777,30 @@ def test_a_depleted_key_failure_reads_as_a_sentence_not_json() -> None:
assert note.startswith("Its provider is out of credits or rate-limited.")
-def test_a_connected_subscription_is_the_last_candidate(monkeypatch) -> None:
- """One depleted API key + a signed-in coding CLI must still produce recaps."""
+def test_a_connected_subscription_writes_recaps_without_any_key(monkeypatch) -> None:
+ """Recaps are background work: a signed-in subscription writes them and no
+ per-token key is asked, even when several keys are configured."""
from jarvis.brain import resolver
- api = SimpleNamespace(model="depleted-api")
+ brains = [SimpleNamespace(model=f"api-{n}") for n in range(recap_engine.MAX_PROVIDER_TRIES)]
subscription = SimpleNamespace(model="coding-cli")
- monkeypatch.setattr(resolver, "frontier_brain_candidates", lambda cfg: iter([api]))
+ monkeypatch.setattr(resolver, "frontier_brain_candidates", lambda cfg: iter(brains))
monkeypatch.setattr(resolver, "resolve_subscription_brain", lambda cfg, **kwargs: subscription)
monkeypatch.setattr("jarvis.core.config.load_config", lambda: SimpleNamespace())
- assert recap_engine._resolve_brains() == [api, subscription] # noqa: SLF001
+ assert recap_engine._resolve_brains() == [subscription] # noqa: SLF001
-def test_a_full_api_chain_still_ends_at_the_subscription(monkeypatch) -> None:
- """The regression that shipped: three configured-but-dead API keys filled
- every candidate slot, and the one credential provably working — the CLI
- running in the panes — was never asked. The subscription rides behind the
- API cap, always."""
+def test_without_a_subscription_the_keyed_chain_writes_recaps(monkeypatch) -> None:
+ """A single-key install keeps model recaps (AP-22)."""
from jarvis.brain import resolver
- brains = [SimpleNamespace(model=f"api-{n}") for n in range(recap_engine.MAX_PROVIDER_TRIES)]
- subscription = SimpleNamespace(model="coding-cli")
- monkeypatch.setattr(resolver, "frontier_brain_candidates", lambda cfg: iter(brains))
- monkeypatch.setattr(resolver, "resolve_subscription_brain", lambda cfg, **kwargs: subscription)
+ api = SimpleNamespace(model="only-key")
+ monkeypatch.setattr(resolver, "frontier_brain_candidates", lambda cfg: iter([api]))
+ monkeypatch.setattr(resolver, "resolve_subscription_brain", lambda cfg, **kwargs: None)
monkeypatch.setattr("jarvis.core.config.load_config", lambda: SimpleNamespace())
- assert recap_engine._resolve_brains() == [*brains, subscription] # noqa: SLF001
+ assert recap_engine._resolve_brains() == [api] # noqa: SLF001
def test_a_failing_provider_leaves_the_previous_sentence_in_place() -> None: