Skip to content

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

TypeScript

fix(codex): raise the visual attachment cap from 3 to 10

Alfredo Lopezfe1473791b74
diff --git a/desktop-app/test/e2e-playwright/codex-image-input.spec.ts b/desktop-app/test/e2e-playwright/codex-image-input.spec.ts
index 494382c37..0322fc81b 100644
--- a/desktop-app/test/e2e-playwright/codex-image-input.spec.ts
+++ b/desktop-app/test/e2e-playwright/codex-image-input.spec.ts
@@ -323,8 +323,8 @@ test('refuses the file that would pass the 16 MiB total and keeps the one that f
await expect(appPage.getByTestId('agent-response')).toHaveCount(0)
})
-test('explains a fourth image instead of dropping it silently', async ({ appPage }) => {
- const files = [0, 1, 2].map(index => {
+test('explains an 11th image instead of dropping it silently', async ({ appPage }) => {
+ const files = Array.from({ length: 10 }, (_, index) => {
const image = challengeImage(index === 1 ? 'jpeg' : 'png')
const format = index === 1 ? 'jpeg' : 'png'
return {
@@ -344,7 +344,7 @@ test('explains a fourth image instead of dropping it silently', async ({ appPage
{ name: extraName, mimeType: 'image/png', buffer: extra.bytes },
])
await expect(appPage.getByRole('alert')).toContainText(
- 'You can attach up to 3 images per message.'
+ 'You can attach up to 10 images per message.'
)
await expect(appPage.getByRole('button', { name: extraName, exact: true })).toHaveCount(0)
await expect(appPage.getByTestId('agent-response')).toHaveCount(0)
diff --git a/desktop-app/ui/src/components/agents/__tests__/ComposerPanel.test.tsx b/desktop-app/ui/src/components/agents/__tests__/ComposerPanel.test.tsx
index 88dc0c85d..f23d298ad 100644
--- a/desktop-app/ui/src/components/agents/__tests__/ComposerPanel.test.tsx
+++ b/desktop-app/ui/src/components/agents/__tests__/ComposerPanel.test.tsx
@@ -389,16 +389,15 @@ describe('ComposerPanel image budget', () => {
expect(attachedImages()).toHaveLength(0)
})
- it('explains files beyond the 3-image cap instead of dropping them silently', async () => {
- composerState.composerImageAttachments = [
- existingAttachment('a.png', MIB),
- existingAttachment('b.png', MIB),
- ]
+ it('explains files beyond the 10-image cap instead of dropping them silently', async () => {
+ composerState.composerImageAttachments = Array.from({ length: 9 }, (_, index) =>
+ existingAttachment(`kept-${index + 1}.png`, MIB)
+ )
const { container } = render(<ComposerPanel inline={false} />)
- pickFiles(container, [imageFile('c.png', MIB), imageFile('d.png', MIB)])
+ pickFiles(container, [imageFile('tenth.png', MIB), imageFile('eleventh.png', MIB)])
await waitFor(() => expect(attachedImages()).toHaveLength(1))
expect(screen.getByRole('alert').textContent).toContain(
- 'You can attach up to 3 images per message.'
+ 'You can attach up to 10 images per message.'
)
})
})
diff --git a/desktop-app/ui/src/constants/attachments.ts b/desktop-app/ui/src/constants/attachments.ts
index e7cde7248..a06725881 100644
--- a/desktop-app/ui/src/constants/attachments.ts
+++ b/desktop-app/ui/src/constants/attachments.ts
@@ -1,4 +1,4 @@
-export const COMPOSER_MAX_IMAGE_ATTACHMENTS = 3
+export const COMPOSER_MAX_IMAGE_ATTACHMENTS = 10
/**
* Composer hard image budget. Mirrors rpc-proxy / mcp-host hop credit: 16MiB
* per image and 16MiB total in a 24MiB JSON body so a poorly compressed 2048
diff --git a/docs/architecture/codex-subscription-transport-contract.md b/docs/architecture/codex-subscription-transport-contract.md
index 110e3b385..1961d6ad4 100644
--- a/docs/architecture/codex-subscription-transport-contract.md
+++ b/docs/architecture/codex-subscription-transport-contract.md
@@ -33,10 +33,10 @@ retain one remaining image per MIME/bytes pair and its explanatory text. They do
not restore pixels removed by pruning. The user-facing attachment collection
keeps its existing deduplication behavior.
-Local visual budgets have two layers. The usual product target is three images,
-5 MiB decoded per image, 9 MiB decoded across a request, and a 14 MiB envelope
-at 2048 pixels (the official Codex client size, with `detail: high`). The hard
-ceiling is 16 MiB per image and 16 MiB aggregate so a poorly compressed 2048
+Local visual budgets have two layers. The usual product target is 5 MiB decoded
+per image, 9 MiB decoded across a request, and a 14 MiB envelope at 2048 pixels
+(the official Codex client size, with `detail: high`). The hard ceiling is 10
+images, 16 MiB per image and 16 MiB aggregate so a poorly compressed 2048
PNG may exceed 10 MiB; the HTTP envelope stays 24 MiB so that encoded body
still fits. Dimensions above 2048 px are rejected here because the frozen
ChatGPT endpoint 400s them; that is a model/pixel limit, not a byte limit.
diff --git a/docs/testing/codex-subscription-validation.md b/docs/testing/codex-subscription-validation.md
index 3e4ce56c9..1ae510b14 100644
--- a/docs/testing/codex-subscription-validation.md
+++ b/docs/testing/codex-subscription-validation.md
@@ -56,7 +56,7 @@ than silently skipping them.
`desktop-app/test/e2e-playwright/codex-image-input.spec.ts` covers direct PNG/JPEG
uploads through the visible composer, including a 5 MiB JPEG, a 12 MiB PNG
(exceptional), a 10+5 MiB pair, three 5 MiB images, and composer refusals over
-16 MiB, over 16 MiB total, a fourth image, and a non-PNG/JPEG type. It creates a fresh 64-bit hexadecimal
+16 MiB, over 16 MiB total, an 11th image, and a non-PNG/JPEG type. It creates a fresh 64-bit hexadecimal
challenge rendered only into image pixels. Large cases pad that same image so
the answer stays in pixels while the decoded size matches the hop budget. The
filename and prompt do not carry the answer. A passing run requires that
diff --git a/external-rest-api/src/releaseManifest.ts b/external-rest-api/src/releaseManifest.ts
index 8e5935da1..f8936daca 100644
--- a/external-rest-api/src/releaseManifest.ts
+++ b/external-rest-api/src/releaseManifest.ts
@@ -9,7 +9,7 @@ export type ReleaseManifest = {
export const releaseManifest: ReleaseManifest = {
releaseId: 'v0.8.1',
externalRestApiVersion: '0.1.82',
- rpcProxyVersion: '0.1.82',
+ rpcProxyVersion: '0.1.83',
desktopVersion: '0.8.1',
minimumDesktopVersion: '0.1.252',
}
diff --git a/mcp-host/package-lock.json b/mcp-host/package-lock.json
index a7179c6be..71ad42258 100644
--- a/mcp-host/package-lock.json
+++ b/mcp-host/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "clerum-mcp-host",
- "version": "0.1.349",
+ "version": "0.1.350",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-mcp-host",
- "version": "0.1.349",
+ "version": "0.1.350",
"license": "SEE LICENSE IN LICENSE",
"dependencies": {
"@anthropic-ai/sdk": "^0.32.0",
diff --git a/mcp-host/package.json b/mcp-host/package.json
index 146038fa9..69365f610 100644
--- a/mcp-host/package.json
+++ b/mcp-host/package.json
@@ -1,6 +1,6 @@
{
"name": "clerum-mcp-host",
- "version": "0.1.349",
+ "version": "0.1.350",
"description": "MCP Host - reads Host CRD and provides LLM access via OpenAI/Claude",
"main": "dist/main.js",
"engines": {
diff --git a/mcp-host/src/__tests__/bodylimits.test.ts b/mcp-host/src/__tests__/bodylimits.test.ts
index cf1f16cb1..d1c269a48 100644
--- a/mcp-host/src/__tests__/bodylimits.test.ts
+++ b/mcp-host/src/__tests__/bodylimits.test.ts
@@ -203,14 +203,22 @@ describe('mcp-host runtime message body budget', () => {
)
})
- it('rejects a fourth qualifying image instead of charging it as text', async () => {
+ it('delivers ten small images in order', async () => {
captured = []
- const attachments = [
- imageAttachment('a1', 64 * 1024),
- imageAttachment('a2', 64 * 1024),
- imageAttachment('a3', 64 * 1024),
- imageAttachment('a4', 64 * 1024),
- ]
+ const attachments = Array.from({ length: 10 }, (_, index) =>
+ imageAttachment(`a${index + 1}`, 64 * 1024)
+ )
+ const response = await postMessage(messagePayload(attachments))
+ expect(response.status).toBe(200)
+ expect(captured).toHaveLength(1)
+ expect(captured[0].attachments?.map(item => item.id)).toEqual(attachments.map(item => item.id))
+ })
+
+ it('rejects an 11th qualifying image instead of charging it as text', async () => {
+ captured = []
+ const attachments = Array.from({ length: 11 }, (_, index) =>
+ imageAttachment(`a${index + 1}`, 64 * 1024)
+ )
const response = await postMessage(messagePayload(attachments))
expect(response.status).toBe(413)
expect(captured).toHaveLength(0)
diff --git a/mcp-host/src/server.ts b/mcp-host/src/server.ts
index f09f9c14e..60fe46906 100644
--- a/mcp-host/src/server.ts
+++ b/mcp-host/src/server.ts
@@ -139,12 +139,12 @@ export type {
* (~21.3MiB base64) plus the 1MiB non-image share still fits. Every other
* route keeps the 6MiB default.
* - MAX_NON_IMAGE_BODY_BYTES bounds that same body MINUS credited image
- * base64 (16MiB per image, at most 3 images / 16MiB total). Usual product
+ * base64 (16MiB per image, at most 10 images / 16MiB total). Usual product
* target remains 5 / 9 / 14 MiB at 2048 px.
*/
const MAX_CHAT_BODY_BYTES = 24 * 1024 * 1024
const MAX_NON_IMAGE_BODY_BYTES = 6 * 1024 * 1024
-const MAX_CHAT_IMAGES = 3
+const MAX_CHAT_IMAGES = 10
const MAX_IMAGE_DECODED_BYTES = 16 * 1024 * 1024
const MAX_IMAGE_DECODED_BYTES_TOTAL = 16 * 1024 * 1024
const BASE64_RE = /^[A-Za-z0-9+/]+={0,2}$/
@@ -191,7 +191,7 @@ function decodedBase64Bytes(dataBase64: string): number | null {
* Only attachments with the exact wire shape the composer produces qualify:
* `kind: 'image'`, `encoding: 'base64'`, a PNG/JPEG MIME type, canonical
* base64 whose leading bytes are that image's signature, and at most 16MiB
- * decoded each within a 3-image / 16MiB total budget. A fourth qualifying
+ * decoded each within a 10-image / 16MiB total budget. An 11th qualifying
* image is fail-loud rather than charged as text. Anything else is charged
* to the non-image budget, so a claim cannot be smuggled through by mislabelling
* a payload.
diff --git a/packages/llm-provider-attempt-contract/index.d.ts b/packages/llm-provider-attempt-contract/index.d.ts
index be35cb396..8513a28b1 100644
--- a/packages/llm-provider-attempt-contract/index.d.ts
+++ b/packages/llm-provider-attempt-contract/index.d.ts
@@ -47,7 +47,7 @@ export declare const LIMITS: {
* 10 MiB. Model vision capability is owned by issue #654 / PR #669.
*/
export declare const VISUAL_LIMITS: {
- readonly maxImages: 3
+ readonly maxImages: 10,
readonly typicalImageBytes: 5242880
readonly typicalTotalImageBytes: 9437184
readonly typicalEnvelopeBytes: 14680064
diff --git a/packages/llm-provider-attempt-contract/index.test.cjs b/packages/llm-provider-attempt-contract/index.test.cjs
index cefb61667..2057dbebd 100644
--- a/packages/llm-provider-attempt-contract/index.test.cjs
+++ b/packages/llm-provider-attempt-contract/index.test.cjs
@@ -728,16 +728,12 @@ test('v2 projection preserves part order, source identity and the text projectio
test('v2 limits: image count, encoder bound, per-image bytes, total bytes, dimensions and pixels', () => {
const png = IMAGE_DATA.png
- const three = [imagePart(png), imagePart(png), imagePart(png)]
- assert.equal(
- contract.parseCodexCompletionRequest(v2WithParts(three)).ok,
- true,
- 'three images fit'
- )
- const four = contract.parseCodexCompletionRequest(v2WithParts([...three, imagePart(png)]))
- assert.equal(four.ok, false)
- assert.equal(four.code, 'limit')
- assert.match(four.message, /3 images/)
+ const ten = Array.from({ length: contract.VISUAL_LIMITS.maxImages }, () => imagePart(png))
+ assert.equal(contract.parseCodexCompletionRequest(v2WithParts(ten)).ok, true, 'ten images fit')
+ const eleven = contract.parseCodexCompletionRequest(v2WithParts([...ten, imagePart(png)]))
+ assert.equal(eleven.ok, false)
+ assert.equal(eleven.code, 'limit')
+ assert.match(eleven.message, /10 images/)
const encoded = contract.parseCodexCompletionRequest(
v2WithParts([imagePart('A'.repeat(MAX_ENCODED_IMAGE_CHARS + 4))])
@@ -871,7 +867,7 @@ test('v2 limits: image count, encoder bound, per-image bytes, total bytes, dimen
assert.equal(jpegAsPng.ok, false)
})
-test('v2 visual budgets are request-scoped across messages: three 5 MiB images fit, four do not', () => {
+test('v2 visual budgets are request-scoped across messages: ten small images fit, eleven do not', () => {
const png = IMAGE_DATA.png
const userWithImages = count => ({
role: 'user',
@@ -879,17 +875,17 @@ test('v2 visual budgets are request-scoped across messages: three 5 MiB images f
contentParts: Array.from({ length: count }, () => imagePart(png)),
})
- // 2 + 2 images: every message is inside maxImages on its own, the request is not.
- const twoEach = contract.parseCodexCompletionRequest(
- v2WithMessages([userWithImages(2), userWithImages(2)])
+ // 6 + 5 images: every message is inside maxImages on its own, the request is not.
+ const splitOverCap = contract.parseCodexCompletionRequest(
+ v2WithMessages([userWithImages(6), userWithImages(5)])
)
- assert.equal(twoEach.ok, false)
- assert.equal(twoEach.code, 'limit')
- assert.match(twoEach.message, /3 images/)
+ assert.equal(splitOverCap.ok, false)
+ assert.equal(splitOverCap.code, 'limit')
+ assert.match(splitOverCap.message, /10 images/)
- // Boundary: exactly maxImages spread over three messages is accepted.
+ // Boundary: exactly maxImages spread over ten messages is accepted.
const oneEach = contract.parseCodexCompletionRequest(
- v2WithMessages([userWithImages(1), userWithImages(1), userWithImages(1)])
+ v2WithMessages(Array.from({ length: contract.VISUAL_LIMITS.maxImages }, () => userWithImages(1)))
)
assert.equal(oneEach.ok, true, oneEach.message)
@@ -959,7 +955,7 @@ function nonImageBytes(request) {
test('requestBodyLimitBytes: V2 declares 24 MiB; every other body keeps the 1 MiB ceiling', () => {
assert.equal(contract.LIMITS.maxRequestBodyBytes, 1048576)
assert.equal(contract.LIMITS.maxVisualRequestBodyBytes, 25165824)
- assert.equal(contract.VISUAL_LIMITS.maxImages, 3)
+ assert.equal(contract.VISUAL_LIMITS.maxImages, 10)
assert.equal(contract.VISUAL_LIMITS.typicalImageBytes, 5 * MIB)
assert.equal(contract.VISUAL_LIMITS.typicalTotalImageBytes, 9 * MIB)
assert.equal(contract.VISUAL_LIMITS.typicalEnvelopeBytes, 14 * MIB)
diff --git a/packages/llm-provider-attempt-contract/visualPayload.cjs b/packages/llm-provider-attempt-contract/visualPayload.cjs
index 1eaa353a9..abc65f5ce 100644
--- a/packages/llm-provider-attempt-contract/visualPayload.cjs
+++ b/packages/llm-provider-attempt-contract/visualPayload.cjs
@@ -28,7 +28,7 @@
*/
const VISUAL_LIMITS = Object.freeze({
- maxImages: 3,
+ maxImages: 10,
typicalImageBytes: 5242880,
typicalTotalImageBytes: 9437184,
typicalEnvelopeBytes: 14680064,
diff --git a/rpc-proxy/package-lock.json b/rpc-proxy/package-lock.json
index a8715fece..fe8605a6e 100644
--- a/rpc-proxy/package-lock.json
+++ b/rpc-proxy/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "clerum-rpc-proxy",
- "version": "0.1.82",
+ "version": "0.1.83",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-rpc-proxy",
- "version": "0.1.82",
+ "version": "0.1.83",
"dependencies": {
"cors": "^2.8.5",
"express": "^4.21.2",
diff --git a/rpc-proxy/package.json b/rpc-proxy/package.json
index 936dba29e..7415bc5fe 100644
--- a/rpc-proxy/package.json
+++ b/rpc-proxy/package.json
@@ -1,6 +1,6 @@
{
"name": "clerum-rpc-proxy",
- "version": "0.1.82",
+ "version": "0.1.83",
"description": "External-facing RPC proxy for tenant-scoped MCP access",
"main": "dist/main.js",
"engines": {
diff --git a/rpc-proxy/src/__tests__/bodylimits.test.ts b/rpc-proxy/src/__tests__/bodylimits.test.ts
index 3ecf290cf..8c89bfbee 100644
--- a/rpc-proxy/src/__tests__/bodylimits.test.ts
+++ b/rpc-proxy/src/__tests__/bodylimits.test.ts
@@ -178,15 +178,24 @@ describe('rpc-proxy chat message body budget', () => {
expect(response.status).toBe(401)
})
- it('rejects a fourth qualifying image instead of charging it as text', async () => {
+ it('credits ten small images instead of charging them as text', async () => {
const body = JSON.stringify({
content: 'look',
- attachments: [
- imageAttachment('a1', 64 * 1024),
- imageAttachment('a2', 64 * 1024),
- imageAttachment('a3', 64 * 1024),
- imageAttachment('a4', 64 * 1024),
- ],
+ attachments: Array.from({ length: 10 }, (_, index) =>
+ imageAttachment(`a${index + 1}`, 64 * 1024)
+ ),
+ })
+ expect(Buffer.byteLength(body)).toBeLessThan(6 * MIB)
+ const response = await post(MESSAGE_PATH, body)
+ expect(response.status).toBe(401)
+ })
+
+ it('rejects an 11th qualifying image instead of charging it as text', async () => {
+ const body = JSON.stringify({
+ content: 'look',
+ attachments: Array.from({ length: 11 }, (_, index) =>
+ imageAttachment(`a${index + 1}`, 64 * 1024)
+ ),
})
expect(Buffer.byteLength(body)).toBeLessThan(6 * MIB)
const response = await post(MESSAGE_PATH, body)
diff --git a/rpc-proxy/src/app.ts b/rpc-proxy/src/app.ts
index ac34a7856..124d19bef 100644
--- a/rpc-proxy/src/app.ts
+++ b/rpc-proxy/src/app.ts
@@ -28,7 +28,7 @@ import { isUpstreamTimeoutError } from './services/wakeAndHold.js'
*/
const MAX_CHAT_BODY_BYTES = 24 * 1024 * 1024
const MAX_NON_IMAGE_BODY_BYTES = 6 * 1024 * 1024
-const MAX_CHAT_IMAGES = 3
+const MAX_CHAT_IMAGES = 10
const MAX_IMAGE_DECODED_BYTES = 16 * 1024 * 1024
const MAX_IMAGE_DECODED_BYTES_TOTAL = 16 * 1024 * 1024
const BASE64_RE = /^[A-Za-z0-9+/]+={0,2}$/
@@ -75,7 +75,7 @@ function decodedBase64Bytes(dataBase64: string): number | null {
* Only attachments with the exact wire shape the composer produces qualify:
* `kind: 'image'`, `encoding: 'base64'`, a PNG/JPEG MIME type, canonical
* base64 whose leading bytes are that image's signature, and at most 16MiB
- * decoded each within a 3-image / 16MiB total budget. A fourth qualifying
+ * decoded each within a 10-image / 16MiB total budget. An 11th qualifying
* image is fail-loud rather than charged as text. Anything else is charged
* to the non-image budget, so a claim cannot be smuggled through by mislabelling
* a payload.
diff --git a/tests/e2e/fixtures/codex-subscription/sanitized-upstream-contract.json b/tests/e2e/fixtures/codex-subscription/sanitized-upstream-contract.json
index a3bdf8ef0..2db7ea462 100644
--- a/tests/e2e/fixtures/codex-subscription/sanitized-upstream-contract.json
+++ b/tests/e2e/fixtures/codex-subscription/sanitized-upstream-contract.json
@@ -83,7 +83,7 @@
"upstreamVerified": false,
"validation": "container-framing-and-dimensions",
"limits": {
- "maxImages": 3,
+ "maxImages": 10,
"typicalImageBytes": 5242880,
"typicalTotalImageBytes": 9437184,
"typicalEnvelopeBytes": 14680064,
diff --git a/tests/e2e/fixtures/package-lock.json b/tests/e2e/fixtures/package-lock.json
index a2488f81a..2e5a1708b 100644
--- a/tests/e2e/fixtures/package-lock.json
+++ b/tests/e2e/fixtures/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "@clerum/e2e-test-fixtures",
- "version": "1.0.84",
+ "version": "1.0.85",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@clerum/e2e-test-fixtures",
- "version": "1.0.84",
+ "version": "1.0.85",
"dependencies": {
"@kubernetes/client-node": "^1.0.0"
},
diff --git a/tests/e2e/fixtures/package.json b/tests/e2e/fixtures/package.json
index 449353a44..6d6baa5ba 100644
--- a/tests/e2e/fixtures/package.json
+++ b/tests/e2e/fixtures/package.json
@@ -1,6 +1,6 @@
{
"name": "@clerum/e2e-test-fixtures",
- "version": "1.0.84",
+ "version": "1.0.85",
"description": "E2E test fixtures and utilities for Clerum testing",
"type": "module",
"main": "index.ts",