fix(FN-LOCAL): refresh docs and retry codex server errors
This commit is contained in:
@@ -92,6 +92,11 @@ describe("Transient Error Detector", () => {
|
||||
expect(isTransientError("OPERATION WAS ABORTED")).toBe(true);
|
||||
});
|
||||
|
||||
it("matches OpenAI/Codex structured server_error payloads", () => {
|
||||
const message = `Codex error: {"type":"error","error":{"type":"server_error","code":"server_error","message":"An error occurred while processing your request. You can retry your request, or contact us through our help center at help.openai.com if the error persists. Please include the request ID 9349dabf-bcb7-4c36-aa40-f645dd04a472 in your message.","param":null},"sequence_number":2}`;
|
||||
expect(isTransientError(message)).toBe(true);
|
||||
});
|
||||
|
||||
it("does NOT match user-initiated 'operation was aborted by user'", () => {
|
||||
expect(isTransientError("The operation was aborted by user")).toBe(false);
|
||||
expect(isTransientError("operation was aborted by the signal")).toBe(false);
|
||||
@@ -165,6 +170,11 @@ describe("Transient Error Detector", () => {
|
||||
expect(classifyError("request was aborted")).toBe("transient");
|
||||
});
|
||||
|
||||
it("classifies OpenAI/Codex server_error payloads as 'transient'", () => {
|
||||
const message = `Codex error: {"type":"error","error":{"type":"server_error","code":"server_error","message":"An error occurred while processing your request. You can retry your request, or contact us through our help center at help.openai.com if the error persists. Please include the request ID 9349dabf-bcb7-4c36-aa40-f645dd04a472 in your message.","param":null},"sequence_number":2}`;
|
||||
expect(classifyError(message)).toBe("transient");
|
||||
});
|
||||
|
||||
it("classifies 'Request was aborted' as 'transient', not 'usage-limit'", () => {
|
||||
// Ensure abort errors are classified as transient, not usage-limit
|
||||
expect(classifyError("Request was aborted")).toBe("transient");
|
||||
|
||||
@@ -28,6 +28,7 @@ import { isUsageLimitError } from "./usage-limit-detector.js";
|
||||
* - Socket errors (socket hang up)
|
||||
* - Transport layer failures
|
||||
* - AI provider abort errors (request was aborted — temporary streaming/API cancellations)
|
||||
* - OpenAI/Codex infrastructure errors surfaced as structured `server_error` payloads
|
||||
*/
|
||||
export const TRANSIENT_ERROR_PATTERNS: RegExp[] = [
|
||||
// Proxy/gateway errors - indicate temporary routing issues
|
||||
@@ -56,6 +57,13 @@ export const TRANSIENT_ERROR_PATTERNS: RegExp[] = [
|
||||
// AbortController when a provider drops an in-flight operation. Excludes user-
|
||||
// initiated cancellations like "operation was aborted by user" — those are not transient.
|
||||
/operation was aborted(?!\s+by\b)/i,
|
||||
|
||||
// OpenAI/Codex structured infrastructure failures. These arrive as JSON-ish payloads
|
||||
// like {"type":"error","error":{"type":"server_error","code":"server_error",...}}
|
||||
// and are temporary service-side failures rather than task-specific defects.
|
||||
/"type":"server_error"/i,
|
||||
/"code":"server_error"/i,
|
||||
/An error occurred while processing your request\./i,
|
||||
];
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user