fix(sdk): recover mid-stream provider 5xx/429 like severed connections - #1162
Closed
nordicnode wants to merge 9045 commits into
Closed
fix(sdk): recover mid-stream provider 5xx/429 like severed connections#1162nordicnode wants to merge 9045 commits into
nordicnode wants to merge 9045 commits into
Conversation
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
errorpart withfinishReason='error'— no longer ends the entire run with an errorclassifyThrownStreamRecovery(already consulted for both the thrown-iterator and error-chunk shapes) so retryableAPICallErrors (429, any 5xx) take the same capped recovery path as a severed body: note injected into the conversation, retry step forced, capped atMAX_CONSECUTIVE_STREAM_RECOVERIESRetryErrorcause chain recovers, client-error statuses and post-cancel 5xx stay fatalThis addresses the run-killing part of #1155: the recoverable class was "the connection failed to speak" (
isTransientNetworkError, a socket-level allowlist) and the fatal class was "the provider reported a failure", which is backwards for flaky endpoints, where both are the same transient event.Validation
bun test sdk/src/__tests__/stream-interruption.test.ts(19 pass, 5 new)bun test sdk(493 pass; the 100 failures are network/env-dependent and pre-exist onmain— same count with this change stashed)bunx tsc --noEmit -p sdk/tsconfig.jsoncleanRefs #1155