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): stabilize local speech turn boundaries
rubenluetke10-beepd44955361f6c
diff --git a/jarvis/realtime/local_server/install.py b/jarvis/realtime/local_server/install.pyindex f18213d778..e466e55afd 100644--- a/jarvis/realtime/local_server/install.py+++ b/jarvis/realtime/local_server/install.py@@ -373,6 +373,15 @@ def derive_launch_command(brain: BrainResolution, *, memory_source: str) -> str:"--qwen3_tts_backend torch","--qwen3_tts_speaker Aiden","--parakeet_tdt_device cpu",+ # Jarvis consumes only final input transcripts. Progressive Parakeet+ # passes therefore contend with the final pass without improving the+ # product surface. A short acoustic silence gate removes breath-sized+ # splits; Smart Turn still keeps semantically incomplete speech open+ # for its full two-second window before any final can escape.+ "--no_enable_live_transcription",+ "--min_silence_ms 320",+ "--smart_turn_incomplete_delay_ms 2000",+ "--unanswered_reopen_ms 2000","--num_pipelines 1",f"--model_name {brain.model}",]diff --git a/jarvis/realtime/local_server/supervisor.py b/jarvis/realtime/local_server/supervisor.pyindex 3b5485d546..c9ce5bd449 100644--- a/jarvis/realtime/local_server/supervisor.py+++ b/jarvis/realtime/local_server/supervisor.py@@ -690,6 +690,25 @@ _REASONING_EFFORT_FLAG = re.compile(r"(?<!\S)--responses_api_reasoning_effort(?:\s+|=)(?:\"[^\"]*\"|'[^']*'|\S+)",re.IGNORECASE,)+_MIN_SILENCE_FLAG = re.compile(+ r"(?<!\S)--min(?:_|-)silence(?:_|-)ms(?:\s+|=)(?:\"[^\"]*\"|'[^']*'|\S+)",+ re.IGNORECASE,+)+_SMART_TURN_INCOMPLETE_DELAY_FLAG = re.compile(+ r"(?<!\S)--smart(?:_|-)turn(?:_|-)incomplete(?:_|-)delay(?:_|-)ms"+ r"(?:\s+|=)(?:\"[^\"]*\"|'[^']*'|\S+)",+ re.IGNORECASE,+)+_UNANSWERED_REOPEN_FLAG = re.compile(+ r"(?<!\S)--unanswered(?:_|-)reopen(?:_|-)ms(?:\s+|=)"+ r"(?:\"[^\"]*\"|'[^']*'|\S+)",+ re.IGNORECASE,+)+_LIVE_TRANSCRIPTION_FLAG = re.compile(+ r"(?<!\S)--(?:no(?:_|-))?enable(?:_|-)live(?:_|-)transcription"+ r"(?:=(?:true|false|0|1)|\s+(?:true|false|0|1))?",+ re.IGNORECASE,+)def _force_loopback_bind(command: str) -> str:@@ -758,6 +777,43 @@ def _force_low_latency_ollama_backend(command: str) -> str:)+def _needs_stable_turn_detection_migration(command: str) -> bool:+ """Whether the managed server can publish premature/repeated finals."""+ return (+ _cli_flag_value(command, "--min_silence_ms") != "320"+ or _cli_flag_value(command, "--smart_turn_incomplete_delay_ms") != "2000"+ or _cli_flag_value(command, "--unanswered_reopen_ms") != "2000"+ or not re.search(+ r"(?<!\S)--no(?:_|-)enable(?:_|-)live(?:_|-)transcription(?!\S)",+ command,+ re.IGNORECASE,+ )+ )+++def _force_stable_turn_detection(command: str) -> str:+ """Canonicalize the managed VAD/STT profile used by Jarvis."""+ if not _needs_stable_turn_detection_migration(command):+ return command+ command = _replace_cli_flag(+ command,+ _MIN_SILENCE_FLAG,+ "--min_silence_ms 320",+ )+ command = _replace_cli_flag(+ command,+ _SMART_TURN_INCOMPLETE_DELAY_FLAG,+ "--smart_turn_incomplete_delay_ms 2000",+ )+ command = _replace_cli_flag(+ command,+ _UNANSWERED_REOPEN_FLAG,+ "--unanswered_reopen_ms 2000",+ )+ without_live_transcription = _LIVE_TRANSCRIPTION_FLAG.sub("", command).rstrip()+ return f"{without_live_transcription} --no_enable_live_transcription"++def _uses_loopback_bind(command: str) -> bool:"""Whether the effective managed-server bind is explicitly loopback-only."""try:@@ -811,6 +867,7 @@ def ensure_running(# both security and latency migrations without a reinstall.command = _force_loopback_bind(command)command = _force_low_latency_ollama_backend(command)+ command = _force_stable_turn_detection(command)try:from jarvis.realtime.local_server import install # lazy (AP-26)@@ -831,8 +888,13 @@ def ensure_running(slow_ollama_backend = bool(owned_command and _needs_ollama_backend_migration(owned_command))+ unstable_turn_detection = bool(+ owned_command+ and _needs_stable_turn_detection_migration(owned_command)+ )+ latency_migration = slow_ollama_backend or unstable_turn_detectionif (- slow_ollama_backend+ latency_migrationand not unsafe_bindand (pool is None@@ -843,7 +905,13 @@ def ensure_running(# live call or a generation whose state cannot be proven. The# next verified-idle connect can replace this generation.return "already-running"- if owned_root is not None and (unsafe_bind or slow_ollama_backend):+ if owned_root is not None and (+ unsafe_bind+ or (+ latency_migration+ and replace_unavailable_generation is None+ )+ ):# Managed servers survive app exits, so an upgrade can inherit# a healthy legacy generation. Only a verified owned process# is eligible for these one-time migrations.diff --git a/tests/unit/realtime/local_server/test_engine.py b/tests/unit/realtime/local_server/test_engine.pyindex fb35e78fe6..607290c48b 100644--- a/tests/unit/realtime/local_server/test_engine.py+++ b/tests/unit/realtime/local_server/test_engine.py@@ -238,6 +238,10 @@ class TestDeriveLaunchCommand:assert "--qwen3_tts_device cuda" in cmdassert "--model_name qwen2.5:7b" in cmdassert "--ws_host 127.0.0.1" in cmd+ assert "--no_enable_live_transcription" in cmd+ assert "--min_silence_ms 320" in cmd+ assert "--smart_turn_incomplete_delay_ms 2000" in cmd+ assert "--unanswered_reopen_ms 2000" in cmddef test_cloud_command_never_carries_the_secret(self) -> None:brain = brain_link.BrainResolution(@@ -248,6 +252,8 @@ class TestDeriveLaunchCommand:assert "--responses_api_api_key" not in cmdassert "--llm_backend chat-completions" not in cmdassert "--responses_api_reasoning_effort" not in cmd+ assert "--no_enable_live_transcription" in cmd+ assert "--smart_turn_incomplete_delay_ms 2000" in cmddef test_apple_unified_memory_maps_to_mps(self) -> None:cmd = install.derive_launch_command(self._brain(), memory_source="apple-unified")diff --git a/tests/unit/realtime/local_server/test_supervisor.py b/tests/unit/realtime/local_server/test_supervisor.pyindex 293dddf276..2ca22e627b 100644--- a/tests/unit/realtime/local_server/test_supervisor.py+++ b/tests/unit/realtime/local_server/test_supervisor.py@@ -656,6 +656,10 @@ def test_legacy_managed_ollama_command_uses_non_reasoning_chat_backend_at_spawn(assert "--llm_backend chat-completions" in spawned[0]assert spawned[0].count("--responses_api_reasoning_effort") == 1assert "--responses_api_reasoning_effort none" in spawned[0]+ assert "--no_enable_live_transcription" in spawned[0]+ assert "--min_silence_ms 320" in spawned[0]+ assert "--smart_turn_incomplete_delay_ms 2000" in spawned[0]+ assert "--unanswered_reopen_ms 2000" in spawned[0]def test_ollama_backend_normalizer_replaces_legacy_equals_flags_once() -> None:@@ -676,6 +680,25 @@ def test_ollama_backend_normalizer_replaces_legacy_equals_flags_once() -> None:assert supervisor._force_low_latency_ollama_backend(migrated) == migrated+def test_turn_detection_normalizer_replaces_legacy_aliases_once() -> None:+ command = (+ "serve --enable-live-transcription=true --min-silence-ms=64 "+ "--smart_turn_incomplete_delay_ms=600 --unanswered-reopen-ms 7000"+ )++ migrated = supervisor._force_stable_turn_detection(command)++ assert migrated.count("--no_enable_live_transcription") == 1+ assert "--enable-live-transcription" not in migrated+ assert migrated.count("--min_silence_ms") == 1+ assert "--min_silence_ms 320" in migrated+ assert migrated.count("--smart_turn_incomplete_delay_ms") == 1+ assert "--smart_turn_incomplete_delay_ms 2000" in migrated+ assert migrated.count("--unanswered_reopen_ms") == 1+ assert "--unanswered_reopen_ms 2000" in migrated+ assert supervisor._force_stable_turn_detection(migrated) == migrated++def test_a_ready_owned_legacy_bind_is_migrated_to_loopback(monkeypatch, tmp_path) -> None:from jarvis.realtime.local_server import install@@ -888,7 +911,11 @@ def test_a_ready_owned_loopback_bind_is_not_restarted(monkeypatch, tmp_path) ->"--responses_api_base_url http://127.0.0.1:11434/v1 ""--responses_api_api_key ollama ""--llm_backend chat-completions "- "--responses_api_reasoning_effort none"+ "--responses_api_reasoning_effort none "+ "--min_silence_ms 320 "+ "--smart_turn_incomplete_delay_ms 2000 "+ "--unanswered_reopen_ms 2000 "+ "--no_enable_live_transcription")(tmp_path / "local_realtime_server.pid.json").write_text(json.dumps(@@ -967,7 +994,7 @@ def test_an_abandoned_owned_pool_is_replaced_generation_safely(assert outcome == "spawned"assert stopped == [root]- assert spawned == [command]+ assert spawned == [supervisor._force_stable_turn_detection(command)]def test_unavailable_pool_replacement_skips_a_newer_generation(