Skip to content

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

TypeScript

fix(codex): allow 20 composer images and keep aggregate on the hop

Alfredo Lopez3a8fe12246f9
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 0322fc81b..2a8d6d93b 100644
--- a/desktop-app/test/e2e-playwright/codex-image-input.spec.ts
+++ b/desktop-app/test/e2e-playwright/codex-image-input.spec.ts
@@ -303,9 +303,7 @@ test('refuses a single image over the 16 MiB limit before send', async ({ appPag
await expect(appPage.getByTestId('agent-response')).toHaveCount(0)
})
-test('refuses the file that would pass the 16 MiB total and keeps the one that fits', async ({
- appPage,
-}) => {
+test('composer attaches a pair that exceeds the hop aggregate', async ({ appPage }) => {
const fits = paddedChallengeImage('png', 10 * MIB)
const over = paddedChallengeImage('jpeg', 7 * MIB)
const fitsName = `fits-${randomUUID()}.png`
@@ -315,16 +313,14 @@ test('refuses the file that would pass the 16 MiB total and keeps the one that f
{ name: fitsName, mimeType: 'image/png', buffer: fits.bytes },
{ name: overName, mimeType: 'image/jpeg', buffer: over.bytes },
])
- await expect(appPage.getByRole('alert')).toContainText(
- `${overName} was not added. Attachments can total at most 16 MiB per message.`
- )
await expect(appPage.getByRole('button', { name: fitsName, exact: true })).toBeVisible()
- await expect(appPage.getByRole('button', { name: overName, exact: true })).toHaveCount(0)
+ await expect(appPage.getByRole('button', { name: overName, exact: true })).toBeVisible()
+ await expect(appPage.getByRole('alert')).toHaveCount(0)
await expect(appPage.getByTestId('agent-response')).toHaveCount(0)
})
-test('explains an 11th image instead of dropping it silently', async ({ appPage }) => {
- const files = Array.from({ length: 10 }, (_, index) => {
+test('explains a 21st image instead of dropping it silently', async ({ appPage }) => {
+ const files = Array.from({ length: 20 }, (_, index) => {
const image = challengeImage(index === 1 ? 'jpeg' : 'png')
const format = index === 1 ? 'jpeg' : 'png'
return {
@@ -344,7 +340,7 @@ test('explains an 11th 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 10 images per message.'
+ 'You can attach up to 20 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/ComposerPanel.tsx b/desktop-app/ui/src/components/agents/ComposerPanel.tsx
index 0f0896a09..ddb03a2f7 100644
--- a/desktop-app/ui/src/components/agents/ComposerPanel.tsx
+++ b/desktop-app/ui/src/components/agents/ComposerPanel.tsx
@@ -23,7 +23,6 @@ import {
COMPOSER_MAX_IMAGE_ATTACHMENTS,
COMPOSER_MAX_IMAGE_BYTES,
COMPOSER_MAX_IMAGE_DIMENSION,
- COMPOSER_MAX_TOTAL_IMAGE_BYTES,
ZAI_IMAGE_ATTACHMENT_UNSUPPORTED_MESSAGE,
} from '@constants/attachments'
import { useContextsDataController } from '@hooks/domain/useContextsDataController'
@@ -92,20 +91,9 @@ function composerImageDimensionRejection(
return null
}
-type ComposerImageBudgetRejection = 'image-too-large' | 'total-too-large' | null
-
-/**
- * Budget decision for one image of `sizeBytes` placed next to `otherImagesBytes`
- * already attached. Shared by the picker/paste/drop path and the annotation-save
- * path so neither route can exceed the per-image limit or the per-message total.
- */
-function composerImageBudgetRejection(
- sizeBytes: number,
- otherImagesBytes: number
-): ComposerImageBudgetRejection {
- if (sizeBytes > COMPOSER_MAX_IMAGE_BYTES) return 'image-too-large'
- if (otherImagesBytes + sizeBytes > COMPOSER_MAX_TOTAL_IMAGE_BYTES) return 'total-too-large'
- return null
+/** Per-image ceiling only. Aggregate bytes are enforced on the chat hop. */
+function composerImageExceedsPerImageBudget(sizeBytes: number): boolean {
+ return sizeBytes > COMPOSER_MAX_IMAGE_BYTES
}
function getComposerReferenceIcon(attachment: ComposerReferenceAttachment) {
@@ -494,30 +482,17 @@ export function ComposerPanel({ inline = false, agentSelector }: ComposerPanelPr
`You can attach up to ${COMPOSER_MAX_IMAGE_ATTACHMENTS} images per message.`
)
}
- // The budget runs across the images already attached plus the ones accepted
- // below, so a selection cannot exceed the per-message total even when every
- // file is individually allowed.
- let plannedBytes = composerImageAttachments.reduce(
- (total, attachment) => total + attachment.sizeBytes,
- 0
- )
-
for (const [index, file] of selected.entries()) {
const mimeType = inferComposerImageMimeType(file)
if (!mimeType || !COMPOSER_ACCEPT_IMAGE_MIME_TYPES.includes(mimeType)) {
validationErrors.push(`${file.name || 'Image'} is not supported. Use PNG or JPEG.`)
continue
}
- const rejection = composerImageBudgetRejection(file.size, plannedBytes)
- if (rejection) {
+ if (composerImageExceedsPerImageBudget(file.size)) {
validationErrors.push(
- rejection === 'image-too-large'
- ? `${file.name || 'Image'} is too large. Max size is ${formatComposerMebibytes(
- COMPOSER_MAX_IMAGE_BYTES
- )} MiB.`
- : `${file.name || 'Image'} was not added. Attachments can total at most ${formatComposerMebibytes(
- COMPOSER_MAX_TOTAL_IMAGE_BYTES
- )} MiB per message.`
+ `${file.name || 'Image'} is too large. Max size is ${formatComposerMebibytes(
+ COMPOSER_MAX_IMAGE_BYTES
+ )} MiB.`
)
continue
}
@@ -555,7 +530,6 @@ export function ComposerPanel({ inline = false, agentSelector }: ComposerPanelPr
sizeBytes: file.size,
previewDataUrl: previewUrl || dataUrl,
})
- plannedBytes += file.size
} catch (error) {
revokePreviewUrl(previewUrl)
validationErrors.push(
@@ -596,40 +570,27 @@ export function ComposerPanel({ inline = false, agentSelector }: ComposerPanelPr
*/
const handleAnnotatedImageSave = useCallback(
(updated: ComposerImageAttachment) => {
- const otherImagesBytes = composerImageAttachments.reduce(
- (total, attachment) =>
- attachment.id === updated.id ? total : total + attachment.sizeBytes,
- 0
- )
- const rejection = composerImageBudgetRejection(updated.sizeBytes, otherImagesBytes)
const dimensionError = composerImageDimensionRejection(
updated.name || 'Image',
updated.mimeType,
updated.dataBase64
)
- if (!rejection && !dimensionError) {
+ if (!composerImageExceedsPerImageBudget(updated.sizeBytes) && !dimensionError) {
onUpdateComposerImageAttachment(updated)
return
}
- if (rejection === 'image-too-large') {
+ if (composerImageExceedsPerImageBudget(updated.sizeBytes)) {
throw new Error(
`${updated.name || 'Image'} was kept unchanged. Max size is ${formatComposerMebibytes(
COMPOSER_MAX_IMAGE_BYTES
)} MiB per image.`
)
}
- if (rejection === 'total-too-large') {
- throw new Error(
- `${updated.name || 'Image'} was kept unchanged. Attachments can total at most ${formatComposerMebibytes(
- COMPOSER_MAX_TOTAL_IMAGE_BYTES
- )} MiB per message.`
- )
- }
throw new Error(
`${updated.name || 'Image'} was kept unchanged. Max resolution is ${COMPOSER_MAX_IMAGE_DIMENSION} px.`
)
},
- [composerImageAttachments, onUpdateComposerImageAttachment]
+ [onUpdateComposerImageAttachment]
)
const handleComposerPaste = useCallback(
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 f23d298ad..f1ee07497 100644
--- a/desktop-app/ui/src/components/agents/__tests__/ComposerPanel.test.tsx
+++ b/desktop-app/ui/src/components/agents/__tests__/ComposerPanel.test.tsx
@@ -346,27 +346,24 @@ describe('ComposerPanel image budget', () => {
expect(composerActions.handleAddComposerImageAttachments).not.toHaveBeenCalled()
})
- it('refuses the over-total file in a selection and keeps the one that fits', async () => {
+ it('attaches 10MiB + 7MiB in the composer; the hop owns the aggregate', async () => {
const { container } = render(<ComposerPanel inline={false} />)
pickFiles(container, [imageFile('fits.png', 10 * MIB), imageFile('over-total.png', 7 * MIB)])
- await waitFor(() =>
- expect(screen.getByRole('alert').textContent).toContain(
- 'over-total.png was not added. Attachments can total at most 16 MiB per message.'
- )
- )
- expect(attachedImages().map(attachment => attachment.name)).toEqual(['fits.png'])
+ await waitFor(() => expect(attachedImages()).toHaveLength(2))
+ expect(attachedImages().map(attachment => attachment.name)).toEqual([
+ 'fits.png',
+ 'over-total.png',
+ ])
+ expect(screen.queryByRole('alert')).toBeNull()
})
- it('refuses an added image that would pass the total with 10MiB already attached', async () => {
+ it('attaches a 7MiB image when 10MiB is already in the composer', async () => {
composerState.composerImageAttachments = [existingAttachment('kept.png', 10 * MIB)]
const { container } = render(<ComposerPanel inline={false} />)
pickFiles(container, [imageFile('over-total.png', 7 * MIB)])
- await waitFor(() =>
- expect(screen.getByRole('alert').textContent).toContain(
- 'can total at most 16 MiB per message'
- )
- )
- expect(composerActions.handleAddComposerImageAttachments).not.toHaveBeenCalled()
+ await waitFor(() => expect(attachedImages()).toHaveLength(1))
+ expect(attachedImages()[0]?.name).toBe('over-total.png')
+ expect(screen.queryByRole('alert')).toBeNull()
})
it('accepts a 5MiB image when 10MiB is already attached', async () => {
@@ -389,15 +386,16 @@ describe('ComposerPanel image budget', () => {
expect(attachedImages()).toHaveLength(0)
})
- 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)
+ it('explains files beyond the 20-image cap instead of dropping them silently', async () => {
+ const small = 64 * 1024
+ composerState.composerImageAttachments = Array.from({ length: 19 }, (_, index) =>
+ existingAttachment(`kept-${index + 1}.png`, small)
)
const { container } = render(<ComposerPanel inline={false} />)
- pickFiles(container, [imageFile('tenth.png', MIB), imageFile('eleventh.png', MIB)])
+ pickFiles(container, [imageFile('twentieth.png', small), imageFile('twenty-first.png', small)])
await waitFor(() => expect(attachedImages()).toHaveLength(1))
expect(screen.getByRole('alert').textContent).toContain(
- 'You can attach up to 10 images per message.'
+ 'You can attach up to 20 images per message.'
)
})
})
@@ -449,24 +447,24 @@ describe('ComposerPanel annotation budget', () => {
)
})
- it('refuses an annotation that would push the message past the 16MiB total', () => {
+ it('applies an annotation next to a 10MiB sibling when only the hop owns the aggregate', () => {
const original = existingAttachment('photo.png', 4 * MIB)
composerState.composerImageAttachments = [original, existingAttachment('other.png', 10 * MIB)]
const { container } = render(<ComposerPanel inline={false} />)
openAnnotation(container, 'photo.png')
- // 10MiB sibling + 7MiB annotation = 17MiB. The annotated image alone is under
- // the per-image limit, so only the per-message total can refuse this.
annotationStub.next = { ...original, sizeBytes: 7 * MIB }
applyAnnotation()
- expect(composerActions.handleUpdateComposerImageAttachment).not.toHaveBeenCalled()
- expect(annotationStub.threw).toContain(
- 'photo.png was kept unchanged. Attachments can total at most 16 MiB per message.'
- )
+ expect(annotationStub.threw).toBeNull()
+ expect(composerActions.handleUpdateComposerImageAttachment).toHaveBeenCalledTimes(1)
+ expect(composerActions.handleUpdateComposerImageAttachment.mock.calls[0]?.[0]).toMatchObject({
+ id: original.id,
+ sizeBytes: 7 * MIB,
+ })
})
- it('applies an annotation that exactly reaches the 16MiB total', () => {
+ it('applies an annotation that exactly reaches the former 16MiB composer total', () => {
const original = existingAttachment('photo.png', 4 * MIB)
composerState.composerImageAttachments = [original, existingAttachment('other.png', 10 * MIB)]
const { container } = render(<ComposerPanel inline={false} />)
diff --git a/desktop-app/ui/src/constants/attachments.ts b/desktop-app/ui/src/constants/attachments.ts
index a06725881..3d624791c 100644
--- a/desktop-app/ui/src/constants/attachments.ts
+++ b/desktop-app/ui/src/constants/attachments.ts
@@ -1,11 +1,10 @@
-export const COMPOSER_MAX_IMAGE_ATTACHMENTS = 10
+export const COMPOSER_MAX_IMAGE_ATTACHMENTS = 20
/**
- * 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
- * PNG may exceed 10MiB. The usual product target is 5 / 9 / 14 MiB.
+ * Composer per-image ceiling. The 16 MiB aggregate lives on the rpc-proxy /
+ * mcp-host hop and the shared contract, not in this picker. A poorly
+ * compressed 2048 PNG may exceed 10 MiB and must still attach here.
*/
export const COMPOSER_MAX_IMAGE_BYTES = 16 * 1024 * 1024
-export const COMPOSER_MAX_TOTAL_IMAGE_BYTES = 16 * 1024 * 1024
/** Official Codex client long-side bound. The hop 400s frames above this. */
export const COMPOSER_MAX_IMAGE_DIMENSION = 2048
export const COMPOSER_ACCEPT_IMAGE_MIME_TYPES = ['image/jpeg', 'image/png'] as const
diff --git a/docs/architecture/codex-subscription-transport-contract.md b/docs/architecture/codex-subscription-transport-contract.md
index 1961d6ad4..b487153a9 100644
--- a/docs/architecture/codex-subscription-transport-contract.md
+++ b/docs/architecture/codex-subscription-transport-contract.md
@@ -35,7 +35,7 @@ keeps its existing deduplication behavior.
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
+(the official Codex client size, with `detail: high`). The hard ceiling is 20
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
diff --git a/docs/testing/codex-subscription-validation.md b/docs/testing/codex-subscription-validation.md
index 1ae510b14..4bec70293 100644
--- a/docs/testing/codex-subscription-validation.md
+++ b/docs/testing/codex-subscription-validation.md
@@ -56,7 +56,8 @@ 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, an 11th image, and a non-PNG/JPEG type. It creates a fresh 64-bit hexadecimal
+16 MiB per image, a 21st image, and a non-PNG/JPEG type. The 16 MiB aggregate is
+enforced on the hop, not the composer. 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 f8936daca..63e911f88 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.83',
+ rpcProxyVersion: '0.1.84',
desktopVersion: '0.8.1',
minimumDesktopVersion: '0.1.252',
}
diff --git a/mcp-host/package-lock.json b/mcp-host/package-lock.json
index 71ad42258..ced3fe0d6 100644
--- a/mcp-host/package-lock.json
+++ b/mcp-host/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "clerum-mcp-host",
- "version": "0.1.350",
+ "version": "0.1.351",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-mcp-host",
- "version": "0.1.350",
+ "version": "0.1.351",
"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 69365f610..99b115901 100644
--- a/mcp-host/package.json
+++ b/mcp-host/package.json
@@ -1,6 +1,6 @@
{
"name": "clerum-mcp-host",
- "version": "0.1.350",
+ "version": "0.1.351",
"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 d1c269a48..005594084 100644
--- a/mcp-host/src/__tests__/bodylimits.test.ts
+++ b/mcp-host/src/__tests__/bodylimits.test.ts
@@ -203,9 +203,9 @@ describe('mcp-host runtime message body budget', () => {
)
})
- it('delivers ten small images in order', async () => {
+ it('delivers twenty small images in order', async () => {
captured = []
- const attachments = Array.from({ length: 10 }, (_, index) =>
+ const attachments = Array.from({ length: 20 }, (_, index) =>
imageAttachment(`a${index + 1}`, 64 * 1024)
)
const response = await postMessage(messagePayload(attachments))
@@ -214,9 +214,9 @@ describe('mcp-host runtime message body budget', () => {
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 () => {
+ it('rejects a 21st qualifying image instead of charging it as text', async () => {
captured = []
- const attachments = Array.from({ length: 11 }, (_, index) =>
+ const attachments = Array.from({ length: 21 }, (_, index) =>
imageAttachment(`a${index + 1}`, 64 * 1024)
)
const response = await postMessage(messagePayload(attachments))
diff --git a/mcp-host/src/server.ts b/mcp-host/src/server.ts
index 60fe46906..0bdf63193 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 10 images / 16MiB total). Usual product
+ * base64 (16MiB per image, at most 20 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 = 10
+const MAX_CHAT_IMAGES = 20
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 10-image / 16MiB total budget. An 11th qualifying
+ * decoded each within a 20-image / 16MiB total budget. A 21st 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 8513a28b1..936254eb4 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: 10,
+ readonly maxImages: 20,
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 2057dbebd..1d2963442 100644
--- a/packages/llm-provider-attempt-contract/index.test.cjs
+++ b/packages/llm-provider-attempt-contract/index.test.cjs
@@ -728,12 +728,16 @@ 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 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 twenty = Array.from({ length: contract.VISUAL_LIMITS.maxImages }, () => imagePart(png))
+ assert.equal(
+ contract.parseCodexCompletionRequest(v2WithParts(twenty)).ok,
+ true,
+ 'twenty images fit'
+ )
+ const twentyOne = contract.parseCodexCompletionRequest(v2WithParts([...twenty, imagePart(png)]))
+ assert.equal(twentyOne.ok, false)
+ assert.equal(twentyOne.code, 'limit')
+ assert.match(twentyOne.message, /20 images/)
const encoded = contract.parseCodexCompletionRequest(
v2WithParts([imagePart('A'.repeat(MAX_ENCODED_IMAGE_CHARS + 4))])
@@ -867,7 +871,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: ten small images fit, eleven do not', () => {
+test('v2 visual budgets are request-scoped across messages: twenty small images fit, twenty-one do not', () => {
const png = IMAGE_DATA.png
const userWithImages = count => ({
role: 'user',
@@ -875,15 +879,15 @@ test('v2 visual budgets are request-scoped across messages: ten small images fit
contentParts: Array.from({ length: count }, () => imagePart(png)),
})
- // 6 + 5 images: every message is inside maxImages on its own, the request is not.
+ // 11 + 10 images: every message is inside maxImages on its own, the request is not.
const splitOverCap = contract.parseCodexCompletionRequest(
- v2WithMessages([userWithImages(6), userWithImages(5)])
+ v2WithMessages([userWithImages(11), userWithImages(10)])
)
assert.equal(splitOverCap.ok, false)
assert.equal(splitOverCap.code, 'limit')
- assert.match(splitOverCap.message, /10 images/)
+ assert.match(splitOverCap.message, /20 images/)
- // Boundary: exactly maxImages spread over ten messages is accepted.
+ // Boundary: exactly maxImages spread over twenty messages is accepted.
const oneEach = contract.parseCodexCompletionRequest(
v2WithMessages(Array.from({ length: contract.VISUAL_LIMITS.maxImages }, () => userWithImages(1)))
)
@@ -955,7 +959,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, 10)
+ assert.equal(contract.VISUAL_LIMITS.maxImages, 20)
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 abc65f5ce..11099b021 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: 10,
+ maxImages: 20,
typicalImageBytes: 5242880,
typicalTotalImageBytes: 9437184,
typicalEnvelopeBytes: 14680064,
diff --git a/rpc-proxy/package-lock.json b/rpc-proxy/package-lock.json
index fe8605a6e..b9042e3d9 100644
--- a/rpc-proxy/package-lock.json
+++ b/rpc-proxy/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "clerum-rpc-proxy",
- "version": "0.1.83",
+ "version": "0.1.84",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-rpc-proxy",
- "version": "0.1.83",
+ "version": "0.1.84",
"dependencies": {
"cors": "^2.8.5",
"express": "^4.21.2",
diff --git a/rpc-proxy/package.json b/rpc-proxy/package.json
index 7415bc5fe..dd8684b18 100644
--- a/rpc-proxy/package.json
+++ b/rpc-proxy/package.json
@@ -1,6 +1,6 @@
{
"name": "clerum-rpc-proxy",
- "version": "0.1.83",
+ "version": "0.1.84",
"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 8c89bfbee..3fc84c177 100644
--- a/rpc-proxy/src/__tests__/bodylimits.test.ts
+++ b/rpc-proxy/src/__tests__/bodylimits.test.ts
@@ -178,10 +178,10 @@ describe('rpc-proxy chat message body budget', () => {
expect(response.status).toBe(401)
})
- it('credits ten small images instead of charging them as text', async () => {
+ it('credits twenty small images instead of charging them as text', async () => {
const body = JSON.stringify({
content: 'look',
- attachments: Array.from({ length: 10 }, (_, index) =>
+ attachments: Array.from({ length: 20 }, (_, index) =>
imageAttachment(`a${index + 1}`, 64 * 1024)
),
})
@@ -190,10 +190,10 @@ describe('rpc-proxy chat message body budget', () => {
expect(response.status).toBe(401)
})
- it('rejects an 11th qualifying image instead of charging it as text', async () => {
+ it('rejects a 21st qualifying image instead of charging it as text', async () => {
const body = JSON.stringify({
content: 'look',
- attachments: Array.from({ length: 11 }, (_, index) =>
+ attachments: Array.from({ length: 21 }, (_, index) =>
imageAttachment(`a${index + 1}`, 64 * 1024)
),
})
diff --git a/rpc-proxy/src/app.ts b/rpc-proxy/src/app.ts
index 124d19bef..2520c5a24 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 = 10
+const MAX_CHAT_IMAGES = 20
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 10-image / 16MiB total budget. An 11th qualifying
+ * decoded each within a 20-image / 16MiB total budget. A 21st 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 2db7ea462..1b82ea96d 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": 10,
+ "maxImages": 20,
"typicalImageBytes": 5242880,
"typicalTotalImageBytes": 9437184,
"typicalEnvelopeBytes": 14680064,
diff --git a/tests/e2e/fixtures/package-lock.json b/tests/e2e/fixtures/package-lock.json
index 2e5a1708b..17b402c80 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.85",
+ "version": "1.0.86",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@clerum/e2e-test-fixtures",
- "version": "1.0.85",
+ "version": "1.0.86",
"dependencies": {
"@kubernetes/client-node": "^1.0.0"
},
diff --git a/tests/e2e/fixtures/package.json b/tests/e2e/fixtures/package.json
index 6d6baa5ba..a38efcff1 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.85",
+ "version": "1.0.86",
"description": "E2E test fixtures and utilities for Clerum testing",
"type": "module",
"main": "index.ts",