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): let the voice persona actually reach the ChatGPT-Live thread

rubenluetke10-beep66ecd6748af8
diff --git a/jarvis/codex_app_server.py b/jarvis/codex_app_server.py
index 60d47700ce..b325df0577 100644
--- a/jarvis/codex_app_server.py
+++ b/jarvis/codex_app_server.py
@@ -3158,7 +3158,22 @@ class CodexAppServerClient:
extra: Mapping[str, Any] | None = None,
) -> dict[str, Any]:
"""Start a verified ChatGPT-only transport thread outside the workspace."""
- del base_instructions, developer_instructions, cwd, model, ephemeral
+ # cwd/model/ephemeral stay caller-proof: the audit below pins them to
+ # the safe values, so a caller cannot widen the boundary. Instructions
+ # are different — they are the voice's identity, one-speaker rule and
+ # language rule. Discarding them here (as an earlier revision did)
+ # silently shipped the "dumb pipe" transport text instead, so the live
+ # model never learned it may request handoffs and answered greetings
+ # out of persona. The transport constants remain the fail-closed floor
+ # whenever a caller passes nothing.
+ del cwd, model, ephemeral
+ base_text = (
+ str(base_instructions or "").strip() or _TRANSPORT_BASE_INSTRUCTIONS
+ )
+ developer_text = (
+ str(developer_instructions or "").strip()
+ or _TRANSPORT_DEVELOPER_INSTRUCTIONS
+ )
await self.ensure_started()
if extra:
raise CodexSubscriptionUnavailable(
@@ -3169,7 +3184,7 @@ class CodexAppServerClient:
{
"allowProviderModelFallback": False,
"approvalPolicy": "never",
- "baseInstructions": _TRANSPORT_BASE_INSTRUCTIONS,
+ "baseInstructions": base_text,
"config": {
"analytics": {"enabled": False},
"cli_auth_credentials_store": "file",
@@ -3240,7 +3255,7 @@ class CodexAppServerClient:
"tools": {"web_search": False},
},
"cwd": self._safe_thread_cwd(),
- "developerInstructions": _TRANSPORT_DEVELOPER_INSTRUCTIONS,
+ "developerInstructions": developer_text,
"dynamicTools": None,
"environments": [],
"ephemeral": True,
diff --git a/tests/unit/codex_app_server/test_transport.py b/tests/unit/codex_app_server/test_transport.py
index f481d1df0f..1808761f2d 100644
--- a/tests/unit/codex_app_server/test_transport.py
+++ b/tests/unit/codex_app_server/test_transport.py
@@ -750,6 +750,69 @@ async def test_realtime_start_subscribes_before_request_and_returns_answer_sdp(
await client.close()
+def _voice_thread_responder(process: FakeProcess, message: dict[str, Any]) -> None:
+ if _respond_handshake(process, message):
+ return
+ request_id = message.get("id")
+ if not isinstance(request_id, int):
+ return
+ if message.get("method") == "thread/start":
+ _respond(process, request_id, {"thread": {"id": "voice-thread"}})
+
+
+async def test_thread_start_sends_caller_instructions_on_the_wire(
+ monkeypatch: pytest.MonkeyPatch,
+) -> None:
+ """The provider's voice persona must reach the JSON-RPC frame verbatim.
+
+ An earlier revision deleted both caller instruction arguments and always
+ sent the hardcoded "dumb pipe" transport text, so the live model never
+ learned its persona, the one-speaker rule, or that handoffs exist — while
+ the adapter-level test kept passing against a fake client that never sees
+ the wire.
+ """
+ harness = SpawnHarness(monkeypatch, [_voice_thread_responder])
+ client = CodexAppServerClient()
+ await client.thread_start(
+ base_instructions="You are the live voice. Request a handoff for actions.",
+ developer_instructions="Execution boundary: actions go to the client.",
+ )
+ params = next(
+ item["params"]
+ for item in harness.processes[0].stdin.messages
+ if item.get("method") == "thread/start"
+ )
+ assert (
+ params["baseInstructions"]
+ == "You are the live voice. Request a handoff for actions."
+ )
+ assert (
+ params["developerInstructions"]
+ == "Execution boundary: actions go to the client."
+ )
+ await client.close()
+
+
+async def test_thread_start_without_instructions_keeps_the_transport_floor(
+ monkeypatch: pytest.MonkeyPatch,
+) -> None:
+ harness = SpawnHarness(monkeypatch, [_voice_thread_responder])
+ client = CodexAppServerClient()
+ await client.thread_start(base_instructions=" ", developer_instructions=None)
+ params = next(
+ item["params"]
+ for item in harness.processes[0].stdin.messages
+ if item.get("method") == "thread/start"
+ )
+ assert params["baseInstructions"] == transport._TRANSPORT_BASE_INSTRUCTIONS
+ assert (
+ params["developerInstructions"] == transport._TRANSPORT_DEVELOPER_INSTRUCTIONS
+ )
+ await client.close()
+
+
@pytest.mark.asyncio
async def test_audio_append_uses_protocol_chunk_shape(
monkeypatch: pytest.MonkeyPatch,