Repository navigation
Conversation
Contributor
|
The following comment was made by an LLM, it may be inaccurate: |
Member
|
This branch has been upgraded to V2. We're no longer taking PRs for V1. If you think this is still relevant, please port it over and open it for V2. — from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊 |
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.
Issue for this PR
Closes #53396
Type of change
What does this PR do?
Retry only looks at the error message, so a network error wrapped by a provider (e.g.
"Cursor HTTP/2 connection failed"withENOTFOUNDon.cause) isn't retried and the session stops.fromErrorwalks thecausechain for a network code (ENOTFOUND,ECONNREFUSED,ETIMEDOUT, ...) and returns a retryableAPIErrorwith that code inmetadata. It stops at an error markedtransient: false/isRetryable: false, so a provider that already gave up isn't retried again.causeof an AI SDKAPICallError. Direct providers (Anthropic, OpenAI) wrap a failed fetch asCannot connect to API: ...with the socket error oncause; before, those got only the default 5 retries.ConnectionRefused,FailedToOpenSocket,ConnectionClosed,ConnectionResetByPeer,ConnectionTimeout) and messages (Unable to connect. Is the computer able to access the url?,Was there a typo in the url or port?). Both are now recognized.retry.ts. I removed its unusedMessageV2import somessage-v2.tscan import it without a cycle.How did you verify your code works?
ENOTFOUNDis retryable, a wrapped error markedtransient: falseis not, and the policy allows 24 retries for network errors.bun test test/session/retry.test.ts test/session/message-v2.test.tsandbun run typecheckpass.cursor-opencode-provider, start a prompt, and turn off Wi-Fi. Before this change the session stops with "Cursor HTTP/2 connection failed". After it, the session shows retry status and continues once you're back online.Screenshots / recordings
N/A
Checklist