Skip to content

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

TypeScript

fix(grok-llm-proxy): name the visual body variable and register the #806 suites in T0

Alfredo Lopez589406f3b978
diff --git a/deploy/base/control-plane/grok-llm-proxy.yaml b/deploy/base/control-plane/grok-llm-proxy.yaml
index 6813ea39c..420aa0b23 100644
--- a/deploy/base/control-plane/grok-llm-proxy.yaml
+++ b/deploy/base/control-plane/grok-llm-proxy.yaml
@@ -87,7 +87,7 @@ spec:
# Caps V8's old space well under the 1Gi limit, so heap growth
# is bounded and collected before the kernel kills the pod. The
# cap does not lower the peak: with eight 8 MiB streams and three
- # queued 8 MiB bodies (#739 D5), RSS measured 510 MiB with it and
+ # queued 8 MiB bodies (#739 D5), RSS measured 511 MiB with it and
# 480-511 MiB without it. One ~36 MB V2 stream in the visual slot
# on top of that load (#784) raised the capped peak to 775 MiB.
- name: NODE_OPTIONS
diff --git a/desktop-app/ui/src/constants/attachments.ts b/desktop-app/ui/src/constants/attachments.ts
index e2659d8cb..eca78062d 100644
--- a/desktop-app/ui/src/constants/attachments.ts
+++ b/desktop-app/ui/src/constants/attachments.ts
@@ -41,7 +41,7 @@ export type ComposerImageBudget = {
maxImageBytes: number
/** `null` → no composer aggregate; the Codex hop owns that ceiling. */
maxTotalBase64Bytes: number | null
- /** `null` → no composer pixel bound (general models). */
+ /** `null` → no composer pixel bound (Grok and general models). */
maxDimension: number | null
sizeUnit: 'MB' | 'MiB'
}
diff --git a/grok-llm-proxy/src/config.ts b/grok-llm-proxy/src/config.ts
index 75ff45088..0b8de4f61 100644
--- a/grok-llm-proxy/src/config.ts
+++ b/grok-llm-proxy/src/config.ts
@@ -89,7 +89,9 @@ export function loadConfig(env: NodeJS.ProcessEnv = process.env): GrokLlmProxyCo
LIMITS.maxVisualRequestBodyBytes
)
if (maxVisualBodyBytes < LIMITS.maxVisualRequestBodyBytes) {
- throw new Error('Visual Grok requests require the full shared envelope byte budget')
+ throw new Error(
+ `GROK_LLM_PROXY_MAX_VISUAL_BODY_BYTES must be at least ${LIMITS.maxVisualRequestBodyBytes}, the contract maxVisualRequestBodyBytes`
+ )
}
return {
runtimePort: requiredPositiveInt(
diff --git a/grok-llm-proxy/src/requestLimits.ts b/grok-llm-proxy/src/requestLimits.ts
index 2412d4cda..5bae29166 100644
--- a/grok-llm-proxy/src/requestLimits.ts
+++ b/grok-llm-proxy/src/requestLimits.ts
@@ -23,9 +23,9 @@ export const DEFAULT_MAX_BODY_BYTES = CONTRACT_LIMITS.maxRequestBodyBytes + ENVE
* bodies in.
* Bodies over the ordinary cap never take this budget: they are V2 visual
* envelopes, bounded by `visualStreamGate` instead. With eight 8 MiB streams
- * and three queued 8 MiB bodies (#739 D5) the process peaked at 510 MiB of
- * RSS with `--max-old-space-size=384` and at 480-511 MiB with an uncapped
- * heap. That is past the former 256Mi limit, which is why the deployment sets
+ * and three queued 8 MiB bodies (#739 D5) the process peaked at 511 MiB of
+ * RSS with `--max-old-space-size=384` (#739 measured 509.8) and at 480-511
+ * MiB with an uncapped heap. That is past the former 256Mi limit, which is why the deployment sets
* that cap. The full load the gates admit adds one visual stream; see
* `VISUAL_STREAM_LIMITS` for that peak and the memory limit it sets.
*/
diff --git a/grok-llm-proxy/test/bodyAdmission.test.ts b/grok-llm-proxy/test/bodyAdmission.test.ts
index 5673401cf..83200587b 100644
--- a/grok-llm-proxy/test/bodyAdmission.test.ts
+++ b/grok-llm-proxy/test/bodyAdmission.test.ts
@@ -3,9 +3,10 @@
*
* At an 8 MiB request cap, the stream gate alone would let 24 bodies in (8
* running plus 16 queued). Eleven bodies in flight (eight streams, three
- * queued; #739 D5) already peaked at 510 MiB of RSS with the heap capped, so
- * 24 would not fit the proxy's 1Gi limit by that ratio (not measured at 24). These tests drive the real runtime app over HTTP and use
- * the control-api `redeem` call as the witness: it runs only after the whole
+ * queued; #739 D5) already peaked at 511 MiB of RSS with the heap capped, so
+ * 24 would not fit the proxy's 1Gi limit by that ratio (not measured at 24).
+ * These tests drive the real runtime app over HTTP and use the control-api
+ * `redeem` call as the witness: it runs only after the whole
* body was read, JSON-parsed, contract-parsed and hash-checked, so the number
* of attempts held there is the number of bodies in memory.
*/
diff --git a/grok-llm-proxy/test/deployManifest.test.ts b/grok-llm-proxy/test/deployManifest.test.ts
index 0ff4f0a43..ac5ed9364 100644
--- a/grok-llm-proxy/test/deployManifest.test.ts
+++ b/grok-llm-proxy/test/deployManifest.test.ts
@@ -24,12 +24,14 @@ const WORKFLOW_RECIPES = readFileSync(
/** Headroom between the last in-flight request finishing and SIGKILL. */
const SHUTDOWN_MARGIN_SECONDS = 20
/**
- * D5 (#739) plus the visual slot (#784): peak RSS with eight 8 MiB streams,
- * one ~36 MB V2 stream (a 20 MiB PNG and 8 MiB of text) and three queued
- * 8 MiB bodies, heap capped at 384 MiB (tsc build, one process, upstream
- * request through undici). D5 alone measured 511 MiB (#739: 509.8).
+ * The larger of the two measured peaks, both with the heap capped at 384 MiB
+ * (tsc build, one process, upstream request through undici):
+ * - D5 (#739): eight 8 MiB streams and three queued 8 MiB bodies, 511 MiB
+ * (#739 measured 509.8);
+ * - D5 plus the visual slot (#784): the same load and one ~36 MB V2 stream
+ * (a 20 MiB PNG and 8 MiB of text), 775.4 MiB.
*/
-const D5_CAPPED_PEAK_RSS_MIB = 775.4
+const CAPPED_PEAK_RSS_MIB = 775.4
const MEMORY_HEADROOM = 1.25
/**
* Owner decision on review M4 (#739): the request sits near the D5 peak, so a
@@ -95,7 +97,7 @@ describe('grok-llm-proxy base manifest', () => {
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))
+ expect(limit).toBeGreaterThanOrEqual(Math.ceil(CAPPED_PEAK_RSS_MIB * MEMORY_HEADROOM))
})
it('T-DEP-3 keeps the Grok subscription off in base, as keyper-labs/evenfire-infra CI requires', () => {
diff --git a/scripts/tests/test-grok-llm-proxy-deploy-contract.sh b/scripts/tests/test-grok-llm-proxy-deploy-contract.sh
index a6d777fae..25c1ed648 100755
--- a/scripts/tests/test-grok-llm-proxy-deploy-contract.sh
+++ b/scripts/tests/test-grok-llm-proxy-deploy-contract.sh
@@ -85,8 +85,8 @@ if "DATABASE_URL" in text or "POSTGRES" in text:
if "CONTROL_API_INTERNAL_SERVICE_TOKENS" in text:
errors.append("proxy must not receive the full token map")
-# Eight 8 MiB streams and three queued 8 MiB bodies (#739 D5) peaked at 510 MiB
-# of RSS with a 384 MiB old space. One ~36 MB V2 stream in the visual slot
+# Eight 8 MiB streams and three queued 8 MiB bodies (#739 D5) peaked at 511 MiB
+# of RSS with a 384 MiB old space (#739 measured 509.8). One ~36 MB V2 stream in the visual slot
# (#784) on top of that load peaked at 775 MiB, past 768Mi; the limit is that
# peak plus 25 %, rounded up to 1Gi, as on codex-llm-proxy. The request is
# 768Mi (owner decision on review M4), near the peak, so a busy node does not
diff --git a/scripts/tests/test-grok-subscription-t0.sh b/scripts/tests/test-grok-subscription-t0.sh
index 0a5a3ed5d..fcf5b0f86 100755
--- a/scripts/tests/test-grok-subscription-t0.sh
+++ b/scripts/tests/test-grok-subscription-t0.sh
@@ -285,11 +285,17 @@ require_real_pg_suite "control-api/test/services.grokProviderAttemptRedemption.r
require_real_pg_suite "control-api/test/services.grokProviderAttemptRedemption.refresh.realPostgres.integration.test.ts"
require_real_pg_suite "control-api/test/pluginWorkloadSdkGrokDualLedger.realPostgres.integration.test.ts"
require_real_pg_suite "control-api/test/db.llmProviderAttemptConnectionIntegrity.realPostgres.integration.test.ts"
+# Shared with Codex; it holds the Grok V2 envelope rollback twin (#784).
+require_real_pg_suite "control-api/test/services.llmProviderAttemptAuthorization.realPostgres.integration.test.ts"
run_group "mcp-host grok" "mcp-host" \
"src/llm/__tests__/grokSubscription.test.ts" \
"src/llm/__tests__/attachmentBudgetRefusal.test.ts" \
"src/llm/__tests__/grokLlmProxyClient.test.ts" \
+ "src/llm/__tests__/imageInput.test.ts" \
+ "src/llm/__tests__/providerAttemptAuthorizer.test.ts" \
+ "src/core/adapters/__tests__/llmImageCompatibility.test.ts" \
+ "src/agent/__tests__/taskExecutor.test.ts" \
"src/llm/__tests__/grokPolicyBinding.test.ts" \
"src/llm/__tests__/subscriptionRequestHash.test.ts" \
"src/llm/__tests__/registry.test.ts" \