Skip to content

fix(stt): accept .oga and .opus voice notes for transcription - #43371

Closed
eliemada wants to merge 1 commit into
NousResearch:mainfrom
eliemada:fix/stt-accept-oga-opus
Closed

fix(stt): accept .oga and .opus voice notes for transcription#43371
eliemada wants to merge 1 commit into
NousResearch:mainfrom
eliemada:fix/stt-accept-oga-opus

Conversation

@eliemada

Copy link
Copy Markdown
Contributor

What does this PR do?

Telegram delivers voice notes as .oga (OGG/Opus container). SUPPORTED_FORMATS in tools/transcription_tools.py listed .ogg but not .oga, so transcribe_audio() rejected every inbound Telegram voice note with Unsupported format: .oga before it reached any STT backend. The gateway then replied "I couldn't transcribe your voice message."

The check sits upstream of provider dispatch, so this broke voice notes for all backends (local faster-whisper, Groq, OpenAI, Mistral, xAI) and any command-provider. The fix adds .oga and .opus to the allowlist.

Related Issue

No existing issue. Bug and reproduction below.

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)

Changes Made

  • tools/transcription_tools.py: add .oga and .opus to SUPPORTED_FORMATS.
  • tests/tools/test_transcription_tools.py: add test_telegram_oga_and_opus_accepted regression test.

How to Test

Reproduce (before the fix): send a voice note to a Telegram gateway, or call transcribe_audio("voice.oga") — it returns {"success": false, "error": "Unsupported format: .oga ..."}.

After the fix:

pytest tests/tools/test_transcription_tools.py -q
# 108 passed

_validate_audio_file() now returns None (accepted) for .oga and .opus. Verified end to end on Ubuntu 24.04 with a real Telegram voice note routed to a command-provider STT backend.

Checklist

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits
  • I searched for existing PRs to make sure this isn't a duplicate
  • My PR contains only changes related to this fix
  • I've run pytest tests/tools/test_transcription_tools.py -q and all 108 tests pass
  • I've added a regression test for this change
  • I've tested on my platform: Ubuntu 24.04

Documentation & Housekeeping

  • No docs change needed — N/A
  • No config keys changed — N/A
  • No architecture/workflow change — N/A
  • Cross-platform: extension allowlist, no platform-specific code — N/A

Telegram sends voice notes as .oga (OGG/Opus). SUPPORTED_FORMATS listed
.ogg but not .oga, so transcribe_audio rejected every Telegram voice note
with "Unsupported format: .oga" before reaching any STT backend. Add .oga
and .opus to the allowlist, with a regression test.
@alt-glitch alt-glitch added type/bug Something isn't working comp/gateway Gateway runner, session dispatch, delivery tool/tts Text-to-speech and transcription platform/telegram Telegram bot adapter P2 Medium — degraded but workaround exists labels Jun 10, 2026

@teknium1 teknium1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the focused regression test. Current main still rejects .opus in tools/transcription_tools.py:103, and Feishu can retain .opus when caching inbound audio (plugins/platforms/feishu/adapter.py:172,3925-3929).

Problems

  • The reported Telegram path is no longer reproducible on current main: inbound msg.voice is explicitly cached as .ogg at plugins/platforms/telegram/adapter.py:7849-7853.
  • Please do not make .oga a bare shared allowlist entry without reconciling the current filename-normalization contract. WhatsApp maps Ogg/Opus MIME values to .ogg because .oga is documented as downstream-STT-incompatible (gateway/platforms/whatsapp_cloud.py:129-164), while several cloud handlers upload the original basename (tools/transcription_tools.py:1406-1409, 1479-1488, 1566-1571).

Suggested changes

  • Re-scope around the verified .opus ingress or canonicalize Ogg/Opus variants before remote dispatch.
  • Add a regression through the relevant cache-to-STT path, not only _validate_audio_file().

Automated hermes-sweeper review.


SUPPORTED_FORMATS = {".mp3", ".mp4", ".mpeg", ".mpga", ".m4a", ".wav", ".webm", ".ogg", ".aac", ".flac"}
SUPPORTED_FORMATS = {".mp3", ".mp4", ".mpeg", ".mpga", ".m4a", ".wav", ".webm", ".ogg", ".oga", ".opus", ".aac", ".flac"}
LOCAL_NATIVE_AUDIO_FORMATS = {".wav", ".aiff", ".aif"}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Current Telegram inbound voice handling already forces .ogg (plugins/platforms/telegram/adapter.py:7849-7853), while WhatsApp deliberately maps .oga to .ogg because downstream STT expects that filename (gateway/platforms/whatsapp_cloud.py:129-164). Please establish provider-safe canonicalization before adding .oga to the shared allowlist; this change otherwise forwards the .oga basename unchanged to cloud providers.

@teknium1 teknium1 added sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform labels Jul 14, 2026
@teknium1

Copy link
Copy Markdown
Contributor

Merged into main via consolidated salvage PR #73507 (merge 156edc5ded). Your .oga/.opus additions to the STT SUPPORTED_FORMATS (Telegram voice notes are .oga) were cherry-picked as 2447d2e.

Your contribution is credited to you in git history. Thank you! Closing this PR as merged-via-salvage.

@teknium1 teknium1 closed this Jul 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/gateway Gateway runner, session dispatch, delivery P2 Medium — degraded but workaround exists platform/telegram Telegram bot adapter sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages tool/tts Text-to-speech and transcription type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants