fix(model-error-classifier): mark OpenAI server_error patterns as retryable (fixes #3799)
OpenAI streaming responses can surface mid-stream errors with type 'server_error' or with the prose message 'An error occurred while processing your request'. Neither matched any entry in RETRYABLE_MESSAGE_PATTERNS, so shouldRetryError returned false and the runtime-fallback / fallback-retry code paths skipped retry. The result was that GPT-5.5 subagent (and main) turns silently stalled until the stale timeout fired. The maintainer's diagnosis on issue #3799 explicitly recommends adding these two patterns to model-error-classifier.ts; this commit does exactly that and adds two regression tests covering the JSON envelope and the prose form.
This commit is contained in:
@@ -434,6 +434,34 @@ describe("model-error-classifier", () => {
|
||||
//#then
|
||||
expect(result).toBe(true)
|
||||
})
|
||||
|
||||
test("treats OpenAI streaming server_error envelopes as retryable (issue #3799)", () => {
|
||||
//#given: OpenAI surfaces its mid-stream error with type 'server_error'
|
||||
const error = {
|
||||
name: undefined,
|
||||
message: "{\"error\":{\"type\":\"server_error\",\"message\":\"server_error\"}}",
|
||||
}
|
||||
|
||||
//#when
|
||||
const result = shouldRetryError(error)
|
||||
|
||||
//#then
|
||||
expect(result).toBe(true)
|
||||
})
|
||||
|
||||
test("treats the OpenAI prose 'An error occurred while processing' message as retryable (issue #3799)", () => {
|
||||
//#given: the human-readable prose surfaced when OpenAI's stream fails
|
||||
const error = {
|
||||
name: undefined,
|
||||
message: "An error occurred while processing your request. Please try again later.",
|
||||
}
|
||||
|
||||
//#when
|
||||
const result = shouldRetryError(error)
|
||||
|
||||
//#then
|
||||
expect(result).toBe(true)
|
||||
})
|
||||
})
|
||||
|
||||
export {}
|
||||
|
||||
Reference in New Issue
Block a user