Skip to content

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

TypeScript

fix(llm-proxy): keep the visual budget above the body budget at startup

Alfredo Lopezee733217fe9b
diff --git a/codex-llm-proxy/src/config.ts b/codex-llm-proxy/src/config.ts
index 32f773920..43bc42e72 100644
--- a/codex-llm-proxy/src/config.ts
+++ b/codex-llm-proxy/src/config.ts
@@ -89,6 +89,14 @@ export function loadConfig(env: NodeJS.ProcessEnv = process.env): CodexLlmProxyC
if (maxVisualBodyBytes < LIMITS.maxVisualRequestBodyBytes) {
throw new Error('Visual Codex requests require the full shared envelope byte budget')
}
+ // Y2 — an equal or lower budget would collapse visual admission into the
+ // ordinary parser's cap, so the visual gate's separate accounting would
+ // never engage.
+ if (maxVisualBodyBytes <= maxBodyBytes) {
+ throw new Error(
+ 'CODEX_LLM_PROXY_MAX_VISUAL_BODY_BYTES must be greater than CODEX_LLM_PROXY_MAX_BODY_BYTES'
+ )
+ }
return {
runtimePort: requiredPositiveInt(
'CODEX_LLM_PROXY_RUNTIME_PORT',
diff --git a/grok-llm-proxy/src/config.ts b/grok-llm-proxy/src/config.ts
index 0b8de4f61..b11d80e9b 100644
--- a/grok-llm-proxy/src/config.ts
+++ b/grok-llm-proxy/src/config.ts
@@ -93,6 +93,14 @@ export function loadConfig(env: NodeJS.ProcessEnv = process.env): GrokLlmProxyCo
`GROK_LLM_PROXY_MAX_VISUAL_BODY_BYTES must be at least ${LIMITS.maxVisualRequestBodyBytes}, the contract maxVisualRequestBodyBytes`
)
}
+ // Y2 — an equal or lower budget would collapse visual admission into the
+ // ordinary parser's cap, so the visual gate's separate accounting would
+ // never engage.
+ if (maxVisualBodyBytes <= maxBodyBytes) {
+ throw new Error(
+ 'GROK_LLM_PROXY_MAX_VISUAL_BODY_BYTES must be greater than GROK_LLM_PROXY_MAX_BODY_BYTES'
+ )
+ }
return {
runtimePort: requiredPositiveInt(
'GROK_LLM_PROXY_RUNTIME_PORT',