fix(codex): cap responses request timeout delays · openclaw/openclaw@e5845dd
steipete
·
2026-05-30
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
|
1 | 1 | import { afterEach, describe, expect, it, vi } from "vitest"; |
| 2 | +import { MAX_TIMER_TIMEOUT_MS } from "../../shared/number-coercion.js"; |
2 | 3 | import type { Context, Model } from "../types.js"; |
3 | 4 | import { |
4 | 5 | extractOpenAICodexAccountId, |
@@ -149,6 +150,25 @@ describe("streamOpenAICodexResponses transport", () => {
|
149 | 150 | expect(result.errorMessage).toContain("Request timed out after 5ms"); |
150 | 151 | }); |
151 | 152 | |
| 153 | +it("caps oversized timeoutMs before creating request abort signals", async () => { |
| 154 | +stubHangingFetch(MAX_TIMER_TIMEOUT_MS); |
| 155 | + |
| 156 | +const stream = streamOpenAICodexResponses(model, context, { |
| 157 | +apiKey: createJwt({ |
| 158 | +"https://api.openai.com/auth": { |
| 159 | +chatgpt_account_id: "acct-1", |
| 160 | +}, |
| 161 | +}), |
| 162 | +timeoutMs: Number.MAX_SAFE_INTEGER, |
| 163 | +transport: "sse", |
| 164 | +}); |
| 165 | + |
| 166 | +const result = await stream.result(); |
| 167 | + |
| 168 | +expect(result.stopReason).toBe("error"); |
| 169 | +expect(result.errorMessage).toContain(`Request timed out after ${MAX_TIMER_TIMEOUT_MS}ms`); |
| 170 | +}); |
| 171 | + |
152 | 172 | it("honors timeoutMs for default websocket transport requests", async () => { |
153 | 173 | stubTimeoutSignal(5); |
154 | 174 | const fetchMock = vi.fn(async () => { |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。