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
perf(realtime): pin localhost to 127.0.0.1 — the 2 s connect delay was a dead IPv6 attempt
rubenluetke10-beepfdc6c47a405f
diff --git a/jarvis/core/config_writer.py b/jarvis/core/config_writer.pyindex c4d6dc747f..4562ed5dac 100644--- a/jarvis/core/config_writer.py+++ b/jarvis/core/config_writer.py@@ -2047,8 +2047,12 @@ def set_local_realtime_launch_command(block = tomlkit.table()providers["local-realtime"] = blockblock["launch_command"] = cleaned- if not str(block.get("base_url", "") or "").strip():- block["base_url"] = "http://localhost:8765"+ # 127.0.0.1, not "localhost": the resolver tries ::1 first while the+ # server binds IPv4 only, and that dead IPv6 attempt measured 2,050 ms+ # per connect (2026-08-08) — the literal IP is the instant path.+ current_base = str(block.get("base_url", "") or "").strip()+ if not current_base or current_base == "http://localhost:8765":+ block["base_url"] = "http://127.0.0.1:8765"out = tomlkit.dumps(doc)if had_bom:@@ -2157,7 +2161,12 @@ def clear_local_realtime_launch_command(if only_if_under and not _command_references_root(command, only_if_under):returnblock["launch_command"] = ""- if str(block.get("base_url", "") or "").strip() == "http://localhost:8765":+ # Both defaults this module ever pinned (localhost historically,+ # 127.0.0.1 since 2026-08-08) count as ours; a custom URL survives.+ if str(block.get("base_url", "") or "").strip() in (+ "http://localhost:8765",+ "http://127.0.0.1:8765",+ ):block["base_url"] = ""out = tomlkit.dumps(doc)diff --git a/jarvis/plugins/realtime/openai_realtime.py b/jarvis/plugins/realtime/openai_realtime.pyindex 2f284c1382..d12b609f65 100644--- a/jarvis/plugins/realtime/openai_realtime.py+++ b/jarvis/plugins/realtime/openai_realtime.py@@ -1325,9 +1325,16 @@ def _normalize_local_root(url: str) -> str:So: ``ws``/``wss`` map to ``http``/``https``, a trailing ``/realtime`` isdropped, a bare ``host:port`` gains a scheme, and ``0.0.0.0`` (a server- BIND address, unusable as a client target) maps to localhost — the same+ BIND address, unusable as a client target) maps to loopback — the samenormalization the local brain cards apply, kept local to this modulebecause a plugin does not reach into the rest of the tree.++ ``localhost`` is pinned to ``127.0.0.1`` deliberately: the OS resolver+ tries ``::1`` first while the common self-hosted server binds IPv4 only,+ and that dead IPv6 attempt cost 2,050 ms per connect on the dev box+ (measured 2026-08-08: ws open via "localhost" 2,093 ms, via "127.0.0.1"+ 2.1 ms — it WAS the user-felt connect delay). A genuinely IPv6-only+ server stays reachable by entering ``[::1]`` explicitly."""root = (url or "").strip().rstrip("/")if not root:@@ -1338,7 +1345,8 @@ def _normalize_local_root(url: str) -> str:root = f"http://{root[len('ws://'):]}"elif root.startswith("wss://"):root = f"https://{root[len('wss://'):]}"- root = root.replace("://0.0.0.0", "://localhost")+ root = root.replace("://0.0.0.0", "://127.0.0.1")+ root = root.replace("://localhost", "://127.0.0.1")if root.endswith("/realtime"):root = root[: -len("/realtime")].rstrip("/")if root.endswith("/v1"):diff --git a/jarvis/plugins/tool/command_impact.py b/jarvis/safety/command_impact.pysimilarity index 100%rename from jarvis/plugins/tool/command_impact.pyrename to jarvis/safety/command_impact.pydiff --git a/tests/unit/realtime/test_local_realtime.py b/tests/unit/realtime/test_local_realtime.pyindex fb514553f5..af535d3300 100644--- a/tests/unit/realtime/test_local_realtime.py+++ b/tests/unit/realtime/test_local_realtime.py@@ -36,21 +36,27 @@ def _cfg(base_url: str = "", model: str = "") -> SimpleNamespace:@pytest.mark.parametrize(("raw", "expected"),[- ("http://localhost:8080", "http://localhost:8080/v1"),- ("http://localhost:8080/", "http://localhost:8080/v1"),+ # "localhost" is pinned to 127.0.0.1: the resolver tries ::1 first+ # while the common server binds IPv4 only — that dead IPv6 attempt+ # measured 2,050 ms per connect (2026-08-08) and WAS the user-felt+ # connect delay.+ ("http://localhost:8080", "http://127.0.0.1:8080/v1"),+ ("http://localhost:8080/", "http://127.0.0.1:8080/v1"),# An already-complete API root must not double up to /v1/v1.- ("http://localhost:8080/v1", "http://localhost:8080/v1"),- ("localhost:8080", "http://localhost:8080/v1"),+ ("http://localhost:8080/v1", "http://127.0.0.1:8080/v1"),+ ("localhost:8080", "http://127.0.0.1:8080/v1"),# What a realtime server actually PRINTS on startup is its websocket# endpoint, and that is what a user pastes. The SDK wants the HTTP API# root and derives the socket itself, so the paste has to survive.- ("ws://localhost:8765/v1/realtime", "http://localhost:8765/v1"),- ("ws://localhost:8765", "http://localhost:8765/v1"),+ ("ws://localhost:8765/v1/realtime", "http://127.0.0.1:8765/v1"),+ ("ws://localhost:8765", "http://127.0.0.1:8765/v1"),("wss://gpu.lan:8443/v1/realtime", "https://gpu.lan:8443/v1"),- ("http://localhost:8765/v1/realtime", "http://localhost:8765/v1"),+ ("http://localhost:8765/v1/realtime", "http://127.0.0.1:8765/v1"),# 0.0.0.0 is a server BIND address; as a client target it fails.- ("0.0.0.0:8080", "http://localhost:8080/v1"),+ ("0.0.0.0:8080", "http://127.0.0.1:8080/v1"),("https://gpu.lan:8443", "https://gpu.lan:8443/v1"),+ # An explicit IPv6 loopback is a deliberate choice and survives.+ ("http://[::1]:8765", "http://[::1]:8765/v1"),("", ""),(" ", ""),],@@ -220,7 +226,8 @@ async def test_model_comes_from_the_server_when_none_is_pinned(fake_models) -> Nfake_models.payload = {"data": [{"id": "moshi-v1"}, {"id": "other"}]}provider = LocalRealtimeProvider(base_url="http://localhost:8080")assert await provider._resolve_model() == "moshi-v1"- assert fake_models.last_url == "http://localhost:8080/v1/models"+ # localhost is pinned to 127.0.0.1 at normalization (IPv6-fallback fix).+ assert fake_models.last_url == "http://127.0.0.1:8080/v1/models"async def test_a_pinned_model_skips_the_probe(fake_models) -> None: