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(jarvisbar): show the failure mark only when the dictation really failed

Personal Jarvis Maintainer5b48ec16a4d5
diff --git a/jarvis/dictation/outcomes.py b/jarvis/dictation/outcomes.py
index 84601fd0d4..b2e6386098 100644
--- a/jarvis/dictation/outcomes.py
+++ b/jarvis/dictation/outcomes.py
@@ -87,6 +87,29 @@ DICTATION_OUTCOMES: Final[tuple[str, ...]] = (
"failed",
)
+#: Outcomes where the user's words REACHED them: the field they were looking
+#: at (``inserted``), the app's own input (``chat``), the app the paste chord
+#: went to (``paste_sent``), or the part of the recording that survived
+#: (``partial``). ``cancelled`` counts too — the user called it off themselves,
+#: and nothing failed.
+#:
+#: This is the set a surface must never put a FAILURE mark on, and the Jarvis
+#: Bar is why it exists at all: the bar carries no text (its
+#: ``show_listening_transcript`` is a documented no-op), so the red cross is
+#: not a caveat standing next to an explanation — it IS the whole message.
+#: Every outcome that carried a ``detail`` sentence used to raise that cross,
+#: which meant a dictation that pasted perfectly and only wanted to add a
+#: footnote ("the shortcut was sent", "some seconds were lost") reported itself
+#: to the user as a failure. Reported on Windows, 2026-08-09.
+#:
+#: Deliberately NOT the complement of "has something to say": ``partial`` is in
+#: here and still owes the user a sentence. The two questions are separate —
+#: *did the words arrive* decides the mark, *is there anything to add* decides
+#: how long the sentence stays up.
+DELIVERED_OUTCOMES: Final[frozenset[str]] = frozenset(
+ {"inserted", "chat", "paste_sent", "partial", "cancelled"}
+)
+
#: Outcomes where the user is missing words the recording could still give
#: back, so keeping the audio (when they allow it) is what makes a later
#: Restore possible. The plain success outcomes are excluded on purpose: audio
@@ -102,6 +125,17 @@ RECOVERABLE_OUTCOMES: Final[frozenset[str]] = frozenset(
)
+def was_delivered(outcome: str | None) -> bool:
+ """``True`` when the dictation's words reached the user.
+
+ Fail-CLOSED, the opposite of :func:`is_recoverable`: an unknown value from
+ a newer install reads as "not delivered". A surface may only ever suppress
+ its failure mark on an outcome it actually understands — the alternative is
+ a future failure outcome that ships silently.
+ """
+ return str(outcome or "") in DELIVERED_OUTCOMES
+
+
def is_recoverable(outcome: str | None) -> bool:
"""``True`` when this outcome left the user missing words the audio holds.
@@ -113,7 +147,9 @@ def is_recoverable(outcome: str | None) -> bool:
__all__ = [
+ "DELIVERED_OUTCOMES",
"DICTATION_OUTCOMES",
"RECOVERABLE_OUTCOMES",
"is_recoverable",
+ "was_delivered",
]
diff --git a/tests/unit/ui/test_orb_bus_bridge_dictation.py b/tests/unit/ui/test_orb_bus_bridge_dictation.py
index 42ff81793b..b3d1a54ce8 100644
--- a/tests/unit/ui/test_orb_bus_bridge_dictation.py
+++ b/tests/unit/ui/test_orb_bus_bridge_dictation.py
@@ -449,3 +449,146 @@ async def test_a_real_session_takes_the_bar_from_the_dictation_lane() -> None:
assert bridge._dictation_failsafe_task is None
assert "listen" in orb.modes
await _quiesce(bridge)
+
+
+# --------------------------------------------------------------------------
+# The failure mark means failure — nothing else
+#
+# The bar carries no text: ``show_listening_transcript`` is a documented no-op
+# on both bar overlays, so the red cross is not a footnote standing next to an
+# explanation, it IS the explanation. Every outcome that merely brought a
+# sentence with it used to raise that cross, which is how a Windows dictation
+# that transcribed cleanly and pasted successfully reported itself to the user
+# as a failure (2026-08-09).
+# --------------------------------------------------------------------------
+async def test_a_delivered_dictation_with_a_footnote_is_not_marked_failed() -> None:
+ """``paste_sent``: the chord went out and the app pasted. The sentence is a
+ caveat about an unknown, not a verdict about a loss."""
+ 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="paste_sent",
+ detail="The shortcut Ctrl + Shift + Insert was sent.",
+ )
+ )
+ await asyncio.sleep(0)
+
+ assert "notice" not in orb.modes
+ # The bar stops claiming work is in flight at once ...
+ assert orb.modes == ["idle"]
+ # ... and the sentence stays up for the dwell on surfaces that render it.
+ assert ("transcript", "The shortcut Ctrl + Shift + Insert was sent.") in orb.calls
+ assert ("transcript", "") not in orb.calls
+ assert ("hide", None) not in orb.calls
+ await _quiesce(bridge)
+
+
+async def test_a_partial_dictation_keeps_its_words_and_loses_the_cross() -> None:
+ """Words ARE missing and that is worth saying — but the fragment arrived,
+ and the user can see it."""
+ orb = _FakeOrb()
+ bridge = _bridge(orb)
+ await bridge._on_dictation_started(DictationStarted(target="insert"))
+ orb.calls.clear()
+
+ await bridge._on_dictation_completed(
+ DictationCompleted(
+ text="three words only",
+ outcome="partial",
+ detail="About 12.0s of the recording could not be transcribed.",
+ )
+ )
+ await asyncio.sleep(0)
+
+ assert "notice" not in orb.modes
+ await _quiesce(bridge)
+
+
+async def test_an_unknown_outcome_still_gets_the_cross() -> None:
+ """Fail-closed: a value this build has never heard of is not proof of
+ delivery, and a future failure outcome must never ship silently."""
+ orb = _FakeOrb()
+ bridge = _bridge(orb)
+ await bridge._on_dictation_started(DictationStarted(target="insert"))
+ orb.calls.clear()
+
+ await bridge._on_dictation_completed(
+ DictationCompleted(text="hello", outcome="teleported")
+ )
+ await asyncio.sleep(0)
+
+ assert orb.modes == ["notice"]
+ await _quiesce(bridge)
+
+
+async def test_every_outcome_the_pipeline_can_publish_is_classified() -> None:
+ """AP-4 guard: the delivered set is keyed off the ONE outcome vocabulary,
+ so a new value cannot quietly inherit either verdict."""
+ from jarvis.dictation.outcomes import DELIVERED_OUTCOMES, DICTATION_OUTCOMES
+
+ assert DELIVERED_OUTCOMES <= set(DICTATION_OUTCOMES)
+ assert set(DICTATION_OUTCOMES) - DELIVERED_OUTCOMES == {
+ "clipboard_only",
+ "unavailable",
+ "empty",
+ "failed",
+ }
+
+
+# --------------------------------------------------------------------------
+# "A dictation is already recording" is not a refusal the user must be shown
+# --------------------------------------------------------------------------
+async def test_already_running_never_marks_the_live_dictation_as_failed() -> None:
+ """The Windows polling hotkey backend re-reports a held chord, so a second
+ start edge lands next to the release. Answering it with the failure look
+ put a verdict on the turn the user was watching — and dropping the lane's
+ state swallowed that turn's completion, so the cross never came off."""
+ from jarvis.core.events import DictationRefused
+
+ 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_refused(
+ DictationRefused(reason="already_running", detail="A dictation is already recording.")
+ )
+
+ assert orb.calls == []
+ assert bridge._dictation_active is True
+
+ # The real completion still lands and still closes the bar.
+ await bridge._on_dictation_completed(
+ DictationCompleted(text="hello there", outcome="inserted")
+ )
+ await asyncio.sleep(0)
+ await asyncio.sleep(0)
+
+ assert "notice" not in orb.modes
+ assert ("hide", None) in orb.calls
+ await _quiesce(bridge)
+
+
+async def test_a_real_refusal_still_reaches_the_user() -> None:
+ from jarvis.core.events import DictationRefused
+
+ orb = _FakeOrb()
+ bridge = _bridge(orb)
+
+ await bridge._on_dictation_refused(
+ DictationRefused(
+ reason="voice_session_active",
+ detail="A voice conversation is running.",
+ )
+ )
+
+ assert orb.modes == ["notice"]
+ assert ("transcript", "A voice conversation is running.") in orb.calls
+ await _quiesce(bridge)
diff --git a/tests/unit/ui/test_orb_bus_bridge_dictation_visibility.py b/tests/unit/ui/test_orb_bus_bridge_dictation_visibility.py
index 7fe376f923..444aacdfc8 100644
--- a/tests/unit/ui/test_orb_bus_bridge_dictation_visibility.py
+++ b/tests/unit/ui/test_orb_bus_bridge_dictation_visibility.py
@@ -375,14 +375,20 @@ async def test_a_refusal_never_claims_the_microphone_is_recording() -> None:
async def test_a_refusal_clears_a_stale_dictation_lane() -> None:
- """Nothing is recording after a refusal, so no timer may outlive it."""
+ """Nothing is recording after a refusal, so no timer may outlive it.
+
+ The reason matters: this holds for every refusal that means the session
+ never opened. ``already_running`` is the one that does NOT — it is raised
+ while a dictation is happily recording — and it is pinned separately by
+ ``test_already_running_leaves_the_running_lane_alone`` below.
+ """
surface = _Surface(persistent=False)
bridge = _bridge(surface, persistent=False)
await bridge._on_dictation_started(DictationStarted(target="insert"))
assert bridge._dictation_failsafe_task is not None
await bridge._on_dictation_refused(
- DictationRefused(reason="already_running", detail="Already recording.")
+ DictationRefused(reason="no_stt", detail="No provider is configured.")
)
assert bridge._dictation_active is False
@@ -391,13 +397,37 @@ async def test_a_refusal_clears_a_stale_dictation_lane() -> None:
await _quiesce(bridge)
+async def test_already_running_leaves_the_running_lane_alone() -> None:
+ """"A dictation is already recording" is a report of SUCCESS.
+
+ Clearing the lane on it dropped the failsafe and ``_dictation_active``, so
+ the running turn's ``DictationCompleted`` was swallowed by its own guard and
+ the refusal look stayed up over a dictation that pasted perfectly — the
+ Windows report of 2026-08-09, where the polling hotkey backend re-reports a
+ held chord and one edge lands next to the release.
+ """
+ surface = _Surface(persistent=False)
+ bridge = _bridge(surface, persistent=False)
+ await bridge._on_dictation_started(DictationStarted(target="insert"))
+ failsafe = bridge._dictation_failsafe_task
+
+ await bridge._on_dictation_refused(
+ DictationRefused(reason="already_running", detail="Already recording.")
+ )
+
+ assert bridge._dictation_active is True
+ assert bridge._dictation_failsafe_task is failsafe
+ assert surface.mode == "dictate"
+ await _quiesce(bridge)
+
+
async def test_a_real_dictation_started_inside_the_dwell_keeps_the_surface() -> None:
"""Refuse, then succeed a moment later: the notice's timer must not close a
dictation that is genuinely recording."""
surface = _Surface(persistent=False)
bridge = _bridge(surface, persistent=False)
await bridge._on_dictation_refused(
- DictationRefused(reason="already_running", detail="Already recording.")
+ DictationRefused(reason="no_stt", detail="No provider is configured.")
)
await bridge._on_dictation_started(DictationStarted(target="insert"))
surface.frames.clear()
diff --git a/ui/orb/bus_bridge.py b/ui/orb/bus_bridge.py
index 328e66f045..c6059d2eb9 100644
--- a/ui/orb/bus_bridge.py
+++ b/ui/orb/bus_bridge.py
@@ -58,6 +58,7 @@ from jarvis.core.events import (
WakeCandidateDetected,
WakeWordDetected,
)
+from jarvis.dictation.outcomes import was_delivered
from ui.orb.animations import IDLE_ANIMATION_POOL
if TYPE_CHECKING:
@@ -117,13 +118,17 @@ DICTATION_NOTHING_BACK_DWELL_S = 1.5
# 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")
+# Refusal reasons the bar must NOT answer with the failure look, keyed by the
+# one thing that makes them different: nothing failed.
+#
+# ``already_running`` is the whole set today and the reason it exists. It is
+# raised when a SECOND start lands on a dictation that is happily recording —
+# on Windows the polling hotkey backend re-reports the chord, so a key edge
+# arriving next to the release produces exactly that. Answering it with the
+# red cross put a verdict on the turn the user was watching, and (because the
+# handler also drops ``_dictation_active``) swallowed that turn's completion,
+# so the cross stayed up over a dictation that pasted perfectly.
+DICTATION_INERT_REFUSALS: frozenset[str] = frozenset({"already_running"})
# Long enough to cover an entire THINKING/SPEAKING phase. The transcript
# bubble is explicitly hidden when the state leaves voice mode (→ IDLE/ERROR).
@@ -1138,16 +1143,20 @@ class OrbBusBridge:
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.
+ * The words arrived (``was_delivered``) → the bar leaves the working
+ look at once and stands down. It never raises the failure mark here,
+ not even when the outcome brought a sentence with it: this surface
+ carries no text (``show_listening_transcript`` is a no-op on both bar
+ overlays), so the red cross is not a footnote next to an explanation
+ — it IS the explanation, and "your dictation was lost" is the wrong
+ one for a paste that landed. A sentence only buys the DWELL, which is
+ what keeps it readable on the surfaces that do render it.
+ * The words did not arrive (``clipboard_only`` — the OS blocked the
+ paste — ``unavailable``, ``empty``, ``failed``, or an outcome from a
+ newer install we do not know) → the notice look, which is what that
+ mark has always meant. It stays up long enough to read a sentence
+ when there is one, and briefly when there is not: a dictation that
+ vanishes in silence is indistinguishable from a dead shortcut.
"""
if not getattr(self, "_dictation_active", False):
return
@@ -1156,11 +1165,13 @@ class OrbBusBridge:
self._cancel_dictation_failsafe()
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()))
+ arrived = was_delivered(outcome)
+ quiet = arrived and not detail
+ # A delivered dictation with nothing to add 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 quiet 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
@@ -1168,8 +1179,15 @@ class OrbBusBridge:
# possibility because dictation never touches the voice state machine.
if self._voice_session_active:
return
- if delivered:
- delay = 0.0
+ if arrived:
+ # Nothing is in flight and nothing failed, so the bar rests NOW
+ # rather than sitting in the working look for the dwell. When a
+ # sentence came with it, the stand-down is merely deferred so the
+ # surfaces that can render it keep it up long enough to read; the
+ # bar itself is already back at rest either way.
+ delay = 0.0 if quiet else DICTATION_OUTCOME_DWELL_S
+ if not quiet:
+ self._rest_surface()
else:
self._show_notice_mode()
delay = (
@@ -1200,10 +1218,29 @@ class OrbBusBridge:
raised while a conversation legitimately owns the surface, and taking
that conversation off screen to report a declined keypress would trade
one invisible state for another.
+
+ The one thing it does NOT answer is a refusal that reports success:
+ ``DICTATION_INERT_REFUSALS``. Those are dropped before anything is
+ painted or torn down — see the comment at the guard.
"""
reason = (event.reason or "").strip() or "unspecified"
detail = (event.detail or "").strip() or DICTATION_REFUSAL_FALLBACK_TEXT
log.info("OrbBridge._on_dictation_refused: reason=%s — %s", reason, detail)
+ if reason in DICTATION_INERT_REFUSALS:
+ # "A dictation is already recording" is not a failure — it is the
+ # statement that the turn the user is watching is alive and will
+ # deliver. Painting the refusal look here marks that turn as lost,
+ # and the teardown below would drop ``_dictation_active``, so the
+ # completion that follows is swallowed by its own guard and the
+ # mark never comes off. That is how a dictation which transcribed
+ # cleanly and pasted successfully ended under a red cross on
+ # Windows, where the polling hotkey backend re-reports a held chord
+ # and one edge lands next to the release.
+ log.debug(
+ "OrbBridge: refusal %r left the running dictation untouched.",
+ reason,
+ )
+ return
# Nothing is recording: a refusal means the session never opened. Drop
# the lane's latches and both of its timers so a stale one can neither
# fight this notice nor close the surface out from under it.
@@ -1215,6 +1252,21 @@ class OrbBusBridge:
self._show_listening_transcript(detail)
self._schedule_notice_standdown(DICTATION_REFUSAL_DWELL_S)
+ def _rest_surface(self) -> None:
+ """Drop the working look NOW, without closing the surface yet.
+
+ For a delivered dictation that still has a sentence to show. The
+ stand-down would do both — rest AND clear the transcript bubble — and
+ the bubble is exactly what has to survive the dwell. Hiding here is
+ wrong for the same reason: on the mascot it would strand the bubble
+ next to nothing, and the stand-down a few seconds later hides anyway.
+ Resting is the honest middle: nothing is in flight, and nothing failed.
+ """
+ try:
+ self._orb.show(mode="idle")
+ except Exception as exc: # noqa: BLE001 — a missed repaint is cosmetic
+ log.debug("OrbBridge dictation rest repaint suppressed: %s", exc)
+
def _show_notice_mode(self) -> None:
"""Drive the current surface into its brief "that did not happen" look.