Skip to content

dictation: Cap recording and finalization duration - #333846

Merged
Megan Rogge (meganrogge) merged 2 commits into
mainfrom
agents/github-app-repo-folder-exploration
Sep 1, 2026
Merged

dictation: Cap recording and finalization duration#333846
Megan Rogge (meganrogge) merged 2 commits into
mainfrom
agents/github-app-repo-folder-exploration

Conversation

@meganrogge

Copy link
Copy Markdown
Collaborator

Fixes #333832

What changed

  • automatically stop and finalize dictation after 20 minutes across the NeMo and MAI backends
  • announce the automatic stop to screen-reader users
  • bound NeMo finalization to eight seconds, then preserve the streamed transcript and cancel stalled backend work
  • add regression coverage for both limits

Alignment with GitHub app

The GitHub app uses an eight-second watchdog after the user requests a stop: if the backend never emits its final stopped event, the composer finishes with the transcript accumulated so far instead of remaining stuck in the transcribing state. VS Code already had a four-second equivalent for MAI, but NeMo had no bound. This change applies the GitHub app pattern to NeMo while retaining VS Code’s existing MAI timeout.

The 20-minute recording cap is separate from that finalization watchdog. It prevents either backend from keeping the microphone open indefinitely; once reached, VS Code follows the normal finalization path so dictated text is preserved.

Validation

  • npm run compile-client
  • npm run hygiene
  • ./scripts/test.sh --run src/vs/workbench/contrib/chat/test/browser/dictationSession.test.ts --run src/vs/workbench/contrib/chat/test/browser/chatSpeechToTextService.test.ts (27 passing)

Stop active dictation after 20 minutes and bound NeMo finalization to eight seconds, preserving the streamed transcript when finalization stalls. Fixes #333832.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings September 1, 2026 19:41

Copilot AI left a comment

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.

Copilot review overview

🟡 Changes recommended

NeMo cancellation can race a subsequent session, and the duration watchdog can be scheduled when recording never started.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review tier: Balanced
Findings: 1 High severity · 1 Medium severity

New issues introduced by this change (2)
Severity Finding
High severity src/​vs/​workbench/​contrib/​chat/​browser/​speechToText/​chatSpeechToTextService.ts — Fire-and-forgetting cancellation lets _stopAndTranscribe expose Idle and permit a new NeMo…
Medium severity src/​vs/​workbench/​contrib/​chat/​browser/​speechToText/​dictationSession.tsstart() has several normal early-return paths (disabled setting, lost entitlement, unsupported…
What changed in this PR

Adds bounded recording and finalization for dictation sessions.

Changes:

  • Stops dictation automatically after 20 minutes with an accessible announcement.
  • Adds an eight-second NeMo finalization timeout with transcript fallback.
  • Adds regression tests for both limits.
File Description
dictationSession.ts Adds the recording-duration watchdog.
chatSpeechToTextService.ts Adds bounded NeMo finalization and cancellation.
dictationSession.test.ts Tests automatic stopping.
chatSpeechToTextService.test.ts Tests finalization timeout fallback.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/vs/workbench/contrib/chat/browser/speechToText/chatSpeechToTextService.ts Outdated
Comment thread src/vs/workbench/contrib/chat/browser/speechToText/dictationSession.ts Outdated
Wait for timed-out NeMo stop and cancellation work before starting another local session, and only schedule the duration cap after recording actually starts.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@meganrogge
Megan Rogge (meganrogge) merged commit 9e62c0b into main Sep 1, 2026
40 checks passed
@meganrogge
Megan Rogge (meganrogge) deleted the agents/github-app-repo-folder-exploration branch September 1, 2026 20:31
@vs-code-engineering vs-code-engineering Bot added this to the 1.137.0 milestone Sep 1, 2026
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.

Dictation: should we consider a duration cap for the NeMo (local) model?

3 participants