Skip to content

fix: recover voice input after empty recognition result - #225

Merged
yuga-hashimoto merged 1 commit into
mainfrom
fix/wakeword-voice-session
Aug 8, 2026
Merged

fix: recover voice input after empty recognition result#225
yuga-hashimoto merged 1 commit into
mainfrom
fix/wakeword-voice-session

Conversation

@yuga-hashimoto

Copy link
Copy Markdown
Owner

Summary\n- remove the invalid language string passed to the boolean-only recognition option\n- submit a partial transcript when the recognizer returns an empty final bundle\n- retry transient empty voice segments instead of immediately showing an error\n\n## Verification\n- spotlessCheck passes\n- app unit test task is blocked in this environment because AAPT2 cannot start on aarch64

@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

🔍 OpenCodeReview found 2 issue(s) in this PR.

  • ✅ Successfully posted inline: 2 comment(s)

var silentSegments = 0
while (isActive) {
var outcome = VoiceDictationOutcome.REPORT
speech.startListening(language = speechLanguageTag(context)).collect { result ->

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[bug · medium]
新しく導入された while (isActive) ループ内で speech.startListening(...).collect に例外処理がありません。SpeechRecognizerManager.startListeningnewRecognizer.startListening(intent) のみ try/catch しており、SpeechRecognizer.createSpeechRecognizer の失敗やコールバック内の想定外例外がフローから送出されると、collect を抜けてそのまま scope.launch のコルーチンが異常終了します。scopeCoroutineScope(SupervisorJob() + Dispatchers.Main.immediate)CoroutineExceptionHandler を持たないため、未捕捉例外はアプリをクラッシュさせ、assistantState が LISTENING/THINKING のまま残るなどセッション状態が不正になります。ループ内で try/catch(または flow.catch)により showError を呼んでループを break するようにしてください。

when (outcome) {
VoiceDictationOutcome.RESTART -> silentSegments++
VoiceDictationOutcome.FINISH -> submitRecognizedText(partial)
VoiceDictationOutcome.REPORT -> showError(result.message)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[other · low]
REPORT 分岐では showError のみを呼び、直前の partialText.value がクリアされません。同じ書き換えの中で RESTART 分岐では明示的に partialText.value = "" としているため、エラー表示時も同様にクリアし、UI に古い部分認識テキストが残るのを防ぐとよいです。

Suggestion:

Suggested change
VoiceDictationOutcome.REPORT -> showError(result.message)
VoiceDictationOutcome.REPORT -> {
partialText.value = ""
showError(result.message)
}

@yuga-hashimoto
yuga-hashimoto merged commit a88218d into main Aug 8, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant