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): keep the Jarvis Bar thinking while a tool still runs

Harald2f3be46c7f8e
diff --git a/CHANGELOG.md b/CHANGELOG.md
index ddafd1cc6f..c13bdbc46d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -20,6 +20,10 @@ 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).
+- **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
+ the result is spoken.
## [1.4.0] — 2026-08-18
diff --git a/jarvis/realtime/session.py b/jarvis/realtime/session.py
index b1472311f5..2dbdcd5d9c 100644
--- a/jarvis/realtime/session.py
+++ b/jarvis/realtime/session.py
@@ -30,7 +30,7 @@ from uuid import uuid4
from jarvis.brain import turn_planner as _planner_vocab
from jarvis.brain.action_honesty import (
action_not_started_phrase,
- has_deferred_action_claim,
+ has_unbacked_action_claim,
)
from jarvis.brain.cu_gate import (
CU_VEHICLE_TOOL_NAMES,
@@ -2160,6 +2160,7 @@ class RealtimeVoiceSession:
# ADR-0035 §3/§7: native tool calls get their own ack watchdog and
# counters; the turn id keeps the ack to one line per turn.
self._native_tool_calls = 0
+ self._native_tools_in_flight = 0
self._native_tool_failures = 0
self._native_tool_denied = 0
self._delegate_cu_dispatches = 0
@@ -4896,7 +4897,7 @@ class RealtimeVoiceSession:
f"{self._provider_output_probe}{event.text}"[-4_096:]
)
self._withheld_promise_parts.append(event.text)
- if has_deferred_action_claim(self._provider_output_probe):
+ if has_unbacked_action_claim(self._provider_output_probe):
# ARM ONLY — never cancel here. Whether a commitment was
# left without a delivered result is a judgement about a
# FINISHED response; on a streaming prefix the sentence
@@ -6167,6 +6168,19 @@ class RealtimeVoiceSession:
words = len(cleaned.split())
self._advance_echo_horizon(words * 0.4 + 1.0)
+ async def _speak_interim_and_keep_thinking(self, text: str) -> None:
+ """Speak a progress line and put the bar back on thinking.
+
+ Surfaces drain the canned line then return to THINKING so the
+ Jarvis Bar / orb keep showing work in flight until the result
+ is spoken (live 2026-08-19: native-tool ack went SPEAKING then
+ LISTENING while YouTube Music was still running).
+ """
+ await self._send_json(
+ self._surface_speech_message(text, spoken_kind=SPOKEN_KIND_PROGRESS)
+ )
+ await self._send_json({"type": "thinking"})
+
def _surface_speech_message(
self,
text: str,
@@ -6586,8 +6600,9 @@ class RealtimeVoiceSession:
async def _recover_unbacked_action_claim(self) -> bool:
"""Turn a provider's unsupported action promise into a real outcome.
- TERMINAL ONLY. ``has_deferred_action_claim`` asks whether a commitment
- was left without a delivered result, which a still-growing stream can
+ TERMINAL ONLY. ``has_unbacked_action_claim`` asks whether a
+ commitment or a false completion ("I'm playing you a playlist") was
+ left without a delivered result, which a still-growing stream can
never answer. Call this from a closed response (``turn_complete``) or
from the settled-silence backstop in the turn stall watchdog — never
from a transcript delta.
@@ -6595,8 +6610,9 @@ class RealtimeVoiceSession:
if (
self._external_update is not None
or self._executed_tool_names
+ or self._native_tools_in_flight
or self._delegate_delivery_started()
- or not has_deferred_action_claim(self._provider_output_probe)
+ or not has_unbacked_action_claim(self._provider_output_probe)
):
return False
@@ -7541,6 +7557,7 @@ class RealtimeVoiceSession:
or self._output_samples_sent > 0
or self._gate.pending_audio_ms > 0
or "".join(self._output_transcript).strip()
+ or self._native_tools_in_flight
or turn_id in self._delegate_turns
or self._has_pending_delegate_from_earlier_turn()
):
@@ -7773,6 +7790,9 @@ class RealtimeVoiceSession:
self._output_active
or self._output_samples_sent > 0
or "".join(self._output_transcript).strip()
+ or self._native_tools_in_flight
+ or self._direct_tool_results
+ or self._executed_tool_names
):
self._clear_deferred_interruption()
return
@@ -7781,7 +7801,13 @@ class RealtimeVoiceSession:
await asyncio.sleep(_DELEGATE_READBACK_POLL_S)
except asyncio.CancelledError:
raise
- if turn_id in self._delegate_turns or self._turn_id != turn_id:
+ if (
+ turn_id in self._delegate_turns
+ or self._turn_id != turn_id
+ or self._native_tools_in_flight
+ or self._direct_tool_results
+ or self._executed_tool_names
+ ):
return
log.warning(
"realtime[%s] the re-asked provider rendered nothing within %.1fs "
@@ -9421,7 +9447,7 @@ class RealtimeVoiceSession:
"running — answering with the deterministic progress line",
self.session_id,
)
- await self._send_json(self._surface_speech_message(status_text))
+ await self._speak_interim_and_keep_thinking(status_text)
def _grounded_pending_status_text(self) -> str:
"""One progress line for a running order: grounded when a tool is known.
@@ -9773,6 +9799,7 @@ class RealtimeVoiceSession:
),
name=f"rt-native-tool-ack-{self.session_id}",
)
+ self._native_tools_in_flight += 1
try:
execute = self._tool_bridge.execute
execute_kwargs: dict[str, Any] = {
@@ -9803,6 +9830,7 @@ class RealtimeVoiceSession:
"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"):
@@ -9882,9 +9910,7 @@ class RealtimeVoiceSession:
detail=f"kind=native_tool;tool={wire_name}",
)
try:
- await self._send_json(
- self._surface_speech_message(line, spoken_kind=SPOKEN_KIND_PROGRESS)
- )
+ await self._speak_interim_and_keep_thinking(line)
except Exception: # noqa: BLE001 — a failed ack must not hurt the call
log.debug("realtime[%s] native-tool ack send failed", self.session_id, exc_info=True)
diff --git a/jarvis/speech/pipeline.py b/jarvis/speech/pipeline.py
index 1274ac57e1..2f5c4a80aa 100644
--- a/jarvis/speech/pipeline.py
+++ b/jarvis/speech/pipeline.py
@@ -9072,7 +9072,25 @@ class SpeechPipeline:
_close_output_segment(
preserve_echo_tail=speaking,
)
- await self._set_turn_state(TurnTakingState.LISTENING)
+ # A progress/preamble line is not the end of the
+ # turn. Returning to LISTENING here made the
+ # Jarvis Bar look ready while the Tool Model was
+ # still running (live 2026-08-19: "I'll play
+ # that" → still bars → music starts seconds
+ # later). The thinking look stays until the
+ # result is spoken.
+ spoken_kind = str(
+ message.get("spoken_kind", "") or ""
+ )
+ await self._set_turn_state(
+ TurnTakingState.PROCESSING
+ if spoken_kind
+ in (
+ SPOKEN_KIND_PROGRESS,
+ SPOKEN_KIND_PREAMBLE,
+ )
+ else TurnTakingState.LISTENING
+ )
elif kind == "provider_error":
log.warning("Realtime desktop status: %s", message)
elif kind == "provider_fallback":
diff --git a/jarvis/ui/web/frontend/src/components/voice/BrowserRealtimeControl.test.tsx b/jarvis/ui/web/frontend/src/components/voice/BrowserRealtimeControl.test.tsx
index 4a7a7b3e4f..cf80a27b1a 100644
--- a/jarvis/ui/web/frontend/src/components/voice/BrowserRealtimeControl.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/voice/BrowserRealtimeControl.test.tsx
@@ -138,6 +138,24 @@ describe("BrowserRealtimeControl", () => {
expect(useEventStore.getState().voiceState).toBe("thinking");
});
+ it("keeps thinking after a progress surface line finishes speaking", async () => {
+ render(<BrowserRealtimeControl />);
+ fireEvent.click(screen.getByRole("button", { name: "sidebar.realtime_start" }));
+ await waitFor(() => expect(fakes.connect).toHaveBeenCalledTimes(1));
+
+ act(() =>
+ fakes.callbacks?.onStatus?.("error_spoken", {
+ text: "I'll play that.",
+ spoken_kind: "progress",
+ }),
+ );
+ act(() => fakes.callbacks?.onStatus?.("tts_end", {}));
+ expect(useEventStore.getState().voiceState).toBe("thinking");
+
+ act(() => fakes.callbacks?.onStatus?.("turn_complete", {}));
+ expect(useEventStore.getState().voiceState).toBe("listening");
+ });
+
it("requires a configured Realtime provider before opening the microphone", () => {
fakes.available = false;
render(<BrowserRealtimeControl />);
diff --git a/jarvis/ui/web/frontend/src/components/voice/BrowserRealtimeControl.tsx b/jarvis/ui/web/frontend/src/components/voice/BrowserRealtimeControl.tsx
index fff4f7433d..c0a5b7d73a 100644
--- a/jarvis/ui/web/frontend/src/components/voice/BrowserRealtimeControl.tsx
+++ b/jarvis/ui/web/frontend/src/components/voice/BrowserRealtimeControl.tsx
@@ -99,6 +99,11 @@ export function BrowserRealtimeControl() {
const levelRef = useRef(0);
const clientRef = useRef<RealtimeAudioClient | null>(null);
const connectionGenerationRef = useRef(0);
+ // A progress/preamble surface line is not the end of the turn. After the
+ // browser finishes speaking it, tts_end must restore thinking — not
+ // listening — or the pill looks ready while the Tool Model is still
+ // working.
+ const resumeThinkingAfterSpeechRef = useRef(false);
const browserSurface = Boolean(
capabilities.data &&
(capabilities.data.native_file_actions === false || !hasEmbeddedDesktopBridge()),
@@ -217,6 +222,10 @@ export function BrowserRealtimeControl() {
const text = typeof payload.text === "string" ? payload.text : "";
if (text.trim()) setSpokenText(text.trim());
setError("");
+ const kind =
+ typeof payload.spoken_kind === "string" ? payload.spoken_kind : "";
+ resumeThinkingAfterSpeechRef.current =
+ kind === "progress" || kind === "preamble";
} else if (status === "hangup") {
// The session ended through a voice hang-up command or end_call.
// Release the microphone and return to idle.
@@ -224,7 +233,16 @@ export function BrowserRealtimeControl() {
} else if (status === "thinking") {
setVoice("thinking");
} else if (status === "turn_complete" || status === "tts_end") {
- setVoice("listening");
+ if (
+ status === "tts_end" &&
+ resumeThinkingAfterSpeechRef.current
+ ) {
+ resumeThinkingAfterSpeechRef.current = false;
+ setVoice("thinking");
+ } else {
+ resumeThinkingAfterSpeechRef.current = false;
+ setVoice("listening");
+ }
} else if (status === "tts_cancel") {
setVoice("listening");
} else if (
diff --git a/tests/unit/speech/test_realtime_mode.py b/tests/unit/speech/test_realtime_mode.py
index f5cef95a95..49c91090c3 100644
--- a/tests/unit/speech/test_realtime_mode.py
+++ b/tests/unit/speech/test_realtime_mode.py
@@ -301,6 +301,84 @@ async def test_interim_audio_returns_to_thinking_before_final_answer(
]
+async def test_surface_progress_ack_returns_to_thinking_while_the_tool_runs(
+ monkeypatch: pytest.MonkeyPatch,
+) -> None:
+ """Native-tool instant ack must not leave the Jarvis Bar looking ready.
+
+ Live 2026-08-19: "I'll play that" spoke through surface TTS, then
+ SPEAKING → LISTENING while YouTube Music was still running. Progress
+ speech is not the end of the turn.
+ """
+ pipe = _pipe()
+ ack_pcm = b"\x0a\x00" * 16
+ result_pcm = b"\x0b\x00" * 16
+ surface_tts = _FakeTTS(ack_pcm)
+ monkeypatch.setattr(
+ "jarvis.plugins.tts.build_realtime_surface_tts",
+ lambda _cfg, _provider: surface_tts,
+ )
+
+ class _ProgressAckSession(_FakeRealtimeSession):
+ async def handle_control(self, message) -> None:
+ self.controls.append(message)
+ await self._send_json(
+ {
+ "type": "audio_ready",
+ "provider": "fake-live",
+ "input_sample_rate": 16_000,
+ "output_sample_rate": 24_000,
+ }
+ )
+ await self._send_json(
+ {
+ "type": "transcript",
+ "role": "user",
+ "text": "play a nice song",
+ "is_final": True,
+ }
+ )
+ await self._send_json(
+ {
+ "type": "error_spoken",
+ "text": "I'll play that.",
+ "language": "en",
+ "spoken_kind": "progress",
+ }
+ )
+ await self._send_binary(result_pcm)
+ await self._send_json({"type": "turn_complete"})
+
+ def _build(**kwargs):
+ return _ProgressAckSession(kwargs["send_binary"], kwargs["send_json"])
+
+ monkeypatch.setattr("jarvis.realtime.factory.build_realtime_session", _build)
+ monkeypatch.setattr(
+ pipeline_mod,
+ "MicrophoneCapture",
+ lambda **_kwargs: _SilentMic(),
+ )
+
+ reason = await asyncio.wait_for(pipe._active_realtime_session(), timeout=2.0)
+
+ assert reason == HANGUP_TURN_COMPLETE
+ assert ack_pcm in pipe._player.pcm
+ assert result_pcm in pipe._player.pcm
+ state_changes = [
+ state
+ for index, state in enumerate(pipe._test_states)
+ if index == 0 or state != pipe._test_states[index - 1]
+ ]
+ assert state_changes == [
+ pipeline_mod.TurnTakingState.PROCESSING,
+ pipeline_mod.TurnTakingState.JARVIS_SPEAKING,
+ pipeline_mod.TurnTakingState.PROCESSING,
+ pipeline_mod.TurnTakingState.JARVIS_SPEAKING,
+ pipeline_mod.TurnTakingState.LISTENING,
+ ]
+
+
@pytest.mark.asyncio
async def test_unsafe_output_cancel_stops_playback_and_returns_to_listening(
monkeypatch: pytest.MonkeyPatch,