Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
fix(codex): turn visual input on for every Codex model
Alfredo Lopez3200b6f33322
diff --git a/codex-llm-proxy/src/codexTransport.ts b/codex-llm-proxy/src/codexTransport.tsindex c36fa2e8b..7afd9b771 100644--- a/codex-llm-proxy/src/codexTransport.ts+++ b/codex-llm-proxy/src/codexTransport.ts@@ -49,8 +49,6 @@ export class CodexTransportError extends Error {}export type StreamCodexCompletionInput = {- /** Explicit rollout gate: local format support is not upstream certification. */- imageInputEnabled?: booleanexecutionTicket: stringrequestHash: stringrequest: unknown@@ -106,16 +104,6 @@ export async function streamCodexCompletion(if (request.model !== input.ticket.model) {throw new CodexTransportError('model_not_allowed', 'request model does not match the ticket')}- if (- request.schemaVersion === 'codex-completion-request.v2' &&- request.messages.some(message => message.contentParts?.some(part => part.type === 'image')) &&- input.imageInputEnabled !== true- ) {- throw new CodexTransportError(- 'image_input_unsupported',- 'Image input is not enabled for this Codex model'- )- }// A client that disconnected before dispatch must not consume the ticket:// nothing was redeemed, so there is no attempt receipt to finalize.if (input.signal?.aborted) {diff --git a/codex-llm-proxy/src/config.ts b/codex-llm-proxy/src/config.tsindex e8b8c3365..2aa9c3e08 100644--- a/codex-llm-proxy/src/config.ts+++ b/codex-llm-proxy/src/config.ts@@ -11,7 +11,6 @@ export type CodexLlmProxyConfig = {jwtIssuer: stringjwtPublicKey: stringexecutionEnabled: boolean- imageInputModels: string[]controlApiBaseUrl: stringcontrolApiServiceName: stringcontrolApiServiceToken: string@@ -60,10 +59,6 @@ function requiredNonEmpty(name: string, raw: string | undefined): string {}export function loadConfig(env: NodeJS.ProcessEnv = process.env): CodexLlmProxyConfig {- const imageInputModels = (env.CODEX_IMAGE_INPUT_MODELS ?? '')- .split(',')- .map(model => model.trim())- .filter(Boolean)const maxBodyBytes = requiredPositiveInt('CODEX_LLM_PROXY_MAX_BODY_BYTES',env.CODEX_LLM_PROXY_MAX_BODY_BYTES,@@ -74,7 +69,7 @@ export function loadConfig(env: NodeJS.ProcessEnv = process.env): CodexLlmProxyCenv.CODEX_LLM_PROXY_MAX_VISUAL_BODY_BYTES,LIMITS.maxVisualRequestBodyBytes)- if (imageInputModels.length > 0 && maxVisualBodyBytes < LIMITS.maxVisualRequestBodyBytes) {+ if (maxVisualBodyBytes < LIMITS.maxVisualRequestBodyBytes) {throw new Error('Visual Codex requests require the full shared envelope byte budget')}return {@@ -108,7 +103,6 @@ export function loadConfig(env: NodeJS.ProcessEnv = process.env): CodexLlmProxyCjwtIssuer: env.CODEX_LLM_PROXY_JWT_ISSUER?.trim() || 'control-api',jwtPublicKey: requiredPem('CODEX_LLM_PROXY_JWT_PUBLIC_KEY', env.CODEX_LLM_PROXY_JWT_PUBLIC_KEY),executionEnabled: env.CODEX_LLM_PROXY_EXECUTION_ENABLED === 'true',- imageInputModels,controlApiBaseUrl: requiredHttpUrl('CODEX_LLM_PROXY_CONTROL_API_URL',env.CODEX_LLM_PROXY_CONTROL_API_URLdiff --git a/codex-llm-proxy/src/server.ts b/codex-llm-proxy/src/server.tsindex ae0d14566..6b53183a8 100644--- a/codex-llm-proxy/src/server.ts+++ b/codex-llm-proxy/src/server.ts@@ -121,16 +121,15 @@ export function createProxyApps(const visualJson = express.json({ limit: config.maxVisualBodyBytes })// Selecting the transport budget needs the platform identity, so this runs as a// route handler after the rate limiter: an unauthenticated caller cannot force- // token verification or body parsing ahead of the limit. Only the image-capable- // completion endpoint with an already valid platform identity may use the larger- // budget. V1 is still bounded by its contract parser, and admin or- // unauthenticated requests keep the ordinary cap.+ // token verification or body parsing ahead of the limit. A valid platform+ // identity may use the visual envelope; V1 is still re-bounded after parse.+ // Admin or unauthenticated requests keep the ordinary cap.const selectTransportBudget = (req: GatedRequest, res: Response, next: NextFunction): void => {// Visual parse keeps a 24 MiB buffer. Admit that parse inside the visual// gate so two concurrent bodies stay inside the 256Mi pod. Identity is// read from the Authorization header; an anonymous caller cannot force// the larger parser.- if (config.imageInputModels.length > 0 && verifyPlatformJwt(bearer(req), config)) {+ if (verifyPlatformJwt(bearer(req), config)) {void (async () => {let release: (() => void) | undefinedtry {@@ -241,7 +240,6 @@ export function createProxyApps(res.setHeader('cache-control', 'no-cache')const started = Date.now()const result = await streamCodexCompletion({- imageInputEnabled: config.imageInputModels.includes(ticket.model),executionTicket: parsed.data.executionTicket,requestHash: parsed.data.requestHash,request: parsed.data.request,diff --git a/codex-llm-proxy/test/codexTransport.conformance.test.ts b/codex-llm-proxy/test/codexTransport.conformance.test.tsindex 5cead2371..2af62e41d 100644--- a/codex-llm-proxy/test/codexTransport.conformance.test.ts+++ b/codex-llm-proxy/test/codexTransport.conformance.test.ts@@ -126,16 +126,12 @@ describe('streamCodexCompletion', () => {fetchFn,lookup: async () => [{ address: '1.2.3.4', family: 4 }],}- await expect(streamCodexCompletion(input)).rejects.toMatchObject({- code: 'image_input_unsupported',+ await expect(streamCodexCompletion({ ...input, deadlineMs: 1000 })).rejects.toMatchObject({+ code: 'invalid_request',})expect(redeem).not.toHaveBeenCalled()expect(fetchFn).not.toHaveBeenCalled()- await expect(- streamCodexCompletion({ ...input, imageInputEnabled: true, deadlineMs: 1000 })- ).rejects.toMatchObject({ code: 'invalid_request' })- expect(redeem).not.toHaveBeenCalled()- await streamCodexCompletion({ ...input, imageInputEnabled: true })+ await streamCodexCompletion(input)const body = JSON.parse(String(fetchFn.mock.calls[0]?.[1]?.body))const sourceParts = fixtures[format].messages[0].contentPartsexpect(body.input[0].content).toEqual(diff --git a/codex-llm-proxy/test/runtimePath.hermetic.e2e.test.ts b/codex-llm-proxy/test/runtimePath.hermetic.e2e.test.tsindex e17cfd5fd..5cfd19990 100644--- a/codex-llm-proxy/test/runtimePath.hermetic.e2e.test.ts+++ b/codex-llm-proxy/test/runtimePath.hermetic.e2e.test.ts@@ -86,7 +86,6 @@ function config(): CodexLlmProxyConfig {jwtIssuer: 'control-api',jwtPublicKey: publicKey,executionEnabled: true,- imageInputModels: [],controlApiBaseUrl: '',controlApiServiceName: 'codex-llm-proxy',controlApiServiceToken: '',diff --git a/codex-llm-proxy/test/server.security.test.ts b/codex-llm-proxy/test/server.security.test.tsindex e060c651f..70f9ae5a9 100644--- a/codex-llm-proxy/test/server.security.test.ts+++ b/codex-llm-proxy/test/server.security.test.ts@@ -30,7 +30,6 @@ function config(overrides: Partial<CodexLlmProxyConfig> = {}): CodexLlmProxyConfjwtIssuer: 'control-api',jwtPublicKey: publicKey,executionEnabled: true,- imageInputModels: [],controlApiBaseUrl: '',controlApiServiceName: 'codex-llm-proxy',controlApiServiceToken: '',@@ -159,7 +158,7 @@ describe('codex-llm-proxy security surface', () => {it('reserves the larger transport budget for authenticated visual requests', async () => {const { runtimeApp, adminApp } = createProxyApps(- config({ maxBodyBytes: 1_048_576, imageInputModels: ['gpt-5.1'] })+ config({ maxBodyBytes: 1_048_576 }))// Deliberately invalid ticket: this test checks parser admission and the// unchanged ticket gate, without redeeming or contacting any model.@@ -201,7 +200,7 @@ describe('codex-llm-proxy security surface', () => {it('rate limits the completion endpoint before body parsing and authorization', async () => {const { runtimeApp } = createProxyApps(- config({ maxBodyBytes: 1024, imageInputModels: ['gpt-5.1'] })+ config({ maxBodyBytes: 1024 }))const completion = () => request(runtimeApp).post('/internal/runtime/v1/codex/completions')const oversized = {@@ -357,27 +356,20 @@ describe('codex-llm-proxy security surface', () => {).toThrow(/bounded positive integer/)})- it('keeps visual rollout disabled by default and refuses an incompatible envelope budget', () => {+ it('refuses a visual envelope budget below the shared contract', () => {const required = {CODEX_LLM_PROXY_JWT_PUBLIC_KEY: publicKey,CODEX_LLM_PROXY_CONTROL_API_URL:'http://control-api-rpc-gateway.control-plane.svc.cluster.local:8090/api/v1',CODEX_LLM_PROXY_CONTROL_API_TOKEN: 'dev-codex-llm-proxy-token',}- expect(loadConfig(required).imageInputModels).toEqual([])expect(() =>loadConfig({...required,- CODEX_IMAGE_INPUT_MODELS: 'gpt-5.1',CODEX_LLM_PROXY_MAX_VISUAL_BODY_BYTES: '1024',})).toThrow(/shared envelope byte budget/)- expect(- loadConfig({- ...required,- CODEX_IMAGE_INPUT_MODELS: ' gpt-5.1, gpt-5.3-codex ',- }).imageInputModels- ).toEqual(['gpt-5.1', 'gpt-5.3-codex'])+ expect(loadConfig(required).maxVisualBodyBytes).toBe(24 * 1024 * 1024)})})diff --git a/codex-llm-proxy/test/sseBackpressure.test.ts b/codex-llm-proxy/test/sseBackpressure.test.tsindex bfd092bf1..dae86e6e5 100644--- a/codex-llm-proxy/test/sseBackpressure.test.ts+++ b/codex-llm-proxy/test/sseBackpressure.test.ts@@ -96,7 +96,6 @@ function config(): CodexLlmProxyConfig {jwtIssuer: 'control-api',jwtPublicKey: publicKey,executionEnabled: true,- imageInputModels: [],controlApiBaseUrl: 'http://control-api.invalid/api/v1',controlApiServiceName: 'codex-llm-proxy',controlApiServiceToken: 'unused',diff --git a/control-api/package-lock.json b/control-api/package-lock.jsonindex cf98c3332..e07f53919 100644--- a/control-api/package-lock.json+++ b/control-api/package-lock.json@@ -1,12 +1,12 @@{"name": "clerum-control-api",- "version": "0.1.580",+ "version": "0.1.581","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "clerum-control-api",- "version": "0.1.580",+ "version": "0.1.581","dependencies": {"@clerum/display-field": "file:../packages/display-field","@clerum/grok-provider-attempt-contract": "file:../packages/grok-provider-attempt-contract",diff --git a/control-api/package.json b/control-api/package.jsonindex f32194a25..55b75e8bf 100644--- a/control-api/package.json+++ b/control-api/package.json@@ -1,6 +1,6 @@{"name": "clerum-control-api",- "version": "0.1.580",+ "version": "0.1.581","description": "Internal Clerum control plane REST API + UI for managing CRDs and secrets","main": "dist/main.js","engines": {diff --git a/control-api/test/services.llmProviderAttemptAuthorizer.test.ts b/control-api/test/services.llmProviderAttemptAuthorizer.test.tsindex 4f7912829..c738832ce 100644--- a/control-api/test/services.llmProviderAttemptAuthorizer.test.ts+++ b/control-api/test/services.llmProviderAttemptAuthorizer.test.ts@@ -241,7 +241,6 @@ describe('authorizeLlmProviderAttempt', () => {const frames: unknown[] = []const result = await streamCodexCompletion({...envelope,- imageInputEnabled: true,ticket: {jti: 'fixture-ticket',hostRef: 'research-host',@@ -284,7 +283,6 @@ describe('authorizeLlmProviderAttempt', () => {const provider = new CodexSubscriptionProvider(REQUEST.model, {authorizer,proxy,- imageInputEnabled: true,attemptContext: () => ({policyRevision: 4,policyHash: body().policyHash,@@ -418,7 +416,6 @@ describe('authorizeLlmProviderAttempt', () => {const frames: unknown[] = []const result = await streamCodexCompletion({...envelope,- imageInputEnabled: true,ticket: {jti: 'fixture-ticket',hostRef: 'research-host',@@ -457,7 +454,6 @@ describe('authorizeLlmProviderAttempt', () => {const provider = new CodexSubscriptionProvider(REQUEST.model, {authorizer,proxy,- imageInputEnabled: true,attemptContext: () => ({policyRevision: 4,policyHash: body().policyHash,diff --git a/deploy/base/control-plane/codex-llm-proxy.yaml b/deploy/base/control-plane/codex-llm-proxy.yamlindex 384384c4e..d8cf25cb2 100644--- a/deploy/base/control-plane/codex-llm-proxy.yaml+++ b/deploy/base/control-plane/codex-llm-proxy.yaml@@ -21,8 +21,6 @@ data:CODEX_LLM_PROXY_MAX_BODY_BYTES: "1048576"# V2 visual envelope. Keep this equal to LIMITS.maxVisualRequestBodyBytes.# Ordinary and anonymous requests still use CODEX_LLM_PROXY_MAX_BODY_BYTES.- # Visual parse stays on the 1 MiB ordinary cap until CODEX_IMAGE_INPUT_MODELS- # is set to the same list on this proxy and on mcp-host.CODEX_LLM_PROXY_MAX_VISUAL_BODY_BYTES: "25165824"CODEX_LLM_PROXY_MAX_STREAM_DURATION_MS: "300000"CODEX_LLM_PROXY_MAX_DEADLINE_MS: "300000"diff --git a/desktop-app/test/codexImageChallenge.test.ts b/desktop-app/test/codexImageChallenge.test.tsindex 6bb3e0e4d..b556c5e07 100644--- a/desktop-app/test/codexImageChallenge.test.ts+++ b/desktop-app/test/codexImageChallenge.test.ts@@ -1,6 +1,10 @@import { describe, expect, it } from 'vitest'import { createRequire } from 'node:module'-import { challengeImage, paddedChallengeImage } from './e2e-playwright/codexImageChallenge.js'+import {+ challengeImage,+ challengeImageAt,+ paddedChallengeImage,+} from './e2e-playwright/codexImageChallenge.js'const MIB = 1024 * 1024const { inspectVisualImage } = createRequire(import.meta.url)(@@ -27,6 +31,37 @@ describe('Codex image challenge fixtures', () => {}})+ it('keeps a 2048 px JPEG inside the hop pixel bound', () => {+ const image = challengeImageAt('jpeg', 2048, 256)+ expect(image.width).toBe(2048)+ expect(image.height).toBe(256)+ expect(image.bytes.includes(Buffer.from(image.code))).toBe(false)+ const inspected = inspectVisualImage({+ mimeType: 'image/jpeg',+ data: image.bytes.toString('base64'),+ })+ expect(inspected.ok, inspected.message).toBe(true)+ })++ it('keeps a 2048 by 2048 JPEG at the pixel ceiling', () => {+ const image = challengeImageAt('jpeg', 2048, 2048)+ const inspected = inspectVisualImage({+ mimeType: 'image/jpeg',+ data: image.bytes.toString('base64'),+ })+ expect(inspected.ok, inspected.message).toBe(true)+ })++ it('builds a 2049 px PNG the hop must refuse', () => {+ const image = challengeImageAt('png', 2049, 128)+ const inspected = inspectVisualImage({+ mimeType: 'image/png',+ data: image.bytes.toString('base64'),+ })+ expect(inspected.ok).toBe(false)+ expect(inspected.message).toMatch(/dimension/)+ })+it('pads a 5 MiB JPEG without putting the answer in the file bytes as text', () => {const image = paddedChallengeImage('jpeg', 5 * MIB)expect(image.bytes).toHaveLength(5 * MIB)diff --git a/desktop-app/test/e2e-playwright/codex-image-input.spec.ts b/desktop-app/test/e2e-playwright/codex-image-input.spec.tsindex f09198a02..494382c37 100644--- a/desktop-app/test/e2e-playwright/codex-image-input.spec.ts+++ b/desktop-app/test/e2e-playwright/codex-image-input.spec.ts@@ -6,14 +6,13 @@* existing stored-session reset needs explicit opt-in before fixtures run.*/import { randomUUID } from 'node:crypto'-import { challengeImage, paddedChallengeImage } from './codexImageChallenge.js'+import { challengeImage, challengeImageAt, paddedChallengeImage } from './codexImageChallenge.js'import { expect, test } from './fixtures.js'const hostRef = process.env.E2E_HOST_REF ?? ''const hostLabel = process.env.E2E_CODEX_HOST_LABEL ?? ''const modelId = process.env.E2E_CODEX_IMAGE_MODEL ?? ''const modelLabel = process.env.E2E_CODEX_IMAGE_MODEL_LABEL ?? ''-const mode = process.env.E2E_CODEX_IMAGE_MODE ?? ''const MIB = 1024 * 1024const escapeRegex = (value: string): string => value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')@@ -39,7 +38,6 @@ test.beforeAll(() => {expect(hostLabel, 'Name its visible Agents-list label explicitly').not.toBe('')expect(modelId, 'Name the actual Codex model explicitly').not.toBe('')expect(modelLabel, 'Name its visible model-picker label explicitly').not.toBe('')- expect(['enabled', 'disabled'], 'Select a provisioned capability lane explicitly').toContain(mode)})async function startOwnedChat(page: import('@playwright/test').Page): Promise<void> {@@ -125,22 +123,11 @@ async function sendVisualTurn().toBeVisible()}const answer = page.getByTestId('agent-response')- if (mode === 'enabled') {- for (const code of input.codes) {- await expect(answer).toContainText(new RegExp(`\\b${code}\\b`, 'i'), { timeout: 180_000 })- }- await expect(answer).not.toHaveClass(/chat-bubble--error/)- await expect(thread.getByTestId('progress-stepper')).toHaveCount(0)- } else {- await expect(answer.locator('.error-bubble-message')).toContainText(- 'Image input is not enabled for this Codex model',- { timeout: 180_000 }- )- await expect(answer).toHaveClass(/chat-bubble--error/)- for (const code of input.codes) {- await expect(answer).not.toContainText(new RegExp(`\\b${code}\\b`, 'i'))- }+ for (const code of input.codes) {+ await expect(answer).toContainText(new RegExp(`\\b${code}\\b`, 'i'), { timeout: 180_000 })}+ await expect(answer).not.toHaveClass(/chat-bubble--error/)+ await expect(thread.getByTestId('progress-stepper')).toHaveCount(0)await expect(answer).toHaveCount(1)await expect(send).toHaveAttribute('aria-label', 'Send message')await expect(thread.locator('.chat-message--in-flight')).toHaveCount(0)@@ -159,9 +146,7 @@ function visualPrompt(count: number): string {}for (const format of ['png', 'jpeg'] as const) {- test(`${format} visual input follows the explicitly provisioned capability lane`, async ({- appPage,- }) => {+ test(`${format} visual input reaches the owned Codex Host and model`, async ({ appPage }) => {test.setTimeout(240_000)// The random answer exists only in pixels, never the filename or prompt.// A generic response or discarded image cannot satisfy this 64-bit challenge.@@ -186,7 +171,53 @@ for (const format of ['png', 'jpeg'] as const) {})}-test('5 MiB JPEG follows the same capability lane as a small image', async ({ appPage }) => {+test('2048 px JPEG follows the Codex long-side pixel bound', async ({ appPage }) => {+ test.setTimeout(360_000)+ const image = challengeImageAt('jpeg', 2048, 256)+ const filename = `visual-${randomUUID()}.jpeg`+ await startOwnedChat(appPage)+ await uploadThroughChooser(appPage, [+ { name: filename, mimeType: 'image/jpeg', buffer: image.bytes },+ ])+ await assertPreview(appPage, filename)+ await sendVisualTurn(appPage, {+ prompt: visualPrompt(1),+ filenames: [filename],+ codes: [image.code],+ })+})++test('2048 by 2048 JPEG stays at the Codex pixel ceiling', async ({ appPage }) => {+ test.setTimeout(360_000)+ const image = challengeImageAt('jpeg', 2048, 2048)+ const filename = `visual-${randomUUID()}.jpeg`+ await startOwnedChat(appPage)+ await uploadThroughChooser(appPage, [+ { name: filename, mimeType: 'image/jpeg', buffer: image.bytes },+ ])+ await assertPreview(appPage, filename)+ await sendVisualTurn(appPage, {+ prompt: visualPrompt(1),+ filenames: [filename],+ codes: [image.code],+ })+})++test('refuses a 2049 px image before send', async ({ appPage }) => {+ const image = challengeImageAt('png', 2049, 128)+ const filename = `over-res-${randomUUID()}.png`+ await startOwnedChat(appPage)+ await uploadThroughChooser(appPage, [+ { name: filename, mimeType: 'image/png', buffer: image.bytes },+ ])+ await expect(appPage.getByRole('alert')).toContainText(+ `${filename} is too large. Max resolution is 2048 px.`+ )+ await expect(appPage.getByRole('button', { name: filename, exact: true })).toHaveCount(0)+ await expect(appPage.getByTestId('agent-response')).toHaveCount(0)+})++test('5 MiB JPEG follows the same visual path as a small image', async ({ appPage }) => {test.setTimeout(360_000)const image = paddedChallengeImage('jpeg', 5 * MIB)const filename = `visual-${randomUUID()}.jpeg`diff --git a/desktop-app/test/e2e-playwright/codexImageChallenge.ts b/desktop-app/test/e2e-playwright/codexImageChallenge.tsindex 6a6a51c85..ebb25a36e 100644--- a/desktop-app/test/e2e-playwright/codexImageChallenge.ts+++ b/desktop-app/test/e2e-playwright/codexImageChallenge.ts@@ -11,23 +11,36 @@ const fixtures = createRequire(__filename)(}/** A neutral image with an answer absent from the filename and user prompt. */-export function challengeImage(format: 'png' | 'jpeg'): { code: string; bytes: Buffer } {+export function challengeImageAt(+ format: 'png' | 'jpeg',+ width: number,+ height: number+): { code: string; bytes: Buffer; width: number; height: number } {// Reuse the Host renderer installed for T0; do not add another dependency.const { createCanvas } = require('@napi-rs/canvas')const code = randomBytes(8).toString('hex').toUpperCase()- const canvas = createCanvas(800, 120)+ const canvas = createCanvas(width, height)const context = canvas.getContext('2d')context.fillStyle = 'white'- context.fillRect(0, 0, 800, 120)+ context.fillRect(0, 0, width, height)context.fillStyle = 'black'- context.font = '48px monospace'- context.fillText(code, 24, 78)+ const fontSize = Math.max(24, Math.min(Math.floor(height * 0.4), Math.floor(width / 12)))+ context.font = `${fontSize}px monospace`+ context.textBaseline = 'middle'+ context.fillText(code, Math.max(16, Math.floor(width * 0.04)), Math.floor(height / 2))return {code,bytes: format === 'png' ? canvas.toBuffer('image/png') : canvas.toBuffer('image/jpeg'),+ width,+ height,}}+export function challengeImage(format: 'png' | 'jpeg'): { code: string; bytes: Buffer } {+ const image = challengeImageAt(format, 800, 120)+ return { code: image.code, bytes: image.bytes }+}+/** Same pixel challenge, grown to an exact decoded size the contract still accepts. */export function paddedChallengeImage(format: 'png' | 'jpeg',diff --git a/desktop-app/test/e2e-playwright/playwright.codex-image.config.ts b/desktop-app/test/e2e-playwright/playwright.codex-image.config.tsindex 969dbca27..713d77202 100644--- a/desktop-app/test/e2e-playwright/playwright.codex-image.config.ts+++ b/desktop-app/test/e2e-playwright/playwright.codex-image.config.ts@@ -18,9 +18,6 @@ for (const name of []) {if (!process.env[name]?.trim()) throw new Error(`Codex image lane requires explicit ${name}`)}-if (!['enabled', 'disabled'].includes(process.env.E2E_CODEX_IMAGE_MODE ?? '')) {- throw new Error('Codex image lane requires E2E_CODEX_IMAGE_MODE=enabled or disabled')-}export default defineConfig({...base,diff --git a/desktop-app/ui/src/components/agents/ComposerPanel.tsx b/desktop-app/ui/src/components/agents/ComposerPanel.tsxindex 8ecc065e8..0f0896a09 100644--- a/desktop-app/ui/src/components/agents/ComposerPanel.tsx+++ b/desktop-app/ui/src/components/agents/ComposerPanel.tsx@@ -22,6 +22,7 @@ import {COMPOSER_ACCEPT_IMAGE_MIME_TYPES,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'@@ -29,6 +30,7 @@ import { useContextsDataController } from '@hooks/domain/useContextsDataControllimport { useMcpServersDataController } from '@hooks/domain/useMcpServersDataController'import { useClickOutside } from '@hooks/useClickOutside'import { useComposerDraft } from '@hooks/useComposerDraft'+import { readImageHeaderDimensions } from '@lib/imageHeaderDimensions'import type { WorkflowRecipeListResult } from '../../../../src/types'import type { ComposerImageAttachment, ComposerReferenceAttachment } from '../../uiTypes'import { AnnotationCanvas } from './AnnotationCanvas'@@ -60,6 +62,36 @@ function formatComposerMebibytes(bytes: number): number {return Math.round(bytes / (1024 * 1024))}+function bytesFromBase64(data: string): Uint8Array | null {+ try {+ const binary = atob(data)+ const bytes = new Uint8Array(binary.length)+ for (let index = 0; index < binary.length; index += 1) {+ bytes[index] = binary.charCodeAt(index)+ }+ return bytes+ } catch {+ return null+ }+}++function composerImageDimensionRejection(+ name: string,+ mimeType: ComposerImageAttachment['mimeType'],+ dataBase64: string+): string | null {+ const bytes = bytesFromBase64(dataBase64)+ const dimensions = bytes ? readImageHeaderDimensions(mimeType, bytes) : null+ if (!dimensions) return null+ if (+ dimensions.width > COMPOSER_MAX_IMAGE_DIMENSION ||+ dimensions.height > COMPOSER_MAX_IMAGE_DIMENSION+ ) {+ return `${name || 'Image'} is too large. Max resolution is ${COMPOSER_MAX_IMAGE_DIMENSION} px.`+ }+ return null+}+type ComposerImageBudgetRejection = 'image-too-large' | 'total-too-large' | null/**@@ -505,6 +537,16 @@ export function ComposerPanel({ inline = false, agentSelector }: ComposerPanelPrrevokePreviewUrl(previewUrl)continue}+ const dimensionError = composerImageDimensionRejection(+ file.name || 'Image',+ mimeType,+ dataBase64+ )+ if (dimensionError) {+ validationErrors.push(dimensionError)+ revokePreviewUrl(previewUrl)+ continue+ }accepted.push({id: crypto.randomUUID(),name: buildAttachmentName(file, source, mimeType, index),@@ -560,18 +602,31 @@ export function ComposerPanel({ inline = false, agentSelector }: ComposerPanelPr0)const rejection = composerImageBudgetRejection(updated.sizeBytes, otherImagesBytes)- if (!rejection) {+ const dimensionError = composerImageDimensionRejection(+ updated.name || 'Image',+ updated.mimeType,+ updated.dataBase64+ )+ if (!rejection && !dimensionError) {onUpdateComposerImageAttachment(updated)return}+ if (rejection === 'image-too-large') {+ 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(- rejection === 'image-too-large'- ? `${updated.name || 'Image'} was kept unchanged. Max size is ${formatComposerMebibytes(- COMPOSER_MAX_IMAGE_BYTES- )} MiB per image.`- : `${updated.name || 'Image'} was kept unchanged. Attachments can total at most ${formatComposerMebibytes(- COMPOSER_MAX_TOTAL_IMAGE_BYTES- )} MiB per message.`+ `${updated.name || 'Image'} was kept unchanged. Max resolution is ${COMPOSER_MAX_IMAGE_DIMENSION} px.`)},[composerImageAttachments, onUpdateComposerImageAttachment]diff --git a/desktop-app/ui/src/components/agents/__tests__/ComposerPanel.test.tsx b/desktop-app/ui/src/components/agents/__tests__/ComposerPanel.test.tsxindex d7bf2f0b8..88dc0c85d 100644--- a/desktop-app/ui/src/components/agents/__tests__/ComposerPanel.test.tsx+++ b/desktop-app/ui/src/components/agents/__tests__/ComposerPanel.test.tsx@@ -249,6 +249,17 @@ const MIB = 1024 * 1024* size drives the real code path without allocating and base64-encoding 10MiB* blobs per case.*/+function pngIhdrFile(name: string, width: number, height: number): File {+ const bytes = new Uint8Array(8 + 8 + 13)+ bytes.set([0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a], 0)+ const view = new DataView(bytes.buffer)+ view.setUint32(8, 13)+ bytes.set([0x49, 0x48, 0x44, 0x52], 12)+ view.setUint32(16, width)+ view.setUint32(20, height)+ return new File([bytes], name, { type: 'image/png' })+}+function imageFile(name: string, sizeBytes: number, type = 'image/png'): File {const file = new File([new Uint8Array([0x41])], name, { type })Object.defineProperty(file, 'size', { configurable: true, value: sizeBytes })@@ -366,6 +377,18 @@ describe('ComposerPanel image budget', () => {expect(screen.queryByRole('alert')).toBeNull()})+ it('refuses a 2049 px image before send and names the pixel bound', async () => {+ const { container } = render(<ComposerPanel inline={false} />)+ pickFiles(container, [pngIhdrFile('over-res.png', 2049, 128)])+ await waitFor(() =>+ expect(screen.getByRole('alert').textContent).toContain(+ 'over-res.png is too large. Max resolution is 2048 px.'+ )+ )+ expect(composerActions.handleAddComposerImageAttachments).not.toHaveBeenCalled()+ expect(attachedImages()).toHaveLength(0)+ })+it('explains files beyond the 3-image cap instead of dropping them silently', async () => {composerState.composerImageAttachments = [existingAttachment('a.png', MIB),diff --git a/desktop-app/ui/src/constants/attachments.ts b/desktop-app/ui/src/constants/attachments.tsindex 57f2630e6..e7cde7248 100644--- a/desktop-app/ui/src/constants/attachments.ts+++ b/desktop-app/ui/src/constants/attachments.ts@@ -6,6 +6,8 @@ export const COMPOSER_MAX_IMAGE_ATTACHMENTS = 3*/export const COMPOSER_MAX_IMAGE_BYTES = 16 * 1024 * 1024export 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 = 2048export const COMPOSER_ACCEPT_IMAGE_MIME_TYPES = ['image/jpeg', 'image/png'] as constexport const ZAI_IMAGE_ATTACHMENT_UNSUPPORTED_MESSAGE ='Image attachments are not supported for agents running on Z AI yet. Switch this agent to a provider with image input support before attaching images.'diff --git a/desktop-app/ui/src/lib/__tests__/imageHeaderDimensions.test.ts b/desktop-app/ui/src/lib/__tests__/imageHeaderDimensions.test.tsnew file mode 100644index 000000000..dcced88e4--- /dev/null+++ b/desktop-app/ui/src/lib/__tests__/imageHeaderDimensions.test.ts@@ -0,0 +1,34 @@+import { describe, expect, it } from 'vitest'+import { readImageHeaderDimensions } from '../imageHeaderDimensions'++function pngIhdrStub(width: number, height: number): Uint8Array {+ const bytes = new Uint8Array(8 + 8 + 13)+ bytes.set([0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a], 0)+ const view = new DataView(bytes.buffer)+ view.setUint32(8, 13)+ bytes.set([0x49, 0x48, 0x44, 0x52], 12)+ view.setUint32(16, width)+ view.setUint32(20, height)+ return bytes+}++describe('readImageHeaderDimensions', () => {+ it('reads PNG IHDR width and height', () => {+ expect(readImageHeaderDimensions('image/png', pngIhdrStub(2048, 256))).toEqual({+ width: 2048,+ height: 256,+ })+ })++ it('reads a 2049 px PNG so the composer can refuse it', () => {+ expect(readImageHeaderDimensions('image/png', pngIhdrStub(2049, 128))).toEqual({+ width: 2049,+ height: 128,+ })+ })++ it('ignores bytes that are not a PNG or JPEG header', () => {+ expect(readImageHeaderDimensions('image/png', new Uint8Array([0x41]))).toBeNull()+ expect(readImageHeaderDimensions('image/jpeg', new Uint8Array([0x41]))).toBeNull()+ })+})diff --git a/desktop-app/ui/src/lib/imageHeaderDimensions.ts b/desktop-app/ui/src/lib/imageHeaderDimensions.tsnew file mode 100644index 000000000..a0ab258d2--- /dev/null+++ b/desktop-app/ui/src/lib/imageHeaderDimensions.ts@@ -0,0 +1,78 @@+/**+ * Header-only PNG/JPEG dimensions for the composer resolution guard.+ * This does not prove the file decodes; the hop still validates the container.+ */++const JPEG_SOF_MARKERS = new Set([+ 0xc0, 0xc1, 0xc2, 0xc3, 0xc5, 0xc6, 0xc7, 0xc9, 0xca, 0xcb, 0xcd, 0xce, 0xcf,+])++export type ImageHeaderDimensions = {+ width: number+ height: number+}++export function readImageHeaderDimensions(+ mimeType: 'image/png' | 'image/jpeg',+ bytes: Uint8Array+): ImageHeaderDimensions | null {+ if (mimeType === 'image/png') return readPngDimensions(bytes)+ if (mimeType === 'image/jpeg') return readJpegDimensions(bytes)+ const exhaustive: never = mimeType+ return exhaustive+}++function readPngDimensions(bytes: Uint8Array): ImageHeaderDimensions | null {+ if (bytes.length < 24) return null+ if (+ bytes[0] !== 0x89 ||+ bytes[1] !== 0x50 ||+ bytes[2] !== 0x4e ||+ bytes[3] !== 0x47 ||+ bytes[4] !== 0x0d ||+ bytes[5] !== 0x0a ||+ bytes[6] !== 0x1a ||+ bytes[7] !== 0x0a+ ) {+ return null+ }+ const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength)+ if (view.getUint32(8) !== 13) return null+ if (bytes[12] !== 0x49 || bytes[13] !== 0x48 || bytes[14] !== 0x44 || bytes[15] !== 0x52) {+ return null+ }+ const width = view.getUint32(16)+ const height = view.getUint32(20)+ if (width < 1 || height < 1) return null+ return { width, height }+}++function readJpegDimensions(bytes: Uint8Array): ImageHeaderDimensions | null {+ if (bytes.length < 4 || bytes[0] !== 0xff || bytes[1] !== 0xd8) return null+ const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength)+ let pos = 2+ while (pos < bytes.length) {+ if (bytes[pos] !== 0xff) return null+ while (pos < bytes.length && bytes[pos] === 0xff) pos += 1+ if (pos >= bytes.length) return null+ const marker = bytes[pos]+ pos += 1+ if (marker === 0x00) return null+ if (marker === 0xd9) break+ if (marker === 0xd8) return null+ if (marker === 0x01 || (marker >= 0xd0 && marker <= 0xd7)) continue+ if (pos + 2 > bytes.length) return null+ const segmentLength = view.getUint16(pos)+ if (segmentLength < 2 || pos + segmentLength > bytes.length) return null+ if (JPEG_SOF_MARKERS.has(marker)) {+ if (segmentLength < 8) return null+ const height = view.getUint16(pos + 3)+ const width = view.getUint16(pos + 5)+ if (width < 1 || height < 1) return null+ return { width, height }+ }+ if (marker === 0xda) break+ pos += segmentLength+ }+ return null+}diff --git a/docs/architecture/codex-subscription-transport-contract.md b/docs/architecture/codex-subscription-transport-contract.mdindex 7fe268df9..110e3b385 100644--- a/docs/architecture/codex-subscription-transport-contract.md+++ b/docs/architecture/codex-subscription-transport-contract.md@@ -40,8 +40,10 @@ ceiling is 16 MiB per image and 16 MiB aggregate so a poorly compressed 2048PNG may exceed 10 MiB; the HTTP envelope stays 24 MiB so that encoded bodystill fits. Dimensions above 2048 px are rejected here because the frozenChatGPT endpoint 400s them; that is a model/pixel limit, not a byte limit.-Which models accept images is owned by issue #654 / PR #669 (models.dev).-These byte numbers are conservative Evenfire limits, not upstream facts.+For `codex-subscription`, visual input is on by default for every catalog model.+Which non-Codex providers accept images is owned by issue #654 / PR #669+(models.dev). These byte numbers are conservative Evenfire limits, not+upstream facts.The shared pure validator checks canonical base64, MIME/container framing andheader dimensions; it does not decode pixels or prove image decodability.The fixtures contain independently decoded 2x2 PNG/JPEG images.@@ -56,7 +58,7 @@ signing but before commit. Exceeding the bound rolls back the new attempt,ticket and new reservation; it does not call the receipt finalizer before redeem.The Host uses the same envelope builder. V2 has no outer deadline: its deadlineis `request.deadlineMs`, part of the authorized hash. A proxy configured below-the shared visual envelope budget refuses visual activation at startup.+the shared visual envelope budget refuses to start.Desktop enforces the 16 MiB individual and 16 MiB combined hard attachmentbudgets (usual target remains 5 / 9 MiB).@@ -76,21 +78,19 @@ an inline data URL. The shape is grounded in the official Codex client[ContentItem and ImageReference definitions](https://github.com/openai/codex/blob/fc2ea82e7eff22c618a56db29c68a6b1967cba7d/codex-rs/protocol/src/models.rs#L878).This source evidence is not a successful call to Evenfire's frozen endpoint.-`CODEX_IMAGE_INPUT_MODELS` is an explicit, comma-separated model rollout gate in-both Host and proxy. It defaults to empty. Set the same list on both services:-enabling it on Host alone still parses the proxy at 1 MiB, and enabling it on-the proxy alone still returns `image_input_unsupported` from Host. Set it only-for the models whose interoperability has been independently verified, after-every authorizer/proxy replica accepts V2. This gate is not a replacement for-catalog authorization.-Until enabled, visual input returns `image_input_unsupported`; it is not silently-removed and does not trigger automatic fallback. Ordinary eligible failures-retain the existing configured fallback policy. Limit errors, including HTTP-413 without a JSON body, remain non-retryable.+Visual input is on by default for every `codex-subscription` model. Catalog+authorization still decides which model a Host may call; this transport does+not keep a second model-vision allowlist. To stop all Codex traffic, use the+existing kill switches (`MCP_HOST_CODEX_SUBSCRIPTION_ENABLED` and+`CODEX_LLM_PROXY_EXECUTION_ENABLED`). Missing image provenance returns+`image_source_invalid`. Limit errors, including HTTP 413 without a JSON body,+remain non-retryable. Images are never silently stripped and do not trigger+automatic fallback.Deploy accepting consumers before visual senders. An old consumer must rejectV2 explicitly; do not translate V2 to text to work around that rejection. On-rollback disable visual activation first, drain attempts, then restore consumers.+rollback set `CODEX_LLM_PROXY_EXECUTION_ENABLED=false`, drain attempts, then+restore consumers.Do not roll back to a sender that silently discards images without a front guard.Committed abandoned attempts retain their audit identity. Existing ticket andbudget TTLs, rather than the receipt finalizer, bound their execution and pendingdiff --git a/docs/testing/codex-subscription-validation.md b/docs/testing/codex-subscription-validation.mdindex c51a744d4..3e4ce56c9 100644--- a/docs/testing/codex-subscription-validation.md+++ b/docs/testing/codex-subscription-validation.md@@ -32,17 +32,16 @@ or readiness. Leave the default enabled for initial bootstrap. Verify theHost's provider/model/connection binding before and after the update.Provider tests must cover both completion methods, direct/tool origins, prompt-context, redacted text parts, repeated bytes from distinct tool calls and the-default-disabled model gate. Proxy conformance inspects the final upstream body,+context, redacted text parts and repeated bytes from distinct tool calls.+Proxy conformance inspects the final upstream body,asserts provenance does not become model input, and retains tools/cancel/SSEchecks. Authorizer tests require a pre-commit exact-envelope check; its PostgreSQLcase must prove rollback against a real transaction. A mocked transaction resultdoes not satisfy that PostgreSQL gate.-Set `CODEX_IMAGE_INPUT_MODELS` consistently on the owned Host/proxy only after-consumer rollout and a separately authorized neutral-image interoperability check.-The default empty list rejects visual input clearly. No test fixture or passing-conformance suite certifies that the real endpoint or selected model sees images.+Visual input is on by default for every `codex-subscription` model. No test+fixture or passing conformance suite certifies that the real endpoint or+selected model sees images.Keep browser/Electron evidence separate: visible login and Host selection, uploadthrough Add context / Upload Files, preview, send, correlated task completion and@@ -60,12 +59,11 @@ uploads through the visible composer, including a 5 MiB JPEG, a 12 MiB PNG16 MiB, over 16 MiB total, a fourth image, and a non-PNG/JPEG type. It creates a fresh 64-bit hexadecimalchallenge rendered only into image pixels. Large cases pad that same image sothe answer stays in pixels while the decoded size matches the hop budget. The-filename and prompt do not carry the answer. An enabled run requires that+filename and prompt do not carry the answer. A passing run requires thatanswer (hexadecimal case is ignored), a non-error response, no tool stepssubstituting OCR/loading for direct image input, and no fallback badge.The selector's stable data attributes verify the actual selected Host, provider-and model. The disabled mode instead requires the explicit capability error.-Composer budget refusals never send.+and model. Composer budget and resolution refusals never send.This is a real upstream lane, not a mock. Before running it, obtain separateauthorization for runtime, upstream access and the existing login fixture's@@ -77,10 +75,7 @@ stored-session reset. Provision the owned Host and consumers first. Set:- `E2E_HOST_REF` to the actual owned Host and `E2E_CODEX_HOST_LABEL` to itsexact visible label in the Agents list; there is no shared-host default.- `E2E_CODEX_IMAGE_MODEL` and `E2E_CODEX_IMAGE_MODEL_LABEL` to its model ID and- visible picker label.-- `E2E_CODEX_IMAGE_MODE=enabled` or `disabled`, matching the provisioned- capability gate. Run both modes against their appropriate configuration;- the test does not change deployments or grants.+ visible picker label. The test does not change deployments or grants.Install Host dependencies as well as Desktop dependencies: the neutral challengeuses the existing Host canvas dependency. Node 24 and `verify:electron` remain@@ -93,7 +88,7 @@ node node_modules/@playwright/test/cli.js test \```The normal Desktop project excludes this spec. Its dedicated config rejects-missing authority, Host/model identity or mode before global setup; it cannot+missing authority or Host/model identity before global setup; it cannotreturn a successful all-skipped run. The model ID must be the canonical IDreturned by the runtime, not an alias. Static audit/typecheck and local challenge-imagedecoding do not count as browser or real-upstream execution. Typed tool-resultdiff --git a/mcp-host/package-lock.json b/mcp-host/package-lock.jsonindex 98cae4676..39932e385 100644--- a/mcp-host/package-lock.json+++ b/mcp-host/package-lock.json@@ -1,12 +1,12 @@{"name": "clerum-mcp-host",- "version": "0.1.347",+ "version": "0.1.348","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "clerum-mcp-host",- "version": "0.1.347",+ "version": "0.1.348","license": "SEE LICENSE IN LICENSE","dependencies": {"@anthropic-ai/sdk": "^0.32.0",diff --git a/mcp-host/package.json b/mcp-host/package.jsonindex 8aa4e44c6..a1811749e 100644--- a/mcp-host/package.json+++ b/mcp-host/package.json@@ -1,6 +1,6 @@{"name": "clerum-mcp-host",- "version": "0.1.347",+ "version": "0.1.348","description": "MCP Host - reads Host CRD and provides LLM access via OpenAI/Claude","main": "dist/main.js","engines": {diff --git a/mcp-host/src/config.ts b/mcp-host/src/config.tsindex 1a68627d5..2f66223df 100644--- a/mcp-host/src/config.ts+++ b/mcp-host/src/config.ts@@ -67,8 +67,6 @@ export interface Config {// Default OFF. Codex provider construction stays dark until the operator// sets MCP_HOST_CODEX_SUBSCRIPTION_ENABLED=true.codexSubscriptionEnabled: boolean- /** Models explicitly cleared for visual rollout; empty until interoperability is verified. */- codexImageInputModels: string[]// Server-owned Codex proxy URL. Callers cannot override this per request.codexProxyRuntimeBaseUrl: stringgrokSubscriptionEnabled: boolean@@ -682,10 +680,6 @@ export const config: Config = {devModelProvider: devMode ? resolveDevModelProvider(rawDevModelProvider) : undefined,devModelName,codexSubscriptionEnabled: process.env.MCP_HOST_CODEX_SUBSCRIPTION_ENABLED === 'true',- codexImageInputModels: (process.env.CODEX_IMAGE_INPUT_MODELS ?? '')- .split(',')- .map(model => model.trim())- .filter(Boolean),codexProxyRuntimeBaseUrl: getEnv('CODEX_LLM_PROXY_RUNTIME_URL','http://codex-llm-proxy.control-plane.svc.cluster.local:8080'diff --git a/mcp-host/src/core/adapters/__tests__/llmImageCompatibility.test.ts b/mcp-host/src/core/adapters/__tests__/llmImageCompatibility.test.tsindex c57a30f41..9896c4e3f 100644--- a/mcp-host/src/core/adapters/__tests__/llmImageCompatibility.test.ts+++ b/mcp-host/src/core/adapters/__tests__/llmImageCompatibility.test.ts@@ -590,7 +590,6 @@ describe('Codex V2 transport wiring (#650)', () => {policyHash: 'b'.repeat(64),hostRef: 'chatllm',}),- imageInputEnabled: true,} as unknown as CodexSubscriptionDeps)const { messages } = repeatedFrameMessages()@@ -634,7 +633,6 @@ describe('Codex V2 transport wiring (#650)', () => {policyHash: 'b'.repeat(64),hostRef: 'chatllm',}),- imageInputEnabled: true,} as unknown as CodexSubscriptionDeps)const fallback = recordingProvider({ cache: false })const policy: LlmPolicy = {diff --git a/mcp-host/src/llm/__tests__/codexSubscription.test.ts b/mcp-host/src/llm/__tests__/codexSubscription.test.tsindex f1ccfe9e0..bc6ff259c 100644--- a/mcp-host/src/llm/__tests__/codexSubscription.test.ts+++ b/mcp-host/src/llm/__tests__/codexSubscription.test.ts@@ -510,10 +510,7 @@ describe('CodexSubscriptionProvider', () => {it.each(METHODS)('sends a real PNG as a V2 part through %s', async method => {const wired = deps()- const provider = new CodexSubscriptionProvider('gpt-5.6-luna', {- ...wired,- imageInputEnabled: true,- } as never)+ const provider = new CodexSubscriptionProvider('gpt-5.6-luna', wired as never)await invoke(provider, method, userWithImage())@@ -542,12 +539,9 @@ describe('CodexSubscriptionProvider', () => {expect(wired.stream.mock.calls[0][0].request).toEqual(authorized.request)})- it('accepts a JPEG part when image input is enabled', async () => {+ it('accepts a JPEG part on the default Codex visual path', async () => {const wired = deps()- const provider = new CodexSubscriptionProvider('gpt-5.6-luna', {- ...wired,- imageInputEnabled: true,- } as never)+ const provider = new CodexSubscriptionProvider('gpt-5.6-luna', wired as never)await provider.completeSingleTurn(userWithImage(JPEG_2X2_BASE64, 'image/jpeg'))@@ -557,26 +551,19 @@ describe('CodexSubscriptionProvider', () => {)})- it.each(METHODS)(- 'refuses to authorize an image through %s while image input is dark',- async method => {- const wired = deps()- // `imageInputEnabled` is absent: the documented default is false.- const provider = new CodexSubscriptionProvider('gpt-5.6-luna', wired as never)+ it.each(METHODS)('authorizes an image through %s without a capability gate', async method => {+ const wired = deps()+ const provider = new CodexSubscriptionProvider('gpt-5.6-luna', wired as never)- await expect(invoke(provider, method, userWithImage())).rejects.toMatchObject({- name: 'CodexAuthorizeError',- code: 'image_input_unsupported',- })- expect(wired.authorize).not.toHaveBeenCalled()- expect(wired.stream).not.toHaveBeenCalled()- }- )+ await invoke(provider, method, userWithImage())+ expect(wired.authorize).toHaveBeenCalledOnce()+ expect(wired.stream).toHaveBeenCalledOnce()+ })- it('classifies an unsupported visual request as terminal with no fallback', () => {+ it('classifies a missing image source as terminal with no fallback', () => {const provider = new CodexSubscriptionProvider('gpt-5.6-luna', deps() as never)const classified = provider.classifyError(- new CodexAuthorizeError('image_input_unsupported', 'image input is not enabled')+ new CodexAuthorizeError('image_source_invalid', 'image part has no usable provenance source'))expect(classified.code).toBe(LlmErrorCode.ApiCallFailed)expect(classified.retryable).toBe(false)@@ -586,10 +573,7 @@ describe('CodexSubscriptionProvider', () => {it.each(METHODS)('rejects an image part without provenance through %s', async method => {const wired = deps()- const provider = new CodexSubscriptionProvider('gpt-5.6-luna', {- ...wired,- imageInputEnabled: true,- } as never)+ const provider = new CodexSubscriptionProvider('gpt-5.6-luna', wired as never)const messages = userWithImage()messages[0].contentParts = [{ type: 'text', text: 'what is on screen?' },@@ -606,10 +590,7 @@ describe('CodexSubscriptionProvider', () => {it('rejects parts on a non-user message instead of dropping them', async () => {const wired = deps()- const provider = new CodexSubscriptionProvider('gpt-5.6-luna', {- ...wired,- imageInputEnabled: true,- } as never)+ const provider = new CodexSubscriptionProvider('gpt-5.6-luna', wired as never)await expect(provider.completeSingleTurn([@@ -646,10 +627,7 @@ describe('CodexSubscriptionProvider', () => {it('restates content from the parts when the caller left them out of sync', async () => {const wired = deps()- const provider = new CodexSubscriptionProvider('gpt-5.6-luna', {- ...wired,- imageInputEnabled: true,- } as never)+ const provider = new CodexSubscriptionProvider('gpt-5.6-luna', wired as never)const messages = userWithImage()// A stale `content` must never reach the wire as a contradiction of its own// parts: V2 rejects the request outright, so the projection rebuilds it.@@ -664,10 +642,7 @@ describe('CodexSubscriptionProvider', () => {'rejects a signature-only image stub through %s before authorize',async method => {const wired = deps()- const provider = new CodexSubscriptionProvider('gpt-5.6-luna', {- ...wired,- imageInputEnabled: true,- } as never)+ const provider = new CodexSubscriptionProvider('gpt-5.6-luna', wired as never)await expect(invoke(provider, method, userWithImage('iVBORw0KGgo=', 'image/png'))@@ -679,10 +654,7 @@ describe('CodexSubscriptionProvider', () => {it('rejects an over-limit image batch through the shared contract, not a local copy', async () => {const wired = deps()- const provider = new CodexSubscriptionProvider('gpt-5.6-luna', {- ...wired,- imageInputEnabled: true,- } as never)+ const provider = new CodexSubscriptionProvider('gpt-5.6-luna', wired as never)const messages = userWithImage()messages[0].contentParts = [{ type: 'text', text: 'what is on screen?' },diff --git a/mcp-host/src/llm/codexSubscription.ts b/mcp-host/src/llm/codexSubscription.tsindex ace8e5542..db2352d64 100644--- a/mcp-host/src/llm/codexSubscription.ts+++ b/mcp-host/src/llm/codexSubscription.ts@@ -63,20 +63,13 @@ export type CodexSubscriptionDeps = {authorizer: ProviderAttemptAuthorizerproxy: CodexLlmProxyClientattemptContext: (input: { model: string }) => CodexAttemptContext- /**- * Visual rollout gate (#650). Defaults to FALSE: a request that actually- * carries image parts is rejected with `image_input_unsupported` until the- * operator clears this model for image input in the registry/config wiring.- */- imageInputEnabled?: boolean}/**- * Pre-authorize rejections. Both are known, non-retryable codes: the request+ * Pre-authorize rejections. These are known, non-retryable codes: the request* itself cannot succeed, so neither may trigger a retry or a provider fallback.*/const CODEX_REQUEST_INVALID = 'invalid_request'-const CODEX_IMAGE_INPUT_UNSUPPORTED = 'image_input_unsupported'const CODEX_IMAGE_SOURCE_INVALID = 'image_source_invalid'/** One image part as the Codex V2 contract serializes it. */@@ -418,12 +411,6 @@ export class CodexSubscriptionProvider implements SingleTurnProvider {`content parts are only supported on user messages (role=${message.role})`)}- if (parts.some(part => part.type === 'image') && this.deps.imageInputEnabled !== true) {- throw new CodexAuthorizeError(- CODEX_IMAGE_INPUT_UNSUPPORTED,- 'Image input is not enabled for this Codex model; remove the attachments or enable image input for the codex-subscription provider'- )- }const contentParts: NonNullable<ProjectedMessage['contentParts']> = parts.map(part =>part.type === 'text'? { type: 'text', text: part.text }diff --git a/mcp-host/src/llm/index.ts b/mcp-host/src/llm/index.tsindex 0c727f00e..244b76807 100644--- a/mcp-host/src/llm/index.ts+++ b/mcp-host/src/llm/index.ts@@ -58,10 +58,9 @@ function createGrokRuntimeDeps(captured?: GrokAttemptContext) {}}-function createCodexRuntimeDeps(model: string | undefined, captured?: CodexAttemptContext) {+function createCodexRuntimeDeps(captured?: CodexAttemptContext) {const gateway = (config.mcpHostGatewayUrl ?? '').trim() || DEFAULT_CODEX_AUTHORIZE_GATEWAYreturn {- imageInputEnabled: Boolean(model && config.codexImageInputModels.includes(model)),authorizer: new ProviderAttemptAuthorizer({authorizeUrl: resolveCodexAuthorizeUrl(gateway),readPlatformJwt: readCodexPlatformJwt,@@ -136,7 +135,7 @@ export function createLLMProvider(credentials,modelName,provider === 'codex-subscription'- ? { codex: createCodexRuntimeDeps(modelName, options?.capturedCodexAttemptContext) }+ ? { codex: createCodexRuntimeDeps(options?.capturedCodexAttemptContext) }: provider === 'grok-subscription'? { grok: createGrokRuntimeDeps(options?.capturedGrokAttemptContext) }: undefineddiff --git a/tests/e2e/fixtures/codex-subscription/sanitized-upstream-contract.json b/tests/e2e/fixtures/codex-subscription/sanitized-upstream-contract.jsonindex 9bc46ad10..a3bdf8ef0 100644--- a/tests/e2e/fixtures/codex-subscription/sanitized-upstream-contract.json+++ b/tests/e2e/fixtures/codex-subscription/sanitized-upstream-contract.json@@ -62,7 +62,6 @@"ticket_invalid","ticket_replayed","request_hash_mismatch",- "image_input_unsupported","image_source_invalid","payload_too_large"],@@ -79,8 +78,8 @@},"requestSchemas": ["codex-completion-request.v1", "codex-completion-request.v2"],"visualInput": {- "activation": "CODEX_IMAGE_INPUT_MODELS",- "enabledByDefault": false,+ "activation": "default",+ "enabledByDefault": true,"upstreamVerified": false,"validation": "container-framing-and-dimensions","limits": {diff --git a/tests/e2e/fixtures/package-lock.json b/tests/e2e/fixtures/package-lock.jsonindex 0d1f39505..a2488f81a 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.83",+ "version": "1.0.84","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "@clerum/e2e-test-fixtures",- "version": "1.0.83",+ "version": "1.0.84","dependencies": {"@kubernetes/client-node": "^1.0.0"},diff --git a/tests/e2e/fixtures/package.json b/tests/e2e/fixtures/package.jsonindex e99436a70..449353a44 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.83",+ "version": "1.0.84","description": "E2E test fixtures and utilities for Clerum testing","type": "module","main": "index.ts",diff --git a/tests/e2e/integration/codex-subscription-contract-freeze.test.ts b/tests/e2e/integration/codex-subscription-contract-freeze.test.tsindex 417f4352f..51df77e87 100644--- a/tests/e2e/integration/codex-subscription-contract-freeze.test.ts+++ b/tests/e2e/integration/codex-subscription-contract-freeze.test.ts@@ -114,12 +114,12 @@ describe('codex-subscription contract freeze', () => {localContract.SCHEMA_VERSION_V2,])expect(fixture.visualInput.limits).toEqual(localContract.VISUAL_LIMITS)- expect(fixture.visualInput.enabledByDefault).toBe(false)+ expect(fixture.visualInput.enabledByDefault).toBe(true)expect(fixture.visualInput.upstreamVerified).toBe(false)- expect(fixture.visualInput.activation).toBe('CODEX_IMAGE_INPUT_MODELS')+ expect(fixture.visualInput.activation).toBe('default')const architecture = readFileSync(architectureDocPath, 'utf8')expect(architecture).toContain('codex-completion-request.v2')- expect(architecture).toContain('CODEX_IMAGE_INPUT_MODELS')+ expect(architecture).not.toContain('CODEX_IMAGE_INPUT_MODELS')const proxyDeploy = readFileSync(join(repoRoot, 'deploy/base/control-plane/codex-llm-proxy.yaml'),'utf8'@@ -130,12 +130,12 @@ describe('codex-subscription contract freeze', () => {expect(proxyDeploy).toContain(`CODEX_LLM_PROXY_MAX_VISUAL_BODY_BYTES: "${localContract.LIMITS.maxVisualRequestBodyBytes}"`)- expect(proxyDeploy).not.toMatch(/CODEX_IMAGE_INPUT_MODELS:/)+ expect(proxyDeploy).not.toMatch(/CODEX_IMAGE_INPUT_MODELS/)const hostConfig = readFileSync(join(repoRoot, 'mcp-host/src/config.ts'), 'utf8')const proxyConfig = readFileSync(join(repoRoot, 'codex-llm-proxy/src/config.ts'), 'utf8')- expect(hostConfig).toMatch(/CODEX_IMAGE_INPUT_MODELS[\s\S]{0,120}split\(','\)/)- expect(proxyConfig).toMatch(/CODEX_IMAGE_INPUT_MODELS[\s\S]{0,120}split\(','\)/)- expect(architecture).toContain('Set the same list on both services')+ expect(hostConfig).not.toMatch(/CODEX_IMAGE_INPUT_MODELS/)+ expect(proxyConfig).not.toMatch(/CODEX_IMAGE_INPUT_MODELS/)+ expect(architecture).toContain('on by default for every `codex-subscription` model')})it('requires the sanitized fixture and both freeze documents', () => {diff --git a/tests/e2e/package-lock.json b/tests/e2e/package-lock.jsonindex e8e24e0d9..c815b82c1 100644--- a/tests/e2e/package-lock.json+++ b/tests/e2e/package-lock.json@@ -1,12 +1,12 @@{"name": "clerum-e2e-tests",- "version": "0.1.88",+ "version": "0.1.89","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "clerum-e2e-tests",- "version": "0.1.88",+ "version": "0.1.89","devDependencies": {"@types/jsonwebtoken": "^9.0.10","@types/node": "^22.0.0",diff --git a/tests/e2e/package.json b/tests/e2e/package.jsonindex 3ae01f2c5..2133e3f63 100644--- a/tests/e2e/package.json+++ b/tests/e2e/package.json@@ -1,6 +1,6 @@{"name": "clerum-e2e-tests",- "version": "0.1.88",+ "version": "0.1.89","private": true,"type": "module","scripts": {