chainBrokenClassification recognizes the OpenAI error "Previous response with id ... not found" returned when a chained turn references a previous_response_id the provider no longer recognizes.
( lowerMessage string, provider string, statusCode int, structured providerErrorDetails, )
| 373 | // chained turn references a previous_response_id the provider no |
| 374 | // longer recognizes. |
| 375 | func chainBrokenClassification( |
| 376 | lowerMessage string, |
| 377 | provider string, |
| 378 | statusCode int, |
| 379 | structured providerErrorDetails, |
| 380 | ) (ClassifiedError, bool) { |
| 381 | if !(strings.Contains(lowerMessage, "previous response with id") && |
| 382 | strings.Contains(lowerMessage, "not found")) { |
| 383 | return ClassifiedError{}, false |
| 384 | } |
| 385 | // This class of error has so far only been observed with OpenAI. |
| 386 | if provider == "" { |
| 387 | provider = "openai" |
| 388 | } |
| 389 | return normalizeClassification(ClassifiedError{ |
| 390 | Detail: structured.detail, |
| 391 | Kind: codersdk.ChatErrorKindGeneric, |
| 392 | Provider: provider, |
| 393 | Retryable: true, |
| 394 | StatusCode: statusCode, |
| 395 | RetryAfter: structured.retryAfter, |
| 396 | ChainBroken: true, |
| 397 | }), true |
| 398 | } |
| 399 | |
| 400 | func responsesAPIDiagnostic(lowerMessage, detail string) (string, bool) { |
| 401 | lowerDetail := strings.ToLower(detail) |
no test coverage detected