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): keep default tool prompt within quota

Ruben Lütkeb6d5a263962c
diff --git a/docs/BUGS.md b/docs/BUGS.md
index c60f9b5882..7c60c41f27 100644
--- a/docs/BUGS.md
+++ b/docs/BUGS.md
@@ -3626,9 +3626,12 @@ cannot speak into the call. Provider events carry explicit recoverability, so
the OpenAI active-response collision no longer poisons a usable session, while
terminal events end the receive pump. The OpenAI adapter also serializes every
local `response.create` against `response.done`, preventing the collision.
-Finally, realtime tool mode defaults to `direct`: the live model calls the
-supervisor safety gateway with its own realtime credential and does not invoke
-the classic Brain/TTS pipeline. Legacy `delegate` remains an explicit opt-in.
+At the time of this fix, realtime tool mode defaulted to `direct`: the live
+model called the supervisor safety gateway with its own realtime credential
+and did not invoke the classic Brain/TTS pipeline. BUG-052 later restored the
+compact `delegate` default after measuring the full dynamic catalog at roughly
+26,000 input tokens per response; `direct` remains an explicit diagnostic
+opt-in.
**Guards.** `tests/unit/speech/test_realtime_announcement_bridge.py` and
`test_announcement_bridge.py` cover voice ownership; realtime pipeline
@@ -3779,6 +3782,12 @@ but the missing invariant predated that default.
exhausted Brain fallback is rendered through the surface's classic TTS path
after realtime playback stops. No model or tool is called again, and the
persisted turn contains the text the user actually heard.
+5. The default tool mode is again compact `delegate`: the realtime provider
+ sees only `jarvis_action` plus `end_call`, while the router Brain owns the
+ large dynamic catalog. A live reproduction showed 134 direct declarations,
+ about 26,000 requested input tokens per response, and a 40,000 TPM limit —
+ enough for roughly one turn before rate limiting. `direct` remains available
+ only as an explicit operator choice.
**Guards.** `tests/unit/realtime/test_openai_realtime.py` covers failed
`response.done` status propagation. `tests/unit/realtime/test_session.py`
diff --git a/jarvis/core/config.py b/jarvis/core/config.py
index 3e7e4d9417..861016922a 100644
--- a/jarvis/core/config.py
+++ b/jarvis/core/config.py
@@ -1956,12 +1956,14 @@ class VoiceConfig(BaseModel):
# reserved for an EXPLICIT user pick (mode present in the TOML), so a
# fresh keyless install degrades silently instead of nagging every call.
mode: str = "realtime"
- # Realtime tool exposure. "direct" (default) lets the realtime model call
- # every available tool through the supervisor safety gateway without a
- # classic Brain provider or TTS hop. "delegate" is a compatibility opt-in
- # that hands one jarvis_action call to the classic router brain. Read once
- # per session; unknown values fail closed to the autonomous direct mode.
- realtime_tool_mode: str = "direct"
+ # Realtime tool exposure. "delegate" (default) gives the live model one
+ # compact jarvis_action function and hands action turns to the key-aware
+ # router Brain. This keeps the persistent realtime prompt small; declaring
+ # the full dynamic catalog consumed ~26k input tokens per response and hit
+ # a 40k TPM limit after one turn. "direct" remains an explicit diagnostic
+ # opt-in. Read once per session; unknown values fail closed to the compact
+ # delegate mode.
+ realtime_tool_mode: str = "delegate"
# Per-gap budget after which a stale pending fragment is silently
# discarded (user-mandated 2026-05-26 — was: flushed/spoken). NOT a total
# budget — every continuation resets the timer. Bumped from 8 s to 15 s
diff --git a/jarvis/realtime/session.py b/jarvis/realtime/session.py
index e0533ca1e8..a754cde240 100644
--- a/jarvis/realtime/session.py
+++ b/jarvis/realtime/session.py
@@ -417,12 +417,12 @@ class RealtimeVoiceSession:
self._brain = brain
mode = str(
getattr(
- getattr(self._config, "voice", None), "realtime_tool_mode", "direct"
+ getattr(self._config, "voice", None), "realtime_tool_mode", "delegate"
)
- or "direct"
+ or "delegate"
).strip().lower()
if mode not in {"delegate", "direct"}:
- mode = "direct"
+ mode = "delegate"
self._tool_mode = mode
# Delegate mode needs only a callable brain (the boot proxy and the
# real BrainManager both qualify); an explicitly injected bridge
diff --git a/tests/unit/realtime/test_factory.py b/tests/unit/realtime/test_factory.py
index 3dd3aee4df..5c818af276 100644
--- a/tests/unit/realtime/test_factory.py
+++ b/tests/unit/realtime/test_factory.py
@@ -121,8 +121,8 @@ def test_pipeline_mode_never_builds_realtime_session(monkeypatch):
)
-def test_realtime_tool_mode_defaults_to_autonomous_direct_execution() -> None:
- assert VoiceConfig().realtime_tool_mode == "direct"
+def test_realtime_tool_mode_defaults_to_compact_delegate_execution() -> None:
+ assert VoiceConfig().realtime_tool_mode == "delegate"
def test_one_realtime_key_builds_without_a_classic_brain(monkeypatch) -> None:
@@ -139,7 +139,7 @@ def test_one_realtime_key_builds_without_a_classic_brain(monkeypatch) -> None:
assert session is not None
assert session._brain is None
- assert session._tool_mode == "direct"
+ assert session._tool_mode == "delegate"
assert session._delegate_enabled is False
assert [provider.name for provider in session._providers] == ["gemini-live"]