Skip to content

Voice-to-text dictation app with local (Nvidia Parakeet/Whisper) and cloud models (BYOK). Privacy-first and available cross-platform.

fix(dictation): prioritize voice agent over translation in route kind resolution (#2309)

Henry Su386333f19ea6
diff --git a/src/helpers/audioManager.js b/src/helpers/audioManager.js
index 68e8a2d89..eff2b99ad 100644
--- a/src/helpers/audioManager.js
+++ b/src/helpers/audioManager.js
@@ -237,7 +237,7 @@ function resolveReasoningRoute(
const kind = resolveDictationRouteKind({
cleanupReachable,
agentReachable: agent.reachable,
- // A translation recording never routes to the agent, so skip the scan.
+ // A translation recording ignores the wake word, so skip the scan.
agentInvoked:
!translationRequested &&
!!agentName &&
diff --git a/src/helpers/dictationRouting.js b/src/helpers/dictationRouting.js
index 836f0103d..35f2c9659 100644
--- a/src/helpers/dictationRouting.js
+++ b/src/helpers/dictationRouting.js
@@ -161,15 +161,6 @@ export function resolveWakeWordLanguage(
return typeof uiLanguage === "string" ? uiLanguage : undefined;
}
-// Decides which reasoning path ("translation" | "agent" | "cleanup" | "skip")
-// a finished dictation takes. A recording started via the voice assistant
-// hotkey always takes the agent path — no wake word needed. Standalone
-// commands stream into the assistant panel (which resolves the Voice Assistant
-// scope itself and reports configuration problems in-conversation), so the dictation
-// agent's reachability only gates selection edits — that check happens at the
-// selection disposition, not here. A translation recording degrades to
-// cleanup instead: the transcript is still a useful dictation without the
-// translation step.
// The renderer-side source of truth for what the main process gates the Agent
// companion pill on. Assistant wins over translation: a voice-agent request is
// explicit user intent even if a stale translation flag survived.
@@ -179,6 +170,16 @@ export function resolveLifecycleInputKind({ voiceAgentRequested, translationRequ
return "dictation";
}
+// Decides which reasoning path ("translation" | "agent" | "cleanup" | "skip")
+// a finished dictation takes. A recording started via the voice assistant
+// hotkey always takes the agent path — no wake word needed, and it wins over
+// translation, as in resolveLifecycleInputKind. Standalone commands stream into
+// the assistant panel (which resolves the Voice Assistant scope itself and
+// reports configuration problems in-conversation), so the dictation
+// agent's reachability only gates selection edits — that check happens at the
+// selection disposition, not here. A translation recording degrades to
+// cleanup instead: the transcript is still a useful dictation without the
+// translation step.
export function resolveDictationRouteKind({
cleanupReachable,
agentReachable,
@@ -187,13 +188,13 @@ export function resolveDictationRouteKind({
translationRequested,
translationReachable,
}) {
+ if (voiceAgentRequested) {
+ return "agent";
+ }
if (translationRequested) {
if (translationReachable) return "translation";
return cleanupReachable ? "cleanup" : "skip";
}
- if (voiceAgentRequested) {
- return "agent";
- }
if (agentReachable && agentInvoked) {
return "agent";
}
diff --git a/test/helpers/dictationRouting.test.js b/test/helpers/dictationRouting.test.js
index 13c88c66c..7af0b40c8 100644
--- a/test/helpers/dictationRouting.test.js
+++ b/test/helpers/dictationRouting.test.js
@@ -48,6 +48,22 @@ test("voice agent hotkey ignores the wake word state", async () => {
);
});
+test("voice agent hotkey wins over translation when both flags are present", async () => {
+ const { resolveDictationRouteKind } = await load();
+
+ assert.equal(
+ resolveDictationRouteKind({
+ cleanupReachable: true,
+ agentReachable: false,
+ agentInvoked: false,
+ voiceAgentRequested: true,
+ translationRequested: true,
+ translationReachable: false,
+ }),
+ "agent"
+ );
+});
+
test("normal dictation with wake word routes to the agent", async () => {
const { resolveDictationRouteKind } = await load();