Repository navigation
gateway: preserve compatible upstream statuses - #555
Merged
Merged
Conversation
Retain observed nonstream 429/503 on the compatible path after required usage and audit. Bound metadata by category and response state while preserving legacy errors, fallback and private accounting. Closes #554 Assisted-by: Codex Signed-off-by: sjungwon03 <sjungwon03@gmail.com>
sjungwon03-ai
approved these changes
Oct 28, 2026
sjungwon03-ai
left a comment
Member
There was a problem hiding this comment.
Review summary
Verdict: Approved
- Reviewed: Observed upstream
429/503capture and validation, compatible-only status projection, legacy isolation, required usage/audit handoffs, fallback isolation, privacy boundaries, and regression coverage. - Checks: All reported GitHub checks passed on
205c50019fceedcbc543dd18e827b47b2febc90b; localnpm run typecheckand the five focused status, retry-hint, boundary, and actual-SDK test suites passed.
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.
Closes #554. Refs #116; unresolved Jev #7 remains unchanged.
Registered nonstream upstream 429/503 previously became 502 even on the OpenRouter-compatible path. /api/v1 now retains an exact observed 429/503 only after required failed-attempt usage and outcome audit succeed; numeric error.code matches HTTP status. /v1 retains 502/symbolic errors. Fixed messages, safe unmapped metadata, request IDs, bounded Retry-After, IAM/limits, fallback and possible-billing accounting remain unchanged.
Known failure classes and terminal route results carry only an allowlisted scalar that agrees with both adapter classification and an observed-response flag. Missing, malformed, contradictory, mismatched or unclassified exception metadata cannot supply status authority. Other upstream statuses/timeouts stay generic 502. Local/persistence faults and successful/later generic fallback cannot inherit earlier status/hints; no raw body/header or new ledger/audit field is forwarded.
Plan: 554-upstream-statuses. Contract: observed statuses.
Validation:
Limits: client retry/backoff behavior may change with distinguishable 429/503; probes disable retries and do not certify automatic policies or prevent duplicate billing. The gateway adds no sleep/retry. Streaming, other statuses, precise provider error_type, HTTP-date/402 handling, live provider guarantees and full #116 remain separate work.