Repository navigation
fix: keep the provider's status and meaning in upstream errors - #9
Merged
Merged
Conversation
Every provider 4xx came back as 502 provider_unavailable, so a request the provider rejected looked like an outage, and our own provider credential or billing failures looked the same as both. - Provider 4xx keeps its status, code provider_rejected_request. - Provider 401/402/403 become 502 provider_configuration_error: they concern Nexus's provider account, not the caller's key. - 429 becomes provider_rate_limited and keeps a validated Retry-After. - 504 becomes provider_timeout; other 5xx keep their status as provider_error. - Errors carry origin (gateway or upstream) and upstream_status. Other diagnostic metadata stays internal. - A configured fallback provider is tried only after 429 or 5xx. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Summary
Every provider 4xx came back as 502
provider_unavailable, so a request the provider rejected looked like an outage, and so did our own provider credential failures.provider_rejected_requestprovider_configuration_error(Nexus's provider account, not the caller's key)provider_rate_limited, with a validRetry-Afterprovider_unavailable(unchanged)provider_timeoutprovider_errororigin(gatewayorupstream) and, when known,upstream_status. Other diagnostic details stay internal.Compatibility
provider_errorinstead ofprovider_unavailable.Tests
Retry-Aftervalidation, the new error fields and the fallback rule.provider_rejected_request, and an invalid provider key returns 502provider_configuration_error.🤖 Generated with Claude Code