Skip to content

feat(voice): add a manual speech model unload action - #41501

Open
UtkarshUsername wants to merge 1 commit into
pingdotgg:mainfrom
UtkarshUsername:feat/voice-unload-local-model
Open

UtkarshUsername wants to merge 1 commit into
pingdotgg:mainfrom
UtkarshUsername:feat/voice-unload-local-model

Conversation

@UtkarshUsername

@UtkarshUsername UtkarshUsername commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Problem

After dictation, a local speech recognition model can stay resident until its idle timeout expires. Voice settings need a way to release that memory on demand.

Change

Add Unload now under Settings → Voice → Advanced. It uses the selected transcription environment's model state and shares the existing worker disposal path. The action is available when the engine has a model loaded and is idle. The model stays downloaded and selected, and the next transcription loads it again.

Scope

A focused feature from a vouched contributor. The control applies to environment-hosted local speech recognition in the shared web and desktop Voice settings.

Verification

  • vp run check:changed upstream/main --concurrency 1 passed with 86 tests and type-checking across 39 packages. The speech service and HTTP tests cover model disposal, preserving the installed selection, reloading on the next run, busy rejection, and permission enforcement.
  • The targeted React Compiler coverage test passed for VoiceSettingsPanel.tsx.
  • In the T3 Browser panel on Windows, transcribed a speech sample with Parakeet, started a live stream, and confirmed the button was disabled and the server returned speech_busy. Closed the stream, clicked Unload now, confirmed the model was still installed and selected, and transcribed the sample again successfully.
  • Repeated the unload through a second, directly paired environment using DPoP. The second environment reported its own model state and retained its model selection after the action.

Before

Voice Advanced settings before the change

After

Voice Advanced settings with an enabled Unload now button

Busy and unloaded states

Active stream

Unload disabled while the speech engine is busy

After unload

Unload disabled after the model leaves memory

Implemented with gpt-6.2-sol using the Codex harness in T3 Code.

@github-actions github-actions Bot added vouch:trusted Author is trusted by repo permissions or the VOUCHED list. size:L 100-499 changed lines (additions + deletions). labels Nov 23, 2026
@coderabbitai

coderabbitai Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The speech service now reports model load state and supports manual unloading. An authorized HTTP endpoint and client operation expose unloading to the settings panel, which displays model-memory status and an unload control.

Changes: Speech model memory

Layer / File(s) Summary
Service unload and load-state reporting
packages/contracts/src/speech.ts, apps/server/src/speech/SpeechService.ts, apps/server/src/speech/SpeechService.test.ts
The service reports busy, loaded, or unloaded status and adds an exclusive unloadModel operation. Tests cover repeated unloads, model reload, idle timeout, and active streams.
Unload API and client operation
packages/contracts/src/environmentHttp.ts, apps/server/src/speech/http.ts, packages/client-runtime/src/voice-input/environment.ts, packages/client-runtime/src/voice-input/index.ts, apps/server/src/speech/http.test.ts
The authorized POST /api/voice/models/unload endpoint calls the service operation. The client runtime exposes the request. HTTP tests cover scope enforcement and error handling.
Settings control and guidance
apps/web/src/components/settings/VoiceSettingsPanel.tsx, apps/web/src/i18n/translations/*.json, docs/user/voice-input.md
Advanced speech settings display model-memory status and offer an unload action when the model is loaded. Translations and documentation describe the status, unload action, and reload behavior.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant VoiceSettingsPanel
  participant unloadEnvironmentSpeechModel
  participant VoiceHTTP as Voice HTTP endpoint
  participant SpeechService
  VoiceSettingsPanel->>unloadEnvironmentSpeechModel: request model unload
  unloadEnvironmentSpeechModel->>VoiceHTTP: POST /api/voice/models/unload
  VoiceHTTP->>SpeechService: call unloadModel
  SpeechService->>SpeechService: dispose loaded model
Loading

Suggested reviewers: juliusmarminge, stienswout, maria-rcks

Merge Risk: Minimal · up to 93cd0

This adds an Unload now control that releases an idle speech model from memory; the model stays downloaded and selected and reloads on the next transcription. No remaining merge risk was identified.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "feat(voice): add a manual speech model unload action" matches the main change: a manual Unload now action that releases the speech model from memory. It is a conventional commit title in pl…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description check Passed The description follows the repository template and covers the problem, change, scope, and verification. The problem is that a local speech model stays in memory until its idle timeout, so users need …
Full details: Title check

Explanation

The title "feat(voice): add a manual speech model unload action" matches the main change: a manual Unload now action that releases the speech model from memory. It is a conventional commit title in plain language and names the feature and its area (voice).

Full details: Description check

Explanation

The description follows the repository template and covers the problem, change, scope, and verification. The problem is that a local speech model stays in memory until its idle timeout, so users need an on-demand release. The change adds an Unload now action under Settings → Voice → Advanced that disposes the worker through the existing path, keeps the model downloaded and selected, and reloads it on the next transcription. Scope states this is a focused feature from a vouched contributor. Verification lists the test commands and results, a manual Windows test with a live stream and busy rejection, a DPoP check on a second environment, and before/after screenshots. The Scope section does not link an issue, and the template says the project accepts bug fixes rather than features, so a maintainer may reject it on scope grounds. The template also asks for a conventional commit title, and the PR title was not provided in the context.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 1bc44f2 and 93cd044.

Files selected for processing: 20

  • apps/server/src/speech/SpeechService.test.ts
  • apps/server/src/speech/SpeechService.ts
  • apps/server/src/speech/http.test.ts
  • apps/server/src/speech/http.ts
  • apps/web/src/components/settings/VoiceSettingsPanel.tsx
  • apps/web/src/i18n/translations/de.json
  • apps/web/src/i18n/translations/en.json
  • apps/web/src/i18n/translations/es.json
  • apps/web/src/i18n/translations/fr.json
  • apps/web/src/i18n/translations/ja.json
  • apps/web/src/i18n/translations/ko.json
  • apps/web/src/i18n/translations/pt-BR.json
  • apps/web/src/i18n/translations/ru.json
  • apps/web/src/i18n/translations/sv.json
  • apps/web/src/i18n/translations/zh.json
  • docs/user/voice-input.md
  • packages/client-runtime/src/voice-input/environment.ts
  • packages/client-runtime/src/voice-input/index.ts
  • packages/contracts/src/environmentHttp.ts
  • packages/contracts/src/speech.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 changed lines (additions + deletions). vouch:trusted Author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant