Skip to content

fix: route Azure embed requests through deployment endpoint#12598

Open
rodboev wants to merge 1 commit into
continuedev:mainfrom
rodboev:pr/azure-embed-webview-errors
Open

fix: route Azure embed requests through deployment endpoint#12598
rodboev wants to merge 1 commit into
continuedev:mainfrom
rodboev:pr/azure-embed-webview-errors

Conversation

@rodboev

@rodboev rodboev commented Jun 10, 2026

Copy link
Copy Markdown

Fixes #12554

Summary

Azure OpenAI embed requests can 404 because _getEmbedEndpoint checks apiType === "azure" while the Azure adapter sets apiType: "azure-openai". The strict check misses the Azure deployment route, so embed requests go to /embeddings instead of /openai/deployments/{deployment}/embeddings?api-version={version}. This change follows the Azure routing pattern already used by _getEndpoint for chat requests.

Root cause

core/llm/llms/OpenAI.ts:708 used strict equality for the embed endpoint, but Azure.ts:17 sets apiType: "azure-openai". The condition never matched, so Azure OpenAI embeddings skipped the deployment path. azure-foundry should still use the plain embeddings path, so the fix distinguishes azure and azure-openai from other Azure-flavored apiType values.

Changes

  • core/llm/llms/OpenAI.ts: route azure and azure-openai embed requests through openai/deployments/{deployment}/embeddings, while keeping azure-foundry on the plain embeddings path
  • core/llm/llms/OpenAI.vitest.ts: add coverage for both Azure OpenAI deployment routing and Azure Foundry plain-path routing
  • core/llm/llms/OpenAI-compatible.vitest.ts: update the Azure subclass expectation to cover the deployment embed URL

Scope note

This PR no longer changes generic webview error logging. The related webviewProtocol.ts stringify guard is handled separately in #12589, so this branch stays focused on Azure embedding endpoint routing.

What this doesn't change

The chat/completions routing (_getEndpoint) and Responses API gate (canUseOpenAIResponses) are already correct for Azure and untouched. No model selection, parameter conversion, streaming logic, or generic webview error handling is modified.

Checklist

  • I've read the contributing guide
  • The relevant docs, if any, have been updated or created
  • The relevant tests, if any, have been updated or created

Screen recording or screenshot

N/A, provider endpoint routing fix covered by tests.

Tests

Attempted locally: cd core && npx vitest run llm/llms/OpenAI.vitest.ts llm/llms/OpenAI-compatible.vitest.ts

Blocked before test collection because the local checkout is running Node v24.15.0 while .nvmrc requires v20.20.1, and sqlite3 has no native binding for the active Node version. The command failed with Could not locate the bindings file ... sqlite3 ... compiled\24.15.0\win32\x64\node_sqlite3.node.

@rodboev rodboev requested a review from a team as a code owner June 10, 2026 23:48
@rodboev rodboev requested review from sestinj and removed request for a team June 10, 2026 23:48
@dosubot dosubot Bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Jun 10, 2026

@cubic-dev-ai cubic-dev-ai 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.

No issues found across 3 files

Re-trigger cubic

@rodboev rodboev force-pushed the pr/azure-embed-webview-errors branch 2 times, most recently from 2c13ca2 to fbd37f1 Compare June 11, 2026 00:03
@rodboev rodboev changed the title fix: Azure embed endpoint routing and webview error handling cascade fix: route Azure embed requests through deployment endpoint Jun 11, 2026
@rodboev rodboev force-pushed the pr/azure-embed-webview-errors branch from fbd37f1 to fe2af65 Compare June 11, 2026 18:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M This PR changes 30-99 lines, ignoring generated files.

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

Azure routing and webview protocol stability issues (minimal diff attached)

1 participant