fix: retry server_is_overloaded for OpenAI Responses stream failures#3040
Merged
tusharmath merged 7 commits intomainfrom Apr 17, 2026
Merged
fix: retry server_is_overloaded for OpenAI Responses stream failures#3040tusharmath merged 7 commits intomainfrom
tusharmath merged 7 commits intomainfrom
Conversation
Preserve structured OpenAI Responses response.failed errors so retry logic can classify server_is_overloaded as retryable. Also keep transport code matching centralized via TRANSPORT_ERROR_CODES and add regression tests. Co-Authored-By: ForgeCode <noreply@forgecode.dev>
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.
Summary
Make OpenAI Responses stream overload failures retryable by preserving structured upstream error codes and classifying
server_is_overloadedas retryable.Context
OpenAI Responses streaming failures were being surfaced as formatted strings (
Upstream response failed: ...), which dropped structured provider error metadata. Because of that, retry classification could not reliably identify theserver_is_overloadedcode from stream failures and the request was not retried.Changes
response.failedstream errors as structured OpenAI DTO errors instead of debug-only strings.server_is_overloaded.TRANSPORT_ERROR_CODES.Key Implementation Details
into_response_failed_error(...)to convertResponseFailedEventintoforge_app::dto::openai::Error::Response, retainingcodeandmessagefields from upstream payloads.ResponseFailedevents.RetryableApiErrorCodeclassifier and recursive code lookup through nested OpenAI error payloads.server_is_overloaded) and transport constant usage (TRANSPORT_ERROR_CODES).Use Cases
code: "server_is_overloaded"message: "Our servers are currently overloaded. Please try again later."then Forge now marks the failure as retryable.
ERR_STREAM_PREMATURE_CLOSE,ECONNRESET, andETIMEDOUTremains intact.Testing
Links