Skip to content

Commit 5a99681

Browse files
committed
fix(openai): bound chatgpt error parsing
1 parent ceb723b commit 5a99681

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

src/llm/providers/openai-chatgpt-responses.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -606,7 +606,8 @@ describe("streamOpenAICodexResponses transport", () => {
606606
expect(result.errorMessage).toContain("usage limit");
607607
expect(result.errorMessage?.length).toBeLessThanOrEqual(16 * 1024);
608608
expect(canceled).toBe(true);
609-
expect(pullCount).toBe(1);
609+
expect(pullCount).toBeGreaterThanOrEqual(1);
610+
expect(pullCount).toBeLessThanOrEqual(3);
610611
expect(fetchMock).toHaveBeenCalledTimes(1);
611612
});
612613
});

src/llm/providers/openai-chatgpt-responses.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1589,7 +1589,7 @@ async function readChatGptResponsesErrorTextLimited(response: Response): Promise
15891589
async function parseErrorResponse(
15901590
response: Response,
15911591
): Promise<{ message: string; friendlyMessage?: string }> {
1592-
const raw = await response.text();
1592+
const raw = await readChatGptResponsesErrorTextLimited(response);
15931593
let message = raw || response.statusText || "Request failed";
15941594
let friendlyMessage: string | undefined;
15951595

0 commit comments

Comments
 (0)