Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
test(llm-proxy): require a 768Mi memory request in both proxies
Alfredo Lopezef45b7a1fca5
diff --git a/codex-llm-proxy/test/deployManifest.test.ts b/codex-llm-proxy/test/deployManifest.test.tsindex 54441568b..6c5565088 100644--- a/codex-llm-proxy/test/deployManifest.test.ts+++ b/codex-llm-proxy/test/deployManifest.test.ts@@ -4,8 +4,8 @@ import { CONTROL_API_REQUEST_TIMEOUT_MS } from '../src/controlApiClient.js'import { BODY_READ_DEADLINE_MS, STREAM_LIMITS } from '../src/requestLimits.js'// The base manifest must agree with the limits this process enforces. Each-// check is a relation with a code constant or a recorded measurement, so a-// change on either side that breaks the relation fails here.+// check is a relation with a code constant, a recorded measurement or a+// recorded owner decision, so a change on either side fails here.const MANIFEST = readFileSync(new URL('../../deploy/base/control-plane/codex-llm-proxy.yaml', import.meta.url),@@ -24,6 +24,11 @@ const SHUTDOWN_MARGIN_SECONDS = 20*/const D5_CAPPED_PEAK_RSS_MIB = 790.3const MEMORY_HEADROOM = 1.25+/**+ * Owner decision on review M4 (#739): the request sits near the D5 peak, so a+ * busy node does not schedule the pod on memory it cannot give it under load.+ */+const MEMORY_REQUEST_MIB = 768function activeLines(yaml: string): string[] {return yaml.split('\n').filter((line) => !line.trimStart().startsWith('#'))@@ -74,7 +79,7 @@ describe('codex-llm-proxy base manifest', () => {expect(grace).toBe(Math.ceil(worstCaseMs / 1000) + SHUTDOWN_MARGIN_SECONDS)})- it('T-DEP-2 caps the heap below the memory limit and keeps the limit above the D5 peak', () => {+ it('T-DEP-2 caps the heap below the memory limit, keeps the limit above the D5 peak and requests 768Mi', () => {const nodeOptions = activeLines(MANIFEST).findIndex((line) => /name:\s*NODE_OPTIONS\s*$/.test(line))expect(nodeOptions, 'the container must set NODE_OPTIONS').toBeGreaterThanOrEqual(0)const heap = /--max-old-space-size=(\d+)/.exec(activeLines(MANIFEST)[nodeOptions + 1] ?? '')@@ -82,6 +87,7 @@ describe('codex-llm-proxy base manifest', () => {const limit = resourceMemory('limits')expect(Number(heap![1])).toBeLessThan(limit)expect(resourceMemory('requests')).toBeLessThanOrEqual(limit)+ expect(resourceMemory('requests')).toBe(MEMORY_REQUEST_MIB)expect(limit).toBeGreaterThanOrEqual(Math.ceil(D5_CAPPED_PEAK_RSS_MIB * MEMORY_HEADROOM))})diff --git a/grok-llm-proxy/test/deployManifest.test.ts b/grok-llm-proxy/test/deployManifest.test.tsindex f68cf22cc..fb8a3f3b6 100644--- a/grok-llm-proxy/test/deployManifest.test.ts+++ b/grok-llm-proxy/test/deployManifest.test.ts@@ -4,8 +4,8 @@ import { CONTROL_API_REQUEST_TIMEOUT_MS } from '../src/controlApiClient.js'import { BODY_READ_DEADLINE_MS, STREAM_LIMITS } from '../src/requestLimits.js'// The base manifest must agree with the limits this process enforces. Each-// check is a relation with a code constant or a recorded measurement, so a-// change on either side that breaks the relation fails here.+// check is a relation with a code constant, a recorded measurement or a+// recorded owner decision, so a change on either side fails here.const MANIFEST = readFileSync(new URL('../../deploy/base/control-plane/grok-llm-proxy.yaml', import.meta.url),@@ -29,6 +29,12 @@ const SHUTDOWN_MARGIN_SECONDS = 20*/const D5_CAPPED_PEAK_RSS_MIB = 509.8const MEMORY_HEADROOM = 1.25+/**+ * Owner decision on review M4 (#739): the request equals the limit, so the+ * pod's memory use can never exceed its request and a busy node does not+ * schedule it on memory it cannot give it under load.+ */+const MEMORY_REQUEST_MIB = 768function activeLines(yaml: string): string[] {return yaml.split('\n').filter((line) => !line.trimStart().startsWith('#'))@@ -79,7 +85,7 @@ describe('grok-llm-proxy base manifest', () => {expect(grace).toBe(Math.ceil(worstCaseMs / 1000) + SHUTDOWN_MARGIN_SECONDS)})- it('T-DEP-2 caps the heap below the memory limit and keeps the limit above the D5 peak', () => {+ it('T-DEP-2 caps the heap below the memory limit, keeps the limit above the D5 peak and requests 768Mi', () => {const nodeOptions = activeLines(MANIFEST).findIndex((line) => /name:\s*NODE_OPTIONS\s*$/.test(line))expect(nodeOptions, 'the container must set NODE_OPTIONS').toBeGreaterThanOrEqual(0)const heap = /--max-old-space-size=(\d+)/.exec(activeLines(MANIFEST)[nodeOptions + 1] ?? '')@@ -87,6 +93,7 @@ describe('grok-llm-proxy base manifest', () => {const limit = resourceMemory('limits')expect(Number(heap![1])).toBeLessThan(limit)expect(resourceMemory('requests')).toBeLessThanOrEqual(limit)+ expect(resourceMemory('requests')).toBe(MEMORY_REQUEST_MIB)expect(limit).toBeGreaterThanOrEqual(Math.ceil(D5_CAPPED_PEAK_RSS_MIB * MEMORY_HEADROOM))})diff --git a/scripts/tests/test-codex-llm-proxy-deploy-contract.sh b/scripts/tests/test-codex-llm-proxy-deploy-contract.shindex de355dd12..6e46fc4f6 100755--- a/scripts/tests/test-codex-llm-proxy-deploy-contract.sh+++ b/scripts/tests/test-codex-llm-proxy-deploy-contract.sh@@ -100,7 +100,9 @@ if named_containers != ["codex-llm-proxy"]:# Measured on the shipping design (#739 D5): eight 8 MiB streams, two 24 MiB# visual streams and three queued 8 MiB bodies peaked at 790 MiB of RSS with a# 384 MiB old space and at 886-1009 MiB without it. The capped peak does not fit-# 768Mi; the limit is that peak plus 25 %, rounded up to 1Gi.+# 768Mi; the limit is that peak plus 25 %, rounded up to 1Gi. The request is+# 768Mi (owner decision on review M4), near the peak, so a busy node does not+# schedule the pod on memory it cannot give it under load.memory_limit = re.search(r"limits:\n\s+cpu: \S+\n\s+memory: (\S+)", text)memory_request = re.search(r"requests:\n\s+cpu: \S+\n\s+memory: (\S+)", text)heap_cap = re.search(@@ -108,8 +110,8 @@ heap_cap = re.search()if not memory_limit or memory_limit.group(1) != "1Gi":errors.append("proxy memory limit must be 1Gi")-if not memory_request or memory_request.group(1) != "256Mi":- errors.append("proxy memory request must be 256Mi")+if not memory_request or memory_request.group(1) != "768Mi":+ errors.append("proxy memory request must be 768Mi")if not heap_cap or heap_cap.group(1) != "384":errors.append("proxy must cap the V8 old space at 384 MiB through NODE_OPTIONS")diff --git a/scripts/tests/test-grok-llm-proxy-deploy-contract.sh b/scripts/tests/test-grok-llm-proxy-deploy-contract.shindex f9c617d81..e92e3f21c 100755--- a/scripts/tests/test-grok-llm-proxy-deploy-contract.sh+++ b/scripts/tests/test-grok-llm-proxy-deploy-contract.sh@@ -88,7 +88,9 @@ if "CONTROL_API_INTERNAL_SERVICE_TOKENS" in text:# Eight 8 MiB streams and three queued 8 MiB bodies (#739 D5) peaked at 510 MiB# of RSS with a 384 MiB old space and at 480-511 MiB with an uncapped heap. That# is past the former 256Mi limit and under 768Mi, so the pod gets a 768Mi limit-# and the same heap cap as codex-llm-proxy (whose visual slots need 1Gi).+# and the same heap cap as codex-llm-proxy (whose visual slots need 1Gi). The+# request equals the limit (owner decision on review M4), so a busy node does not+# schedule the pod on memory it cannot give it under load.memory_limit = re.search(r"limits:\n\s+cpu: \S+\n\s+memory: (\S+)", text)memory_request = re.search(r"requests:\n\s+cpu: \S+\n\s+memory: (\S+)", text)heap_cap = re.search(@@ -96,8 +98,8 @@ heap_cap = re.search()if not memory_limit or memory_limit.group(1) != "768Mi":errors.append("proxy memory limit must be 768Mi")-if not memory_request or memory_request.group(1) != "256Mi":- errors.append("proxy memory request must be 256Mi")+if not memory_request or memory_request.group(1) != "768Mi":+ errors.append("proxy memory request must be 768Mi")if not heap_cap or heap_cap.group(1) != "384":errors.append("proxy must cap the V8 old space at 384 MiB through NODE_OPTIONS")