Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
test(codex): stop encoding a 1 MiB authorize hop
Alfredo Lopez0cdccbd17de1
diff --git a/control-api/package-lock.json b/control-api/package-lock.jsonindex 997496ac6..4d871b0c3 100644--- a/control-api/package-lock.json+++ b/control-api/package-lock.json@@ -1,12 +1,12 @@{"name": "clerum-control-api",- "version": "0.1.554",+ "version": "0.1.555","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "clerum-control-api",- "version": "0.1.554",+ "version": "0.1.555","dependencies": {"@clerum/display-field": "file:../packages/display-field","@clerum/image-policy": "file:../packages/image-policy",diff --git a/control-api/package.json b/control-api/package.jsonindex 4a60ece3d..2dcf0f57a 100644--- a/control-api/package.json+++ b/control-api/package.json@@ -1,6 +1,6 @@{"name": "clerum-control-api",- "version": "0.1.554",+ "version": "0.1.555","description": "Internal Clerum control plane REST API + UI for managing CRDs and secrets","main": "dist/main.js","engines": {diff --git a/control-api/test/network.gateway.intent.test.ts b/control-api/test/network.gateway.intent.test.tsindex aa7ab77d0..b9358e863 100644--- a/control-api/test/network.gateway.intent.test.ts+++ b/control-api/test/network.gateway.intent.test.ts@@ -369,6 +369,23 @@ describe('network/gateway intent (manifest-level)', () => {expect(gatewayConf).not.toContain('/api/v1/external/')})+ it('keeps the Codex authorize route at the 24MiB visual envelope', () => {+ const configmaps = read(`${BASE}/control-plane/configmaps.yaml`)+ const gatewayConf = docContaining(yamlDocs(configmaps), 'name: nginx-workflow-approval-gateway')+ const authorize = locationBlock(+ gatewayConf,+ 'location = /api/v1/mcp-host/llm/provider-attempts/authorize'+ )+ expect(authorize).toContain('client_max_body_size 25165824;')+ expect(gatewayConf.match(/client_max_body_size/g)).toHaveLength(1)+ })++ it('pins the shipped Codex proxy visual envelope to 24MiB', () => {+ const proxy = read(`${BASE}/control-plane/codex-llm-proxy.yaml`)+ expect(proxy).toContain('CODEX_LLM_PROXY_MAX_BODY_BYTES: "1048576"')+ expect(proxy).toContain('CODEX_LLM_PROXY_MAX_VISUAL_BODY_BYTES: "25165824"')+ })+it('keeps the profile-control-funnel body cap at gfsc write-cap parity (24MiB)', () => {const configmaps = read(`${BASE}/profiles/configmaps.yaml`)const funnelConf = docContaining(yamlDocs(configmaps), 'name: profile-control-funnel-nginx')diff --git a/control-api/test/routes.mcp-host.llmProviderAttempts.test.ts b/control-api/test/routes.mcp-host.llmProviderAttempts.test.tsindex 7fba48636..dd8c0f452 100644--- a/control-api/test/routes.mcp-host.llmProviderAttempts.test.ts+++ b/control-api/test/routes.mcp-host.llmProviderAttempts.test.ts@@ -42,7 +42,8 @@ const HOST = 'research-host'function buildApp() {const app = express()- app.use(express.json({ limit: '1mb' }))+ // Match the authorize gateway: V2 visual envelopes are 24 MiB, not nginx's 1m default.+ app.use(express.json({ limit: '24mb' }))const api = express.Router()api.use(createMcpHostLlmProviderAttemptRoutes({@@ -152,6 +153,27 @@ describe('POST /api/v1/mcp-host/llm/provider-attempts/authorize', () => {})expect(JSON.stringify(res.body)).not.toMatch(/refresh|access_token|Authorization/i)})++ it('admits a V2 authorize body larger than 1 MiB', async () => {+ const app = buildApp()+ vi.mocked(authorizer.authorizeLlmProviderAttempt).mockResolvedValueOnce({+ providerAttemptId: '33333333-3333-4333-8333-333333333333',+ requestHash: 'a'.repeat(64),+ executionTicket: 'ticket.jwt',+ expiresAt: '2026-08-20T12:00:00.000Z',+ })+ const res = await request(app)+ .post('/api/v1/mcp-host/llm/provider-attempts/authorize')+ .set('Authorization', `Bearer ${token()}`)+ .send({+ request: {+ schemaVersion: 'codex-completion-request.v2',+ pad: 'x'.repeat(2 * 1024 * 1024),+ },+ })+ expect(res.status).toBe(200)+ expect(authorizer.authorizeLlmProviderAttempt).toHaveBeenCalledOnce()+ })})describe('resolveHostAssignedConnectionKey', () => {diff --git a/mcp-host/package-lock.json b/mcp-host/package-lock.jsonindex 57e1f20e3..9f9d220a9 100644--- a/mcp-host/package-lock.json+++ b/mcp-host/package-lock.json@@ -1,12 +1,12 @@{"name": "clerum-mcp-host",- "version": "0.1.341",+ "version": "0.1.342","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "clerum-mcp-host",- "version": "0.1.341",+ "version": "0.1.342","license": "SEE LICENSE IN LICENSE","dependencies": {"@anthropic-ai/sdk": "^0.32.0",diff --git a/mcp-host/package.json b/mcp-host/package.jsonindex cbe5371b8..74be27fa3 100644--- a/mcp-host/package.json+++ b/mcp-host/package.json@@ -1,6 +1,6 @@{"name": "clerum-mcp-host",- "version": "0.1.341",+ "version": "0.1.342","description": "MCP Host - reads Host CRD and provides LLM access via OpenAI/Claude","main": "dist/main.js","engines": {diff --git a/mcp-host/src/llm/__tests__/providerAttemptAuthorizer.test.ts b/mcp-host/src/llm/__tests__/providerAttemptAuthorizer.test.tsindex 86db35dce..36f35c5f8 100644--- a/mcp-host/src/llm/__tests__/providerAttemptAuthorizer.test.ts+++ b/mcp-host/src/llm/__tests__/providerAttemptAuthorizer.test.ts@@ -33,6 +33,32 @@ describe('ProviderAttemptAuthorizer', () => {expect(fetchFn).not.toHaveBeenCalled()})+ it('dispatches a V2 envelope larger than the 1 MiB V1 ceiling', async () => {+ const fetchFn = vi.fn().mockResolvedValue({+ ok: true,+ json: async () => validAuthorize,+ })+ const authorizer = new ProviderAttemptAuthorizer({+ authorizeUrl: 'http://gateway/authorize',+ readPlatformJwt: () => 'test-jwt',+ fetchFn: fetchFn as unknown as typeof fetch,+ })+ await expect(+ authorizer.authorize({+ request: {+ schemaVersion: 'codex-completion-request.v2',+ pad: 'a'.repeat(2 * 1024 * 1024),+ },+ invocationId: 'inv-1',+ attemptGeneration: 1,+ providerAttemptIndex: 1,+ policyRevision: 1,+ policyHash: 'b'.repeat(64),+ })+ ).resolves.toMatchObject({ executionTicket: 'ticket-123456' })+ expect(fetchFn).toHaveBeenCalledOnce()+ })+it('recognizes a non-JSON 413 as a request limit', async () => {const fetchFn = vi.fn(async () => new Response('<h1>Too large</h1>', { status: 413 }))const authorizer = new ProviderAttemptAuthorizer({diff --git a/tests/e2e/integration/codex-subscription-contract-freeze.test.ts b/tests/e2e/integration/codex-subscription-contract-freeze.test.tsindex 342efb8ff..4d3f77a6a 100644--- a/tests/e2e/integration/codex-subscription-contract-freeze.test.ts+++ b/tests/e2e/integration/codex-subscription-contract-freeze.test.ts@@ -120,6 +120,16 @@ describe('codex-subscription contract freeze', () => {const architecture = readFileSync(architectureDocPath, 'utf8')expect(architecture).toContain('codex-completion-request.v2')expect(architecture).toContain('CODEX_IMAGE_INPUT_MODELS')+ const proxyDeploy = readFileSync(+ join(repoRoot, 'deploy/base/control-plane/codex-llm-proxy.yaml'),+ 'utf8'+ )+ expect(proxyDeploy).toContain(+ `CODEX_LLM_PROXY_MAX_BODY_BYTES: "${localContract.LIMITS.maxRequestBodyBytes}"`+ )+ expect(proxyDeploy).toContain(+ `CODEX_LLM_PROXY_MAX_VISUAL_BODY_BYTES: "${localContract.LIMITS.maxVisualRequestBodyBytes}"`+ )})it('requires the sanitized fixture and both freeze documents', () => {diff --git a/tests/e2e/package-lock.json b/tests/e2e/package-lock.jsonindex 6c6c23be7..2c10f9a69 100644--- a/tests/e2e/package-lock.json+++ b/tests/e2e/package-lock.json@@ -1,12 +1,12 @@{"name": "clerum-e2e-tests",- "version": "0.1.86",+ "version": "0.1.87","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "clerum-e2e-tests",- "version": "0.1.86",+ "version": "0.1.87","devDependencies": {"@types/jsonwebtoken": "^9.0.10","@types/node": "^22.0.0",diff --git a/tests/e2e/package.json b/tests/e2e/package.jsonindex 7f9f2ae67..da4a3e8a1 100644--- a/tests/e2e/package.json+++ b/tests/e2e/package.json@@ -1,6 +1,6 @@{"name": "clerum-e2e-tests",- "version": "0.1.86",+ "version": "0.1.87","private": true,"type": "module","scripts": {