Repository navigation
Description
What version of the Codex App are you using?
Desktop bundle: 26.1013.40934, build 20770 (read from the installed app's Info.plist).
Installed bundled CLI reports 0.163.0-alpha.10.2. The already-running process was not restarted or binary-matched during diagnosis, so this does not establish its exact build.
What subscription do you have?
ChatGPT Pro, using ChatGPT sign-in.
What platform is your computer?
macOS 26.6.2, Apple Silicon (arm64).
What issue are you seeing?
An existing image-heavy conversation repeatedly displayed:
Reconnecting 5/5
stream disconnected before completion: websocket closed by server before response.completed
Each WebSocket handshake succeeded, but the client retried the full request five times before falling back to HTTP. HTTP then succeeded and the conversation resumed.
This is related to #55317 and #38846. This report adds an independent, minimal JSON-whitespace boundary control at 16 MiB ± 1 byte, and focuses on byte-aware preflight/fallback and loss of Close-code diagnostics. It does not reproduce or claim the heartbeat timeout discussed in #55317.
Original incident evidence
On 2026-10-21 (UTC+08:00):
- 10:07:29: WebSocket connected successfully.
- 10:07:43–10:08:02: retries 1/5 through 5/5, each with the error above.
- Reconnection logs contain
non-incremental request reason="connection_closed". - 10:08:08:
falling back to HTTP. - The subsequent HTTP request log records
pre_compression_bytes=19094865 post_compression_bytes=11130448using zstd. - 10:08:15: HTTP 200; assistant output and tool execution subsequently resumed.
The HTTP body's uncompressed size is 19,094,865 bytes (18.21 MiB). This is a measured HTTP fallback body, not a captured byte-for-byte copy of the failed WebSocket message.
A read-only reconstruction using the last compacted.replacement_history plus subsequent response_item records, up to the turn's start, found:
- 152 history items.
- 9 retained inline user images: 18,189,822 data-URL bytes (17.35 MiB).
- Serialized reconstructed history: 18,972,342 bytes, before additional runtime instructions/tool schemas and any runtime filtering.
- The most recent recorded compaction had retained historical images; the images alone exceeded the boundary measured below.
The historical failure's Close code was not preserved. Therefore, attributing that original incident to size rejection is a strongly supported inference, not a claim that its actual Close frame was captured as 1009.
What steps can reproduce the bug?
Controlled transport test (completed)
Using a separate Python standard-library WebSocket probe, connect to the same authenticated Responses endpoint, wss://chatgpt.com/backend-api/codex/responses, through the existing local HTTP CONNECT proxy.
Serialize this synthetic warmup event as compact UTF-8 JSON:
{"type":"response.create","model":"gpt-6-astra","instructions":"Diagnostic warmup.","input":[],"tools":[],"store":false,"generate":false}For each target size, append ASCII spaces after the closing JSON brace, so the message remains valid JSON with identical semantic content:
payload = json.dumps(event, separators=(",", ":")).encode("utf-8")
payload += b" " * (target_bytes - len(payload))
assert len(payload) == target_bytesUse a fresh WebSocket connection per case. Send one logical Text message in 64 KiB continuation fragments, with FIN only on the last fragment. Mask client frames and respond to server Ping frames. Do not negotiate permessage-deflate. Read the raw server Close frame as well as response events.
| Exact logical message bytes | Upgrade | Result | Total elapsed |
|---|---|---|---|
| 1,024 | HTTP 101 | response.completed |
3.32 s |
| 16,777,215 (16 MiB − 1) | HTTP 101 | response.completed |
6.68 s |
| 16,777,217 (16 MiB + 1) | HTTP 101 | Received Close 1009, empty reason; no response events | 7.11 s |
All three cases used the same endpoint, account, model, proxy and selected upstream node. Only the trailing whitespace byte count changed. No original images, prompts or conversation history were transmitted by the probes. generate=false produced no model output.
This brackets a size-sensitive rejection within two bytes around 16 MiB on this route. It does not establish the exact inclusive configured limit, which backend/edge component enforces it, or limits for other endpoints. Fragmentation does not bypass the logical-message limit.
Network context
Clash uses mixed port 7897. The desktop and backend processes inherited HTTP/HTTPS proxy variables plus a SOCKS5 ALL_PROXY value. Matching local socket ports against the Clash connection table confirmed active backend connections to chatgpt.com using HTTP CONNECT. The synthetic probes explicitly used that same HTTP CONNECT proxy without changing network configuration.
Below-boundary success and above-boundary Close 1009 on the same route give a more specific explanation than a general proxy outage. They do not prove that every reconnect error has this cause.
What is the expected behavior?
- Consider a serialized-byte budget separately from token/context limits, including retained inline image data.
- When the request is known to exceed the supported WebSocket budget, select a supported transport or recovery path before repeatedly uploading it.
- Preserve Close code/reason and classify a received 1009 as non-transient for an unchanged payload; avoid retrying the same oversized request five times.
- Provide an actionable error and a supported way to recover an affected conversation without losing useful context.
HTTP fallback already recovered this incident. The issue is the avoidable retry loop and misleading generic network diagnosis.
Additional information
The public source's Message::Close(_) branch returns a generic error without including the code/reason:
| Message::Close(_) => { |
The probe uses the documented warmup behavior:
https://developers.openai.com/api/docs/guides/websocket-mode
No original screenshots, private prompts, raw rollouts, account/thread/turn identifiers, credentials, personal filesystem paths or proxy server addresses are included in this report. Original history and application/network settings were not modified.
Activity
github-actions commentedon Oct 21, 2026
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
chenzecan97-boop commentedon Oct 23, 2026
Adding independent Windows evidence for this issue, submitted by an assistant at the user's explicit request.
Environment: Windows desktop; bundled core
codex-cli 0.163.0-alpha.11.1during the 2026-10-23 probes; modelgpt-6-astra. The preceding native incident on 2026-10-22 used0.163.0-alpha.11.Native observation: an image-heavy conversation repeatedly completed WebSocket handshakes, then logged five retries with Windows error 10053 before HTTP fallback. The first fallback request had
pre_compression_bytes=40682846andpost_compression_bytes=28556602; subsequent model requests remained large. These are encoded HTTP body sizes, not a capture of the failed WebSocket payloads or an exact retransmission/billing total.Independent transport controls: authenticated, certificate-verified TLS to
wss://chatgpt.com/backend-api/codex/responses; current TUN route versus explicit HTTP CONNECT through the same existing proxy exit. No application or proxy settings changed.previous_response_idcompleted with a 227-byte request and no image retransmission. This demonstrates a useful reuse path in the isolated test, not a measured fix in the desktop client.The native logs did not preserve a 1009 Close frame or actual failed frame lengths. Therefore, linking every native 10053 to this size rejection remains an inference; other failures may coexist.
Please investigate serialized-byte preflight, preservation/classification of Close 1009, and avoiding unchanged oversized retries while retaining incremental image-context reuse and task quality. Automatic text/token compaction alone should not be assumed to enforce a wire-byte budget.
No project content, images, raw logs, transcripts, local paths, account/session identifiers, credentials, or proxy addresses are included. No attachments.
yyyzl commentedon Oct 27, 2026
Adding another macOS Desktop observation, posted by an assistant at the user's explicit request. Is there a supported workaround or a fix planned for continuing an existing affected thread without losing its useful context?
Environment: Codex Desktop
26.1021.31345; installed bundled CLI reports0.164.0-alpha.11.1; macOS Apple Silicon; modelgpt-6.1-terra, reasoning effortxhigh. The running binary was not independently matched against the public source build.Observed sequence, in one existing thread:
non-incremental request reason="connection_closed"and then five retries withwebsocket closed by server before response.completed. It subsequently loggedfalling back to HTTP.pre_compression_bytes=25295743andpost_compression_bytes=12332390. Several HTTP requests then took approximately 27–31 seconds from request preparation to response headers. The first assistant update appeared about 149 seconds after the turn started, including retries.These are local observations, not a controlled benchmark: tasks differed, and the time to response headers includes request transmission and upstream waiting. HTTP request-body sizes are not a captured WebSocket payload or a measurement of transferred/billed bytes. The local history contains approximately 23.7 MB of inline image data URLs, but we did not capture the peer's close code or run a synthetic size-boundary test; request size is a plausible factor, not a proven cause. This single example does not establish an idle timeout threshold.
Could maintainers clarify:
No private text, images, raw logs, local paths, thread IDs, account details, credentials, or proxy addresses are included.
chipfighter commentedon Oct 29, 2026
@yannan-cr Your case where nine old images survive compaction and the conversation goes through five reconnects before continuing is close to the problem that led me to build Context Attachment Manager.
I'm the author. I originally needed it while repeatedly revising character images for a short film. It's free and open source, now v0.9.1 with 560 GitHub Stars, with people facing similar image-history problems using it and sharing feedback.
After installing and restarting Codex, automatic selection is enabled by default. The assistant can retrieve original pictures as needed, including after compaction, rather than carrying every old picture into each turn. The panel lets you browse thumbnails, search by remembered visual details, zoom previews, and choose references to keep selected.
Original quality and conversation records are preserved. Management stays on your machine; the plugin doesn't separately collect or upload your images or chats.
https://github.com/chipfighter/context-attachment-manager
The page includes setup steps. Once you're comfortable with the plugin, you can ask Codex or Claude Code to install it for you. It supports Codex Desktop and the local Code tab in Claude Desktop.
If image-heavy conversations are still part of your workflow, I'd welcome your feedback on whether it helps avoid that repeated image build-up.
zzz163519 commentedon Oct 31, 2026
Additional Windows/WSL CLI evidence, posted at the affected user's explicit request. This concerns generated-image histories as well as attached images. Related reports: #52464 and #55083.
Environment
gpt-6.1-sol, reasoning effortxhigh.0.165.0; the already-running process was not independently version-queried. On October 31, both the affected session metadata and the installed CLI reported0.166.0.A. Large HTTP requests after repeated image generation, October 30
The persistent history contained 19 image-generation records whose
resultfields totaled 50,865,220 ASCII Base64 characters. These history measurements are separate from the request measurements below; I did not capture the final model-input body.Two attempts at the same short text follow-up logged these zstd request-body sizes:
The first request received HTTP 200 headers approximately 6 minutes 30 seconds after request preparation. The turn was interrupted after 6 minutes 56 seconds without an assistant reply or tool execution. Resubmitting prepared another request of almost the same size. Time to headers includes upload, intermediaries and upstream waiting; it is not an isolated upload-time measurement.
B. Repeated WebSocket disconnects in a newer generated-image session, October 31
A separate session contained five image-generation records with 12,474,356 ASCII Base64 characters in their result fields, plus image-view operations. This is not a measurement of its serialized WebSocket request size.
The recorded sequence included:
websocket closed by server before response.completed.IO error: Broken pipe (os error 32)andIO error: Connection reset by peer (os error 104)on subsequent attempts.codex doctor --network-only --jsonpassed provider HTTP reachability and the Responses WebSocket handshake check. This only establishes short-probe connectivity, not reliable transfer of the affected history.Linux TCP snapshots also showed unsent data and sustained receiver-window backpressure on the connection to the local proxy. The proxy separately recorded connection timeouts in the same incident period. Network involvement has therefore not been ruled out.
Current-source observations
At public main
67f0994b532b8740f14b5b738af7b7b2a915b1d6:These are source observations, not proof that every generated image is retransmitted on every incremental request or a binary-matched root-cause reproduction.
Limits and requested recovery
I did not capture a Close 1009, the failed WebSocket frame length, or an alternate-network/image-removal control. The October 30 HTTP sizes must not be treated as captured WebSocket sizes, and the October 31 incident is not proof of the exact 16 MiB rejection described above.
This adds evidence that generated-image workflows can leave even a short follow-up carrying a very large request, while generic reconnect errors obscure whether recovery is possible. A supported fix should preserve original images and useful visual context, enforce a serialized-byte budget separately from token estimates, preserve Close diagnostics, and avoid unchanged retries for an explicitly identified size rejection. HTTP fallback alone also does not address repeated large uploads.
Is there a supported recovery path for existing CLI sessions, or a planned fix for reference reuse/byte-aware transport selection? Only aggregate measurements and sanitized error strings are included here; no original images, conversation contents, identifiers, credentials or proxy addresses are attached.
chen21019 commentedon Nov 1, 2026
Additional Windows observation: successful WebSocket upgrades, five early-close retries, then HTTP recovery
I observed the same retry/fallback pattern on Windows on 2026-11-01. This adds a Windows case to this issue rather than a separate duplicate report.
Environment
26200.26.1027.30824; installed MSIX package version:26.1027.3384.0.--version:codex-cli 0.166.0-alpha.5.1.gpt-6.1-sol, reasoning effortultra, ChatGPT sign-in, default OpenAI provider.Observed sequence (UTC+08:00; corresponding UTC times are eight hours earlier)
stream disconnected before completion: websocket closed by server before response.completedcodex_core::client:falling back to HTTP; HTTP request compression loggedInterleaved connection records show repeated successful Responses WebSocket upgrades (
status=101) andnon-incremental request reason="connection_closed"before fallback. The initial connection failure was not an inability to perform the WebSocket upgrade.The HTTP fallback request logged:
These are the measured HTTP fallback body sizes, not a captured byte-for-byte copy of the failed WebSocket message. The last recorded model input around this incident was approximately 190,394 tokens against a reported 475,000-token context window.
Interpretation and limits
Please consider byte-aware transport selection, preservation of Close code/reason, and avoiding repeated unchanged requests when the close indicates a non-transient failure. A supported recovery path should preserve the existing conversation and completed work.
Only sanitized event descriptions, timings, versions and aggregate sizes are included here. No conversation text, images, raw transcripts, raw headers, credentials, account/session identifiers, personal filesystem paths or workplace infrastructure details are attached.
MianMian5012 commentedon Nov 2, 2026
Independent reproduction on macOS Apple Silicon with
codex-cli 0.166.0:websocket closed by server before response.completed. After five retries, HTTPS fallback completed.The original image-heavy conversation also recovered after HTTPS fallback; its logged HTTP request body was approximately 26 MB before compression.
These controls show a payload-size-sensitive failure on this network path. They do not capture the WebSocket close code or establish which component enforces the limit.
Please consider byte-aware transport selection and preserving close-code diagnostics, while retaining the original images and conversation context.
HezeAI commentedon Nov 4, 2026
CODEX-MEDIA-REPORT-EN.txt
Aurantium-47 commentedon Nov 13, 2026
Windows Desktop follow-up: recurrent stalls in image-heavy chats, 2026-11-13
Adding measurements from another affected Windows installation. The problem recurred across image-editing and photo-layout conversations: a short text follow-up could spend several minutes reconnecting with no useful progress, while a fresh, non-forked chat supplied with a concise task description and local image paths could start responding and running tools. Several replacement jobs completed. Some original chats also eventually resumed after HTTP fallback, so this is intermittent, not a claim that every affected chat is permanently unrecoverable.
Environment
26200.26.1106.6628.0; Desktop client version in recent app-server events:26.1106.51428.--version:codex-cli 0.167.0-alpha.4.1. This does not establish the core version of earlier processes.26.1103.60933.gpt-6-astraandgpt-6.1-sol, using ChatGPT sign-in.Native log evidence
All times below are 2026-11-13, UTC+08:00. Read-only queries were made against the local
logs_2.sqlite; only selected event fields are included.One photo-layout conversation logged this sequence after a short text follow-up:
The logged error was:
The Windows message means that an established connection was aborted by software on the host. Earlier in that conversation, the logs recorded
falling back to HTTPat 20:45:24. Another image-editing conversation recorded the same fallback at 19:46:47.HTTP request compression records show substantial retained request sizes:
These are measured HTTP request-body sizes, not captured failed WebSocket frame sizes, total retransmitted traffic, or billable usage. The table does not establish that every request failed: the original conversations sometimes made further progress.
Workflow and impact
This workaround repeatedly required rebuilding task context and checking that detailed user constraints were not lost. It is a recovery burden, not a durable fix.
Limits and requested investigation
The observations are consistent with the retained-image/request-size problem tracked here, but no WebSocket Close 1009 or failed-frame length was captured in these incidents, and no new boundary test was run. Error 10053 alone does not prove size rejection. Proxy/network involvement is not excluded. Fresh-chat recovery is an observed workaround, not a controlled root-cause experiment.
Please investigate byte-aware transport selection and history/image-reference reuse, preservation of Close-code diagnostics, and avoiding repeated unchanged requests when a failure is known to be non-transient. The UI should expose the retry/fallback stage and offer a supported way to recover the existing task with its requirements and original image quality intact.
Submitted by an assistant at the affected user's explicit request. This comment contains no original images, private prompts, raw transcripts/databases/headers, credentials, thread/turn IDs, personal filesystem paths or proxy addresses.
goldisfreedom commentedon Nov 19, 2026
Images finish, then ChatGPT Work stalls on both Windows and Linux
I use ChatGPT Work on Pro 100. I generated a high volume of images in one day without this problem. The next day, images still appeared normally, but Work repeatedly got stuck on “Thinking” or “Reconnecting” before finishing the conversation.
I initially suspected a recent ChatGPT app update on my Windows 11 machine, so I tried my older laptop running CachyOS Linux and an older version of ChatGPT Work. In a fresh project, I asked for just three images. All three appeared, then Work got stuck reconnecting. The turn eventually finished after about 25 minutes in total. I could reproduce the visible stall without Windows or the newer ChatGPT client. I collected the detailed transport logs on Windows only, so I can’t confirm that Linux followed the same WebSocket retry sequence.
On Windows I also tested whether clearing earlier images from the working context would help.
/compactremoved both earlier images from the saved context, and the next three-image batch still stalled. Earlier question about compactionWindows run. Desktop
26.1111.9664.0, bundled runtime0.169.1. I generated two images in a fresh project, then requested three more in the same chat. All three new PNGs were on disk before the first disconnect. Here are the selected log events, shortened, with elapsed time rounded to seconds from the last PNG save.Each successful WebSocket upgrade was followed by about 110–111 seconds before the next abort or fallback. The scheduled retry waits were only 0.195–3.283 seconds. After HTTP recovered, the pending file-copy step ran once and finished in 1.44 seconds. The fallback body measured 13.47 MiB before compression. I don’t have the failed WebSocket message length or protocol close code, so I can’t attribute this incident to the 16 MiB boundary measured here.
Controlled compaction run. In a separate Work chat, I kept the style prompt and generation settings the same across both batches.
This verifies what disappeared from the saved working context. The logs did not measure how many image bytes went over the WebSocket after compaction.
Images finish, then ChatGPT Work stalls on both Windows and Linux I use ChatGPT Work on Pro 100. I generated a high volume of images in one day without this problem. The next day, images still appeared normally, but Work repeatedly got stuck on “Thinking” or “Reconnecting” before finishing the conversation.I initially suspected a recent ChatGPT app update on my Windows 11 machine, so I tried my older laptop running CachyOS Linux and an older version of ChatGPT Work. In a fresh project, I asked for just three images. All three appeared, then Work got stuck reconnecting. The turn eventually finished after about 25 minutes in total. I could reproduce the visible stall without Windows or the newer ChatGPT client. I collected the detailed transport logs on Windows only, so I can’t confirm that Linux followed the same WebSocket retry sequence.
On Windows I also tested whether clearing earlier images from the working context would help. /compact removed both earlier images from the saved context, and the next three-image batch still stalled. Earlier question about compaction
Windows run. Desktop 26.1111.9664.0, bundled runtime 0.169.1. I generated two images in a fresh project, then requested three more in the same chat. All three new PNGs were on disk before the first disconnect. Here are the selected log events, shortened, with elapsed time rounded to seconds from the last PNG save.
+00:00 Last PNG saved. Image tool returned all three images.
+01:13 retry 1/5: websocket closed by server before response.completed
+01:15 WebSocket upgrade: HTTP 101
non-incremental request reason="connection_closed"
+03:05 retry 2/5: OS error 10053
+04:59 retry 3/5: OS error 10053
+06:51 retry 4/5: OS error 10053
+08:44 retry 5/5: OS error 10053
+10:39 falling back to HTTP
+10:40 pre_compression_bytes=14124415 post_compression_bytes=10136923
+12:38 POST /backend-api/codex/responses: HTTP 200
+15:14 Final answer recorded.
Each successful WebSocket upgrade was followed by about 110–111 seconds before the next abort or fallback. The scheduled retry waits were only 0.195–3.283 seconds. After HTTP recovered, the pending file-copy step ran once and finished in 1.44 seconds. The fallback body measured 13.47 MiB before compression. I don’t have the failed WebSocket message length or protocol close code, so I can’t attribute this incident to the 16 MiB boundary measured here.
Controlled compaction run. In a separate Work chat, I kept the style prompt and generation settings the same across both batches.
Stage Local measurement
Generate two images Two inline image data URLs totaled 6,015,044 encoded bytes.
Run /compact Completed in 5.5 s. The saved replacement history was 131,267 serialized bytes and contained zero embedded image URLs.
Generate three more All three PNGs were saved. The new tool result added 8,218,834 encoded image bytes.
Continue the chat One 10053 and two further WebSocket closes. I stopped the turn 5 min 2 s after the last PNG save. No HTTP fallback had been logged by then.
This verifies what disappeared from the saved working context. The logs did not measure how many image bytes went over the WebSocket after compaction.