Skip to content

Conversation

@devin-ai-integration
Copy link
Contributor

@devin-ai-integration devin-ai-integration bot commented Jan 21, 2026

Summary

Fixes incorrect language validation in the Deepgram adapter where:

  1. The model parameter was being ignored (_model) in validation functions
  2. Validation only checked the base ISO-639 code (e.g., en) instead of the full BCP-47 code (e.g., en-CA)

This caused users selecting en-CA with nova-3-general to not see a warning, even though that combination doesn't work (nova-3-general doesn't support en-CA, but nova-3-medical does).

Key changes:

  • Added language_matches_supported_codes() helper that centralizes BCP-47 matching logic with proper fallback behavior
  • supports_language() uses the helper and only falls back to base ISO-639 code when the language has no region specified
  • Added Nova3Medical to the model fallback chain so en-CA auto-selects nova-3-medical
  • is_supported_languages_impl and language_quality_live now use the model parameter for validation
  • Proxy-side: Added should_override_deepgram_model() to correct incompatible model/language combinations
  • Exported DeepgramModel from owhisper-client for use in transcribe-proxy

Updates since last revision

  • Merged with main to incorporate clippy fixes
  • Fixed formatting issues after merge
  • should_override_deepgram_model now uses parsed_model.supports_language(lang) directly for consistent validation logic between client and proxy

Review & Testing Checklist for Human

  • Verify strict BCP-47 matching behavior: en-CA should NOT match models that only list en in their supported languages. This is intentional but may surprise users expecting fallback behavior.
  • Test proxy override logic: When user selects nova-3-general with en-CA, proxy should auto-override to nova-3-medical. Verify this doesn't cause unexpected behavior for users who explicitly chose a model.
  • Test with actual Deepgram API: Verify that en-CA with nova-3-medical actually works, and en-CA with nova-3-general actually fails at the API level
  • Check for regressions with regional codes: Languages like en-US, en-GB, fr-CA that ARE in the supported lists should still work correctly
  • Verify UI warning behavior: When user selects en-CA + nova-3-general, the settings UI should now show a warning

Recommended test plan:

  1. In settings, select en-CA as language and nova-3-general as model → should show unsupported warning
  2. Select en-CA with no model specified → should auto-select nova-3-medical
  3. Select en-US with nova-3-general → should work without warning
  4. Select multi-language ["en", "es"] with nova-3-medical → should show unsupported warning
  5. Test actual transcription with en-CA to verify proxy correctly routes to nova-3-medical

Notes

…d model parameter

- Fix supports_language to only fall back to base ISO-639 code when no region is specified
- Update is_supported_languages_impl to use the model parameter for validation
- Update language_quality_live to check model-specific language support
- Add nova-3-medical to the model fallback chain in best_for_languages
- Add model override logic in transcribe-proxy for Deepgram when model doesn't support languages
- Export DeepgramModel from owhisper-client for use in transcribe-proxy
- Add tests for en-CA with nova-3-general (not supported) and nova-3-medical (supported)

Co-Authored-By: yujonglee <yujonglee.dev@gmail.com>
@devin-ai-integration
Copy link
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR that start with 'DevinAI' or '@devin'.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@netlify
Copy link

netlify bot commented Jan 21, 2026

Deploy Preview for hyprnote-storybook canceled.

Name Link
🔨 Latest commit f662448
🔍 Latest deploy log https://app.netlify.com/projects/hyprnote-storybook/deploys/697035150d874700086957e1

@netlify
Copy link

netlify bot commented Jan 21, 2026

Deploy Preview for hyprnote canceled.

Name Link
🔨 Latest commit f662448
🔍 Latest deploy log https://app.netlify.com/projects/hyprnote/deploys/69703515de5a2a0008ab9a31

@netlify
Copy link

netlify bot commented Jan 21, 2026

Deploy Preview for howto-fix-macos-audio-selection canceled.

Name Link
🔨 Latest commit f662448
🔍 Latest deploy log https://app.netlify.com/projects/howto-fix-macos-audio-selection/deploys/697035150f00ad0008d56cb0

Copy link
Contributor Author

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

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

Devin Review found 1 potential issue.

View issue and 3 additional flags in Devin Review.

Open in Devin Review

The should_override_deepgram_model function was using permissive OR logic
that didn't match the strict logic in DeepgramModel::supports_language.
This caused the proxy to not override the model for en-CA with nova-3-general
even though the client correctly showed it as unsupported.

Co-Authored-By: yujonglee <yujonglee.dev@gmail.com>
Comment on lines +134 to 140
if listen_params.model.is_none() || should_override {
if let Some(model) =
AdapterKind::from(provider).recommended_model_live(&listen_params.languages)
{
listen_params.model = Some(model.to_string());
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Critical logic bug: When should_override is true (incompatible model/language combination detected) but recommended_model_live() returns None, the incompatible model remains in listen_params.model. This means an explicitly provided incompatible model (e.g., nova-3-general with en-CA) will still be used if no alternative is found, causing API failures.

Fix:

if listen_params.model.is_none() || should_override {
    if let Some(model) =
        AdapterKind::from(provider).recommended_model_live(&listen_params.languages)
    {
        listen_params.model = Some(model.to_string());
    } else if should_override {
        // Clear incompatible model when no alternative exists
        listen_params.model = None;
    }
}
Suggested change
if listen_params.model.is_none() || should_override {
if let Some(model) =
AdapterKind::from(provider).recommended_model_live(&listen_params.languages)
{
listen_params.model = Some(model.to_string());
}
}
if listen_params.model.is_none() || should_override {
if let Some(model) =
AdapterKind::from(provider).recommended_model_live(&listen_params.languages)
{
listen_params.model = Some(model.to_string());
} else if should_override {
// Clear incompatible model when no alternative exists
listen_params.model = None;
}
}

Spotted by Graphite Agent

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

Copy link
Contributor Author

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

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

Devin Review found 1 new potential issue.

View issue and 4 additional flags in Devin Review.

Open in Devin Review

devin-ai-integration bot and others added 5 commits January 21, 2026 01:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants