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): stop announcing a failure that never happened

Harald762ec1c171bb
diff --git a/jarvis/brain/ack_brain/generator.py b/jarvis/brain/ack_brain/generator.py
index 1cd135de66..340c9639d9 100644
--- a/jarvis/brain/ack_brain/generator.py
+++ b/jarvis/brain/ack_brain/generator.py
@@ -368,6 +368,14 @@ class AckGenerator:
# legitimate Flash-Brain output, not the unwanted brain-side
# filler that the regular scrub mode removes.
scrub_result = scrub_for_voice(text, language=language, ack_mode=True)
+ if scrub_result.fallback_used:
+ # The scrub threw the whole ack away and substituted the generic
+ # error phrase. An ack that announces a failure BEFORE the answer
+ # even exists is a lie, and the phrase survives the alnum check
+ # below — so reject it here and stay silent.
+ _emit_counter("ack_scrubbed_empty_total", provider=provider_label)
+ await self._breaker.record_success()
+ return None
scrubbed = scrub_result.cleaned
alnum_count = sum(1 for c in scrubbed if c.isalnum())
if alnum_count < 3:
@@ -418,7 +426,11 @@ class AckGenerator:
detected = _detect_language(text)
if detected != "unknown" and detected != language:
return None
- scrubbed = scrub_for_voice(text, language=language, ack_mode=True).cleaned
+ scrub_result = scrub_for_voice(text, language=language, ack_mode=True)
+ if scrub_result.fallback_used:
+ # Same verdict as ``run()``: the generic error phrase is not an ack.
+ return None
+ scrubbed = scrub_result.cleaned
if sum(1 for c in scrubbed if c.isalnum()) < 3:
return None
if has_deferred_action_claim(scrubbed):
diff --git a/jarvis/brain/ack_brain/spawn_announcement.py b/jarvis/brain/ack_brain/spawn_announcement.py
index fc42788ce6..8a99691141 100644
--- a/jarvis/brain/ack_brain/spawn_announcement.py
+++ b/jarvis/brain/ack_brain/spawn_announcement.py
@@ -535,11 +535,15 @@ class SpawnAnnouncementComposer:
if detected != "unknown" and detected != lang:
return None
try:
- scrubbed = scrub_for_voice(
- trimmed, language=lang, ack_mode=True
- ).cleaned.strip()
+ result = scrub_for_voice(trimmed, language=lang, ack_mode=True)
except Exception: # noqa: BLE001 — a scrubber bug must not mute the spawn
return None
+ if result.fallback_used:
+ # The scrub replaced the whole announcement with the generic error
+ # phrase. Announcing a failure at the moment a spawn STARTS is a
+ # lie; drop the candidate and let the generic pool speak instead.
+ return None
+ scrubbed = result.cleaned.strip()
if sum(1 for c in scrubbed if c.isalnum()) < 3:
return None
return scrubbed
diff --git a/jarvis/brain/scrub_verdict.py b/jarvis/brain/scrub_verdict.py
new file mode 100644
index 0000000000..3428dbe469
--- /dev/null
+++ b/jarvis/brain/scrub_verdict.py
@@ -0,0 +1,57 @@
+"""Whole-turn verdict for a ``scrub_for_voice`` result (non-streaming paths).
+
+``scrub_for_voice`` ends with a residue guard: when a filter fired AND fewer
+than ``MIN_MEANINGFUL_CHARS`` alphanumeric characters survive, it throws the
+input away and returns the canned error phrase for ALL of it. That guard is
+the last defence against a machine leak reaching TTS and must stay exactly as
+it is — but it conflates two very different turns:
+
+* a machine leak was cut out (tool JSON, stacktrace, raw repr, shell command)
+ and what remains is debris — something really did go wrong, the error phrase
+ is the honest thing to say;
+* only harmless prose was cut out (filler opener, honorific, self-reference,
+ jargon, markdown, an em dash) — nothing failed, the model simply said
+ nothing of substance. Measured 2026-08-18: "Tolle Frage!", "Great
+ question.", "As an AI." and "Sir," all came back as "Es trat ein Fehler
+ auf." / "An error occurred.".
+
+Speaking a failure that never happened is a lie, so the non-streaming voice
+call sites need the second case separated out. The streaming paths already
+do this: :func:`jarvis.realtime.scrub_gate._is_stream_safe_residue` owns the
+action classification (blocking vs. non-blocking scrub actions), and this
+module deliberately REUSES that one classifier instead of keeping a second
+copy of the action sets in sync. Only the CONCLUSION differs: a stream waits
+for the next delta, a completed turn stays silent.
+"""
+
+from __future__ import annotations
+
+from jarvis.brain.output_filter import ScrubResult
+
+# Private on purpose over there: the sets are an implementation detail of one
+# shared verdict, not a public taxonomy. Importing the function (rather than
+# copying the sets) keeps ONE place where a newly added scrub action has to be
+# classified — an unclassified action still counts as blocking there, so this
+# module inherits the fail-closed default too.
+from jarvis.realtime.scrub_gate import _is_stream_safe_residue
+
+__all__ = ["is_harmless_scrub_residue"]
+
+
+def is_harmless_scrub_residue(result: ScrubResult) -> bool:
+ """``True`` when the scrub emptied a turn without finding anything wrong.
+
+ The caller is holding a :class:`ScrubResult` whose ``cleaned`` text is the
+ generic error phrase. This returns ``True`` only when that phrase came from
+ the post-scrub residue guard AND every filter that fired is a harmless
+ prose transform. Then the honest outcome is to say nothing — never to
+ claim an error.
+
+ ``False`` covers both remaining cases and both keep the fallback phrase:
+ a real leak was scrubbed (``removed_tool_json``, ``replaced_stacktrace``,
+ ...), or a scrub action nobody has classified yet showed up.
+
+ Never swallow this silently: every call site logs the dropped text and the
+ actions behind it (contract §7, "no silent except").
+ """
+ return _is_stream_safe_residue(result)
diff --git a/jarvis/browser_voice/session.py b/jarvis/browser_voice/session.py
index 1740914c5d..c39d68c423 100644
--- a/jarvis/browser_voice/session.py
+++ b/jarvis/browser_voice/session.py
@@ -33,6 +33,7 @@ from typing import Any
from uuid import uuid4
from jarvis.brain.output_filter import scrub_for_voice
+from jarvis.brain.scrub_verdict import is_harmless_scrub_residue
from jarvis.browser_voice.audio import (
STT_SAMPLE_RATE,
TTS_SAMPLE_RATE,
@@ -206,7 +207,20 @@ class BrowserVoiceSession:
await self._send_json({"type": "transcript", "text": text, "is_final": True})
response = await self._think(text)
- spoken = scrub_for_voice(response, language=self._lang_short()).cleaned
+ scrubbed = scrub_for_voice(response, language=self._lang_short())
+ if is_harmless_scrub_residue(scrubbed):
+ # The whole reply was filler / an honorific, so the residue
+ # guard emptied it and returned the generic error phrase.
+ # Nothing failed — say nothing rather than claim an error.
+ log.info(
+ "browser_voice[%s] reply carried no substance (%s) — "
+ "staying silent instead of speaking the error phrase: %r",
+ self.session_id,
+ scrubbed.actions,
+ response[:80],
+ )
+ return
+ spoken = scrubbed.cleaned
if not spoken.strip():
return
self._tts_task = asyncio.create_task(self._speak(spoken))
diff --git a/jarvis/missions/voice/announcer.py b/jarvis/missions/voice/announcer.py
index 9b5cbf0b88..a3716b5f9e 100644
--- a/jarvis/missions/voice/announcer.py
+++ b/jarvis/missions/voice/announcer.py
@@ -35,6 +35,7 @@ import logging
from typing import TYPE_CHECKING, Literal
from jarvis.brain.output_filter import scrub_for_voice
+from jarvis.brain.scrub_verdict import is_harmless_scrub_residue
from jarvis.core.bus import EventBus
from jarvis.core.events import AnnouncementRequested
from jarvis.missions.voice.readback import (
@@ -172,6 +173,18 @@ class MissionAnnouncer:
"MissionAnnouncer pre-scrub [%s]: %s (fallback=%s)",
lang, scrubbed.actions, scrubbed.fallback_used,
)
+ if is_harmless_scrub_residue(scrubbed):
+ # Filler-only announcement. The residue guard turned it into
+ # the generic error phrase; publishing that would announce a
+ # mission failure that never happened.
+ logger.info(
+ "MissionAnnouncer: announcement carried no substance "
+ "(%s) — staying silent instead of publishing the error "
+ "phrase: %r",
+ scrubbed.actions,
+ text[:80],
+ )
+ return
text = scrubbed.cleaned
if not text.strip():
logger.info("MissionAnnouncer: text leer nach pre-scrub — skip")
diff --git a/jarvis/missions/voice/listener.py b/jarvis/missions/voice/listener.py
index 7c308c692f..716ffa0319 100644
--- a/jarvis/missions/voice/listener.py
+++ b/jarvis/missions/voice/listener.py
@@ -24,6 +24,7 @@ from collections.abc import Awaitable, Callable
from typing import TYPE_CHECKING
from jarvis.brain.output_filter import scrub_for_voice
+from jarvis.brain.scrub_verdict import is_harmless_scrub_residue
from jarvis.voice.contextual_readback import render_readback
from ..event_bus import MissionBus
@@ -133,6 +134,17 @@ class MissionVoiceListener:
"MissionVoiceListener filter [%s]: %s (fallback=%s)",
lang, scrubbed.actions, scrubbed.fallback_used,
)
+ if is_harmless_scrub_residue(scrubbed):
+ # Filler-only readback. The residue guard replaced it with the
+ # generic error phrase; speaking that would report a mission
+ # failure that never happened.
+ logger.info(
+ "MissionVoiceListener: readback carried no substance (%s) — "
+ "staying silent instead of speaking the error phrase: %r",
+ scrubbed.actions,
+ text[:80],
+ )
+ return
if not scrubbed.cleaned.strip():
logger.info("MissionVoiceListener: text empty after filter — skip")
return
diff --git a/jarvis/realtime/session.py b/jarvis/realtime/session.py
index c91d45e47b..220150e95d 100644
--- a/jarvis/realtime/session.py
+++ b/jarvis/realtime/session.py
@@ -42,6 +42,7 @@ from jarvis.brain.provider_test import (
UNREACHABLE,
classify_provider_error,
)
+from jarvis.brain.scrub_verdict import is_harmless_scrub_residue
from jarvis.brain.turn_planner import (
TurnPath,
TurnPlan,
@@ -5260,7 +5261,19 @@ class RealtimeVoiceSession:
if not raw:
return ""
language = str(getattr(delegate_state, "language", "") or self._language)
- return scrub_for_voice(raw, language=language).cleaned.strip()
+ scrubbed = scrub_for_voice(raw, language=language)
+ if is_harmless_scrub_residue(scrubbed):
+ # Filler-only reply: the post-scrub residue guard emptied it and
+ # handed back the generic error phrase. The delegate did not fail,
+ # so returning "" keeps the surface quiet instead of announcing an
+ # incident that never happened.
+ log.info(
+ "Trusted delegate reply carried no substance (%s) — dropping "
+ "it instead of speaking the error phrase",
+ scrubbed.actions,
+ )
+ return ""
+ return scrubbed.cleaned.strip()
def _advance_echo_horizon(self, duration_s: float) -> None:
"""Date the echo guard's activity forward to the estimated drain.
@@ -6725,10 +6738,14 @@ class RealtimeVoiceSession:
for candidate in candidates:
if not isinstance(candidate, str) or not candidate.strip():
continue
- cleaned = scrub_for_voice(
- candidate,
- language=self._language,
- ).cleaned.strip()
+ scrubbed = scrub_for_voice(candidate, language=self._language)
+ if is_harmless_scrub_residue(scrubbed):
+ # Filler-only candidate. The residue guard turned it into the
+ # generic error phrase — speaking that for a tool call that
+ # SUCCEEDED would invent a failure. Skip to the next candidate
+ # and, failing that, to the localized action phrase below.
+ continue
+ cleaned = scrubbed.cleaned.strip()
if cleaned:
return cleaned, succeeded
phrase_key = "cu_done" if succeeded else "action_failed_generic"
diff --git a/jarvis/speech/pipeline.py b/jarvis/speech/pipeline.py
index a522e9a09a..2f13e92f5d 100644
--- a/jarvis/speech/pipeline.py
+++ b/jarvis/speech/pipeline.py
@@ -49,6 +49,7 @@ from jarvis.audio.player import AudioPlayer
from jarvis.audio.vad import SileroEndpointer
from jarvis.audio.vad_reasons import FORCED_CUT_REASONS
from jarvis.brain.output_filter import FALLBACK_PHRASES, ScrubResult, scrub_for_voice
+from jarvis.brain.scrub_verdict import is_harmless_scrub_residue
from jarvis.brain.turn_planner import plan_turn
from jarvis.core.events import (
CU_PROGRESS_EVENTS,
@@ -4650,6 +4651,18 @@ class SpeechPipeline:
"🧹 Announcement-Filter [%s]: %s (fallback=%s)",
ann_lang, scrubbed.actions, scrubbed.fallback_used,
)
+ if is_harmless_scrub_residue(scrubbed):
+ # The whole announcement was filler/honorific/markdown, so the
+ # residue guard emptied it and handed back the generic error
+ # phrase. Nothing failed — speaking it would report an incident
+ # that never happened. Stay silent, but say so in the log.
+ log.info(
+ "Announcement carried no substance (%s) — staying silent "
+ "instead of speaking the error phrase: %r",
+ scrubbed.actions,
+ (event.text or "")[:80],
+ )
+ return
if not scrubbed.cleaned.strip():
log.info("Announcement nach Filter leer — schweige.")
return
@@ -5325,6 +5338,20 @@ class SpeechPipeline:
"🧹 Background-Filter: %s (fallback=%s)",
scrubbed.actions, scrubbed.fallback_used,
)
+ if is_harmless_scrub_residue(scrubbed):
+ # Filler-only readback: the residue guard replaced it with the
+ # generic error phrase. The mission SUCCEEDED here as often as
+ # not, so speaking that phrase would invent a failure. Silence is
+ # the honest outcome; the bus event still carries the result.
+ log.info(
+ "Jarvis-Agent background finished (success=%s) — the readback "
+ "carried no substance (%s), staying silent instead of "
+ "speaking the error phrase: %r",
+ event.success,
+ scrubbed.actions,
+ text[:80],
+ )
+ return
cleaned = scrubbed.cleaned.strip()
if not cleaned:
log.info(
@@ -8751,6 +8778,18 @@ class SpeechPipeline:
or self._output_language(None, text)
)
scrubbed = scrub_for_voice(text, language=language)
+ if is_harmless_scrub_residue(scrubbed):
+ # Filler-only surface text. The residue guard turned it
+ # into the generic error phrase; re-rendering that would
+ # announce a failure the user does not have.
+ log.info(
+ "Realtime surface fallback carried no substance (%s) "
+ "— dropping it instead of speaking the error phrase: "
+ "%r",
+ scrubbed.actions,
+ text[:80],
+ )
+ return
cleaned = scrubbed.cleaned.strip()
if cleaned and getattr(self, "_muted", False):
# Voice muted at delivery time (orb double-double-click):
@@ -13291,6 +13330,22 @@ class SpeechPipeline:
"🧹 Output-Filter [%s]: %s (fallback=%s)",
lang, scrubbed.actions, scrubbed.fallback_used,
)
+ if is_harmless_scrub_residue(scrubbed):
+ # The whole turn was filler ("Tolle Frage!"), an honorific or a
+ # self-reference, so the residue guard emptied it and returned the
+ # generic error phrase. Nothing failed — the brain simply said
+ # nothing of substance, and claiming an error would be a lie. Stay
+ # silent (the pre-filters above already treat a substance-free turn
+ # that way) and log what was dropped.
+ log.info(
+ "Output filter [%s]: the turn carried no substance (%s) — "
+ "staying silent instead of speaking the error phrase: %r",
+ lang,
+ scrubbed.actions,
+ response[:80],
+ )
+ await self._set_turn_state(TurnTakingState.LISTENING)
+ return True
response = scrubbed.cleaned
if not response.strip():
log.info("Output-Filter hinterlaesst leeren Text — schweige.")
diff --git a/jarvis/voice/contextual_readback.py b/jarvis/voice/contextual_readback.py
index cdae488567..5e81e3414d 100644
--- a/jarvis/voice/contextual_readback.py
+++ b/jarvis/voice/contextual_readback.py
@@ -461,11 +461,17 @@ class ReadbackComposer:
if trimmed in self._recent:
return None
try:
- scrubbed = scrub_for_voice(
- trimmed, language=language, ack_mode=True
- ).cleaned.strip()
+ result = scrub_for_voice(trimmed, language=language, ack_mode=True)
except Exception: # noqa: BLE001 — a scrubber bug must not mute us
return None
+ if result.fallback_used:
+ # The scrub threw the whole candidate away and substituted the
+ # generic error phrase. Emitting that would make the readback
+ # announce a failure that never happened — and no downstream guard
+ # could tell it apart from a genuine one. Reject the candidate; the
+ # caller falls back to the deterministic canned line.
+ return None
+ scrubbed = result.cleaned.strip()
if sum(1 for c in scrubbed if c.isalnum()) < 3:
return None
return scrubbed
diff --git a/tests/unit/brain/test_scrub_verdict.py b/tests/unit/brain/test_scrub_verdict.py
new file mode 100644
index 0000000000..293a23cd07
--- /dev/null
+++ b/tests/unit/brain/test_scrub_verdict.py
@@ -0,0 +1,71 @@
+"""``is_harmless_scrub_residue`` splits the two turns the residue guard merges.
+
+The guard in ``scrub_for_voice`` returns the canned error phrase whenever a
+filter fired and almost nothing survived. Non-streaming voice call sites need
+to know WHY it fired: harmless prose removal (stay silent) or a scrubbed
+machine leak (speak the error phrase). The classification itself is reused from
+``jarvis.realtime.scrub_gate`` so both the streaming and the non-streaming
+verdict cannot drift apart — these tests pin the reuse against real
+``scrub_for_voice`` output, not against a hand-built ``ScrubResult``.
+"""
+from __future__ import annotations
+
+import pytest
+
+from jarvis.brain.output_filter import FALLBACK_PHRASES, ScrubResult, scrub_for_voice
+from jarvis.brain.scrub_verdict import is_harmless_scrub_residue
+
+HARMLESS = [
+ ("Tolle Frage!", "de"), # i18n-allow: German filler opener under test
+ ("Als KI kann ich das nicht.", "de"), # i18n-allow: German self-reference under test
+ ("Great question.", "en"),
+ ("As an AI.", "en"),
+ ("Sir,", "en"),
+ ("**...**", "de"),
+ ("—", "de"),
+]
+
+REAL_LEAKS = [
+ (
+ "<function_calls><invoke name='read_file'>"
+ "<parameter name='path'>x</parameter></invoke></function_calls>",
+ "de",
+ ),
+ ('{"tool_call": {"name": "read_file", "arguments": {"path": "x"}}}', "de"),
+ (
+ 'Traceback (most recent call last):\n File "x.py", line 1, in <module>\n'
+ ' raise ValueError("boom")',
+ "de",
+ ),
+]
+
+
[email protected](("text", "language"), HARMLESS)
+def test_prose_only_residue_is_harmless(text: str, language: str) -> None:
+ result = scrub_for_voice(text, language=language)
+ # Precondition: without the verdict this text WOULD be spoken as an error.
+ assert result.cleaned == FALLBACK_PHRASES[language]
+ assert is_harmless_scrub_residue(result) is True
+
+
[email protected](("text", "language"), REAL_LEAKS)
+def test_scrubbed_leak_is_not_harmless(text: str, language: str) -> None:
+ result = scrub_for_voice(text, language=language)
+ assert result.cleaned == FALLBACK_PHRASES[language]
+ assert is_harmless_scrub_residue(result) is False
+
+
+def test_ordinary_answer_is_not_a_residue_case() -> None:
+ # i18n-allow: German voice answer under test
+ result = scrub_for_voice("Es sind achtzehn Grad.", language="de")
+ assert is_harmless_scrub_residue(result) is False
+
+
+def test_unclassified_action_stays_blocking() -> None:
+ """A scrub action nobody classified must keep the error phrase (fail-closed)."""
+ result = ScrubResult(
+ cleaned=FALLBACK_PHRASES["de"],
+ actions=["removed_something_brand_new", "replaced_with_fallback_residue"],
+ fallback_used=True,
+ )
+ assert is_harmless_scrub_residue(result) is False
diff --git a/tests/unit/speech/test_nonstreaming_residue_honesty.py b/tests/unit/speech/test_nonstreaming_residue_honesty.py
new file mode 100644
index 0000000000..d202b49536
--- /dev/null
+++ b/tests/unit/speech/test_nonstreaming_residue_honesty.py
@@ -0,0 +1,124 @@
+"""The non-streaming voice path must not announce a failure that never happened.
+
+``scrub_for_voice`` ends with a residue guard: a filter fired AND fewer than
+three alphanumeric characters survived → the whole text becomes the canned
+error phrase ("Es trat ein Fehler auf." / "An error occurred."). That guard is
+right for what it defends — a machine leak must never reach TTS — but it
+conflates two turns that have nothing in common:
+
+* a leak was cut out (tool JSON, stacktrace, raw repr, shell command): the
+ error phrase is honest, something really did go wrong;
+* only harmless prose was cut out (filler opener, honorific, self-reference,
+ jargon, markdown): nothing failed, the model just said nothing of substance.
+
+Measured 2026-08-18 before the fix: a turn whose whole content was "Tolle
+Frage!" was spoken as "Es trat ein Fehler auf.". The streaming path was already
+covered from two sides (``scrub_gate._is_stream_safe_residue`` and the
+per-sentence drop in ``_brain_streaming``); the non-streaming call sites were
+not. These tests pin the split for the two whole-turn chokepoints in the
+pipeline: the bus announcement handler and the non-streaming brain turn.
+"""
+from __future__ import annotations
+
+from types import SimpleNamespace
+
+import pytest
+
+from jarvis.brain.output_filter import FALLBACK_PHRASES
+from jarvis.core.bus import EventBus
+from jarvis.core.events import AnnouncementRequested
+from jarvis.core.protocols import Transcript
+from tests.unit.speech.test_announcement_bridge import (
+ FakePlayer,
+ FakeTTS,
+ _make_pipeline,
+)
+
+# A turn made of nothing but a filler opener. Every filter that touches it is a
+# prose transform — no machine data is involved anywhere.
+FILLER_DE = "Tolle Frage!" # i18n-allow: German filler opener under test
+FILLER_EN = "Great question."
+# A real leak: the tool-call wrapper is removed and the residue guard then fires
+# on what is left. The user IS owed the error phrase here.
+TOOL_LEAK = (
+ "<function_calls><invoke name='read_file'>"
+ "<parameter name='path'>x</parameter></invoke></function_calls>"
+)
+
+
+def _spoken(tts: FakeTTS) -> list[str]:
+ return [text for text, _lang in tts.calls]
+
+
+async def _run_announcement(text: str, language: str) -> list[str]:
+ bus = EventBus()
+ tts = FakeTTS()
+ _make_pipeline(tts, bus, FakePlayer())
+ await bus.publish(AnnouncementRequested(text=text, language=language))
+ return _spoken(tts)
+
+
+async def _run_nonstreaming_turn(response: str, language: str) -> list[str]:
+ """Drive ONE complete turn down the non-streaming branch of the pipeline."""
+ bus = EventBus()
+ tts = FakeTTS()
+ pipe = _make_pipeline(tts, bus, FakePlayer())
+ # No ``generate_stream`` on the brain → the non-streaming fallback branch.
+ pipe._streaming_enabled = lambda: False # type: ignore[method-assign]
+ pipe._output_language = lambda *_a, **_kw: language # type: ignore[method-assign]
+ pipe._brain = SimpleNamespace(reply_language=language, conversation_language=language)
+
+ async def _transcribe(_pcm: bytes) -> Transcript:
+ # i18n-allow: spoken German user prompt in the test
+ prompt = "Wie ist das Wetter?"
+ return Transcript(text=prompt, language=language, confidence=0.99)
+
+ async def _brain(*_a: object, **_kw: object) -> str:
+ return response
+
+ pipe._transcribe_final = _transcribe # type: ignore[method-assign]
+ pipe._brain_with_ack = _brain # type: ignore[method-assign]
+ await pipe._handle_utterance_turn(bytes(3200), skip_completion=True)
+ return _spoken(tts)
+
+
+ ("response", "language"),
+ [(FILLER_DE, "de"), (FILLER_EN, "en")],
+)
+async def test_filler_only_turn_is_silent_not_an_error(
+ response: str, language: str
+) -> None:
+ """A substance-free turn says nothing — it never claims a failure."""
+ assert await _run_nonstreaming_turn(response, language) == []
+
+
+ ("text", "language"),
+ [(FILLER_DE, "de"), (FILLER_EN, "en")],
+)
+async def test_filler_only_announcement_is_silent_not_an_error(
+ text: str, language: str
+) -> None:
+ """Same verdict on the bus-announcement chokepoint."""
+ assert await _run_announcement(text, language) == []
+
+
+async def test_scrubbed_leak_still_speaks_the_fallback_on_a_turn() -> None:
+ """A machine leak really is a failure — the error phrase must survive."""
+ assert await _run_nonstreaming_turn(TOOL_LEAK, "de") == [FALLBACK_PHRASES["de"]]
+
+
+async def test_scrubbed_leak_still_speaks_the_fallback_on_an_announcement() -> None:
+ assert await _run_announcement(TOOL_LEAK, "de") == [FALLBACK_PHRASES["de"]]
+
+
+async def test_ordinary_answer_is_untouched() -> None:
+ """The guard only ever fires on a whole-text fallback, never on real prose."""
+ answer = "Es sind achtzehn Grad und sonnig." # i18n-allow: German voice answer under test
+ assert await _run_nonstreaming_turn(answer, "de") == [answer]