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(voice-engine): act only on request and time barge-in on either signal

rubenluetke10-beep3f26e6c03e5a
diff --git a/docs/local-live-voice-rebuild.md b/docs/local-live-voice-rebuild.md
index 7ed9af05e5..1681fae7d3 100644
--- a/docs/local-live-voice-rebuild.md
+++ b/docs/local-live-voice-rebuild.md
@@ -488,10 +488,11 @@ A phase is done when its gate passes, not when its code is merged. Day counts
are rough planning estimates.
Status 2026-10-01: P0 passed on Windows NVIDIA and the CPU container; the Mac
-run waits for hardware. P1 code is complete and the kill drill passed; the
-real-time worker latency, soak and offline-boot gates are still open
-(section 12.4). P2 has started with the `local-voice` adapter, which is not
-registered as a provider yet.
+run waits for hardware. P1: code complete; the real-time latency gate (p50
+≤ 1.0 s) and the kill drill passed; the 500-turn soak and a boot with the
+network unplugged are still open (section 12.4). P2: the `native.py` fixes
+(4.4, items 1–6) are in; provider registration, config and the card are in
+progress.
| Phase | Content | Gate |
| --- | --- | --- |
@@ -637,6 +638,13 @@ premium option pending a blind listening test.
| `qwen3.5:9b` | 0.11 | — | — | fails German, invents actions |
| `qwen3.5:2b` | — | — | CPU | CPU-only default, first clause ~1.5 s |
+Small models also act on mood: asked "I'm so tired today" or for a sleep tip,
+`qwen3.5:4b` set the volume, started music or a timer in 9 of 30 trials. One
+engine rule ("act only on request", `jarvis/voice_engine/engine.py`) brought
+that to 0 of 30 with 0 of 40 real requests missed. On `qwen3.5:2b` the same
+rule only lowers it from 18 to 12 of 30, so the CPU-only tier still needs a
+safeguard for changing actions before it ships (P3).
+
Ollama's `prompt_eval_count` includes cached tokens. Qwen3.5 does not reuse a
cached prefix across new conversations, so the engine primes the cache when a
session opens. The Mistral chat template defeats the cache.
@@ -650,6 +658,15 @@ session opens. The Mistral chat template defeats the cache.
| Worker boot (Windows, all models) | 11.5 s to ready; self-test de/en character errors 0, LLM 390 ms |
| Worker memory | about 2.1 GB resident |
| Kill drill | worker gone 0.06 s after the app's pipe closes, 0 orphans |
+| Real-time worker, `qwen3.5:4b` + Piper, de+en (44 turns) | dialog p50 685 ms, tool p50 951 ms, 0 unanswered |
+| Real-time worker, `qwen3.5:4b` + Pocket, de+en (44 turns) | dialog p50 775 ms, tool p50 999 ms, 0 unanswered |
+| Barge-in cut (from the user's speech onset, 20 trials) | p50 235–258 ms, p95 370–390 ms; 0 ms of reply audio after the cut |
+
+The real-time runs stream synthetic speech at wall-clock pace through the
+worker's pipes and time speech end to the first audio frame the app receives.
+The barge-in p95 misses the 250 ms SLO mainly on the English "Stop", whose
+unvoiced "s" counts as onset here before the VAD hears voice; the cut needs
+160 ms of voiced speech.
| CPU container | boots and talks; STT 225 ms, Pocket first audio 136 ms |
Three Windows worker bugs found on the way, all fixed: a blocking stdin read
diff --git a/jarvis/voice_engine/bench/worker_suite.py b/jarvis/voice_engine/bench/worker_suite.py
index 7b2bc9f518..4b89b5385e 100644
--- a/jarvis/voice_engine/bench/worker_suite.py
+++ b/jarvis/voice_engine/bench/worker_suite.py
@@ -58,6 +58,12 @@ class _Conversation:
self.audio_frames = 0
self.done = asyncio.Event()
self.interrupted_at: float | None = None
+ # Barge-in cut: the first ``interrupted`` (reply still generating) or
+ # ``speech_started`` (reply generated, app still playing — the app
+ # flushes playback on it) once the bench starts talking over Jarvis.
+ self.cut_armed = False
+ self.cut_at: float | None = None
+ self.cut_kind = ""
# Audio after this point answers the user's next utterance, so it is
# no leak of the interrupted reply.
self.next_turn_at: float | None = None
@@ -71,6 +77,9 @@ class _Conversation:
self.audio_frames = 0
self.done = asyncio.Event()
self.interrupted_at = None
+ self.cut_armed = False
+ self.cut_at = None
+ self.cut_kind = ""
self.next_turn_at = None
self.leaked_until = None
self.metrics = {}
@@ -85,8 +94,11 @@ class _Conversation:
now = time.monotonic()
self.events.append((now, message))
kind = message.get("type")
+ if (self.cut_armed and self.cut_at is None
+ and kind in (p.INTERRUPTED, p.SPEECH_STARTED)):
+ self.cut_at, self.cut_kind = now, kind
if kind == p.TRANSCRIPT_INPUT and message.get("final"):
- if self.interrupted_at is not None and self.next_turn_at is None:
+ if self.cut_at is not None and self.next_turn_at is None:
self.next_turn_at = now
await self.client.send({"type": p.RESPONSE_REQUEST, "session": self.session,
"language": self.language})
@@ -109,7 +121,7 @@ class _Conversation:
if self.first_audio_at is None:
self.first_audio_at = now
self.last_audio_at = now
- if self.interrupted_at is not None and self.next_turn_at is None:
+ if self.cut_at is not None and self.next_turn_at is None:
self.leaked_until = now
await asyncio.gather(messages(), audio())
@@ -209,16 +221,17 @@ async def _run(model: str, tts: str, languages: list[str], voice_kind: str,
continue
await convo.stream(silence(0.4, STT_RATE))
barge = voice.render(_BARGE[language], language, pad_s=0.0)
+ convo.cut_armed = True
sent_at = await convo.stream(np.concatenate([barge, silence(0.6, STT_RATE)]))
barge_start = sent_at + _speech_start(barge)
- interrupted = convo.interrupted_at
+ cut = convo.cut_at
leak = 0.0
- if interrupted is not None and convo.leaked_until is not None:
- leak = max(0.0, convo.leaked_until - interrupted)
+ if cut is not None and convo.leaked_until is not None:
+ leak = max(0.0, convo.leaked_until - cut)
barges.append({
"language": language,
- "interrupt_ms": round((interrupted - barge_start) * 1000.0, 1)
- if interrupted else None,
+ "cut_by": convo.cut_kind or None,
+ "interrupt_ms": round((cut - barge_start) * 1000.0, 1) if cut else None,
"audio_after_interrupt_ms": round(leak * 1000.0, 1),
})
convo.done = asyncio.Event()
diff --git a/jarvis/voice_engine/engine.py b/jarvis/voice_engine/engine.py
index fd8b89c68c..4f2399e2d1 100644
--- a/jarvis/voice_engine/engine.py
+++ b/jarvis/voice_engine/engine.py
@@ -39,6 +39,15 @@ INPUT_RATE = p.INPUT_RATE
OUTPUT_RATE = p.OUTPUT_RATE
LANGUAGE_NAMES = {"de": "German", "en": "English", "es": "Spanish", "fr": "French",
"it": "Italian", "pt": "Portuguese", "nl": "Dutch"}
+# Small local models otherwise act on mood: "I'm so tired" set the volume and
+# started music in 9 of 30 trials (qwen3.5:4b). With this rule: 0 of 30, and
+# 0 of 40 real requests missed (plan section 12.3).
+_ACT_ONLY_ON_REQUEST = (
+ "Act only on request: call a tool that changes something (timer, volume, music, "
+ "lights, messages, calendar, apps) only when the user explicitly asks for that "
+ "action. For tips, ideas, recipes, feelings or knowledge, answer in words and call "
+ "no tool."
+)
class VadModel(Protocol):
@@ -618,7 +627,10 @@ class ConversationSession:
def _system_text(self) -> str:
name = LANGUAGE_NAMES.get(self._language, self._language)
- rule = f"Reply in {name}. Keep spoken answers short: one to three sentences."
+ rule = (
+ f"Reply in {name}. Keep spoken answers short: one to three sentences. "
+ + _ACT_ONLY_ON_REQUEST
+ )
return f"{self._instructions.strip()}\n\n{rule}".strip()
def _bounded_messages(self) -> list[dict[str, Any]]: