Skip to content

Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure

TypeScript

test(llm-proxies): pin the Retry-After bounds of an upstream 429 (#720)

Alfredo Lopezb18344209e5c
diff --git a/codex-llm-proxy/test/codexTransport.conformance.test.ts b/codex-llm-proxy/test/codexTransport.conformance.test.ts
index b9d92397f..4f8881b94 100644
--- a/codex-llm-proxy/test/codexTransport.conformance.test.ts
+++ b/codex-llm-proxy/test/codexTransport.conformance.test.ts
@@ -1632,6 +1632,20 @@ describe('streamCodexCompletion', () => {
}
})
+ // Review round 2 L7: both ends of 1..3600 are valid.
+ it('G1-1d carries a Retry-After of exactly 1 or 3600 seconds', async () => {
+ for (const seconds of [1, 3600]) {
+ const err = await streamWith(
+ () =>
+ new Response('slow down', { status: 429, headers: { 'retry-after': String(seconds) } })
+ ).pending.catch((caught: unknown) => caught)
+ expect(err, `retry-after=${seconds}`).toMatchObject({
+ code: 'rate_limited',
+ details: { retryAfterSeconds: seconds },
+ })
+ }
+ })
+
it('G1-1c keeps an upstream 503 as provider_unavailable, Retry-After or not', async () => {
const err = await streamWith(
() => new Response('busy', { status: 503, headers: { 'retry-after': '7' } })
diff --git a/grok-llm-proxy/test/grokTransport.conformance.test.ts b/grok-llm-proxy/test/grokTransport.conformance.test.ts
index 8869cf53c..5f50adf4d 100644
--- a/grok-llm-proxy/test/grokTransport.conformance.test.ts
+++ b/grok-llm-proxy/test/grokTransport.conformance.test.ts
@@ -1636,6 +1636,20 @@ describe('streamGrokCompletion', () => {
}
})
+ // Review round 2 L7: both ends of 1..3600 are valid.
+ it('G1-1d carries a Retry-After of exactly 1 or 3600 seconds', async () => {
+ for (const seconds of [1, 3600]) {
+ const err = await streamWith(
+ () =>
+ new Response('slow down', { status: 429, headers: { 'retry-after': String(seconds) } })
+ ).pending.catch((caught: unknown) => caught)
+ expect(err, `retry-after=${seconds}`).toMatchObject({
+ code: 'rate_limited',
+ details: { retryAfterSeconds: seconds },
+ })
+ }
+ })
+
it('G1-1c keeps an upstream 503 as provider_unavailable, Retry-After or not', async () => {
const err = await streamWith(
() => new Response('busy', { status: 503, headers: { 'retry-after': '7' } })