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(dictation): stop the bar thinking once the dictated text has landed

Ruben Lütke37c59a6bbb11
diff --git a/tests/unit/ui/test_orb_bus_bridge_dictation.py b/tests/unit/ui/test_orb_bus_bridge_dictation.py
index e3d379f449..42ff81793b 100644
--- a/tests/unit/ui/test_orb_bus_bridge_dictation.py
+++ b/tests/unit/ui/test_orb_bus_bridge_dictation.py
@@ -267,6 +267,109 @@ async def test_a_persistent_bar_repaints_idle_instead_of_being_withdrawn() -> No
await _quiesce(bridge)
+async def test_the_thinking_core_stops_the_moment_the_text_lands() -> None:
+ """The reported bug (2026-07-29): the bar kept "thinking" for a second and a
+ half AFTER the dictated text had visibly been pasted into the field.
+
+ ``dictate_transcribing`` represents work in flight. Once the completion
+ event is here there is none — the transcription finished and the paste
+ already happened — so the working look must not survive into the dwell.
+ """
+ orb = _FakeOrb()
+ bridge = _bridge(orb, hide_on_idle=True)
+ await bridge._on_dictation_started(DictationStarted(target="insert"))
+ await bridge._on_dictation_transcribing(DictationTranscribing())
+ orb.calls.clear()
+
+ await bridge._on_dictation_completed(
+ DictationCompleted(text="hello there", outcome="inserted")
+ )
+ await asyncio.sleep(0)
+ await asyncio.sleep(0)
+
+ assert "dictate_transcribing" not in orb.modes
+ assert ("hide", None) in orb.calls, (
+ "a delivered dictation must stand the bar down at once, not after a dwell"
+ )
+ await _quiesce(bridge)
+
+
+async def test_a_delivered_dictation_raises_no_echo_bubble() -> None:
+ """The words are already in the field the user is looking at. A bubble put
+ up for one frame and cleared by the immediate stand-down is a flicker."""
+ orb = _FakeOrb()
+ bridge = _bridge(orb)
+ await bridge._on_dictation_started(DictationStarted(target="insert"))
+ await bridge._on_dictation_transcribing(DictationTranscribing())
+ orb.calls.clear()
+
+ await bridge._on_dictation_completed(
+ DictationCompleted(text="hello there", outcome="inserted")
+ )
+
+ assert ("transcript", "hello there") not in orb.calls
+ await _quiesce(bridge)
+
+
+async def test_a_cancelled_dictation_also_leaves_the_working_look_at_once() -> None:
+ orb = _FakeOrb()
+ bridge = _bridge(orb, hide_on_idle=True)
+ await bridge._on_dictation_started(DictationStarted(target="insert"))
+ await bridge._on_dictation_transcribing(DictationTranscribing())
+ orb.calls.clear()
+
+ await bridge._on_dictation_completed(DictationCompleted(outcome="cancelled"))
+ await asyncio.sleep(0)
+ await asyncio.sleep(0)
+
+ assert ("hide", None) in orb.calls
+ await _quiesce(bridge)
+
+
+async def test_an_outcome_that_needs_acting_on_stays_up_but_stops_working() -> None:
+ """The OS blocked the paste and the text is on the clipboard. That sentence
+ must stay long enough to read — and must read as a MESSAGE, not as a
+ transcription still running."""
+ orb = _FakeOrb()
+ bridge = _bridge(orb)
+ await bridge._on_dictation_started(DictationStarted(target="insert"))
+ await bridge._on_dictation_transcribing(DictationTranscribing())
+ orb.calls.clear()
+
+ await bridge._on_dictation_completed(
+ DictationCompleted(
+ text="hello there",
+ outcome="clipboard_only",
+ detail="The window in front is running as administrator.",
+ )
+ )
+ await asyncio.sleep(0)
+
+ assert orb.modes == ["notice"]
+ assert ("hide", None) not in orb.calls
+ assert ("transcript", "The window in front is running as administrator.") in orb.calls
+ await _quiesce(bridge)
+
+
+async def test_nothing_coming_back_is_still_visible_for_a_beat() -> None:
+ """A dictation that produced no text must not vanish in silence — that is
+ indistinguishable from a dead shortcut."""
+ orb = _FakeOrb()
+ bridge = _bridge(orb)
+ await bridge._on_dictation_started(DictationStarted(target="insert"))
+ await bridge._on_dictation_transcribing(DictationTranscribing())
+ orb.calls.clear()
+
+ await bridge._on_dictation_completed(
+ DictationCompleted(outcome="failed", error="AuthenticationError: 401")
+ )
+ await asyncio.sleep(0)
+
+ assert orb.modes == ["notice"]
+ assert ("hide", None) not in orb.calls
+ await _quiesce(bridge)
+
+
async def test_a_new_dictation_cancels_the_previous_stand_down() -> None:
"""Press → release → press again inside the dwell must not be closed by the
first turn's timer."""
diff --git a/ui/orb/bus_bridge.py b/ui/orb/bus_bridge.py
index 48f5838a93..328e66f045 100644
--- a/ui/orb/bus_bridge.py
+++ b/ui/orb/bus_bridge.py
@@ -105,6 +105,26 @@ DICTATION_REFUSAL_DWELL_S = 3.0
# surface says the one thing that is true without the detail.
DICTATION_REFUSAL_FALLBACK_TEXT = "Dictation could not start."
+# How long the bar stays up after a dictation that came back with NOTHING —
+# silence, or a provider that refused. Short, and deliberately not zero: the
+# recording look was on screen a moment ago, so vanishing without a beat is
+# indistinguishable from "the shortcut did nothing", which is the exact
+# failure shape the dictation lane exists to end.
+DICTATION_NOTHING_BACK_DWELL_S = 1.5
+
+# How long an outcome that needs ACTING on stays up (the OS blocked the paste
+# and the text is on the clipboard; a custom paste chord was sent to an app
+# that may not bind it). Long enough to read a full sentence.
+DICTATION_OUTCOME_DWELL_S = 4.0
+
+# Outcomes the bar has nothing to add to: the words reached the field the user
+# is already looking at (``inserted``), the app's own input (``chat``), or the
+# user called the dictation off themselves (``cancelled``). Nothing is in
+# flight and nothing needs saying, so the bar stands down AT ONCE — see
+# ``_on_dictation_completed``. Every other outcome carries either a sentence to
+# act on or the news that nothing came back, and gets a dwell.
+DICTATION_QUIET_OUTCOMES: tuple[str, ...] = ("inserted", "chat", "cancelled")
+
# Long enough to cover an entire THINKING/SPEAKING phase. The transcript
# bubble is explicitly hidden when the state leaves voice mode (→ IDLE/ERROR).
#
@@ -1107,20 +1127,40 @@ class OrbBusBridge:
self._show_dictation_mode("dictate_transcribing")
async def _on_dictation_completed(self, event: DictationCompleted) -> None:
- """Dictation finished — show the outcome briefly, then stand down.
-
- ``detail`` is only non-empty when something the user must know happened
- (the OS blocked the paste and the text is on the clipboard). Showing it
- on the bar is the difference between "nothing happened" and "here is
- why, and here is what to do".
+ """Dictation finished — leave the working look AT ONCE, then stand down.
+
+ The thinking core represents work in flight. By the time this event
+ arrives there is none: the transcription is done and the text has
+ already been pasted into the user's field. Leaving
+ ``dictate_transcribing`` up for the dwell is what made the bar keep
+ "thinking" for one and a half seconds AFTER the words had visibly
+ landed — a claim about the app's state that the screen already
+ contradicted (reported 2026-07-29). So the mode is resolved here, by
+ the outcome, and never left over from the previous phase:
+
+ * The words arrived (``inserted`` / ``chat``) or the user cancelled →
+ nothing is left to say and the text speaks for itself, so the bar
+ goes down immediately.
+ * ``detail`` is set → something needs ACTING on (the OS blocked the
+ paste; a custom chord was sent to an app that may ignore it). The
+ notice look says "here is what happened" instead of "still working",
+ and it stays up long enough to read.
+ * Nothing came back at all (``empty`` / ``failed``) → the same notice
+ look, briefly. A dictation that vanishes in silence is
+ indistinguishable from a dead shortcut.
"""
if not getattr(self, "_dictation_active", False):
return
self._dictation_active = False
self._dictation_transcribing = False
self._cancel_dictation_failsafe()
- message = (event.detail or "").strip() or (event.text or "").strip()
- self._show_listening_transcript(message)
+ detail = (event.detail or "").strip()
+ outcome = (event.outcome or "").strip()
+ delivered = not detail and outcome in DICTATION_QUIET_OUTCOMES
+ # A delivered dictation gets NO echo bubble: the words are already in
+ # the field the user is looking at, and a bubble raised for one frame
+ # before the stand-down clears it is a flicker, not a receipt.
+ self._show_listening_transcript("" if delivered else (detail or (event.text or "").strip()))
# Whatever raised the bar must be able to lower it. This guard is
# deliberately the SAME one ``_on_dictation_started`` uses — an
# asymmetric pair (raise on any state, lower only from IDLE) would leave
@@ -1128,10 +1168,13 @@ class OrbBusBridge:
# possibility because dictation never touches the voice state machine.
if self._voice_session_active:
return
- # Give the user a moment to read it, then return the bar to standby.
- # A longer dwell for a message that needs acting on than for the plain
- # "here is what you dictated" echo.
- delay = 4.0 if (event.detail or "").strip() else 1.5
+ if delivered:
+ delay = 0.0
+ else:
+ self._show_notice_mode()
+ delay = (
+ DICTATION_OUTCOME_DWELL_S if detail else DICTATION_NOTHING_BACK_DWELL_S
+ )
try:
self._schedule_dictation_standdown(delay)
except Exception as exc: # noqa: BLE001