Skip to content

Add Provider Health Tracking and Safe Fallback Routing to AIProviderRegistry #105

@ShashankSaga

Description

@ShashankSaga

Is your feature request related to a problem? Please describe.

Currently, all registered AI providers are treated as equally healthy and available. If a provider fails (e.g., timeout, API error, local model crash), there is no built-in mechanism to track failures or safely route requests to an alternative provider. This can lead to repeated failures and a poor user experience.

Describe the solution you'd like

Introduce lightweight provider health tracking within the AIProviderRegistry. Each provider should maintain basic runtime metadata such as:

  • last failure timestamp
  • consecutive failure count
  • current health status (healthy / degraded)

Based on this data, the registry should be able to:

  • temporarily exclude unhealthy providers
  • safely fallback to the next compatible provider when a request fails
  • keep the implementation fully additive and non-breaking

This should work on top of the existing AIProvider abstraction without modifying existing chat or inference flows.

Describe alternatives you've considered

An alternative would be to handle failures ad hoc at the request level. However, centralizing provider health logic in the registry keeps the system cleaner, more extensible, and easier to reason about as more providers are added.

Additional context

This feature builds naturally on the new AIProvider abstraction and prepares the system for multi-provider setups (cloud + local) while ensuring stability and reliability without adding unnecessary complexity.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions