fix(stt): scope upload size limits to remote providers - #65823
Conversation
tonydwb
left a comment
There was a problem hiding this comment.
Code Review Summary
Verdict: Approved
Scopes STT upload size limits to remote providers only (local file processing unaffected). Clean, well-scoped fix. No security concerns.
Reviewed by Hermes Agent
teknium1
left a comment
There was a problem hiding this comment.
Thanks for isolating a real ordering bug in transcribe_audio(): current main validates the 25 MiB limit before _get_provider() (tools/transcription_tools.py:1732-1745).
Problems
tools/voice_mode.py:891-896still chunks every oversized WAV before provider resolution.tests/tools/test_voice_mode.py:792-830verifies this path while returningprovider: "local"; the proposedtranscription_tools.pychange therefore does not give CLI local recordings the requested direct dispatch.- The new command-provider exemption classifies all
type: commandproviders as local. The documented contract supports curl-style pipelines (website/docs/user-guide/features/tts.md:542), so this also removes the cap for command providers that upload remotely.
Suggested changes
- Make voice-mode chunking provider-aware and add local-versus-remote oversized recording coverage.
- Limit the command exemption to provably local providers, or add an explicit documented configuration signal for command-provider upload behavior.
Automated hermes-sweeper review.
9c95c42 to
7932931
Compare
|
Addressed review feedback: tightened Changes:
Post-fix validation: 215 passed, 0 failed (canonical focused suite). |
7932931 to
d8e4a68
Compare
|
Addressed voice-mode chunking feedback: Changes:
Post-fix: 70 passed, 6 failed (6 pre-existing |
|
Merged into main via consolidated salvage PR #73510 (merge Your contribution is credited to you in git history. Thank you! Closing this PR as merged-via-salvage. |
What does this PR do?
Fixes a bug where
transcribe_audio()applies the 25 MiB remote upload cap to all providers, includinglocal,local_command, and user-configured command providers that never upload files. A 26 MiB WAV file processed locally by faster-whisper gets rejected before the dispatcher is even reached.The fix moves provider resolution before the size check: local/command providers skip the upload-cap enforcement, while remote built-ins, plugin providers, and unknown providers continue to enforce it.
Before (current main):
After:
Related Issue
N/A — discovered during local STT workflow investigation with large meeting recordings.
Type of Change
Changes Made
tools/transcription_tools.py: Added_is_local_stt_provider()helper and_validate_audio_file_size()extracted from the original monolithic_validate_audio_file(). Size validation now happens after provider resolution, only for non-local providers.tests/tools/test_transcription_tools.py: Added oversized file tests forlocalandlocal_commandproviders confirming they reach the dispatcher.tests/tools/test_transcription_command_providers.py: Added oversized configured command provider test.tests/tools/test_transcription_plugin_dispatch.py: Refactored 9 E2E tests to use realtmp_pathfiles instead of mocking_validate_audio_file()— the validation chain now actually runs. Added oversized plugin rejection test.How to Test
scripts/run_tests.sh tests/tools/test_transcription.py tests/tools/test_transcription_tools.py tests/tools/test_transcription_command_providers.py tests/tools/test_transcription_plugin_dispatch.py -k "not test_timeout_returns_clean_error" -q— 215 passed, 0 failed.test_timeout_returns_clean_error) is a pre-existing baseline failure caused by the shared venv lackingpsutil— triggers the live-system kill guard. Verified identical failure on cleanupstream/mainwith no local changes.stt.provider: local→ enters dispatcher. Same file +stt.provider: openai→ returns "File too large" without calling_transcribe_openai.Checklist
Code
Documentation & Housekeeping
cli-config.yaml.example— or N/ACONTRIBUTING.mdorAGENTS.md— or N/AScreenshots / Logs