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(realtime): recover spoken action claims that never called a tool (BUG-154)

Harald81295b9ccbb7
diff --git a/CHANGELOG.md b/CHANGELOG.md
index c13bdbc46d..775880409a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -20,6 +20,11 @@ versioning per [SemVer](https://semver.org/).
- **Vertex Live native tools work again.** Vertex reports hybrid function
calls as `default:run_shell`. The bridge treated that as an unknown tool
and the model said the tools were down (BUG-153).
+- **A spoken "I'm playing that" is no longer treated as done.** Hybrid
+ voice could announce a playlist (or any other action) without calling
+ the tool; the user had to ask again. The session now recovers those
+ false completions, music capture rematches to the connected service,
+ and an in-flight native tool no longer looks like silence (BUG-154).
- **The Jarvis Bar keeps thinking while the Tool Model works.** After the
short "I'll play that" ack it used to look ready even though YouTube
Music was still running. Progress speech now returns to thinking until
diff --git a/docs/BUGS.md b/docs/BUGS.md
index 1f044ca977..6d2ddcbe7b 100644
--- a/docs/BUGS.md
+++ b/docs/BUGS.md
@@ -10698,3 +10698,82 @@ tool. Resolve at lookup; echo on the wire what the provider emitted.
**Parity.** Lookup is session/bridge-level, every realtime transport.
Only Vertex Live is known to emit the `default:` prefix; OpenAI and
Gemini AI Studio send the declared name and hit the exact-match path.
+
+
+## BUG-154: hybrid live model says the action is done, then does nothing — user has to ask again (HIGH, FIXED 2026-08-19)
+
+**Symptom (Windows live forensic, 17:13, `vertex-live` /
+`gemini-live-2.5-flash-native-audio`, hybrid tool mode).** User: "Kannst du
+bitte richtig coole Musik spielen?" <!-- i18n-allow: live user utterance -->
+Model asked what kind. User: "Egal einfach irgendwas aus den 2010ern." <!-- i18n-allow: live follow-up -->
+Model said "Alles klar, ich spiele dir eine Playlist mit Songs aus den 2010ern." <!-- i18n-allow: live spoken false completion -->
+— then silence. No music. The user had to say it a third time
+("Ja, dann spiel es auch ab.") before `youtube_music` ran. <!-- i18n-allow: live third ask -->
+Same class on other actions: the voice claims the work is done, nothing
+happened, repeating it once makes it work.
+
+**Timeline (`data/jarvis_desktop.log`, session `c0f763c0`).**
+
+| Time | What happened |
+|---|---|
+| 17:13:22 | Turn 1 complete — 1.8 s audio, 37 chars, **function_calls=0** (clarifying question; allowed) |
+| 17:13:34 | Turn 2 complete — 3.7 s audio, 67 chars, **function_calls=0** (false completion; the bug) |
+| 17:13:52 | Turn 3: native `youtube_music` starts |
+| 17:13:55 | Empty-turn watchdog recovers through the Brain chain **over the in-flight tool** |
+| 17:13:55 | `plugin-spotify` matched, plugin not connected, capture aborted — YouTube Music sibling never ran |
+
+**Three stacked faults.**
+
+1. *False completion is not a deferred promise.* The existing
+ `has_deferred_action_claim` guard looks for "I'll check later". "Ich
+ spiele dir eine Playlist …" looks like a delivered result (long tail), <!-- i18n-allow: live spoken false completion -->
+ so the turn was persisted as success. Prompt rules already forbid
+ announcing without a function call; live 17:13 is proof they are not a
+ correctness boundary.
+2. *Skill capture vetoed the disconnected winner before rematch.*
+ `_prefer_music_service` existed and would have swapped Spotify → YouTube
+ Music. It ran *after* `VETO_PLUGIN_NOT_CONNECTED` returned None.
+3. *The empty-turn watchdog ignored in-flight native tools.*
+ `_executed_tool_names` is written only when execute *finishes*. A 28 s
+ `youtube_music` call looked like silence, so Brain recovery raced it.
+
+**Fix.**
+
+- `has_false_completion_claim` (regex-only, de/en/es): first-person
+ present/perfect action *for the user* ("ich spiele dir", "I'm playing <!-- i18n-allow: matcher example -->
+ you a", "te pongo una playlist"). `_recover_unbacked_action_claim` uses <!-- i18n-allow: matcher example -->
+ `has_unbacked_action_claim` (deferred OR false completion). The
+ clarifying question of turn 1 does not match.
+- `_match_skill_for_turn` rematches the music sibling *before* the
+ disconnected veto, so Brain recovery of a music turn actually plays.
+- `_native_tools_in_flight` is counted around native execute; the
+ empty-turn re-ask watchdog and empty-turn recovery treat an in-flight
+ call as evidence and stand down.
+
+**Class rule.** A spoken outcome is not execution evidence. Detect both
+shapes — "I'll do it later" *and* "I am doing it now" — and recover
+through the orchestrator when no tool ran. An in-flight tool is already
+the recovery.
+
+**Parity.** Hybrid and delegate: the unbacked claim starts the
+deterministic Brain dispatch (the 17:13 cell). Direct-tool mode and
+classic `BrainManager.generate` keep the existing honest fallback
+("I did not start an action…") when no tool ran — they do not
+re-dispatch, same as deferred promises. Skill rematch is Brain-level, so
+a later Brain pass on a music turn plays the connected service.
+Execute-time music reroute (unnamed request → preferred / only connected
+service) remains the net when the live model *does* call the wrong
+sibling. Covers every realtime transport; Vertex Live is the forensic.
+
+**Guards.** `tests/unit/brain/test_action_honesty.py`
+(`test_false_completion_claims_are_detected`,
+`test_questions_and_hobby_talk_are_not_false_completions`,
+`test_honesty_fallback_is_not_itself_a_false_completion`,
+`test_german_perfect_needs_the_beneficiary`);
+`tests/unit/realtime/test_session.py`
+(`test_false_completion_without_a_tool_dispatches_the_action`,
+`test_clarifying_question_is_not_an_unbacked_action`,
+`test_in_flight_native_tool_cancels_empty_turn_brain_recovery`);
+`tests/unit/brain/test_paired_plugin_capture_veto.py`
+(`test_capture_rematches_before_the_disconnected_veto`,
+`test_match_skill_for_turn_swaps_disconnected_spotify`).
diff --git a/jarvis/brain/ack_brain/generator.py b/jarvis/brain/ack_brain/generator.py
index 43f7c36080..8c514286fc 100644
--- a/jarvis/brain/ack_brain/generator.py
+++ b/jarvis/brain/ack_brain/generator.py
@@ -31,7 +31,7 @@ from typing import TYPE_CHECKING
from jarvis.brain.ack_brain.circuit_breaker import CircuitBreaker
from jarvis.brain.ack_brain.persona_prompt import get_persona_prompt
-from jarvis.brain.action_honesty import has_deferred_action_claim
+from jarvis.brain.action_honesty import has_unbacked_action_claim
from jarvis.brain.output_filter import scrub_for_voice
from jarvis.core.turn_language import (
detect_text_language,
@@ -358,7 +358,7 @@ class AckGenerator:
await self._breaker.record_success()
return None
- if has_deferred_action_claim(scrubbed):
+ if has_unbacked_action_claim(scrubbed):
_emit_counter(
"ack_unbacked_action_suppressed_total",
provider=provider_label,
@@ -410,7 +410,7 @@ class AckGenerator:
scrubbed = scrub_result.cleaned
if sum(1 for c in scrubbed if c.isalnum()) < 3:
return None
- if has_deferred_action_claim(scrubbed):
+ if has_unbacked_action_claim(scrubbed):
return None
if _detect_self_answer(scrubbed):
return None
diff --git a/jarvis/brain/action_honesty.py b/jarvis/brain/action_honesty.py
index a33b491c5e..60ca88d2fa 100644
--- a/jarvis/brain/action_honesty.py
+++ b/jarvis/brain/action_honesty.py
@@ -1,10 +1,11 @@
-"""Execution-state backstop for model promises about future actions.
+"""Execution-state backstop for model promises and false completions.
-Models occasionally end a turn with an acknowledgement such as "I'll check and
-get back to you" without emitting a tool call. Jarvis has no autonomous
-continuation after that response, so the sentence is not harmless filler: it is
-an ungrounded claim that work is running. This module detects that narrow,
-high-confidence shape with regex only and provides a localized honest fallback.
+Models occasionally end a turn with "I'll check and get back to you" or
+with a finished-looking result ("I'm playing you a playlist") without a
+tool call. Jarvis has no autonomous continuation after that response, so
+the sentence is not harmless filler: it is an ungrounded claim that work
+is running or already done. This module detects both shapes with regex
+only and provides a localized honest fallback.
The judgement is made per clause, never over the whole text. An answer that
opens with "Let me check." and signs off with "I'll get back to you when that
@@ -28,6 +29,38 @@ def _normalize(text: str) -> str:
return "".join(ch for ch in folded if not unicodedata.combining(ch))
+# Present-tense / perfect claims that the action is already happening or done
+# FOR the user. Distinct from the deferred "I'll look later" vocabulary
+# below: these sentences carry a long result-shaped tail ("a playlist of
+# 2010s songs") that ``_analyse`` treats as substance, so they never look
+# "bare". Live 2026-08-19 17:13 (vertex-live hybrid): the model announced
+# a 2010s playlist in German with function_calls=0 — the user had to say
+# it again before the tool ran.
+_FALSE_COMPLETION_RE = re.compile(
+ r"(?:"
+ r"\bich\s+(?:spiele?|offne|starte|sende|schicke|speichere|" # i18n-allow: German output matcher
+ r"lege\s+an|setze|mache)\s+" # i18n-allow: German output matcher
+ r"(?:dir|fur\s+dich)\b|" # i18n-allow: German output matcher
+ r"\bich\s+habe\s+(?:dir|fur\s+dich)\s+" # i18n-allow: DE output
+ r"(?:gerade\s+)?.{0,48}"
+ r"(?:gespielt|geoffnet|gestartet|gesendet|" # i18n-allow: DE output
+ r"geschickt|gespeichert|erledigt)\b|" # i18n-allow: DE output
+ r"\bi(?:'m|\s+am)\s+(?:playing|opening|starting|sending|saving)\s+"
+ r"(?:you\s+)?(?:a|the|your)\b|"
+ r"\bi(?:'ll|\s+will)\s+(?:play|open|start|send|save)\s+"
+ r"(?:you\s+)?(?:a|the|your)\b|"
+ r"\bi(?:'ve|\s+have)\s+(?:just\s+)?(?:played|opened|started|sent|saved)\s+"
+ r"(?:you\s+)?(?:a|the|your|it)\b|"
+ r"\bplaying\s+you\s+(?:a|the)\b|"
+ r"\bte\s+(?:pongo|reproduzco)\s+(?:una?\s+)?" # i18n-allow: ES output
+ r"(?:playlist|cancion|musica)\b|" # i18n-allow: ES output
+ r"\bte\s+(?:envio|abro)\s+(?:el|la|un|una|tu)\b|" # i18n-allow: ES output
+ r"\bestoy\s+(?:reproduciendo|abriendo|iniciando|enviando)\b|" # i18n-allow
+ r"\bhe\s+(?:reproducido|abierto|iniciado|enviado|guardado)\b" # i18n-allow
+ r")"
+)
+
+
_ACTION_COMMITMENT_RE = re.compile(
r"(?:"
r"\b(?:das|es)\s+kann\s+ich(?:\s+gerne)?" # i18n-allow: German output matcher
@@ -280,6 +313,35 @@ def has_deferred_action_claim(text: str) -> bool:
return _analyse(text).kind == "bare"
+def _clause_is_false_completion(clause: _Clause) -> bool:
+ body = clause.body.rstrip()
+ if not body or body.endswith("?"):
+ return False
+ return _FALSE_COMPLETION_RE.search(_normalize(body)) is not None
+
+
+def has_false_completion_claim(text: str) -> bool:
+ """Return whether ``text`` is a false completion with no other substance.
+
+ Used when the model narrates the outcome ("I'm playing you a playlist")
+ without a tool call. The deferred-promise analyser cannot see these:
+ the fake result is the tail, so they look delivered. A list or answer
+ in another clause is substance and must not be replaced.
+ """
+ clauses = _split_clauses(text)
+ if not any(_clause_is_false_completion(clause) for clause in clauses):
+ return False
+ return not any(
+ clause.substance and not _clause_is_false_completion(clause)
+ for clause in clauses
+ )
+
+
+def has_unbacked_action_claim(text: str) -> bool:
+ """Either shape of an action claim that has no execution evidence."""
+ return has_deferred_action_claim(text) or has_false_completion_claim(text)
+
+
def action_not_started_phrase(language: str) -> str:
"""Return the honest fallback in one resolved runtime output language."""
return _ACTION_NOT_STARTED_PHRASES.get(
@@ -297,6 +359,8 @@ def replace_unbacked_action_claim(
"""Drop an unbacked promise without ever dropping a delivered answer."""
if executed_tools:
return text
+ if has_false_completion_claim(text):
+ return action_not_started_phrase(language)
analysis = _analyse(text)
if analysis.kind == "bare":
return action_not_started_phrase(language)
@@ -308,5 +372,7 @@ def replace_unbacked_action_claim(
__all__ = [
"action_not_started_phrase",
"has_deferred_action_claim",
+ "has_false_completion_claim",
+ "has_unbacked_action_claim",
"replace_unbacked_action_claim",
]
diff --git a/jarvis/brain/manager.py b/jarvis/brain/manager.py
index 29863d3b35..ef0d189676 100644
--- a/jarvis/brain/manager.py
+++ b/jarvis/brain/manager.py
@@ -5521,6 +5521,13 @@ class BrainManager:
vetoed_by=guards.VETO_BLOCK_TIER, skill=skill,
)
return None
+ # Two music connectors, one domain: rematch BEFORE the
+ # disconnected veto. Live 2026-08-19 17:13: plugin-spotify won
+ # the trigger, the veto aborted capture, and the connected
+ # YouTube Music sibling never ran — the live model then
+ # announced a playlist with function_calls=0. A named service
+ # still wins; veto only if the winner is still disconnected.
+ skill = self._prefer_music_service(skill, user_text, ctx.registry)
if self._paired_plugin_disconnected(skill):
# Two connectors can serve one domain (Spotify and YouTube
# Music both answer "spiel Musik"). A paired skill whose plugin
@@ -5537,10 +5544,6 @@ class BrainManager:
vetoed_by=guards.VETO_PLUGIN_NOT_CONNECTED, skill=skill,
)
return None
- # Two music connectors, one domain: the request goes to the service
- # the user named, else the preferred one, else the only connected
- # one — never to whichever music skill happened to be first.
- skill = self._prefer_music_service(skill, user_text, ctx.registry)
self._skill_match_band = decision.band
self._skill_match_class = classify(skill)
diff --git a/jarvis/realtime/session.py b/jarvis/realtime/session.py
index 2dbdcd5d9c..72229ee233 100644
--- a/jarvis/realtime/session.py
+++ b/jarvis/realtime/session.py
@@ -9801,56 +9801,57 @@ class RealtimeVoiceSession:
)
self._native_tools_in_flight += 1
try:
- execute = self._tool_bridge.execute
- execute_kwargs: dict[str, Any] = {
- "wire_name": wire_name,
- "arguments": arguments,
- }
try:
- parameters = inspect.signature(execute).parameters.values()
- except (TypeError, ValueError):
- parameters = ()
- if any(
- parameter.name == "trace_id"
- or parameter.kind is inspect.Parameter.VAR_KEYWORD
- for parameter in parameters
+ execute = self._tool_bridge.execute
+ execute_kwargs: dict[str, Any] = {
+ "wire_name": wire_name,
+ "arguments": arguments,
+ }
+ try:
+ parameters = inspect.signature(execute).parameters.values()
+ except (TypeError, ValueError):
+ parameters = ()
+ if any(
+ parameter.name == "trace_id"
+ or parameter.kind is inspect.Parameter.VAR_KEYWORD
+ for parameter in parameters
+ ):
+ execute_kwargs["trace_id"] = self._turn_trace_id
+ original_name, result = await execute(**execute_kwargs)
+ except Exception: # noqa: BLE001 -- a failed tool must not kill duplex audio
+ log.warning("realtime tool execution failed: %s", wire_name, exc_info=True)
+ await self._publish_error(
+ "RealtimeToolError",
+ f"Realtime tool execution failed: {wire_name}",
+ recoverable=True,
+ )
+ original_name = wire_name
+ result = {
+ "success": False,
+ "error": "The tool failed safely and was not completed.",
+ }
+ if result.get("success"):
+ self._executed_tool_names.add(original_name)
+ elif result.get("confirmation_required"):
+ pass # a pending confirmation is neither a failure nor a denial
+ elif "not run" in str(result.get("error", "")) or "not available" in str(
+ result.get("error", "")
):
- execute_kwargs["trace_id"] = self._turn_trace_id
- original_name, result = await execute(**execute_kwargs)
- except Exception: # noqa: BLE001 -- a failed tool must not kill duplex audio
- log.warning("realtime tool execution failed: %s", wire_name, exc_info=True)
- await self._publish_error(
- "RealtimeToolError",
- f"Realtime tool execution failed: {wire_name}",
- recoverable=True,
+ self._native_tool_denied += 1
+ else:
+ self._native_tool_failures += 1
+ self._direct_tool_results.append((original_name, dict(result)))
+ self._mark_latency_named(
+ "REALTIME_TOOL_COMPLETED",
+ detail=(
+ f"tool={original_name};success={bool(result.get('success'))};"
+ f"duration_ms={round((time.monotonic() - started_at) * 1000)}"
+ ),
)
- original_name = wire_name
- result = {
- "success": False,
- "error": "The tool failed safely and was not completed.",
- }
finally:
self._native_tools_in_flight = max(0, self._native_tools_in_flight - 1)
if not ack_task.done():
ack_task.cancel()
- if result.get("success"):
- self._executed_tool_names.add(original_name)
- elif result.get("confirmation_required"):
- pass # a pending confirmation is neither a failure nor a denial
- elif "not run" in str(result.get("error", "")) or "not available" in str(
- result.get("error", "")
- ):
- self._native_tool_denied += 1
- else:
- self._native_tool_failures += 1
- self._direct_tool_results.append((original_name, dict(result)))
- self._mark_latency_named(
- "REALTIME_TOOL_COMPLETED",
- detail=(
- f"tool={original_name};success={bool(result.get('success'))};"
- f"duration_ms={round((time.monotonic() - started_at) * 1000)}"
- ),
- )
self._drop_provider_output_until_new_response = False
await self._session.send_tool_result(call_id, wire_name, result)
diff --git a/scripts/diag_voice_sessions.py b/scripts/diag_voice_sessions.py
index d28b0e4d41..a85e87da11 100644
--- a/scripts/diag_voice_sessions.py
+++ b/scripts/diag_voice_sessions.py
@@ -46,7 +46,7 @@ from typing import Any
REPO_ROOT = Path(__file__).resolve().parents[1]
sys.path.insert(0, str(REPO_ROOT))
-from jarvis.brain.action_honesty import has_deferred_action_claim # noqa: E402
+from jarvis.brain.action_honesty import has_unbacked_action_claim # noqa: E402
from jarvis.diagnostics.realtime_forensics import ( # noqa: E402
evaluate_postmortem,
extract_postmortems,
@@ -114,7 +114,7 @@ def _check_promise_without_action(session: Session) -> None:
payload = event.get("payload") or {}
jarvis_text = str(payload.get("jarvis_text", "") or "")
tool_calls = payload.get("tool_calls") or ()
- if jarvis_text and not tool_calls and has_deferred_action_claim(jarvis_text):
+ if jarvis_text and not tool_calls and has_unbacked_action_claim(jarvis_text):
session.findings.append(
Finding(
severity="high",
diff --git a/tests/unit/brain/test_action_honesty.py b/tests/unit/brain/test_action_honesty.py
index 728979a88d..5296a855dc 100644
--- a/tests/unit/brain/test_action_honesty.py
+++ b/tests/unit/brain/test_action_honesty.py
@@ -7,6 +7,8 @@ import pytest
from jarvis.brain.action_honesty import (
action_not_started_phrase,
has_deferred_action_claim,
+ has_false_completion_claim,
+ has_unbacked_action_claim,
replace_unbacked_action_claim,
)
from jarvis.brain.manager import BrainManager
@@ -201,6 +203,66 @@ async def test_brain_manager_replaces_a_provider_promise_without_tool_evidence()
assert reply == action_not_started_phrase("en")
+ "text",
+ [
+ (
+ "Alles klar, ich spiele dir eine Playlist mit Songs " # i18n-allow
+ "aus den 2010ern." # i18n-allow: live 2026-08-19 17:13
+ ),
+ "I'm playing you a playlist of 2010s hits.",
+ "I'll play you a playlist of songs from the 2010s.",
+ "I've just sent the email.",
+ "Te pongo una playlist de los 2010.", # i18n-allow: Spanish output matcher
+ ],
+)
+def test_false_completion_claims_are_detected(text: str) -> None:
+ """Narrating the outcome is not the same as a deferred 'I'll look later'."""
+ assert has_false_completion_claim(text) is True
+ assert has_unbacked_action_claim(text) is True
+ assert replace_unbacked_action_claim(
+ text, executed_tools=(), language="en"
+ ) == action_not_started_phrase("en")
+
+
+ "text",
+ [
+ "Was genau für Musik gefällt dir denn?", # i18n-allow: live clarifying question
+ "Ich spiele gerne Tennis am Wochenende.", # i18n-allow: hobby, not an action
+ "Ich habe gestern Tennis gespielt.", # i18n-allow: hobby perfect, no beneficiary
+ "You can play the playlist from the sidebar.",
+ "Looking at the 2010s, the hits were huge.",
+ "I'll send you a list: A, B and C are ready.",
+ "Te pongo un ejemplo.", # i18n-allow: idiom, not playback
+ ],
+)
+def test_questions_and_hobby_talk_are_not_false_completions(text: str) -> None:
+ assert has_false_completion_claim(text) is False
+
+
[email protected]("language", ["de", "en", "es"])
+def test_honesty_fallback_is_not_itself_a_false_completion(language: str) -> None:
+ phrase = action_not_started_phrase(language)
+ assert has_false_completion_claim(phrase) is False
+ assert has_unbacked_action_claim(phrase) is False
+
+
+def test_german_perfect_needs_the_beneficiary() -> None:
+ opened = "Ich habe dir die Datei geöffnet." # i18n-allow: beneficiary + open
+ assert has_false_completion_claim(opened) is True
+
+
+def test_executed_tool_grounds_a_false_completion() -> None:
+ text = "I'm playing you a playlist of 2010s hits."
+ assert (
+ replace_unbacked_action_claim(
+ text, executed_tools={"youtube_music"}, language="en"
+ )
+ == text
+ )
+
+
def test_packaged_persona_forbids_narrating_a_future_action() -> None:
from jarvis.brain.persona_loader import default_persona_prompt
diff --git a/tests/unit/brain/test_paired_plugin_capture_veto.py b/tests/unit/brain/test_paired_plugin_capture_veto.py
index 8cf8741d01..956ee2f0dc 100644
--- a/tests/unit/brain/test_paired_plugin_capture_veto.py
+++ b/tests/unit/brain/test_paired_plugin_capture_veto.py
@@ -10,11 +10,16 @@ a real store read, and never on a fault.
"""
from __future__ import annotations
+from pathlib import Path
from types import SimpleNamespace
from typing import Any
from jarvis.brain.manager import BrainManager
+from jarvis.core.bus import EventBus
+from jarvis.core.config import JarvisConfig
from jarvis.skills import guards
+from jarvis.skills.registry import SkillRegistry
+from jarvis.skills.skill_context import SkillContext, set_skill_context
class _Store:
@@ -124,6 +129,67 @@ def test_only_connected_service_wins_under_auto() -> None:
assert mgr._prefer_music_service(spotify, "spiel musik", reg) is ytm
+def test_capture_rematches_before_the_disconnected_veto() -> None:
+ """Live 2026-08-19 17:13: plugin-spotify won, the veto aborted, YouTube
+ Music never captured. Rematch first, then veto the winner."""
+ spotify, ytm = _skill("spotify"), _skill("youtube_music")
+ reg = _Registry({"plugin-spotify": spotify, "plugin-youtube_music": ytm})
+ mgr = _manager_with("auto", {"youtube_music"})
+ rematched = mgr._prefer_music_service(spotify, "spiel musik", reg) # i18n-allow
+ store = _Store({"youtube_music": _tokens()})
+ assert rematched is ytm
+ assert BrainManager._paired_plugin_disconnected(rematched, store=store) is False
+ assert BrainManager._paired_plugin_disconnected(spotify, store=store) is True
+
+
+class _StubRunner:
+ def render_instructions(self, skill: Any, *, args: dict | None = None) -> str:
+ return f"# {skill.name}\nPlay."
+
+
+def _write_music_skill(root: Path, name: str, plugin_id: str, pattern: str) -> None:
+ folder = root / name
+ folder.mkdir(parents=True, exist_ok=True)
+ (folder / "SKILL.md").write_text(
+ "---\n"
+ 'schema_version: "1"\n'
+ f"name: {name}\n"
+ f"description: Play music on {plugin_id}.\n"
+ f"plugin_id: {plugin_id}\n"
+ "triggers:\n"
+ " - type: voice\n"
+ f' pattern: "{pattern}"\n'
+ " language: [de, en]\n"
+ "risk_policy:\n"
+ " default_tier: monitor\n"
+ "---\n"
+ "# Demo\nPlay the song.\n",
+ encoding="utf-8",
+ )
+
+
+def test_match_skill_for_turn_swaps_disconnected_spotify(tmp_path: Path) -> None:
+ """The live 17:13 veto-before-rematch: Spotify wins the trigger, is not
+ connected, capture must still return YouTube Music."""
+ _write_music_skill(tmp_path, "plugin-spotify", "spotify", "(musik|music)")
+ _write_music_skill(
+ tmp_path, "plugin-youtube_music", "youtube_music", "(youtube music)"
+ )
+ registry = SkillRegistry(root=tmp_path)
+ registry.reload_sync()
+ set_skill_context(SkillContext(registry=registry, runner=_StubRunner())) # type: ignore[arg-type]
+ try:
+ mgr = BrainManager(config=JarvisConfig(), bus=EventBus(), tools={})
+ mgr._plugin_disconnected = ( # type: ignore[method-assign]
+ lambda pid, store=None: pid != "youtube_music"
+ )
+ matched = mgr._match_skill_for_turn("spiel mal musik") # i18n-allow
+ assert matched is not None
+ assert matched.name == "plugin-youtube_music"
+ finally:
+ set_skill_context(None)
+
+
def test_no_swap_when_the_match_already_fits_or_the_sibling_is_missing() -> None:
spotify, ytm = _skill("spotify"), _skill("youtube_music")
reg = _Registry({"plugin-spotify": spotify, "plugin-youtube_music": ytm})
diff --git a/tests/unit/realtime/test_session.py b/tests/unit/realtime/test_session.py
index 3944446880..b20f014394 100644
--- a/tests/unit/realtime/test_session.py
+++ b/tests/unit/realtime/test_session.py
@@ -4579,6 +4579,131 @@ async def test_blocked_action_promise_still_dispatches_after_boundary_timeout(
await sess.end(reason="test")
+async def test_false_completion_without_a_tool_dispatches_the_action():
+ """Live 2026-08-19 17:13: the model announced a 2010s playlist with
+ function_calls=0. That is a finished-looking result, not a deferred
+ 'I'll look later', so the old promise guard let the turn end. Recovery
+ must still run the action."""
+ user_text = "Egal einfach irgendwas aus den 2010ern" # i18n-allow: live follow-up
+ claim = (
+ "Alles klar, ich spiele dir eine Playlist mit Songs " # i18n-allow
+ "aus den 2010ern." # i18n-allow: live 2026-08-19 17:13
+ )
+ brain = FakeBrain(replies=("Playing 2010s hits now.",))
+ provider = FakeProvider(
+ [
+ RealtimeEvent(type="input_transcript", text=user_text, is_final=True),
+ RealtimeEvent(type="output_transcript_delta", text=claim),
+ RealtimeEvent(type="turn_complete"),
+ ]
+ )
+ sess = _session(
+ provider,
+ brain=brain,
+ tool_bridge=FakeToolBridge(),
+ tool_mode="hybrid",
+ )
+
+ await sess.handle_control({"type": "audio_start", "sample_rate": 16_000})
+ async with asyncio.timeout(2):
+ while not brain.calls: # noqa: ASYNC110 - fake has no event
+ await asyncio.sleep(0.01)
+
+ assert brain.calls[0][0] == user_text
+ await sess.wait_finished()
+ await sess.end(reason="test")
+
+
+async def test_clarifying_question_is_not_an_unbacked_action():
+ """Turn 1 of the same session asked what kind of music — that is not a
+ claim that playback started, so recovery must not steal the turn."""
+ user_text = "Kannst du bitte richtig coole Musik spielen?" # i18n-allow
+ question = "Was genau für Musik gefällt dir denn?" # i18n-allow: live question
+ brain = FakeBrain(replies=("never spoken",))
+ provider = FakeProvider(
+ [
+ RealtimeEvent(type="input_transcript", text=user_text, is_final=True),
+ RealtimeEvent(type="output_transcript_delta", text=question),
+ RealtimeEvent(type="turn_complete"),
+ ]
+ )
+ sess = _session(
+ provider,
+ brain=brain,
+ tool_bridge=FakeToolBridge(),
+ tool_mode="hybrid",
+ )
+
+ await sess.handle_control({"type": "audio_start", "sample_rate": 16_000})
+ await asyncio.wait_for(sess.wait_finished(), timeout=2)
+
+ assert brain.calls == []
+ await sess.end(reason="test")
+
+
+async def test_in_flight_native_tool_cancels_empty_turn_brain_recovery(
+ monkeypatch,
+):
+ """Live 2026-08-19 17:13 turn 3: youtube_music was already running when
+ the empty-turn watchdog expired and started a second Brain dispatch.
+ An in-flight native call is evidence; do not recover over it."""
+ import jarvis.realtime.session as session_module
+
+ monkeypatch.setattr(session_module, "_DELEGATE_READBACK_WAIT_S", 0.2)
+
+ class _SlowBridge(FakeToolBridge):
+ def __init__(self):
+ super().__init__()
+ self.started = asyncio.Event()
+ self.release = asyncio.Event()
+
+ async def execute(self, *, wire_name, arguments):
+ self.calls.append((wire_name, arguments))
+ self.started.set()
+ await self.release.wait()
+ return "youtube_music", {
+ "success": True,
+ "output": "playing",
+ "error": None,
+ }
+
+ user_text = "Ja, dann spiel es auch ab." # i18n-allow: live third ask
+ brain = FakeBrain(replies=("never spoken",))
+ bridge = _SlowBridge()
+ provider = ScriptedTextTurnsProvider(
+ [
+ RealtimeEvent(type="input_transcript", text=user_text, is_final=True),
+ RealtimeEvent(type="turn_complete"),
+ ],
+ [
+ RealtimeEvent(
+ type="tool_call",
+ call_id="call-yt",
+ tool_name="youtube_music",
+ tool_args={"action": "play", "query": "2010s"},
+ ),
+ ],
+ )
+ sess = _session(
+ provider,
+ brain=brain,
+ tool_bridge=bridge,
+ tool_mode="hybrid",
+ )
+
+ await sess.handle_control({"type": "audio_start", "sample_rate": 16_000})
+ await asyncio.wait_for(bridge.started.wait(), timeout=2)
+ await asyncio.sleep(0.45)
+ assert brain.calls == [], "in-flight youtube_music must own the turn"
+ bridge.release.set()
+ await asyncio.wait_for(sess.wait_finished(), timeout=2)
+ assert bridge.calls and bridge.calls[0][0] == "youtube_music"
+ await sess.end(reason="test")
+
+
@pytest.mark.asyncio
async def test_fast_deterministic_delegate_needs_no_bridge_line(monkeypatch):
"""A result faster than the bridge delay keeps the turn chatter-free."""