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(live): say why a GPT-Live call ends when it cannot start

rubenluetke10-beep5265d26f0f32
diff --git a/jarvis/live/session.py b/jarvis/live/session.py
index 5d9292a837..269e6cd848 100644
--- a/jarvis/live/session.py
+++ b/jarvis/live/session.py
@@ -497,10 +497,43 @@ class LiveVoiceSession:
"continuous": True,
}
)
- except BaseException:
+ except BaseException as exc:
+ if isinstance(exc, Exception):
+ await self._announce_start_failure(exc)
await self.end(reason="error")
raise
+ async def _announce_start_failure(self, exc: Exception) -> None:
+ """Say why the call ends instead of hanging up in silence.
+
+ Live 2026-09-29: an empty API balance made every wake end after a
+ second with no word, which read as a broken wake word.
+ """
+ from jarvis.brain.provider_test import (
+ NO_CREDITS,
+ RATE_LIMITED,
+ classify_provider_error,
+ )
+ from jarvis.realtime.session import _handshake_failure_message
+
+ status = classify_provider_error(str(exc))
+ cause = {NO_CREDITS: "no_credits", RATE_LIMITED: "rate_limited"}.get(
+ status, "unavailable"
+ )
+ log.warning("Live session could not start (cause=%s): %s", cause, exc)
+ try:
+ await self._send_json(
+ {
+ "type": "error_spoken",
+ "text": _handshake_failure_message(cause, self._language),
+ "language": self._language,
+ "spoken_kind": "reply",
+ "provider": self.active_provider,
+ }
+ )
+ except Exception: # noqa: BLE001 — the start failure still propagates
+ log.warning("Live start failure notice could not be sent", exc_info=True)
+
def _take_initial_context(self) -> list[dict]:
from jarvis.core.runtime_refs import get_brain_manager
diff --git a/jarvis/plugins/realtime/openai_live.py b/jarvis/plugins/realtime/openai_live.py
index a845d35360..4b1294fc65 100644
--- a/jarvis/plugins/realtime/openai_live.py
+++ b/jarvis/plugins/realtime/openai_live.py
@@ -111,8 +111,17 @@ class OpenAILiveProvider:
json={"session": session, "transport": {"type": "webrtc", "sdp": offer}},
)
if response.status_code >= 400:
+ from jarvis.brain.provider_test import classify_provider_error
+
+ # Only the classification leaves this scope, never the
+ # provider's body (AP-34): "no_credits" and "rate_limited"
+ # share HTTP 429 and need different words for the user.
+ cause = classify_provider_error(
+ f"HTTP {response.status_code} {response.text[:2000]}"
+ )
raise RuntimeError(
- f"OpenAI Live session creation failed (HTTP {response.status_code})."
+ "OpenAI Live session creation failed "
+ f"(HTTP {response.status_code}, {cause})."
)
payload = response.json()
session_id = payload["session"]["id"]
diff --git a/jarvis/realtime/session.py b/jarvis/realtime/session.py
index 7ac718034b..5ded21d216 100644
--- a/jarvis/realtime/session.py
+++ b/jarvis/realtime/session.py
@@ -1749,12 +1749,16 @@ _HANDSHAKE_FAILURE_MESSAGES: dict[str, dict[str, str]] = {
},
"no_credits": {
"de": ( # i18n-allow: localized runtime voice output
- "Das Sprachkontingent ist aufgebraucht, " # i18n-allow
- "deshalb musste ich das Gespräch beenden." # i18n-allow
+ "Das Guthaben für die Sprachverbindung ist aufgebraucht. " # i18n-allow
+ "Lade es beim Anbieter auf, dann klappt es wieder." # i18n-allow
+ ),
+ "en": (
+ "The credit for the voice connection is used up. "
+ "Top it up with the provider and it will work again."
),
- "en": "The voice quota is used up, so I had to end the call.",
"es": ( # i18n-allow: localized runtime voice output
- "Se agotó la cuota de voz, así que tuve que terminar la llamada."
+ "Se agotó el saldo de la conexión de voz. "
+ "Recárgalo con el proveedor y volverá a funcionar."
),
},
"dropped": {
diff --git a/tests/contract/test_live_surface_lifecycle.py b/tests/contract/test_live_surface_lifecycle.py
index 174af7a3d3..c19fa6591b 100644
--- a/tests/contract/test_live_surface_lifecycle.py
+++ b/tests/contract/test_live_surface_lifecycle.py
@@ -133,3 +133,29 @@ async def test_new_input_recovers_after_task_cancellation(tmp_path):
assert old_token.is_cancelled()
finally:
ledger.close()
+
+
+async def test_an_empty_balance_is_spoken_instead_of_a_silent_hangup():
+ """Live 2026-09-29: every wake ended after a second with no word because
+ the API balance was empty; the call must say why it ends."""
+ frames = []
+
+ async def send(frame):
+ frames.append(frame)
+
+ session = LiveVoiceSession(
+ session_id="live-no-credits",
+ bus=None,
+ send_json=send,
+ send_binary=send,
+ config=SimpleNamespace(brain=SimpleNamespace(reply_language="en")),
+ providers=[SimpleNamespace(name="test")],
+ )
+ await session._announce_start_failure(
+ RuntimeError("OpenAI Live session creation failed (HTTP 429, no_credits).")
+ )
+
+ spoken = [f for f in frames if f.get("type") == "error_spoken"]
+ assert len(spoken) == 1
+ assert "credit" in spoken[0]["text"].lower()