Skip to content

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

TypeScript

refactor(llm-proxy): drop the test-only in-flight body byte budget (#739)

Alfredo Lopez4e6bf6f0ab0a
diff --git a/codex-llm-proxy/src/requestLimits.ts b/codex-llm-proxy/src/requestLimits.ts
index 5c5dcf052..df6618220 100644
--- a/codex-llm-proxy/src/requestLimits.ts
+++ b/codex-llm-proxy/src/requestLimits.ts
@@ -39,9 +39,6 @@ export const IN_FLIGHT_BODY_BUDGET_BODIES = 3
*/
export const BODY_READ_DEADLINE_MS = 10_000
-/** The deployed admission budget in bytes: about 24 MiB of declared bodies. */
-export const IN_FLIGHT_BODY_BUDGET_BYTES = IN_FLIGHT_BODY_BUDGET_BODIES * DEFAULT_MAX_BODY_BYTES
-
export const STREAM_LIMITS = {
maxConcurrentStreams: 8,
maxQueuedRequests: 16,
diff --git a/codex-llm-proxy/test/bodyBudget.test.ts b/codex-llm-proxy/test/bodyBudget.test.ts
index 04d4cae1d..b8b18f7da 100644
--- a/codex-llm-proxy/test/bodyBudget.test.ts
+++ b/codex-llm-proxy/test/bodyBudget.test.ts
@@ -1,15 +1,5 @@
import { describe, expect, it } from 'vitest'
-import { readFileSync } from 'node:fs'
-import { dirname, join } from 'node:path'
-import { fileURLToPath } from 'node:url'
-import {
- BodyBudget,
- DEFAULT_MAX_BODY_BYTES,
- IN_FLIGHT_BODY_BUDGET_BYTES,
- RequestLimitError,
-} from '../src/requestLimits.js'
-
-const here = dirname(fileURLToPath(import.meta.url))
+import { BodyBudget, RequestLimitError } from '../src/requestLimits.js'
async function isPending(promise: Promise<unknown>): Promise<boolean> {
const marker = Symbol('pending')
@@ -77,19 +67,4 @@ describe('BodyBudget (#731 R3-2)', () => {
await budget.acquire(10)
expect(budget.inFlightBytes).toBe(10)
})
-
- it('T-R3-2h sizes the deployed budget at three bodies and keeps five copies of it under the pod limit', () => {
- expect(IN_FLIGHT_BODY_BUDGET_BYTES).toBe(3 * DEFAULT_MAX_BODY_BYTES)
- const manifest = readFileSync(
- join(here, '../../deploy/base/control-plane/codex-llm-proxy.yaml'),
- 'utf8'
- )
- const limit = /limits:\s*\n\s*cpu:[^\n]*\n\s*memory:\s*(\d+)Mi/.exec(manifest)
- expect(limit, 'codex-llm-proxy.yaml must declare a memory limit in Mi').not.toBeNull()
- const podLimitBytes = Number(limit![1]) * 1024 * 1024
- // About five copies of each body are alive while it is parsed and hashed:
- // the raw buffer, the decoded string, the parsed object, the contract copy
- // and the canonical serialization used for the hash.
- expect(5 * IN_FLIGHT_BODY_BUDGET_BYTES).toBeLessThan(podLimitBytes)
- })
})
diff --git a/grok-llm-proxy/src/requestLimits.ts b/grok-llm-proxy/src/requestLimits.ts
index c3055f446..f6467b90c 100644
--- a/grok-llm-proxy/src/requestLimits.ts
+++ b/grok-llm-proxy/src/requestLimits.ts
@@ -37,9 +37,6 @@ export const IN_FLIGHT_BODY_BUDGET_BODIES = 3
*/
export const BODY_READ_DEADLINE_MS = 10_000
-/** The deployed admission budget in bytes: about 24 MiB of declared bodies. */
-export const IN_FLIGHT_BODY_BUDGET_BYTES = IN_FLIGHT_BODY_BUDGET_BODIES * DEFAULT_MAX_BODY_BYTES
-
export const STREAM_LIMITS = {
maxConcurrentStreams: 8,
maxQueuedRequests: 16,
diff --git a/grok-llm-proxy/test/bodyBudget.test.ts b/grok-llm-proxy/test/bodyBudget.test.ts
index 06a57a33d..c4878ebd9 100644
--- a/grok-llm-proxy/test/bodyBudget.test.ts
+++ b/grok-llm-proxy/test/bodyBudget.test.ts
@@ -1,15 +1,5 @@
import { describe, expect, it } from 'vitest'
-import { readFileSync } from 'node:fs'
-import { dirname, join } from 'node:path'
-import { fileURLToPath } from 'node:url'
-import {
- BodyBudget,
- DEFAULT_MAX_BODY_BYTES,
- IN_FLIGHT_BODY_BUDGET_BYTES,
- RequestLimitError,
-} from '../src/requestLimits.js'
-
-const here = dirname(fileURLToPath(import.meta.url))
+import { BodyBudget, RequestLimitError } from '../src/requestLimits.js'
async function isPending(promise: Promise<unknown>): Promise<boolean> {
const marker = Symbol('pending')
@@ -77,19 +67,4 @@ describe('BodyBudget (#731 R3-2)', () => {
await budget.acquire(10)
expect(budget.inFlightBytes).toBe(10)
})
-
- it('T-R3-2h-grok sizes the deployed budget at three bodies and keeps five copies of it under the pod limit', () => {
- expect(IN_FLIGHT_BODY_BUDGET_BYTES).toBe(3 * DEFAULT_MAX_BODY_BYTES)
- const manifest = readFileSync(
- join(here, '../../deploy/base/control-plane/grok-llm-proxy.yaml'),
- 'utf8'
- )
- const limit = /limits:\s*\n\s*cpu:[^\n]*\n\s*memory:\s*(\d+)Mi/.exec(manifest)
- expect(limit, 'grok-llm-proxy.yaml must declare a memory limit in Mi').not.toBeNull()
- const podLimitBytes = Number(limit![1]) * 1024 * 1024
- // About five copies of each body are alive while it is parsed and hashed:
- // the raw buffer, the decoded string, the parsed object, the contract copy
- // and the canonical serialization used for the hash.
- expect(5 * IN_FLIGHT_BODY_BUDGET_BYTES).toBeLessThan(podLimitBytes)
- })
})