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.

release: v1.1.1 — macOS realtime self-talk loop fixed, JarvisBar self-healing

Ruben Lütkea7d321644297
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7eb5df7350..cf9474a455 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,6 +9,36 @@ versioning per [SemVer](https://semver.org/lang/de/).
## [Unreleased]
+## [1.1.1] — 2026-07-19
+
+### Fixed
+
+- **macOS: realtime voice no longer talks to itself.** On built-in speakers
+ next to the built-in mic, the assistant's own playback could come back as
+ a "user" turn and be answered — spiralling into an endless two-voice
+ self-conversation (BUG-089). Realtime sessions now recognize their own
+ recently spoken words (including every canned error phrase) and drop the
+ echo before it can start a turn; a genuine answer that adds anything new
+ always gets through.
+- **Outage apologies stop repeating themselves.** When no language model is
+ reachable, the spoken "I can't reach my language model" notice now comes
+ at most once per half minute instead of on every turn — repeats complete
+ silently and honestly in the log.
+- **The emergency fallback voice keeps the caller's voice profile.** When
+ the realtime voice dies mid-call and a reply is re-rendered locally, the
+ substitute voice now matches the session voice's gender instead of
+ hard-flipping to a male default — no more "second assistant" joining the
+ call.
+- **Smoother replies while you can interrupt.** The local interrupt
+ detector's per-frame inference moved off the audio loop — one less
+ stutter source on slower machines.
+- **macOS: the status bar comes back after a crash.** The out-of-process
+ bar host now respawns itself (bounded, with honest logging) instead of
+ staying invisible for the rest of the session.
+- The session build warns when the realtime provider and every configured
+ brain provider share one credential family — the setup in which a single
+ quota error silences both at once.
+
## [1.1.0] — 2026-07-18
### Added
diff --git a/docs/BUGS.md b/docs/BUGS.md
index 151bd6c47c..a74ebc3ca9 100644
--- a/docs/BUGS.md
+++ b/docs/BUGS.md
@@ -6167,3 +6167,63 @@ offenders, because they are spoken exactly when the system is degraded and
repeating. And an error phrase that can repeat MUST carry a cooldown: a
fixed apology re-spoken every few seconds is not honesty, it is fuel for
whatever loop caused it.
+
+## BUG-090: Surface-TTS fallback flips to a different-gender voice mid-answer AND the turn loses its voice label (HIGH, FIXED 2026-07-19)
+
+**Symptom (live 2026-07-19 07:41, session `4123ba4c`, gemini-live, voice
+pinned Fenrir).** Turn 3 (a delegated calendar question) was audibly spoken
+by a FEMALE voice while every other turn spoke as masculine Fenrir — and the
+exported transcript shows NO voice label at all for exactly that turn, so
+the flip was invisible in the record.
+
+**What actually happened, per the run log.**
+
+1. 07:42:30.112 — the provider produced no audio for the grounded Brain
+ result; the surface TTS fallback (`gemini-flash-tts`) rendered the
+ two-sentence answer.
+2. The fallback instance was built WITHOUT the voice-consistency profile:
+ `build_realtime_surface_tts` passed neither `chunk_by_sentence` (ctor
+ default **True** — one generation PER SENTENCE, confirmed by two synth
+ calls in the log) nor the `[tts]` `seed`/`temperature` drift knobs the
+ pipeline instance has honored since 2026-05-24. Gemini TTS is generative
+ (BUG-086): each extra generation re-rolls the delivery, and the Bavarian
+ dialect persona is exactly the performance cue that pushes the render
+ past the `PrebuiltVoiceConfig` pin — one take came out female.
+3. The honest label was then dropped: the surface path publishes its
+ reply-kind `SpeechSpoken` (voice + provider) only after playback
+ DRAINED (~14 s later) — by then `VoiceTurnCompleted` had finalized the
+ turn (correctly claiming no session voice, `_output_samples_sent == 0`),
+ and the recorder attached `SpeechSpoken` only to an OPEN turn. Result:
+ a spoken turn with an empty `voice_name`.
+
+**Fix (both layers, cross-platform pure Python).**
+
+- **One take + drift knobs:** `build_realtime_surface_tts` now constructs
+ the surface `GeminiFlashTTS` with `chunk_by_sentence=False` (the whole
+ reply is ONE generation; with `[tts].streaming` the single take still
+ streams, so first-audio latency is unchanged) and passes through the
+ `[tts]` `seed`/`temperature` values.
+- **Late label re-attach:** the recorder keeps the session's most recently
+ finalized turn; a reply-kind `SpeechSpoken` that arrives late attaches
+ its voice to that turn — only when the turn has NO voice yet and its
+ recorded reply text matches the confirmed-audible text (equality, or
+ containment past a 16-char floor for scrubbed subsets) and the OPEN turn
+ does not own the same reply. `SessionStore.update_turn_voice` persists
+ the two voice columns post-finalize.
+
+**Guards (run in the `ci.yml` pytest matrix on Linux/Windows/macOS).**
+`tests/unit/plugins/tts/test_realtime_surface_tts.py` (one-take profile
+with and without configured knobs),
+`tests/unit/sessions/test_turn_voice_label.py` (late label lands on the
+finalized turn + persists; never stamps the next open turn; scrubbed-subset
+match; never overwrites an honest label; short interjections prefer the
+open turn).
+
+**Class rule (extends BUG-086's).** A voice instance whose sole purpose is
+IDENTITY (an emergency re-render of a session voice) must be built with the
+strictest consistency profile the engine offers — never the engine's
+convenience defaults; every extra generation is another dice roll. And the
+authoritative "this voice actually spoke" signal must be attachable to the
+turn it describes even when playback outlives the turn — a label that can
+only land on an open turn silently disappears exactly when the fallback
+path (the interesting case) is slow.
diff --git a/jarvis/__init__.py b/jarvis/__init__.py
index a693828dc4..bd739c525c 100644
--- a/jarvis/__init__.py
+++ b/jarvis/__init__.py
@@ -1,3 +1,3 @@
"""Personal Jarvis — a voice-driven, cross-platform meta-orchestrator."""
-__version__ = "1.1.0"
+__version__ = "1.1.1"
diff --git a/jarvis/plugins/tts/__init__.py b/jarvis/plugins/tts/__init__.py
index b6f37963b6..a12feb39be 100644
--- a/jarvis/plugins/tts/__init__.py
+++ b/jarvis/plugins/tts/__init__.py
@@ -342,6 +342,21 @@ def build_realtime_surface_tts(cfg: Any, realtime_provider: str) -> Any | None:
getattr(tts_cfg, "allow_sapi5_fallback", False)
),
streaming=bool(getattr(tts_cfg, "streaming", False)),
+ # Voice-identity profile (BUG-090). Gemini TTS is generative:
+ # every generation re-rolls the delivery, and a performance cue
+ # in the text (dialect persona, quoted lines) can flip the
+ # rendered voice past the PrebuiltVoiceConfig pin. The ctor
+ # default chunk_by_sentence=True gave the 2026-07-19 07:42
+ # fallback one generation PER SENTENCE — the second take came
+ # out as a different-gender voice mid-answer. The emergency
+ # re-render exists solely to keep the session's voice identity,
+ # so it is always ONE take (with streaming=True the single
+ # whole-text generation still streams, no first-audio cost)
+ # and inherits the [tts] drift knobs the pipeline instance
+ # already honors.
+ chunk_by_sentence=False,
+ seed=getattr(tts_cfg, "seed", None),
+ temperature=getattr(tts_cfg, "temperature", None),
api_key=api_key,
)
else: # pragma: no cover — map entries always name a buildable family
diff --git a/jarvis/sessions/recorder.py b/jarvis/sessions/recorder.py
index 563a057e4d..d6f1af68f1 100644
--- a/jarvis/sessions/recorder.py
+++ b/jarvis/sessions/recorder.py
@@ -175,6 +175,13 @@ class _SessionState:
total_tokens_out: int = 0
providers_used: set[str] = field(default_factory=set)
current_turn: _TurnState | None = None
+ # The most recently FINALIZED turn of this session. A surface-TTS fallback
+ # confirms playback only after its audio fully drained, so its honest
+ # reply-kind SpeechSpoken can arrive AFTER VoiceTurnCompleted already
+ # closed the turn — and even after the NEXT turn opened. Kept so the late
+ # label can be re-attached to the turn that actually spoke instead of
+ # being dropped or stamped onto the wrong turn (BUG-090).
+ last_final_turn: _TurnState | None = None
class SessionRecorder:
@@ -309,7 +316,7 @@ class SessionRecorder:
self._maybe_append_raw(event, kind)
def _on_speech_spoken(self, event: SpeechSpoken) -> None:
- """Adopt the speaking voice onto the open turn.
+ """Adopt the speaking voice onto the turn that actually spoke.
``SpeechSpoken`` is the authoritative audible track, so a voice it
names beats the session-level claim in ``VoiceTurnCompleted`` — that is
@@ -317,16 +324,66 @@ class SessionRecorder:
(the surface voice spoke, not the session voice). The reply phrase
wins over supplemental phrases; a supplemental phrase only fills a
blank.
+
+ Reply-kind events additionally re-attach LATE: a surface-TTS fallback
+ confirms playback only after its audio drained, which can be after the
+ turn was finalized (and after the next turn opened). Dropping it left
+ the fallback turn with no voice label at all in the transcript
+ (session 2026-07-19 07:41, turn 3 — BUG-090).
"""
assert self._state is not None
- t = self._state.current_turn
voice = getattr(event, "voice", None)
- if t is None or not voice:
+ if not voice:
+ return
+ if event.spoken_kind == SPOKEN_KIND_REPLY:
+ late = self._late_reply_target(event)
+ if late is not None:
+ late.voice_name = str(voice)
+ late.voice_provider = str(
+ getattr(event, "voice_provider", None) or ""
+ )
+ # The turn row was already written by finalize_turn — persist
+ # the honest label explicitly.
+ self._store.update_turn_voice(
+ turn_id=late.turn_id,
+ voice_name=late.voice_name,
+ voice_provider=late.voice_provider,
+ )
+ return
+ t = self._state.current_turn
+ if t is None or t.finalized:
return
if event.spoken_kind == SPOKEN_KIND_REPLY or not t.voice_name:
t.voice_name = str(voice)
t.voice_provider = str(getattr(event, "voice_provider", None) or "")
+ def _late_reply_target(self, event: SpeechSpoken) -> _TurnState | None:
+ """Finalized turn a late reply-kind ``SpeechSpoken`` belongs to.
+
+ Only the most recently finalized turn qualifies, and only when it has
+ no honest voice label yet AND its recorded reply text matches what was
+ just confirmed audible — so a genuinely new reply for the OPEN turn
+ can never be stolen backwards, and a turn whose voice is already
+ known (provider-voiced realtime, classic in-turn phrase) keeps it.
+ """
+ assert self._state is not None
+ last = self._state.last_final_turn
+ if last is None or last.voice_name:
+ return None
+ spoken = _normalized_reply(getattr(event, "text", "") or "")
+ if not spoken or not _reply_text_matches(spoken, last.jarvis_text):
+ return None
+ cur = self._state.current_turn
+ if (
+ cur is not None
+ and not cur.finalized
+ and _reply_text_matches(spoken, cur.jarvis_text)
+ ):
+ # The open turn already owns this exact reply — normal in-turn
+ # attribution below takes precedence.
+ return None
+ return last
+
# -----------------------------------------------------------------
# Session lifecycle
# -----------------------------------------------------------------
@@ -548,6 +605,9 @@ class SessionRecorder:
if t.provider:
self._state.providers_used.add(t.provider)
t.finalized = True
+ # Late-label anchor: a reply-kind SpeechSpoken confirmed after this
+ # point can still be re-attached to this turn (BUG-090).
+ self._state.last_final_turn = t
# -----------------------------------------------------------------
# Per-event handlers
@@ -863,6 +923,35 @@ def _now_ms() -> int:
return int(time.time() * 1000)
+#: Containment (instead of equality) between a spoken phrase and a recorded
+#: reply only counts from this length on — short interjections ("Okay.",
+#: "Fertig.") recur across turns and would false-match. i18n-allow: quoted
+#: German interjection example.
+_REPLY_CONTAINMENT_MIN_CHARS = 16
+
+
+def _normalized_reply(text: str) -> str:
+ """Whitespace/case-insensitive canonical form for reply-text matching."""
+ return " ".join(str(text or "").split()).casefold()
+
+
+def _reply_text_matches(normalized_spoken: str, recorded_reply: str) -> bool:
+ """Whether a confirmed-audible phrase is (part of) a recorded reply.
+
+ The surface path scrubs the reply before speaking it (markdown/URLs
+ dropped), so the audible text may be a strict subset of the recorded
+ transcript — containment counts, but only past a length floor so recurring
+ interjections can never glue onto the wrong turn.
+ """
+ recorded = _normalized_reply(recorded_reply)
+ if not normalized_spoken or not recorded:
+ return False
+ if normalized_spoken == recorded:
+ return True
+ shorter, longer = sorted((normalized_spoken, recorded), key=len)
+ return len(shorter) >= _REPLY_CONTAINMENT_MIN_CHARS and shorter in longer
+
+
def _payload_for(event: Event) -> dict[str, Any]:
"""Selects the fields of an event relevant for replay.
diff --git a/jarvis/sessions/store.py b/jarvis/sessions/store.py
index 6c373c4f76..938c640e67 100644
--- a/jarvis/sessions/store.py
+++ b/jarvis/sessions/store.py
@@ -340,6 +340,27 @@ class SessionStore:
),
)
+ def update_turn_voice(
+ self,
+ *,
+ turn_id: str,
+ voice_name: str,
+ voice_provider: str,
+ ) -> None:
+ """Late voice-label update for an already-finalized turn (BUG-090).
+
+ A surface-TTS fallback confirms playback only after its audio drained,
+ so the honest "this voice actually spoke" signal can arrive after
+ ``finalize_turn`` wrote the row. Only the two voice columns move —
+ every other finalized value stays untouched.
+ """
+ with self._lock:
+ self._c.execute(
+ "UPDATE voice_turns SET voice_name = ?, voice_provider = ? "
+ "WHERE id = ?",
+ (voice_name, voice_provider, turn_id),
+ )
+
# --- Events -------------------------------------------------------
def append_event(
diff --git a/jarvis/ui/jarvisbar/subprocess_overlay.py b/jarvis/ui/jarvisbar/subprocess_overlay.py
index 03dd31d2cf..7a70a252a3 100644
--- a/jarvis/ui/jarvisbar/subprocess_overlay.py
+++ b/jarvis/ui/jarvisbar/subprocess_overlay.py
@@ -22,6 +22,7 @@ original contract: it stays hidden until the next overlay swap or app
restart. Deliberately defines no ``_root`` attribute so the bridge's reset
path early-returns (same contract as ``NullOverlay``).
"""
+
from __future__ import annotations
import json
@@ -226,9 +227,7 @@ class SubprocessBarOverlay:
# these, so the proxy saves the IPC round-trip and no-ops locally too.
def play_animation(self, name: str, **params: Any) -> None: ...
def stop_animation(self, name: str) -> None: ...
- def show_listening_transcript(
- self, text: str = "", duration_ms: int = 30000
- ) -> None: ...
+ def show_listening_transcript(self, text: str = "", duration_ms: int = 30000) -> None: ...
def hide_comment(self) -> None: ...
def start_mouth_animation(self, duration_ms: int = 60000) -> None: ...
def stop_mouth_animation(self) -> None: ...
@@ -236,9 +235,7 @@ class SubprocessBarOverlay:
def set_on_mute_toggle(self, callback: Callable[[], None] | None) -> None:
self._on_mute_toggle = callback
- def set_feedback_publisher(
- self, callback: Callable[[str, dict], None] | None
- ) -> None:
+ def set_feedback_publisher(self, callback: Callable[[str, dict], None] | None) -> None:
self._feedback_publisher = callback
def set_on_show_window(self, callback: Callable[[], None] | None) -> None:
@@ -470,9 +467,7 @@ class SubprocessMascotOverlay(SubprocessBarOverlay):
def stop_animation(self, name: str) -> None:
self._send({"op": "stop_animation", "name": str(name)})
- def show_listening_transcript(
- self, text: str = "", duration_ms: int = 30000
- ) -> None:
+ def show_listening_transcript(self, text: str = "", duration_ms: int = 30000) -> None:
self._send(
{
"op": "show_listening_transcript",
diff --git a/pyproject.toml b/pyproject.toml
index e0110b0d0b..2f5e44a4ef 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
[project]
name = "personal-jarvis"
-version = "1.1.0"
+version = "1.1.1"
description = "Voice-driven meta-orchestrator that turns one spoken request into a fleet of self-checking AI agents"
requires-python = ">=3.11,<3.15"
readme = "README.md"
diff --git a/tests/unit/plugins/tts/test_realtime_surface_tts.py b/tests/unit/plugins/tts/test_realtime_surface_tts.py
index 351a8902d1..2bc1fdfeb1 100644
--- a/tests/unit/plugins/tts/test_realtime_surface_tts.py
+++ b/tests/unit/plugins/tts/test_realtime_surface_tts.py
@@ -98,6 +98,34 @@ def test_untagged_unknown_voice_still_falls_back_to_charon() -> None:
assert tts._default_voice == "Charon"
+def test_surface_fallback_renders_one_take_with_the_config_drift_knobs() -> None:
+ """BUG-090: Gemini TTS is generative — one generation per SENTENCE let the
+ 2026-07-19 fallback re-roll the delivery mid-answer and flip the voice's
+ gender past the Fenrir pin. The emergency re-render is always ONE take and
+ inherits the [tts] drift knobs the pipeline instance already honors."""
+ cfg = _cfg()
+ cfg.tts.seed = 7
+ cfg.tts.temperature = 0.7
+ with override_provider_secrets({"gemini-live": "rt-scoped-key"}):
+ tts = build_realtime_surface_tts(cfg, "gemini-live")
+ assert isinstance(tts, GeminiFlashTTS)
+ assert tts._chunk_by_sentence is False
+ assert tts._seed == 7
+ assert tts._temperature == 0.7
+
+
+def test_surface_fallback_is_one_take_even_without_configured_knobs() -> None:
+ """A fresh install without the [tts] drift knobs still gets the one-take
+ profile — voice identity is the fallback's entire purpose (§3: never
+ assume the maintainer's config)."""
+ with override_provider_secrets({"gemini-live": "rt-scoped-key"}):
+ tts = build_realtime_surface_tts(_cfg(), "gemini-live")
+ assert isinstance(tts, GeminiFlashTTS)
+ assert tts._chunk_by_sentence is False
+ assert tts._seed is None
+ assert tts._temperature is None
+
+
def test_keyless_realtime_provider_yields_no_surface_tts() -> None:
with override_provider_secrets({"gemini-live": None}):
assert build_realtime_surface_tts(_cfg(), "gemini-live") is None
diff --git a/tests/unit/sessions/test_turn_voice_label.py b/tests/unit/sessions/test_turn_voice_label.py
index f93d5ad256..d51ab1b7e6 100644
--- a/tests/unit/sessions/test_turn_voice_label.py
+++ b/tests/unit/sessions/test_turn_voice_label.py
@@ -194,6 +194,281 @@ async def test_unknown_voice_stays_empty_never_guessed(tmp_path) -> None:
store.close()
+# ---------------------------------------------------------------------------
+# Late surface-fallback labels (BUG-090, session 2026-07-19 07:41 turn 3).
+# The surface TTS confirms playback only after its audio drained, so its
+# honest reply-kind SpeechSpoken can arrive AFTER VoiceTurnCompleted closed
+# the turn (and even after the next turn opened). The label must land on the
+# turn that actually spoke — never be dropped, never stamp the next turn.
+# ---------------------------------------------------------------------------
+
+# Quoted German product-surface reply under test (voice fixture).
+_FALLBACK_ANSWER = "Du hast morgen einen vollen Terminkalender." # i18n-allow
+
+
+async def test_late_reply_voice_lands_on_the_finalized_turn(tmp_path) -> None:
+ """Turn closed without a voice (provider silent, surface fallback spoke
+ later): the late confirmed-audible label is attached AND persisted."""
+
+ async def scenario(bus):
+ await bus.publish(
+ VoiceTurnStarted(
+ source_layer="realtime.gemini-live",
+ session_id="sess-voice",
+ turn_id="turn-rt-late",
+ )
+ )
+ await bus.publish(
+ VoiceTurnCompleted(
+ source_layer="realtime.gemini-live",
+ session_id="sess-voice",
+ turn_id="turn-rt-late",
+ jarvis_text=_FALLBACK_ANSWER,
+ tier="realtime",
+ provider="gemini-live",
+ )
+ )
+ # Surface fallback playback drained only now.
+ await bus.publish(
+ SpeechSpoken(
+ source_layer="speech.pipeline",
+ text=_FALLBACK_ANSWER,
+ language="de",
+ spoken_kind=SPOKEN_KIND_REPLY,
+ voice="Fenrir",
+ voice_provider="gemini-flash-tts",
+ )
+ )
+
+ turns, store = await _run_session(tmp_path, scenario)
+ try:
+ assert turns
+ assert turns[0].voice_name == "Fenrir"
+ assert turns[0].voice_provider == "gemini-flash-tts"
+ finally:
+ store.close()
+
+
+async def test_late_reply_voice_does_not_stamp_the_next_open_turn(tmp_path) -> None:
+ """The next user turn is already open when the fallback playback drains:
+ the label still lands on the turn whose reply it was."""
+
+ async def scenario(bus):
+ await bus.publish(
+ VoiceTurnStarted(
+ source_layer="realtime.gemini-live",
+ session_id="sess-voice",
+ turn_id="turn-a",
+ )
+ )
+ await bus.publish(
+ VoiceTurnCompleted(
+ source_layer="realtime.gemini-live",
+ session_id="sess-voice",
+ turn_id="turn-a",
+ jarvis_text=_FALLBACK_ANSWER,
+ tier="realtime",
+ provider="gemini-live",
+ )
+ )
+ await bus.publish(
+ VoiceTurnStarted(
+ source_layer="realtime.gemini-live",
+ session_id="sess-voice",
+ turn_id="turn-b",
+ )
+ )
+ await bus.publish(
+ SpeechSpoken(
+ source_layer="speech.pipeline",
+ text=_FALLBACK_ANSWER,
+ language="de",
+ spoken_kind=SPOKEN_KIND_REPLY,
+ voice="Fenrir",
+ voice_provider="gemini-flash-tts",
+ )
+ )
+ await bus.publish(
+ VoiceTurnCompleted(
+ source_layer="realtime.gemini-live",
+ session_id="sess-voice",
+ turn_id="turn-b",
+ jarvis_text="Etwas ganz anderes.", # i18n-allow: German voice fixture
+ tier="realtime",
+ provider="gemini-live",
+ )
+ )
+
+ turns, store = await _run_session(tmp_path, scenario)
+ try:
+ assert len(turns) == 2
+ by_id = {t.id: t for t in turns}
+ assert by_id["turn-a"].voice_name == "Fenrir"
+ assert by_id["turn-a"].voice_provider == "gemini-flash-tts"
+ assert by_id["turn-b"].voice_name == ""
+ finally:
+ store.close()
+
+
+async def test_late_reply_scrubbed_subset_still_matches(tmp_path) -> None:
+ """The surface path scrubs the reply before speaking — the audible text
+ may be a strict subset of the recorded transcript and still counts."""
+
+ async def scenario(bus):
+ await bus.publish(
+ VoiceTurnStarted(
+ source_layer="realtime.gemini-live",
+ session_id="sess-voice",
+ turn_id="turn-scrubbed",
+ )
+ )
+ await bus.publish(
+ VoiceTurnCompleted(
+ source_layer="realtime.gemini-live",
+ session_id="sess-voice",
+ turn_id="turn-scrubbed",
+ jarvis_text=f"**Wichtig:** {_FALLBACK_ANSWER}", # i18n-allow: German voice fixture
+ tier="realtime",
+ provider="gemini-live",
+ )
+ )
+ await bus.publish(
+ SpeechSpoken(
+ source_layer="speech.pipeline",
+ text=_FALLBACK_ANSWER,
+ language="de",
+ spoken_kind=SPOKEN_KIND_REPLY,
+ voice="Fenrir",
+ voice_provider="gemini-flash-tts",
+ )
+ )
+
+ turns, store = await _run_session(tmp_path, scenario)
+ try:
+ assert turns
+ assert turns[0].voice_name == "Fenrir"
+ finally:
+ store.close()
+
+
+async def test_late_reply_never_overwrites_an_honest_label(tmp_path) -> None:
+ """A turn whose speaking voice is already recorded keeps it — a late
+ reply-kind event only ever fills a blank."""
+
+ async def scenario(bus):
+ await bus.publish(
+ VoiceTurnStarted(
+ source_layer="realtime.gemini-live",
+ session_id="sess-voice",
+ turn_id="turn-voiced",
+ )
+ )
+ await bus.publish(
+ VoiceTurnCompleted(
+ source_layer="realtime.gemini-live",
+ session_id="sess-voice",
+ turn_id="turn-voiced",
+ jarvis_text=_FALLBACK_ANSWER,
+ tier="realtime",
+ provider="gemini-live",
+ voice="Fenrir",
+ voice_provider="gemini-live",
+ )
+ )
+ await bus.publish(
+ SpeechSpoken(
+ source_layer="speech.pipeline",
+ text=_FALLBACK_ANSWER,
+ language="de",
+ spoken_kind=SPOKEN_KIND_REPLY,
+ voice="Charon",
+ voice_provider="gemini-flash-tts",
+ )
+ )
+
+ turns, store = await _run_session(tmp_path, scenario)
+ try:
+ assert turns
+ assert turns[0].voice_name == "Fenrir"
+ assert turns[0].voice_provider == "gemini-live"
+ finally:
+ store.close()
+
+
+async def test_short_interjection_prefers_the_open_turn(tmp_path) -> None:
+ """A short recurring reply ("Okay.") spoken for the OPEN turn must not
+ glue backwards onto a voiceless previous turn with the same text."""
+
+ async def scenario(bus):
+ from jarvis.core.events import ResponseGenerated
+
+ await bus.publish(
+ VoiceTurnStarted(
+ source_layer="realtime.gemini-live",
+ session_id="sess-voice",
+ turn_id="turn-old",
+ )
+ )
+ await bus.publish(
+ VoiceTurnCompleted(
+ source_layer="realtime.gemini-live",
+ session_id="sess-voice",
+ turn_id="turn-old",
+ jarvis_text="Okay.",
+ tier="realtime",
+ provider="gemini-live",
+ )
+ )
+ await bus.publish(
+ VoiceTurnStarted(
+ source_layer="realtime.gemini-live",
+ session_id="sess-voice",
+ turn_id="turn-new",
+ )
+ )
+ await bus.publish(
+ ResponseGenerated(
+ source_layer="realtime.gemini-live",
+ text="Okay.",
+ language="de",
+ )
+ )
+ await bus.publish(
+ SpeechSpoken(
+ source_layer="speech.pipeline",
+ text="Okay.",
+ language="de",
+ spoken_kind=SPOKEN_KIND_REPLY,
+ voice="Charon",
+ voice_provider="gemini-flash-tts",
+ )
+ )
+ await bus.publish(
+ VoiceTurnCompleted(
+ source_layer="realtime.gemini-live",
+ session_id="sess-voice",
+ turn_id="turn-new",
+ jarvis_text="Okay.",
+ tier="realtime",
+ provider="gemini-live",
+ )
+ )
+
+ turns, store = await _run_session(tmp_path, scenario)
+ try:
+ assert len(turns) == 2
+ by_id = {t.id: t for t in turns}
+ assert by_id["turn-old"].voice_name == ""
+ assert by_id["turn-new"].voice_name == "Charon"
+ finally:
+ store.close()
+
+
def test_markdown_export_prints_the_voice_note() -> None:
session = VoiceSessionRow(id="s1", started_ms=1_700_000_000_000)
turn = VoiceTurnRow(
diff --git a/tests/unit/ui/jarvisbar/test_subprocess_overlay.py b/tests/unit/ui/jarvisbar/test_subprocess_overlay.py
index 50605ef181..477e92e2b5 100644
--- a/tests/unit/ui/jarvisbar/test_subprocess_overlay.py
+++ b/tests/unit/ui/jarvisbar/test_subprocess_overlay.py
@@ -5,6 +5,7 @@ the local mirrors (_mode/_persistent/_muted), the ready handshake, event →
callback dispatch, and the dead-host degrade are proven without spawning a
process. The real cross-process path is covered in test_host_protocol.py.
"""
+
from __future__ import annotations
import gc
@@ -334,9 +335,7 @@ class _CrashLoopPopen(_FakePopen):
self.stdout = _QuicklyDyingStdout()
-def test_respawn_is_bounded_to_three_attempts_then_gives_up(
- monkeypatch, caplog
-) -> None:
+def test_respawn_is_bounded_to_three_attempts_then_gives_up(monkeypatch, caplog) -> None:
"""Every attempt uses the crash-prone fake, so each respawned host dies
again (EOF) a beat later — chaining through all 3 attempts and proving
the surface gives up instead of looping forever."""
@@ -386,9 +385,7 @@ def test_surface_contract_exposes_every_bridge_method() -> None:
# --------------------------------------------------------------------- #
# SubprocessMascotOverlay — the mascot flavor of the same host proxy #
# --------------------------------------------------------------------- #
-def _started_mascot(
- monkeypatch, **kwargs
-) -> tuple[SubprocessMascotOverlay, _FakePopen]:
+def _started_mascot(monkeypatch, **kwargs) -> tuple[SubprocessMascotOverlay, _FakePopen]:
monkeypatch.setattr(mod.subprocess, "Popen", _FakePopen)
surface = SubprocessMascotOverlay(**kwargs)
surface.start_in_thread(timeout=2.0)
diff --git a/uv.lock b/uv.lock
index e189ac74f3..266440af74 100644
--- a/uv.lock
+++ b/uv.lock
@@ -2492,7 +2492,7 @@ wheels = [
[[package]]
name = "personal-jarvis"
-version = "1.1.0"
+version = "1.1.1"
source = { editable = "." }
dependencies = [
{ name = "aiofiles" },