fix: Azure OpenAI memory indexing fails for custom providers#111813
fix: Azure OpenAI memory indexing fails for custom providers#111813vyncint wants to merge 5 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
Fixes Azure OpenAI–compatible embedding requests in the OpenAI-compatible embedding provider by moving a configured api-version header into the request URL query string for recognized Azure hostnames, matching Azure’s required contract and preventing 404s during memory indexing/search.
Changes:
- Add Azure hostname detection + request-target normalization that (a) preserves existing query params, (b) prefers an existing URL
api-version, and (c) removes theapi-versionheader when moved. - Route embedding POSTs through the normalized
{ url, headers }target instead of directly using${baseUrl}/embeddings. - Add a dedicated Azure regression test suite covering the three Azure-compatible hostname suffixes, URL precedence, query preservation, and non-Azure behavior.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/plugins/openai-compatible-embedding-provider.ts | Normalizes Azure-compatible embedding request URL/headers so api-version is sent as a query param (while preserving existing query values and keeping non-Azure behavior unchanged). |
| src/plugins/openai-compatible-embedding-provider.azure.test.ts | Adds focused regression tests for Azure host suffix handling, api-version query precedence, header removal, and non-Azure passthrough behavior. |
e6a7472 to
7d8b82b
Compare
|
Codex review: needs real behavior proof before merge. Reviewed July 21, 2026, 4:55 AM ET / 08:55 UTC. Summary PR surface: Source +42, Tests +122. Total +164 across 2 files. Reviewed head: Reproducibility: no. live reproduction was run in this read-only review, but the current-main request construction and the reported Azure configuration make the failure path source-reproducible with high confidence. Review metrics: none identified. Stored data model Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Keep the Azure-only normalization and focused tests, then add a redacted real Azure Do we have a high-confidence way to reproduce the issue? No live reproduction was run in this read-only review, but the current-main request construction and the reported Azure configuration make the failure path source-reproducible with high confidence. Is this the best way to solve the issue? Yes, conditionally: Azure-host-scoped URL normalization matches the documented API contract and preserves non-Azure behavior, but a real after-fix Azure indexing result is still required before merge. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 6f43c50f37f9. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +42, Tests +122. Total +164 across 2 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
Review history (3 earlier review cycles) |
Closes #111386
What Problem This Solves
Fixes an issue where users indexing memory through a custom Azure OpenAI embedding provider would receive HTTP 404 when the provider supplied
api-versionas a header. Azure OpenAI requires that value in the request URL query.Why This Change Was Made
For Azure OpenAI-compatible endpoints, the embedding transport now follows the same request contract as the existing chat transport: it moves a case-insensitive
api-versionheader into the query string at request time, preserves other configured query values, and lets an existing URL value take precedence. Non-Azure OpenAI-compatible endpoints keep their existing header behavior.This matches the Azure OpenAI REST API contract, which defines
api-versionas a required query parameter. Reported by @OliPlus in #111386.User Impact
Users can index and search memory with custom Azure OpenAI embedding deployments without switching to another embedding provider as a workaround.
Evidence
node scripts/run-vitest.mjs src/plugins/openai-compatible-embedding-provider.azure.test.ts src/plugins/openai-compatible-embedding-provider.test.ts -- --reporter=verbose: 2 files and 31 tests passed.node scripts/run-oxlint.mjs --tsconfig config/tsconfig/oxlint.core.json src/plugins/openai-compatible-embedding-provider.azure.test.ts src/plugins/openai-compatible-embedding-provider.ts: passed.oxfmt --checkandgit diff --check: passed.autoreview --mode uncommitted: clean, with no accepted/actionable findings; reviewer confidence 0.94.checks-node-compact-small-1: 1 failed, 1,291 passed, and 4 skipped. It reproduced across two PR-context runs while the same shard passed on the exact base commit; the second failed status is the aggregateci-gatereflecting that shard.AI-assisted: Codex helped research the issue, implement the fix, add tests, and prepare this PR. I reviewed the final diff and understand the behavior: request headers are cloned and normalized only for recognized Azure hosts, an existing URL
api-versionwins, and non-Azure endpoints are unchanged. A redacted session transcript is included below.Agent Transcript
Redacted Codex session transcript