Repository navigation
fix(proxy): try configured fallback providers after primary failures - #333
Open
liangzhechen655 wants to merge 1 commit into
Conversation
|
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When a healthy primary provider fails during a request,
ProxyClientexhausts its initial primary-provider list and immediately switches to the server's default client. Configuredfallback_onlyproviders are only considered if no primary is healthy before the request starts, so they are skipped in the failure path they are meant to handle.Try unattempted configured fallback providers after the primary candidates are exhausted, before using the default client. The existing router, model mapping, timeout handling, health updates, and semaphore cleanup apply to these requests too. Each provider is attempted at most once per request.
Regression coverage includes all three routing strategies, upstream failures/timeouts, exhausted primary capacity, multiple primary and backup providers, default-client ordering, failure reporting, and released concurrency slots. An additional test uses the real OpenAI SDK with
httpx.MockTransportto exercise HTTP 503 followed by a successful mapped-model request to the backup.Validation on Windows, Python 3.13:
main, including the backup being skipped with all three routing strategies.python -m pytest tests/test_proxy_failover.py tests/test_proxy_plugin.py tests/test_ssl_config.py tests/test_conversation_logger.py tests/test_conversation_logging_approaches.py -q: 45 passed, 6 subtests passed.git diff --check: passed.Tests use the proxy-only dependency set plus test dependencies and Beautiful Soup for the existing SSL tests. Local-model inference and live-provider integration suites were not run.
This PR was generated with Codex (GPT-6); the regression tests and checks above were executed locally.