Skip to content

Add Retry to Stream Errors#265

Merged
sfreeman422 merged 2 commits into
masterfrom
feature/make-transient-retriable
Jun 23, 2026
Merged

Add Retry to Stream Errors#265
sfreeman422 merged 2 commits into
masterfrom
feature/make-transient-retriable

Conversation

@sfreeman422

Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI review requested due to automatic review settings June 23, 2026 18:45

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds broader retry classification for transient transport-layer failures in ResilientOpenAIClient, aimed at improving resilience when OpenAI calls fail due to stream/connection issues (e.g., “Premature close”).

Changes:

  • Refactors retry classification to detect network/transport failures via a new hasRetriableNetworkSignal() helper that inspects error message/name/code and follows cause chains.
  • Keeps existing retry behavior for TIMEOUT (ResilientOpenAIError) and HTTP status-based retriable errors (429 / 5xx).
  • Adds a regression test ensuring a FetchError with “Premature close” triggers a retry and succeeds.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
packages/backend/src/lib/resilientOpenAIClient.ts Introduces hasRetriableNetworkSignal() and routes network/transport retry detection through it.
packages/backend/src/lib/resilientOpenAIClient.spec.ts Adds test coverage for retrying transient “Premature close” fetch/stream failures.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 4 changed files in this pull request and generated no new comments.

@sfreeman422 sfreeman422 merged commit 675748b into master Jun 23, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants