Problem
Codex CLI runtime (src/middleware/runtimes/codex.ts) has a --image flag for image input that was previously broken in --json output mode due to upstream bug codex#5773.
Upstream status
Blocked on openai/codex#5773.
Unblocked. openai/codex#5891 fixed the race condition causing codex exec --json --image to hang. Merged Oct 28, 2025.
Current state
- Uses
exec --json --color never for invocation
--image <path> flag exists and works in --json mode (upstream fix landed)
mediaCapabilities still declares acceptsInbound: [] (workaround for the now-fixed bug)
Implementation
- Update
mediaCapabilities: acceptsInbound: ["image/"]
- In
buildArgs(), for each image MediaAttachment with filePath, append --image <path>
- Codex CLI accepts
--image directly as file paths (no base64/stdin envelope needed, unlike Claude)
- Audio/video remain unsupported:
emitsOutbound: false
readonly mediaCapabilities = {
acceptsInbound: ["image/"],
emitsOutbound: false,
} as const;
Codex --image flag details
- Long:
--image, Short: -i
- Accepts file paths, repeatable or comma-delimited
- Works on
exec subcommand; verify behavior on exec resume
Considerations
- Media attachments arrive with
filePath populated (from media-resolver.ts)
partitionMedia() in channel-bridge.ts already filters by capabilities
- Temp file lifecycle managed by the bridge (cleaned up after invocation)
- Session resume: verify if
exec resume supports --image — may need to skip images on resume since Codex propagates conversation context internally
Tests
Unit tests (src/middleware/runtimes/codex.test.ts)
Live smoke test (src/middleware/__smoke__/codex.live.test.ts)
Depends on
Related
Problem
Codex CLI runtime (
src/middleware/runtimes/codex.ts) has a--imageflag for image input that was previously broken in--jsonoutput mode due to upstream bug codex#5773.Upstream status
Blocked on openai/codex#5773.Unblocked. openai/codex#5891 fixed the race condition causing
codex exec --json --imageto hang. Merged Oct 28, 2025.Current state
exec --json --color neverfor invocation--image <path>flag exists and works in--jsonmode (upstream fix landed)mediaCapabilitiesstill declaresacceptsInbound: [](workaround for the now-fixed bug)Implementation
mediaCapabilities:acceptsInbound: ["image/"]buildArgs(), for each imageMediaAttachmentwithfilePath, append--image <path>--imagedirectly as file paths (no base64/stdin envelope needed, unlike Claude)emitsOutbound: falseCodex
--imageflag details--image, Short:-iexecsubcommand; verify behavior onexec resumeConsiderations
filePathpopulated (frommedia-resolver.ts)partitionMedia()inchannel-bridge.tsalready filters by capabilitiesexec resumesupports--image— may need to skip images on resume since Codex propagates conversation context internallyTests
Unit tests (
src/middleware/runtimes/codex.test.ts)mediaCapabilitiesreportsacceptsInbound: ["image/"]buildArgs()with image media passes--image <path>flagsbuildArgs()with multiple images passes multiple--imageflagsbuildArgs()without media does not include--imagebuildArgs()filters non-image media (no--imagefor audio/video)Live smoke test (
src/middleware/__smoke__/codex.live.test.ts)Depends on
feat(middleware): add multimodal media attachments to AgentRuntime contract #385 — AgentRuntime multimodal contract(merged)Related