Skip to content

fix(openai): route MP3 TTS through voice delivery#100715

Merged
steipete merged 1 commit into
mainfrom
codex/pr-83227-refactor
Jul 6, 2026
Merged

fix(openai): route MP3 TTS through voice delivery#100715
steipete merged 1 commit into
mainfrom
codex/pr-83227-refactor

Conversation

@steipete

@steipete steipete commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

OpenAI-compatible TTS configured with responseFormat: "mp3" reports voice-note output as incompatible. Speech-core then keeps the result on audio-file delivery even though Telegram's native voice-message path and the shared media contract accept MP3.

Closes #80317. Supersedes the conflicting, non-maintainer-editable #83227 while preserving its contributor credit.

Why This Change Was Made

The OpenAI speech provider now derives compatibility from the existing shared voice-message media policy instead of maintaining an Opus-only provider rule. The produced file extension is computed once and passed to that policy; voice-note MP3 and Opus remain compatible, while WAV remains an audio file.

This keeps format policy at its existing owner boundary. Existing speech-core tests own provider-metadata routing, and existing Telegram tests own MP3 sendVoice behavior, so the replacement retains one focused parameterized OpenAI regression instead of duplicating cross-layer tests.

User Impact

Users of Piper, Kokoro, and other OpenAI-compatible TTS endpoints can configure MP3 output and receive native Telegram voice messages rather than audio attachments. Non-voice targets and WAV output are unchanged.

Evidence

  • Blacksmith Testbox tbx_01kwv40nw0cbq0f8s7kt1wvps6: OpenAI provider, speech-core, and Telegram send suites passed, 216/216 tests.
  • Same Testbox: pnpm check:changed passed extension production/test typechecks, changed-file lint, dependency and package guards, database-first guard, runtime sidecar guard, and import-cycle verification.
  • Production provider live proof against a real local OpenAI-compatible HTTP endpoint captured response_format: "mp3" and returned outputFormat: "mp3", fileExtension: ".mp3", voiceCompatible: true, and six response bytes.
  • Fresh autoreview: no actionable findings; overall correctness 0.98.
  • Official contracts checked: OpenAI speech supports MP3 output, and Telegram sendVoice accepts MP3 voice messages.
  • git diff --check origin/main...HEAD passed.

Co-authored-by: Hemantsudarshan [email protected]

@steipete steipete self-assigned this Jul 6, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: aed99881fd

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread CHANGELOG.md
### Fixes

- **OpenAI Realtime Codex auth:** reuse external Codex OAuth profiles for Realtime voice sessions when no explicit OpenAI API key is configured.
- **OpenAI-compatible TTS voice notes:** route configured MP3 speech output through native voice-message delivery when the channel supports it, while keeping WAV output on the audio-file path. (#83227, #80317) Thanks @HemantSudarshan.

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.

P2 Badge Remove this non-release changelog entry

For this normal fix commit, adding a manual Unreleased entry conflicts with the root AGENTS.md Docs/Changelog rule that CHANGELOG.md is release-only and release generation owns it; keeping this line risks duplicate or stale release notes when entries are generated from merged PRs and direct commits. Please keep the release-note context in the commit/PR body and remove this line.

Useful? React with 👍 / 👎.

@steipete
steipete force-pushed the codex/pr-83227-refactor branch from aed9988 to a95d22c Compare July 6, 2026 07:33
@steipete
steipete merged commit 9302c80 into main Jul 6, 2026
37 checks passed
@steipete
steipete deleted the codex/pr-83227-refactor branch July 6, 2026 07:34
@steipete

steipete commented Jul 6, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TTS OpenAI provider: MP3 responseFormat not voice-compatible for Telegram, unlike Edge TTS

1 participant