Skip to content

gateway: preserve compatible upstream statuses - #555

Merged
sjungwon03 merged 1 commit into
mainfrom
feat/554-upstream-statuses
Oct 29, 2026
Merged

sjungwon03 merged 1 commit into
mainfrom
feat/554-upstream-statuses

Conversation

@sjungwon03

Copy link
Copy Markdown
Member

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:

  • Initial red before implementation: 40 cases, 16 expected compatible missing-status failures, 24 passes.
  • Initial green selection: 258 passed. A separate defensive red reproduced 2 contradictory no-response-state failures among 20 cases; constructors/coordinators now reject that metadata. Final focused provider/routing/errors/accounting/actual-SDK selection: 278 passed.
  • Full npm run check: 7,785 total, 7,784 passed, zero failures/cancellations, one optional external PostgreSQL skip (~243sec). Typecheck, lint, planning/link/fixture-secret checks and all six offline integrity checks passed.
  • Existing 42 lint warnings/65 infos are unchanged. Planning/links/fixture-secret scan, whitespace and CLAUDE.md symlink passed. Six source pins, dependencies and migrations are byte-unchanged.

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.

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>
@github-actions github-actions Bot added ai-review-requested Review requested from sjungwon03-ai type:feature Product capability labels Oct 28, 2026

@sjungwon03-ai sjungwon03-ai left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review summary

Verdict: Approved

  • Reviewed: Observed upstream 429/503 capture 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; local npm run typecheck and the five focused status, retry-hint, boundary, and actual-SDK test suites passed.

@sjungwon03
sjungwon03 merged commit db2535a into main Oct 29, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-review-requested Review requested from sjungwon03-ai type:feature Product capability

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: preserve compatible upstream transient statuses

2 participants