Repository navigation
streaming: preserve pre-stream upstream failures - #559
Merged
Merged
Conversation
Retain observed 429/503 and bounded retry hints at the JSON boundary before client streaming starts, after required usage and outcome audit. Keep legacy status, post-frame errors, cancellation and fallback rules. Refs: #558 Assisted-by: Codex Signed-off-by: sjungwon03 <sjungwon03@gmail.com>
sjungwon03-ai
approved these changes
Oct 29, 2026
sjungwon03-ai
left a comment
Member
There was a problem hiding this comment.
Review summary
Verdict: Approved
- Reviewed: Bounded pre-stream
429/503andRetry-Aftercapture across all eight response consumers, legacy/compatible JSON projection, persistence gating, cancellation, fallback isolation, post-start SSE behavior, privacy, and SDK regressions. - Checks: All three GitHub checks passed; locally, all 711 focused tests, TypeScript checking, documentation/link/fixture-secret validation, six offline schema-integrity checks, and
git diff --checkpassed.
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 #558. Refs #116; Jev #7 remains unresolved.
A stream:true request rejected by a registered provider with429/503 previously became502 without its safe Retry-After, even before any client SSE started. Text/function consumers now retain bounded metadata from those observed HTTP rejections. After required failed-attempt usage and outcome audit, /api/v1 returns that JSON status/matching numeric error.code; /v1 keeps502/symbolic upstream_failed. Both may return canonical integer-seconds Retry-After, including zero. Missing/invalid hints do not suppress a valid status.
Once streaming starts, HTTP200 and existing generic safe SSE errors remain unchanged: discard upstream status/hints, retain interruption-audit failure semantics and withhold final usage/DONE. Local/persistence/unclassified exceptions and other statuses cannot inherit metadata. Rejected-body cancellation, IAM/limits/registered destinations, possible-billing/missing usage and fallback eligibility remain intact. No new ledger/audit fields or raw provider body/header forwarding.
Plan: 558-prestream-errors. Contract: pre-stream errors.
Validation:
Risks/limits: clients may change retry/backoff with distinguishable429/503/Retry-After; probes disable retries and certify delivery only. Registered observed rejections remain responseStarted:true, so this adds no automatic fallback, retry/sleep or free-retry guarantee. Exact provider causes, broader status/date/402 and streaming error parity, live providers and full #116 remain open. Six source pins, dependencies and storage remain unchanged.