Let Privacy Mode keep voice on-device when the STT provider is a local endpoint
Summary
Under local_only, voice is the one documented exception: "there is no local speech-to-text engine, so transcription still leaves the device." Since #5454 that is a deliberate choice, and this issue does not ask to bring whisper.cpp back into the build. The point is that a user-run local transcription server already looks like any other voice provider (an OpenAI-style /audio/transcriptions endpoint), so local_only could cover voice too when the configured STT endpoint is on the device. No new native dependency is needed.
Problem
privacy-mode.mdtells users to "leave voice off" if transcription egress matters. For the users who chooselocal_only, that means voice is effectively unavailable, and dictation is usually the most sensitive input they have (names, health details, client matters).- From reading the code, a
voice_providersentry takes an arbitraryendpointwithstt_api_style = OpenaiAudio, so a user can probably already point STT at a local faster-whisper or whisper.cpp server. But Privacy Mode does not know about it: voice stays exempt as a whole, so there is no guarantee and no failure if the endpoint is actually remote. util::url::host_is_local(used elsewhere) also counts RFC 1918 private ranges as local. That is reasonable for "my Ollama box on the LAN", but for a privacy guarantee "on this device" and "on my network" are different claims, and the docs should state which one Privacy Mode makes.
Solution (optional)
Core only, small:
- In
local_only, resolve the effective STT provider. If its endpoint passes a loopback check, allow it. Otherwise refuse at construction time, the same way external chat providers are refused, instead of exempting voice. - Decide and document whether private LAN addresses count. Our suggestion: loopback only by default, with LAN as an explicit opt-in, because "nothing leaves the device" is the wording users read.
- Update
privacy-mode.md: voice is covered when STT is local; with a hosted STT engine, voice fails closed underlocal_only.
A related, optional improvement: ExternalSttProvider sends language but not the OpenAI-style prompt field. Passing a short user vocabulary there is the cheapest accuracy fix for names and product terms, especially for non-English speakers. An MIT write-up of that approach (a vocabulary prompt before decoding plus a whole-word correction map after it): https://github.com/ousher/whisper-glossary. This is a reference, not a proposed dependency.
Acceptance criteria
- [ ] Local STT is allowed under
local_only. With an STT provider on127.0.0.1/::1/localhost, voice works. - [ ] Remote STT fails closed under
local_only. With the hosted engine or a remote endpoint configured, voice is refused with a clear message, and nothing falls back to the cloud. - [ ] The LAN question is decided and documented. Private ranges are either refused, or allowed behind an explicit setting.
- [ ] Docs are updated.
privacy-mode.mdno longer says voice is always exempt. - [ ] Diff coverage ≥ 80%.
Related
- #5454: removal of the bundled whisper.cpp STT
- #5462, #5464: follow-ups to that removal
gitbooks/features/privacy-mode.md
Allow voice transcription under local_only when STT provider is a local endpoint
Labelled priority: p3.
Picking this one up, with loopback-only as the default you suggested. If the transcription endpoint is on the machine itself, voice will work under local-only; the hosted engine and anything off the box, a server on the LAN included, gets refused up front rather than quietly sending audio away, and the docs will say exactly that instead of calling voice an exception.
Triage: needs opinion — “Let Privacy Mode keep voice on-device when the STT provider is a local endpoint” needs a maintainer decision on product scope/priority or fresh reproduction evidence before its status can be settled. Please advise whether to pursue, narrow, or close it.
On scope, what I have in mind is narrow: under local-only, speech-to-text is allowed only when its endpoint is on the machine itself (127.0.0.1, ::1, localhost). The hosted engine, a remote provider and LAN addresses are refused when the provider is built, so nothing falls back to the cloud. Core only, no new dependency, plus the privacy-mode doc update.
I have it mostly done locally. If you want this pursued I'll open a small PR; if not, I'll drop it.
We re-checked against current main: voice is still a blanket exemption from Privacy Mode, so a loopback speech-to-text server works, but a remote one isn't refused either.
@obchain, a PR would be welcome, and loopback-only looks like a sensible default. It overlaps with #6260 and its open fix #8061, which make cloud speech fail closed under local_only, so please build on that, or at least check against it, so the two agree on the error and on how the docs describe voice. A maintainer still needs to confirm the policy: loopback only, and LAN not counted as local.
Thanks, picking this back up with loopback only (127.0.0.1, ::1, localhost) and LAN not counted as local.
One thing: #8061 comes back as not found for me, so there's nothing to line up with yet. I'll keep the refusal for hosted STT under local_only as a clear fail-closed error and word the privacy-mode doc so #6260 can reuse it. If you'd rather I cover #6260 in the same PR, say so and I'll fold it in.