Skip to content

fix(azure): report the Azure Speech voice-reset 502 as a non-retryable 400 - #21944

Merged
kkdawkins merged 1 commit into
mainfrom
kdawkins/azure-voice-reset-400
Oct 2, 2026
Merged

kkdawkins merged 1 commit into
mainfrom
kdawkins/azure-voice-reset-400

Conversation

@kkdawkins

Copy link
Copy Markdown
Contributor

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 contains reset reason: protocol error. The failed-response handler maps it to a descriptive message and isRetryable: false, but keeps statusCode: 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: 400 as well as isRetryable: 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 expects statusCode: 400; the "other 502s stay retryable" and 429/503 cases are unchanged. 59/59 pass.
  • Live probe against Azure Speech with a bad voice and a bad style on all four MAI voices: only mai-voice-2.1 returns the Envoy 502; the other three return 400 directly.

Backport

Also targets release-v6.0 (same handler), see the companion PR.

…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.
@kkdawkins
kkdawkins merged commit 9210b70 into main Oct 2, 2026
59 checks passed
@kkdawkins
kkdawkins deleted the kdawkins/azure-voice-reset-400 branch October 2, 2026 16:40
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.
@github-actions

github-actions Bot commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

🚀 Published in:

Package Version
ai 7.0.128 github npm
@ai-sdk/alibaba 2.0.61 github npm
@ai-sdk/amazon-bedrock 5.0.106 github npm
@ai-sdk/angular 3.0.128 github npm
@ai-sdk/anthropic 4.0.72 github npm
@ai-sdk/anthropic-aws 2.0.64 github npm
@ai-sdk/assemblyai 3.0.54 github npm
@ai-sdk/azure 4.0.91 github npm
@ai-sdk/baseten 2.1.41 github npm
@ai-sdk/black-forest-labs 2.0.55 github npm
@ai-sdk/bytedance 2.0.57 github npm
@ai-sdk/cartesia 3.0.49 github npm
@ai-sdk/cerebras 3.0.63 github npm
@ai-sdk/code-mode 1.0.85 github npm
@ai-sdk/cohere 4.0.55 github npm
@ai-sdk/deepgram 3.1.25 github npm
@ai-sdk/deepinfra 3.0.63 github npm
@ai-sdk/deepseek 3.0.59 github npm
@ai-sdk/devtools 1.0.31 github npm
@ai-sdk/elevenlabs 3.0.55 github npm
@ai-sdk/fal 3.0.55 github npm
@ai-sdk/fireworks 3.0.66 github npm
@ai-sdk/fish-audio 3.0.32 github npm
@ai-sdk/gateway 4.0.104 github npm
@ai-sdk/gladia 3.0.54 github npm
@ai-sdk/gmicloud 3.0.34 github npm
@ai-sdk/google 4.0.88 github npm
@ai-sdk/google-vertex 5.0.102 github npm
@ai-sdk/groq 4.0.55 github npm
@ai-sdk/harness 1.0.139 github npm
@ai-sdk/harness-acp 1.0.78 github npm
@ai-sdk/harness-claude-code 1.0.143 github npm
@ai-sdk/harness-cline 1.0.66 github npm
@ai-sdk/harness-codex 1.0.141 github npm
@ai-sdk/harness-cursor 1.0.53 github npm
@ai-sdk/harness-deepagents 1.0.139 github npm
@ai-sdk/harness-fx 1.0.53 github npm
@ai-sdk/harness-github-copilot 1.0.35 github npm
@ai-sdk/harness-grok-build 1.0.77 github npm
@ai-sdk/harness-opencode 1.0.141 github npm
@ai-sdk/harness-pi 1.0.141 github npm
@ai-sdk/huggingface 2.0.63 github npm
@ai-sdk/hume 3.0.54 github npm
@ai-sdk/klingai 4.0.56 github npm
@ai-sdk/langchain 3.0.128 github npm
@ai-sdk/llamaindex 3.0.128 github npm
@ai-sdk/luma 3.0.55 github npm
@ai-sdk/mcp 2.0.67 github npm
@ai-sdk/minimax 3.0.49 github npm
@ai-sdk/mistral 4.0.57 github npm
@ai-sdk/moonshotai 3.0.63 github npm
@ai-sdk/open-responses 2.0.59 github npm
@ai-sdk/openai 4.0.84 github npm
@ai-sdk/openai-compatible 3.0.63 github npm
@ai-sdk/otel 1.0.128 github npm
@ai-sdk/perplexity 5.0.6 github npm
@ai-sdk/policy-opa 1.0.128 github npm
@ai-sdk/prodia 2.0.55 github npm
@ai-sdk/provider 4.0.22 github npm
@ai-sdk/provider-utils 5.0.54 github npm
@ai-sdk/quiverai 2.0.55 github npm
@ai-sdk/react 4.0.131 github npm
@ai-sdk/replicate 3.0.55 github npm
@ai-sdk/revai 3.0.54 github npm
@ai-sdk/rsc 3.0.128 github npm
@ai-sdk/sandbox-just-bash 1.0.139 github npm
@ai-sdk/sandbox-vercel 1.0.139 github npm
@ai-sdk/svelte 5.0.128 github npm
@ai-sdk/togetherai 3.0.64 github npm
@ai-sdk/topaz 3.0.1 github npm
@ai-sdk/tui 1.0.129 github npm
@ai-sdk/typesafe-ai 3.0.13 github npm
@ai-sdk/valibot 3.0.54 github npm
@ai-sdk/voyage 2.0.54 github npm
@ai-sdk/vue 4.0.128 github npm
@ai-sdk/workflow 2.0.59 github npm
@ai-sdk/workflow-harness 1.0.139 github npm
@ai-sdk/xai 5.0.15 github npm
@ai-sdk/zai 3.0.25 github npm

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants