Learner accounts get 403 on /api/voice/stt and /api/voice/tts (mic + read aloud)
Version: v1.7.1 (Docker image), also present on main.
What happens: A learner account (preset learner, allowed_surfaces ["chat","reading"]) sees the "Record voice" and "Play aloud" buttons in chat, but both fail: POST /api/voice/stt and POST /api/voice/tts return 403 {"detail":"This learning account cannot use the requested server surface."}. STT/TTS are configured and work for the admin.
Cause: _learning_surface_for_path in deeptutor/api/routers/auth.py has no entry for /api/voice, so it maps to "" and require_learning_surface denies it. api/routers/voice.py says that any authenticated user may call it and that it is not gated by per-user grants, so this looks unintended.
Suggested fix: map POST /api/voice/stt and POST /api/voice/tts to the chat surface (and reading for read-aloud), or hide the buttons for learners when the surface is not allowed.
Tested fix (running on my instance since 2026-11-04): wrapping _learning_surface_for_path so that only these two paths map to chat:
def wrapped(path, method="GET", *, route_path=None):
normalized = "/" + str(path or "").lstrip("/")
if str(method).upper() == "POST" and normalized in {"/api/voice/stt", "/api/voice/tts"}:
return "chat"
return original(path, method, route_path=route_path)
In-tree, it would be the same as adding ("/api/voice/stt", "chat") and ("/api/voice/tts", "chat") to the prefix table, limited to POST. After the change, the learner gets 200 with the transcription from gpt-4o-mini-transcribe and 200 audio/mpeg from TTS. Other unmapped paths, such as POST /api/settings, still return "" and are denied.
Independently reproduced on current dev (60fb3bdfd), and verified the auth change proposed in #2440 (224c7bbfa). I used the full API in a real Uvicorn process, a disposable runtime home, and actual learner accounts/password login. Only speech synthesis/transcription were replaced with deterministic stand-ins; no paid provider was called.
Both POST /api/voice/tts and POST /api/voice/stt behave as follows:
| Caller | Current dev | With #2440's auth change |
|---|---|---|
| Admin | 200 | 200 |
Learner, chat + reading |
403 | 200 |
Learner, reading only |
403 | 403 |
| Not signed in | 401 | 401 |
The provider stand-ins are never reached for denied requests. This confirms the failure is at the learning-surface guard, before provider configuration or audio processing. The six HTTP regression cases from #2440 also pass with the change; together with the existing surface-map/default-model tests, 102 passed.
So #2440 addresses the chat microphone/read-aloud failure in this report. The reading-only restriction remains intentional in that proposal; this verification does not cover microphone capture in the browser or a live speech provider.
Fixed on local dev (3a533c6c5f9aadf4ab821f679e8ed58f58b05a91). Guarded voice endpoints and negative permissions tested in the 375-pass first batch.
will be fixed in the next releases!