openhuman icon indicating copy to clipboard operation
openhuman copied to clipboard

Let Privacy Mode keep voice on-device when the STT provider is a local endpoint

Open ousher opened this issue 2 months ago • 5 comments

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.md tells users to "leave voice off" if transcription egress matters. For the users who choose local_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_providers entry takes an arbitrary endpoint with stt_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:

  1. 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.
  2. 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.
  3. Update privacy-mode.md: voice is covered when STT is local; with a hosted STT engine, voice fails closed under local_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 on 127.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.md no 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

ousher avatar Oct 01 '26 07:10 ousher

Allow voice transcription under local_only when STT provider is a local endpoint

Labelled priority: p3.

tinysweeper avatar Oct 01 '26 07:10 tinysweeper

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.

obchain avatar Oct 01 '26 11:10 obchain

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.

senamakel avatar Oct 09 '26 17:10 senamakel

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.

obchain avatar Oct 20 '26 11:10 obchain

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.

M3gA-Mind avatar Nov 16 '26 16:11 M3gA-Mind

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.

obchain avatar Nov 19 '26 07:11 obchain