Repository navigation
fix(azure): report the Azure Speech voice-reset 502 as a non-retryable 400 - #21944
Merged
Merged
Conversation
…e 400 An unknown voice or unsupported style on MAI-Voice-2.1 makes Azure Speech reset the connection with an Envoy protocol-error 502. The handler already marks it non-retryable; it now also carries statusCode 400, since this is a client input error and callers retry 5xx.
aayush-kapoor
approved these changes
Oct 1, 2026
kkdawkins
added a commit
that referenced
this pull request
Oct 2, 2026
…e 400 (release-v6.0) (#21945) Backport of #21944 to `release-v6.0` (clean cherry-pick; same handler on both lines). ## Summary `azure.speech()` already recognizes the Azure Speech voice-reset failure (an Envoy 502 with `reset reason: protocol error` for an unknown voice or unsupported style on MAI-Voice-2.1) and marks it `isRetryable: false`, but kept `statusCode: 502`. Callers retry 5xx, so a single bad voice turned into three ~11 s attempts. The error now carries `statusCode: 400`; message, URL, headers, and body are unchanged, and other 502s stay retryable. ## Verification - `azure-speech-model.test.ts`: 58/58 pass on this branch; `tsc --noEmit` clean. - Live probe: only `mai-voice-2.1` returns the Envoy 502; MAI-Voice-2 / 2-flash / 2.1-flash return 400 directly.
Contributor
|
🚀 Published in:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Background
azure.speech()already recognizes the Azure Speech voice-reset failure: an unknown voice or unsupported style on MAI-Voice-2.1 makes the service reset the connection with an Envoy 502 whose body containsreset reason: protocol error. The failed-response handler maps it to a descriptive message andisRetryable: false, but keepsstatusCode: 502.Downstream, status is what callers act on. HTTP clients and gateways retry 5xx, so a single bad voice turned into three ~11 s attempts (~40 s) before the caller saw an error, and the failure counted as a provider outage. The same mistake on MAI-Voice-2 / 2-flash / 2.1-flash is a plain 400 from Azure and fails in under a second.
Summary
The voice-reset case now carries
statusCode: 400as well asisRetryable: false. The message, URL, headers, and body are unchanged. Other 502s stay retryable, as before.Verification
azure-speech-model.test.ts: the protocol-error 502 now expectsstatusCode: 400; the "other 502s stay retryable" and 429/503 cases are unchanged. 59/59 pass.mai-voice-2.1returns the Envoy 502; the other three return 400 directly.Backport
Also targets
release-v6.0(same handler), see the companion PR.