Repository navigation
Return 503 capability_unavailable instead of falling back to the wrong backend - #236
Conversation
…capability is down
…ble hosts are all down
|
Caution Review failedThe pull request is closed. No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Routing contract and provider scope internal/core/constants/routing.go, internal/core/domain/routing.go, internal/app/handlers/handler_provider_common.go |
Adds routing constants and a ProviderScope field. Provider routes record their supported endpoint types. |
Capability refusal decision internal/app/handlers/handler_proxy.go, internal/app/handlers/handler_provider_common.go |
Capability filtering checks whether any candidate serves a capable model and whether known, compatible capable hosts are all unhealthy. The handlers record an applicable refusal and return no endpoints. |
Routing tests and documentation internal/app/handlers/handler_proxy_capability_test.go, internal/app/handlers/handler_proxy_embeddings_mixed_fleet_test.go, docs/content/about/release-notes.md, docs/content/api-reference/text-embeddings-inference.md, docs/content/concepts/model-routing.md, docs/content/integrations/backend/text-embeddings-inference.md |
Tests cover refusal and fallback cases, including offline and busy hosts, and verify warning output. Documentation describes the 503 response and fallback conditions. |
Priority:
Estimated code review effort: 3 (Moderate) | ~25 minutes
Change: Bug fix
Possibly related PRs
- thushan/olla#238: Extracts a model from request bodies, which can affect whether model-less capability filtering applies.
- thushan/olla#231: Adds TEI capability tagging and model discovery used by capability routing.
- thushan/olla#234: Changes model discovery and health-check HTTP clients used to determine capable-host availability.
Merge Risk: 
Low · up to dc586
-
The routing change is mergeable, but the release note should clarify when requests still fall back rather than return 503.
Pre-merge checks: 
4 · 
1
-
Failed checks: 1 warning Passed checks: 4 passedFull details: Docstring Coverage
-
Explanation
Docstring coverage is 72.73% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 11 functions across 6 files. (4 skipped: 4 unsupported.)
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
-
Finishing Touches
-
📝 Generate docstrings
-
- Commit to this branch
- Create a new PR
🧪 Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands.
|
@coderabbitai review please |
|
🧠 Learnings used
✅ Action performed
|
Summary
A request that names no model is filtered by capability, for example a model-less
/embedneedsembeddings. When every capable host was down, Olla fell back to all endpoints unfiltered. With a TEI embedder down, a model-less/embedwas then answered by a TEI reranker or classifier with424 Model is not an embedding model.Now, if capable hosts the request could be sent to exist but none is healthy, Olla answers 503 with
X-Olla-Routing-Reason: capability_unavailable. This applies on/olla/proxy/and on provider routes, including thegetProviderEndpointsearly exit. Details:RequestProfile.ProviderScope). A healthy capable host the request can never reach, such as an Ollama embedder on/olla/tei/embed, no longer blocks the refusal.GetHealthyEndpoints, the source of candidates.routing_reason, and the detailed line is at Debug.Type of change
How was this tested?
TestProxyRouting_CapabilityUnavailablebuilds the fleet through the real unified registry and runs under strict, optimistic-compatible-only and optimistic-all. Cases:/olla/proxy/embed,/olla/tei/embedand/olla/tei/v1/embeddings;Every case asserts the selected endpoints, not just the status.
TestFilterEndpointsByCapabilities_RefusalWritesNoWarnandTestProxyRouting_CapabilityRefusalWritesOnlyTheRejectionWarncover the logging.Live run on
integration/test-octoberatc9d134c, against real Ollama, three TEI mocks and a vLLM mock, on the olla and sherpa engines with strict and optimistic routing. With the TEI embedder down,/olla/proxy/embed,/olla/tei/embedand/olla/tei/v1/embeddingsreturned 503capability_unavailable10/10, with zero 424s./olla/proxy/v1/embeddingsstill reached Ollama. 200 refusals logged one sampled "Request rejected" and no other WARNs. Routing recovered once the embedder came back.Checklist
make readypasses at3fefff6concepts/model-routing.md(Routing Reasons table), both TEI pages, and the v0.0.30 release noteSummary by CodeRabbit
503with acapability_unavailablerouting reason when known models with that capability are hosted only on unhealthy compatible endpoints.