litellm/litellm/vector_stores
paveln83 c904856114
fix(passthrough): find a new Azure AI Search index in the DB on a registry miss (#51098)
* fix(passthrough): find a new Azure AI Search index in the DB on a registry miss

An index created with POST /v1/indexes answered 500 on every instance until the periodic registry sync loaded it. The Azure passthrough now reads a missing index from the DB through the shared registry read-through, and an unknown index with no AZURE_API_BASE answers 404 naming the index.

* fix(proxy): read vector stores through the DB writer on first use for Azure, Milvus and OpenSearch passthroughs

A vector store created with POST /vector_store/new only reached the instance that served the create,
so the issue's own steps still answered 500 on the Azure passthrough and Milvus and OpenSearch searches
answered 400 until the periodic sync. The Azure, Milvus and OpenSearch passthroughs now look a missing
index and vector store up in the DB on first use through the shared read-through, and both reads go to
the DB writer so a lagging replica cannot turn a new index into a 404.

The route tests run the real app, access checks included, with only the upstream search service mocked.

* fix(proxy): reload the vector store index table at most once per 2s on a registry miss

A DB read per unknown index name let a burst of made-up names cost one read each and use up the shared read budget, so a real index created on another instance then missed again. On an index miss the Azure, Milvus and OpenSearch passthroughs now reload the whole index table from the DB writer, one reload in flight per worker and at most one every 2 seconds, success or failure, and a caller waits at most 1 second for it

With AZURE_API_BASE unset, a name the reload did not find answers 404 saying it is not loaded on this proxy, and a failed reload answers 503 asking to retry, since the index may exist. With AZURE_API_BASE set, both still relay as before

* fix(passthrough): load a created index on its own worker and answer 503 when the index read fails

POST /v1/indexes now loads the new index into the worker's registry, so that worker never waits out the reload cooldown. Milvus and OpenSearch answer the same retryable 503 as Azure when the index table read fails or runs past 1s, and the Azure 404 no longer mentions AZURE_API_BASE

The writer-pin test fakes now carry create, so the test fails when the pin is removed, and a new test checks that two stores with one name resolve to the newest

* fix(proxy): load a vector store renamed on another instance and say the index read timed out

A store lookup that found the name in the DB used to skip a store whose id was already loaded under its old name, so the
name never loaded and every request read the DB again. The lookup now updates the store by id and reports whether the
name loaded, so a miss is cached when it still is not there

The 503 for an index read that fails or passes 1s now says the read did not finish in time

* fix(proxy): keep the newest store first when a lookup loads a renamed one, and give reload tests a fake clock

* ci: re-run checks so the required zizmor check reports at this commit

* fix(proxy): answer 503 when the index table read fails on an AZURE_API_BASE proxy

A failed or timed-out index lookup used to relay the request to AZURE_API_BASE with the global key, skipping the managed index's own store and access checks. It now answers 503 asking to retry on every proxy, and a name the reload did not find still relays

* fix(proxy): skip index rows that fail validation in the index reload

One index row written outside the API without vector_store_name made the whole reload fail, so every index name the proxy had not loaded answered 503. Skip such rows with a warning and load the rest

* fix(proxy): let a relay proxy use a recent index read while the DB is slow

On a proxy with AZURE_API_BASE set, a search on an unmanaged index name
answered 503 whenever the index table read passed 1s or failed, even though
main relayed it. The relay decision now uses the last successful read when it
started in the past 10s, and still answers 503 after that.

* fix(proxy): keep relaying unmanaged Azure AI Search names while the index read is slow

Use the last good index read for up to the periodic sync interval, counted from when that read finished, so a relay proxy never decides on an older read than its own sync

* fix(proxy): relay unmanaged Azure AI Search names when the index read fails

A proxy with AZURE_API_BASE set relays a name to it when the index table read fails or passes 1s, as main does, instead of answering 503. This drops the 30s stale window, which only delayed those 503s during a DB writer outage

---------

Co-authored-by: mateo-berri <277851410+mateo-berri@users.noreply.github.com>
2026-11-26 08:29:21 +00:00
..
__init__.py refactor(lint): apply every safe ruff autofix and zero 28 strict-rule budgets 2026-08-01 15:43:29 -07:00
fallbacks.py feat(vector_stores): add YAML-configured unified search fallbacks (#52093) 2026-11-18 08:41:02 -08:00
main.py refactor(types): type the kwargs reads in the videos, skills, evals, vector store and container entrypoints (#54630) 2026-11-26 05:07:52 +00:00
search_query.py fix(router): make the constructor stub work for mypy and guard it in CI (#50354) 2026-11-22 21:25:00 +00:00
utils.py fix(bedrock): map OpenAI vector store search filters to AWS RetrievalFilter (#51291) 2026-11-14 13:39:43 -05:00
vector_store_registry.py fix(passthrough): find a new Azure AI Search index in the DB on a registry miss (#51098) 2026-11-26 08:29:21 +00:00