feat(vscode): prewarm microphone capture before showing voice input as recording - #12001
Merged
Conversation
Contributor
Code Review SummaryStatus: 3 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
SUGGESTION
The latest commit ( Files Reviewed (32 files)
Fix these issues in Kilo Cloud Reviewed by claude-sonnet-5 · Input: 28 · Output: 13.9K · Cached: 817.6K Review guidance: REVIEW.md from base branch |
chrarnoldus
approved these changes
Jul 7, 2026
This was referenced Jul 7, 2026
t7tran
pushed a commit
to t7tran/kilocode
that referenced
this pull request
Aug 14, 2026
feat(vscode): prewarm microphone capture before showing voice input as recording
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When the microphone button is clicked, voice input immediately appears as "recording" even though FFmpeg and the OS may still be opening the capture device. Speech during that opening gap is lost, which is most noticeable on the first recording after startup. The loading indicator also flips to the recording state before capture is actually ready, so users begin speaking too early.
What changed
Introduces an explicit
startingstate between click and confirmed capture readiness, and prewarms FFmpeg binary discovery so the first recording does not pay the discovery cost at click time.Capture-readiness state machine (
useSpeechToText.ts,SpeechToTextButton.tsx):idle -> starting -> recordinginstead of jumping straight torecording. It only entersrecordingwhen the extension confirms capture is ready via the existingspeechToTextStartedmessage.starting, the button shows the spinner, is non-interactive (clicks are ignored), and exposesaria-busy/aria-disabledso assistive tech announces it as in progress. Tooltips distinguish "Starting microphone..." from "Recording. Click to stop."speechToTextStartedmessages for a request that is no longer instartingare dropped, preventing an orphaned ready event from falsely marking the button as recording.onCleanup) so a webview re-mount during a recording does not leave a dangling capture.FFmpeg prewarm (
capture.ts,input-tools.ts,SpeechToTextPrewarm.tsx):speechToTextPrewarmwebview message triggersresolveFFmpeg(), which discovers the FFmpeg binary and caches the resolved path. This resolves the binary only, without opening the microphone or prompting for permission, so signed-out users and users with Kilo speech disabled never run it.startSpeechCapturereuses the cached binary viaresolveFFmpeg(), falling back to a fresh discovery if the cached path no longer exists. The cached promise is cleared on failure so a failed prewarm remains retryable when recording actually starts.SpeechToTextPrewarmcomponent is mounted in the sidebar, Agent Manager, and diff viewer webview roots; it fires the prewarm once speech-to-text is available and the user is authenticated.Related
Addresses the same capture-readiness gap as #11738 (
fix/speech-capture-readiness), which introduces a starting state and prewarms FFmpeg binary discovery. This is an alternate implementation of the same behavior for comparison.