Skip to content

fix(media): use default STT model for auto audio transcription (#63349) - #63472

Closed
neeravmakwana wants to merge 2 commits into
openclaw:mainfrom
neeravmakwana:fix/media-audio-auto-stt-model-63349
Closed

neeravmakwana wants to merge 2 commits into
openclaw:mainfrom
neeravmakwana:fix/media-audio-auto-stt-model-63349

Conversation

@neeravmakwana

Copy link
Copy Markdown
Contributor

Summary

  • Problem: Auto-selected inbound audio transcription reused the active chat model id (e.g. gpt-5.4) as the /audio/transcriptions model. That endpoint expects speech-to-text models, so transcription could fail and voice notes surfaced as raw attachments with no transcript echo (tools.media.audio.echoTranscript).
  • Why it matters: Telegram and other channels rely on successful STT before the agent turn; failed STT matches reports in v2026.4.8: Telegram voice notes reach agent as raw .ogg, no transcript echo #63349.
  • What changed: resolveActiveModelEntry no longer passes the chat model for the audio capability; runProviderEntry continues to resolve the provider default (e.g. OpenAI gpt-4o-transcribe) when no explicit tools.media.audio.models entry applies.
  • What did NOT change: Explicit tools.media.audio.models, image/video active-model behavior, and non-auto entry paths are unchanged.

Change Type

  • Bug fix

Scope

  • Gateway / orchestration

Linked Issue/PR

Root Cause

  • Root cause: Active provider selection for auto audio correctly picked the same provider as chat but incorrectly forwarded the conversation model id into the transcription API.
  • Missing detection / guardrail: Unit coverage now asserts auto audio does not pass a non-STT chat model when activeModel is set.

Regression Test Plan

  • Coverage level: Unit test
  • Target test: src/media-understanding/runner.auto-audio.test.ts
  • Scenario: activeModel: { provider: "openai", model: "gpt-5.4" } → transcription request uses gpt-4o-transcribe.

User-visible / Behavior Changes

  • Inbound voice/audio transcription when using auto model selection with the same provider as the active chat model now uses that provider’s default STT model instead of the chat model.

Security Impact

  • New permissions/capabilities? No
  • New network endpoints or data exfiltration risk? No

Changelog

  • Entry added under Unreleased → Fixes in CHANGELOG.md.

Made with Cursor

@greptile-apps

greptile-apps Bot commented Apr 9, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes a bug where the active chat model ID (e.g. gpt-5.4) was incorrectly forwarded to the /audio/transcriptions API endpoint, which expects speech-to-text model IDs. The fix adds an explicit audio branch in resolveActiveModelEntry that returns undefined for the model, letting runProviderEntry fall through to resolveDefaultMediaModel (which resolves the correct STT default such as gpt-4o-transcribe). A new regression test confirms that with activeModel: { provider: "openai", model: "gpt-5.4" }, the transcription request receives gpt-4o-transcribe instead.

Confidence Score: 5/5

Safe to merge — minimal, targeted fix with no side effects on image/video paths and explicit regression coverage.

The change is a single-branch addition to a ternary in resolveActiveModelEntry, well-commented and scoped only to audio. The runProviderEntry fallback to resolveDefaultMediaModel was already in place and correct. All remaining observations are P2 or lower.

No files require special attention.

Vulnerabilities

No security concerns identified.

Reviews (1): Last reviewed commit: "Media: use default STT model for auto au..." | Re-trigger Greptile

@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: d178873142

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +635 to +637
: params.capability === "audio"
? undefined
: params.activeModel?.model;

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.

P1 Badge Preserve explicit audio model overrides

This change makes resolveActiveModelEntry drop activeModel.model whenever the capability is audio, which means caller-provided overrides are no longer honored on the auto-entry path. As a result, flows that pass an explicit model (e.g. capability audio transcribe --model <provider/model>) now ignore that model and fall back to the provider default in runProviderEntry, changing user-requested behavior and potentially selecting an unintended STT model.

Useful? React with 👍 / 👎.

@neeravmakwana

Copy link
Copy Markdown
Contributor Author

Follow-up: AI review (Codex P1 on resolveActiveModelEntry)

Concern: Dropping activeModel.model for every audio auto-entry could ignore explicit transcription overrides (e.g. openclaw … --model openai/whisper-1 → transcribeAudioFile / runCapability with no tools.media.audio.models config).

What we changed: Auto audio no longer uses a single undefined for all cases. activeModel.model is reused only when it is plausibly an STT intent:

  • Matches resolveDefaultMediaModel / bundled default STT for that provider (covers defaults like gpt-4o-transcribe, gemini-… when that is the resolved default, etc.).
  • Matches a small dedicated-STT heuristic: whisper, transcribe, nova-, voxtral (covers explicit whisper-1, CLI-style overrides, Deepgram/Mistral-style ids).

Otherwise it is treated as a chat model id (e.g. gpt-5.4) and omitted so runProviderEntry applies the provider default STT model.

Tests: Extended runner.auto-audio.test.ts with a case that activeModel: { provider: "openai", model: "whisper-1" } still sends whisper-1 to transcribeAudio, while gpt-5.4 still resolves to gpt-4o-transcribe.

Changelog: Unreleased Fixes bullet updated to mention explicit STT overrides.

Pushed: ba68dea03e on fix/media-audio-auto-stt-model-63349.

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.

v2026.4.8: Telegram voice notes reach agent as raw .ogg, no transcript echo

1 participant