[Fix] Azure OpenAI returns 404 with resource endpoint - #1192
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
navedmerchant
left a comment
There was a problem hiding this comment.
Review summary
The core Azure OpenAI /openai normalization is sound for the documented resource-root and already-normalized endpoint forms, and the provider/UI/translation coverage is strong. I am requesting changes for one confirmed UI/runtime routing mismatch.
Medium — Azure AI Inference can receive contradictory Azure OpenAI guidance
Location: isAzureOpenAiBaseUrl(), OpenAICompatible(), and OpenAiHandler.constructor().
The helper returns true immediately when openAiUseAzure is enabled, before checking whether the host ends in services.ai.azure.com. The UI relies directly on that result. The backend, however, computes Azure AI Inference independently and gives it precedence at OpenAiHandler.constructor(), so the same profile is routed through the plain OpenAI/Azure AI Inference path. This also contradicts the helper documentation stating that Azure AI Inference endpoints return false at isAzureOpenAiBaseUrl().
A profile containing both openAiBaseUrl: https://my-resource.services.ai.azure.com/models and openAiUseAzure: true therefore displays the Azure OpenAI /openai placeholder and asks for an Azure deployment name, while runtime requests retain Azure AI Inference semantics and expect the model identifier. Users can be guided into entering the wrong identifier and receive request failures.
Recommendation: Make route precedence shared and unambiguous. At minimum, classify services.ai.azure.com as Azure AI Inference before honoring the explicit Azure OpenAI flag. Preferably expose a shared three-way classifier for Azure OpenAI, Azure AI Inference, and generic OpenAI, then use it in both backend and UI. Add a regression test for the combined Azure AI Inference URL plus enabled Azure flag.
Verification
- Focused backend suite: 69/69 passed.
- Focused webview suite: 15/15 passed.
- Types package, extension, and webview type checks passed.
- ESLint passed on all changed TypeScript/TSX files.
- Translation completeness and locale JSON validation passed.
- Real OpenAI 5.23.2 request construction produced the expected Azure deployment URL for all four normalized forms.
- Local Playwright component bundling succeeded, but browser execution was unavailable because Chromium is not installed. The PR's CI
webview-visualjob passed, along with all other reported checks.
Verdict: Request changes.
navedmerchant
left a comment
There was a problem hiding this comment.
The Azure AI Inference precedence issue is actionable on the changed helper line below. Please make the classifier shared/unambiguous so the UI does not show Azure OpenAI deployment guidance when the runtime will use the Azure AI Inference route.
What changed
/openaipath before constructing the SDK client.Why this change was made
Azure OpenAI requests returned
404 Resource not foundwhen users entered the resource endpoint shown by Azure AI Studio because the SDK received a base URL without/openai. The generic model label also encouraged users to enter the underlying model name instead of their user-defined Azure deployment name.Impact
Users can connect with either the Azure resource endpoint or the full
/openaiendpoint, and the settings UI now makes the deployment-name requirement explicit in every supported language. Generic OpenAI-compatible providers and Azure AI Inference retain their existing request paths.Related PRs
Closes #1191