You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
App Server explodes websocket frames with mandatory generated image data #21988
When asking Codex App Server for turns, it embeds full generated images data with each turn for the current page. For a thread that contains just 1 turn with 7 generated images, that's a 27 megabyte websocket frame. If you have more images per turn, more turns with generated images, higher res images etc, this hits user RAM hard.
For locally running CAS, generated image bytes aren't needed at all - the CAS client already has access to the filesystem and can read savedPath directly. For remote clients, generated image bytes would be better off loaded separately from general turn data, or least there should be an option to do that.
As a workaround, I'm doing manual streaming and parsing of CAS's websocket/json data to drop the image bytes field on the fly and avoid hitting user's RAM, if anyone else is looking for a solution. This still wastes tens or hundreds megabytes of i/o traffic between your CAS client and CAS because you have to physically consume that websocket frame, but at least RAM gets saved.
Linux/stdin-stdout reproduction: default thread/resume emits a 23 MB JSONL record
I reproduced the same generated-image frame amplification through the app-server's stdio transport,
where it becomes a connection/recovery failure rather than only a RAM/traffic problem.
ChatGPT-auth production thread, replayed from a disposable clone without auth.json
The stored thread had exactly seven completed image_generation_end records. Their serialized
rollout records totaled 22,612,401 bytes; the corresponding paired large tool-output records totaled
22,608,258 bytes. No prompt, path, image bytes, or raw history was retained in the measurement.
The oversized record is a response envelope (id=2, no method), not an item/turn notification.
A client with a bounded 16 MiB line reader cannot parse the envelope or resolve the pending resume
request. Discarding the record is not recovery because this is the only required response.
The existing experimental API is an effective control. With initialize.capabilities.experimentalApi=true and thread/resume(excludeTurns=true), the exact same
thread returned a 5,104-byte id=2 response (99.978% smaller). It retained the matching thread id, status={"type":"idle"}, preview and runtime/config metadata, and returned turns=[]. Without the
initialize capability, 0.149.0 correctly returned -32600: thread/resume.excludeTurns requires experimentalApi capability.
Default resume/read responses should not inline unbounded generated-image bytes into one transport
frame.
Large binary results should be omitted, externalized, or referenced by saved path/content id.
The bounded metadata-only resume contract should remain available without reconstructing full turn
payloads, and clients should be able to negotiate it deterministically.
Related current report: #39148 shows read_thread returning multi-megabyte imageGeneration.result
despite includeOutputs:false and maxOutputCharsPerItem.
We mitigated the client side by negotiating experimentalApi, using excludeTurns:true for stored
native resumes, and treating any lost oversized JSONL record as terminal transport corruption rather
than continuing with unresolved request correlation
(metadata-only resume and typed failure).
This avoids the crash, but it does not remove the upstream unbounded default response.
Minimal response-size scanner
Run only against a disposable CODEX_HOME containing an image-heavy test thread. It does not start a
model turn and never retains the response payload; it reports envelope id/method and byte length.
I also opened #40362 for the distinct bounded-stdio/RPC-recovery failure mode: the mandatory thread/resume response exceeds a line-framed client limit, so response correlation is lost and reconnect repeats the same frame. The measurements and scanner above are mirrored there.
Activity
github-actions commentedon May 10, 2026
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
DrSeedon commentedon Aug 24, 2026
Linux/stdin-stdout reproduction: default
thread/resumeemits a 23 MB JSONL recordI reproduced the same generated-image frame amplification through the app-server's stdio transport,
where it becomes a connection/recovery failure rather than only a RAM/traffic problem.
Environment:
codex-cli 0.149.07.0.0-30-genericx86_64codex app-server --stdio(newline-delimited JSON-RPC)auth.jsonThe stored thread had exactly seven completed
image_generation_endrecords. Their serializedrollout records totaled 22,612,401 bytes; the corresponding paired large tool-output records totaled
22,608,258 bytes. No prompt, path, image bytes, or raw history was retained in the measurement.
Request sequence:
initialize, requestid=1initializedthread/resume, requestid=2, default parameters (excludeTurnsabsent)Measured stdout records:
id=1)configWarningremoteControl/status/changedthread/status/changedid=2)The oversized record is a response envelope (
id=2, nomethod), not an item/turn notification.A client with a bounded 16 MiB line reader cannot parse the envelope or resolve the pending resume
request. Discarding the record is not recovery because this is the only required response.
The existing experimental API is an effective control. With
initialize.capabilities.experimentalApi=trueandthread/resume(excludeTurns=true), the exact samethread returned a 5,104-byte
id=2response (99.978% smaller). It retained the matching thread id,status={"type":"idle"}, preview and runtime/config metadata, and returnedturns=[]. Without theinitialize capability, 0.149.0 correctly returned
-32600:thread/resume.excludeTurns requires experimentalApi capability.This is consistent with the current source comment that
thread/resumecan include large MCP andimage-generation payloads, while response redaction is limited to the two ChatGPT mobile remote
client names:
https://github.com/openai/codex/blob/main/codex-rs/app-server/src/request_processors/thread_resume_redaction.rs
Expected behavior:
frame.
payloads, and clients should be able to negotiate it deterministically.
Related current report: #39148 shows
read_threadreturning multi-megabyteimageGeneration.resultdespite
includeOutputs:falseandmaxOutputCharsPerItem.We mitigated the client side by negotiating
experimentalApi, usingexcludeTurns:truefor storednative resumes, and treating any lost oversized JSONL record as terminal transport corruption rather
than continuing with unresolved request correlation
(metadata-only resume and typed failure).
This avoids the crash, but it does not remove the upstream unbounded default response.
Minimal response-size scanner
Run only against a disposable
CODEX_HOMEcontaining an image-heavy test thread. It does not start amodel turn and never retains the response payload; it reports envelope id/method and byte length.
Expected on the measured test thread:
DrSeedon commentedon Aug 24, 2026
I also opened #40362 for the distinct bounded-stdio/RPC-recovery failure mode: the mandatory
thread/resumeresponse exceeds a line-framed client limit, so response correlation is lost and reconnect repeats the same frame. The measurements and scanner above are mirrored there.