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(realtime): move Codex subscription voice to the live v3 protocol
Ruben Lütke0e2f0e6d0d87
diff --git a/jarvis/brain/model_catalog.py b/jarvis/brain/model_catalog.pyindex d1680c8ece..39f0e4e942 100644--- a/jarvis/brain/model_catalog.py+++ b/jarvis/brain/model_catalog.py@@ -488,11 +488,13 @@ TTS_CATALOG: dict[str, tuple[str, list[ModelInfo]]] = {# they target dedicated translation/transcription sessions, not the general# duplex voice-agent protocol implemented by this adapter.REALTIME_MODELS: dict[str, list[ModelInfo]] = {- # Codex 0.146's experimental v1 subscription transport has its own fixed- # model/voice contract. Keep it separate from the metered OpenAI Realtime- # API catalog: their accepted voice sets are not interchangeable.+ # ChatGPT-Live (Codex v3): the SERVER chooses the model — a client+ # `session.model` is rejected outright, and the old v1 protocol (which+ # accepted a model) answers 403 since the ChatGPT-Live launch (both+ # verified live 2026-08-01). One honest entry instead of a fake choice;+ # model selection lives on the metered OpenAI Realtime card."codex-subscription-realtime": _curated(- [("gpt-realtime-1.5", "GPT Realtime 1.5 (Codex default)")]+ [("auto", "ChatGPT-Live (model chosen by OpenAI)")]),"openai-realtime": _curated([diff --git a/jarvis/codex_app_server.py b/jarvis/codex_app_server.pyindex 7518058575..3b7edd4a62 100644--- a/jarvis/codex_app_server.py+++ b/jarvis/codex_app_server.py@@ -3068,13 +3068,38 @@ class CodexAppServerClient:)answer_sdp: str | None = Noneif sdp_subscription is not None:- notification = await sdp_subscription.wait_for(- "thread/realtime/sdp", timeout_s=sdp_timeout_s- )- candidate = notification.params.get("sdp")- if not isinstance(candidate, str) or not candidate:- raise CodexAppServerError("Codex app-server returned an invalid WebRTC answer.")- answer_sdp = candidate+ # Wait for the answer, but FAIL FAST on a realtime error or+ # close: the upstream refusal (for example the 403 that ended+ # the experimental v1 protocol) used to hide behind a blind+ # 15s timeout instead of reaching the user as its honest text.+ deadline = asyncio.get_running_loop().time() + sdp_timeout_s+ while True:+ remaining = deadline - asyncio.get_running_loop().time()+ if remaining <= 0:+ raise CodexAppServerTimeout(+ "Timed out waiting for the Codex WebRTC answer."+ )+ notification = await sdp_subscription.get(remaining)+ if notification.method == "thread/realtime/sdp":+ candidate = notification.params.get("sdp")+ if not isinstance(candidate, str) or not candidate:+ raise CodexAppServerError(+ "Codex app-server returned an invalid WebRTC answer."+ )+ answer_sdp = candidate+ break+ if notification.method == "thread/realtime/error":+ message = " ".join(+ str(notification.params.get("message", "") or "").split()+ )[:300]+ raise CodexAppServerError(+ "Codex realtime start failed: "+ + (message or "unspecified realtime error")+ )+ if notification.method == "thread/realtime/closed":+ raise CodexAppServerError(+ "Codex realtime transport closed before answering."+ )return CodexRealtimeStartResult(response=response, answer_sdp=answer_sdp)finally:if sdp_subscription is not None:diff --git a/jarvis/plugins/realtime/codex_subscription.py b/jarvis/plugins/realtime/codex_subscription.pyindex aefe7e4c88..ccd06987f9 100644--- a/jarvis/plugins/realtime/codex_subscription.py+++ b/jarvis/plugins/realtime/codex_subscription.py@@ -29,9 +29,17 @@ _OUTPUT_QUIESCENCE_S = 0.5_NORMALIZATION_QUEUE_MAX = 128_REMOTE_CLEANUP_TIMEOUT_S = 1.5_TURN_INTERRUPT_TIMEOUT_S = 1.5-_V1_MODEL = "gpt-realtime-1.5"-_V1_DEFAULT_VOICE = "cove"-_V1_VOICES = frozenset(+# The experimental v1 protocol was shut off server-side with the ChatGPT-Live+# launch (every v1 start now answers "403 Voice session access denied",+# verified live 2026-08-01). v3 is the ChatGPT-Live protocol: the SERVER+# chooses the model (a client `model` field is rejected outright), the client+# only picks the voice. The legacy model id is still accepted in config as a+# no-op so older pins keep working.+_LEGACY_V1_MODEL = "gpt-realtime-1.5"+_DEFAULT_VOICE = "cove"+# Server-confirmed v3 roster (the refusal for an unknown voice lists exactly+# these nine, verified live 2026-08-01).+_V3_VOICES = frozenset({"arbor","breeze",@@ -714,6 +722,11 @@ class CodexSubscriptionRealtimeProvider:supports_realtime = Trueimplicit_usage_fallback_allowed = Falserequires_webrtc_offer = True+ # Declared handshake need (capability, AP-21): a COLD start spawns+ # app-server, verifies the live account, re-audits config, and negotiates+ # WebRTC — measured 15-25s on a mid-range desktop. The shared 12s ceiling+ # beheaded every cold call into a pipeline fallback (log 2026-08-01).+ handshake_budget_s = 45.0input_sample_rate = _INPUT_RATEoutput_sample_rate = _OUTPUT_RATEcredential_candidates: tuple[tuple[str, str | None], ...] = ()@@ -843,30 +856,38 @@ class CodexSubscriptionRealtimeProvider:raise RuntimeError("Codex app-server did not return a thread id")subscription = client.subscribe(thread_id)- model = str(getattr(cfg, "model", "") or "").strip() or _V1_MODEL+ configured_model = str(getattr(cfg, "model", "") or "").strip()+ if configured_model and configured_model not in {+ "auto",+ _LEGACY_V1_MODEL,+ }:+ # v3 rejects a client model outright; an unknown leftover pin+ # must not brick the call — the server chooses the model.+ log.info(+ "Codex subscription realtime ignores the configured model "+ "%r: ChatGPT-Live (v3) selects the model server-side",+ configured_model,+ )voice = (str(getattr(cfg, "voice", "") or "").strip().lower()- or _V1_DEFAULT_VOICE+ or _DEFAULT_VOICE)- if model != _V1_MODEL:- raise RuntimeError(- "Codex subscription realtime has an unsupported V1 model configured"- )- if voice not in _V1_VOICES:+ if voice not in _V3_VOICES:raise RuntimeError(- "Codex subscription realtime has an unsupported V1 voice configured"+ "Codex subscription realtime has an unsupported voice configured")start = await client.realtime_start(thread_id,output_modality="audio",offer_sdp=offer_sdp,prompt="",- model=model,+ # v3 (ChatGPT-Live): the server chooses the model; sending a+ # client model is rejected with "Field `session.model` is not+ # allowed" (verified live 2026-08-01). The dead v1 protocol+ # answered every start with 403 since the ChatGPT-Live launch.+ model=None,voice=voice,- # Codex 0.146 deliberately ignores the configured voice for a- # WebRTC start whose version is omitted. V1 is the current- # supported protocol and preserves the selected voice.- version="v1",+ version="v3",include_startup_context=False,client_managed_handoffs=True,)diff --git a/jarvis/realtime/session.py b/jarvis/realtime/session.pyindex 6b6d2f89f2..d90074d538 100644--- a/jarvis/realtime/session.py+++ b/jarvis/realtime/session.py@@ -1569,7 +1569,22 @@ class RealtimeVoiceSession:async def _open(self) -> None:loop = asyncio.get_running_loop()- deadline = loop.time() + _PROVIDER_HANDSHAKE_TOTAL_TIMEOUT_S+ # A provider may DECLARE a larger handshake need (a capability, never+ # a provider-name check — AP-21): the Codex subscription transport+ # legitimately spends 15-30s on a cold start (app-server spawn, live+ # account verification, WebRTC negotiation), and the shared 12s+ # ceiling beheaded every cold call into a pipeline fallback.+ declared_total = max(+ (+ float(getattr(provider, "handshake_budget_s", 0.0) or 0.0)+ for provider in self._providers+ if self._provider_is_available(provider)+ ),+ default=0.0,+ )+ deadline = loop.time() + max(+ _PROVIDER_HANDSHAKE_TOTAL_TIMEOUT_S, declared_total+ )for provider in self._providers:if not self._provider_is_available(provider):continue@@ -1623,6 +1638,13 @@ class RealtimeVoiceSession:if remaining <= 0:raise TimeoutError("realtime handshake budget exhausted")provider_budget = remaining / max(1, providers_left)+ declared = float(+ getattr(provider, "handshake_budget_s", 0.0) or 0.0+ )+ if declared > provider_budget:+ # Honor the declared need up to what the (already+ # stretched) overall deadline still allows.+ provider_budget = min(declared, remaining)async def _probe_and_open(candidate: Any = provider,diff --git a/tests/unit/brain/test_current_model_catalogs.py b/tests/unit/brain/test_current_model_catalogs.pyindex b04ff19ffa..d9d44ac7fe 100644--- a/tests/unit/brain/test_current_model_catalogs.py+++ b/tests/unit/brain/test_current_model_catalogs.py@@ -126,9 +126,9 @@ def test_current_stt_and_cartesia_model_rosters() -> None:def test_current_realtime_models_and_voices() -> None:- assert _ids(REALTIME_MODELS["codex-subscription-realtime"]) == {- "gpt-realtime-1.5"- }+ # ChatGPT-Live (v3) picks the model server-side — one honest entry, no+ # fake choice (client model fields are rejected; verified 2026-08-01).+ assert _ids(REALTIME_MODELS["codex-subscription-realtime"]) == {"auto"}assert _ids(REALTIME_VOICES["codex-subscription-realtime"]) == {"cove","juniper",diff --git a/tests/unit/brain/test_model_catalog.py b/tests/unit/brain/test_model_catalog.pyindex 01034dcf3d..3ea45ba05d 100644--- a/tests/unit/brain/test_model_catalog.py+++ b/tests/unit/brain/test_model_catalog.py@@ -754,11 +754,13 @@ class TestModelClassification:class TestRealtimeCatalog:- def test_codex_subscription_catalog_matches_app_server_v1(self) -> None:+ def test_codex_subscription_catalog_matches_app_server_v3(self) -> None:from jarvis.brain.model_catalog import REALTIME_MODELS, REALTIME_VOICES+ # v3 (ChatGPT-Live): the server chooses the model; the voice roster+ # below is the server-confirmed nine (verified live 2026-08-01).assert [m.id for m in REALTIME_MODELS["codex-subscription-realtime"]] == [- "gpt-realtime-1.5"+ "auto"]assert [v.id for v in REALTIME_VOICES["codex-subscription-realtime"]] == ["cove",diff --git a/tests/unit/realtime/test_codex_subscription.py b/tests/unit/realtime/test_codex_subscription.pyindex 5c0eafc571..33df221885 100644--- a/tests/unit/realtime/test_codex_subscription.py+++ b/tests/unit/realtime/test_codex_subscription.py@@ -200,9 +200,12 @@ async def test_direct_sdp_open_uses_safe_experimental_transport_contract() -> No"output_modality": "audio","offer_sdp": "v=0\r\no=browser-offer","prompt": "",- "model": "gpt-realtime-1.5",+ # v3 (ChatGPT-Live): the server chooses the model — the client must+ # not send one (rejected with "Field `session.model` is not allowed",+ # verified live 2026-08-01).+ "model": None,"voice": "cove",- "version": "v1",+ "version": "v3","include_startup_context": False,"client_managed_handoffs": True,}@@ -240,23 +243,17 @@ async def test_timed_out_remote_cleanup_poisons_the_entire_client(assert client.poison_calls == 1- ("field", "value"),- [("model", "gpt-4o-realtime-preview"), ("voice", "marin")],-)@pytest.mark.asyncio-async def test_stale_api_v2_selection_fails_before_subscription_realtime_start(- field: str,- value: str,-) -> None:+async def test_stale_api_voice_selection_fails_before_subscription_realtime_start() -> None:+ """A voice outside the server-confirmed v3 roster fails before start."""client = _Client()provider = CodexSubscriptionRealtimeProvider(client=client)config = RealtimeSessionConfig(transport_offer_sdp="v=0\r\no=browser-offer",- **{field: value},+ voice="marin",)- with pytest.raises(RuntimeError, match="unsupported V1"):+ with pytest.raises(RuntimeError, match="unsupported voice"):await provider.open_session(config)assert client.realtime_starts == []@@ -264,6 +261,27 @@ async def test_stale_api_v2_selection_fails_before_subscription_realtime_start(assert client.unsubscribes == ["thread-1"]+async def test_stale_model_pin_is_ignored_not_fatal() -> None:+ """v3 chooses the model server-side: a leftover pin from the metered API+ (or the dead v1 era) must not brick the call — it is dropped, and no+ model field reaches the server."""+ client = _Client()+ provider = CodexSubscriptionRealtimeProvider(client=client)+ config = RealtimeSessionConfig(+ transport_offer_sdp="v=0\r\no=browser-offer",+ model="gpt-4o-realtime-preview",+ )++ session = await provider.open_session(config)++ assert len(client.realtime_starts) == 1+ _thread, start = client.realtime_starts[0]+ assert start["model"] is None+ assert start["version"] == "v3"+ await session.close()++@pytest.mark.asyncioasync def test_language_update_is_developer_context_and_speech_is_authoritative() -> None:client = _Client()