Skip to content

CLI 0.165.0: image-heavy history repeatedly hits Broken pipe ~81s after WebSocket upgrade #58015

Closed as duplicate

Description

@zhouchenghao330-svg

What version of Codex CLI is running?

codex-cli 0.165.0 (npm-installed macOS arm64 CLI; verified with codex --version)

What subscription do you have?

ChatGPT subscription sign-in (not an API-key provider); subscription tier omitted.

Which model were you using?

gpt-6.1-sol; high reasoning in the detailed failing turn, with xhigh used in earlier turns.

What platform is your computer?

macOS 27.0.1, Apple Silicon arm64.

What terminal emulator and version are you using (if applicable)?

Orca integrated terminal, version 1.4.245-adhoc.20261029063132 (read from the installed application bundle). No terminal-emulator root cause has been established.

Codex doctor report

Reviewed excerpts from codex doctor on CLI 0.165.0:
- install: consistent
- auth: configured
- state: databases healthy
- network: no proxy environment variables
- websocket: connected (HTTP 101 Switching Protocols), 15s probe timeout
- reachability: active provider endpoints reachable over HTTP

The full report is omitted because it contains unrelated local paths/configuration. A successful short probe does not validate a large model request.

What issue are you seeing?

After reading many images during a long local document task, a conversation repeatedly enters Reconnecting... 1/5 through 5/5. WebSocket upgrade succeeds, but the connection fails about 81 seconds later with Broken pipe (os error 32). The client repeatedly reconnects before falling back to HTTP.

Image-heavy retained history is a suspected trigger, not a proven root cause. I found related reports #55317, #57725, #56913 and #19821 before filing. This report adds a current CLI 0.165.0 timeline and a same-machine comparison between successful small WebSocket keepalives and the affected large-history requests. Please consolidate if appropriate.

Failing native-client timeline

All times are 2026-10-29, UTC+08:00. These records are correlated to the same affected conversation and turn.

Time Native CLI observation
15:05:17 Retry 1/5, IO error: Broken pipe (os error 32)
15:05:18 WebSocket successfully connected
15:06:39 Retry 2/5, same Broken pipe, 81s after successful connection
15:06:42 WebSocket successfully connected
15:08:03 Retry 3/5, same error, 81s later
15:08:04 WebSocket successfully connected
15:09:25 Retry 4/5, same error, 81s later
15:09:27 WebSocket successfully connected
15:10:48 Retry 5/5, same error, 81s later
15:10:52 WebSocket successfully connected again
15:12:13 falling back to HTTP, another 81s later

This costs 6m56s from the first logged retry to HTTP fallback. The native log excerpts available here do not include a WebSocket Close code/reason, so this report does not claim to have captured Close 1011 or 1009.

Request size and image history

The HTTP fallback logged:

pre_compression_bytes=18285218
post_compression_bytes=12681481

These are the measured zstd HTTP body sizes, not a capture of the failed WebSocket payload. A read-only audit counted 37 input-image items recorded after the latest compaction, totaling approximately 16.9 MB of serialized image-item data. This is a history count, not a reconstructed exact on-wire request or a count of distinct images.

HTTPS-only fork

A fork inheriting the conversation used a custom Responses provider with requires_openai_auth=true and supports_websockets=false. Its similarly sized HTTP requests did receive HTTP 200:

Request preparation HTTP 200 headers Elapsed Compressed body bytes
15:18:03 15:19:23 80s 12,685,642
15:19:52 15:21:16 84s 12,691,722
15:30:39 15:32:24 105s 12,699,167
15:33:01 15:34:52 111s 12,710,503

These are preparation-to-response-header intervals, not isolated upload timings or full generation times. HTTP-only bypasses the WebSocket retry sequence in this sample, but does not make the inherited large history fast. Forking did not reduce the request bytes.

What steps can reproduce the bug?

Observed workflow; no deterministic clean-state minimal reproducer yet:

  1. Run Codex CLI 0.165.0 with ChatGPT sign-in and gpt-6.1-sol.
  2. Continue a long document-analysis conversation and read many local images through tools.
  3. Ask the assistant to continue after the image-heavy history has accumulated.
  4. In the affected conversation, observe successful WebSocket connections followed by repeated Broken pipe errors, retries 1/5 through 5/5, and delayed HTTP fallback.
  5. A fork retaining the same history, with WebSockets disabled, still sends approximately 12.7 MB compressed HTTP requests.

Private prompts, images and thread identifiers are omitted. No claim is made that every image-heavy chat reproduces this, or that a fresh text-only control has established causality.

What is the expected behavior?

Image-heavy conversations should either continue reliably or fail with a useful, bounded recovery path. Please investigate:

  • Retaining WebSocket Close code/reason and distinguishing request upload failures, heartbeat failures, size rejection and response-stream loss.
  • Keeping heartbeat handling responsive during slow large sends; the ~81s pattern may be relevant, but heartbeat starvation was not directly captured in this native run.
  • Accounting for serialized image/history bytes separately from token-based compaction, with a supported way to reduce an affected conversation's payload while preserving useful progress.
  • Avoiding repeated unchanged requests when diagnostics identify a non-transient failure, and exposing a supported transport/recovery setting.

The report does not assert a universal size limit or assign the failure to a particular network/server component.

Additional information

Proxy checks and limits

Clash Verge with Mihomo v1.19.32 was active: rule mode, gVisor TUN enabled, and system HTTP/HTTPS proxy enabled. Sampled live Codex connections matched the intended proxy policy and used the same AnyTLS outbound; they were not routed DIRECT/REJECT. This confirms sampled routing, not the health of every historical connection.

Two independent lightweight authenticated probes to the Codex Responses WebSocket endpoint were run without model requests or conversation content:

Route Upgrade Keepalive result
OS/TUN socket route HTTP 101 95 seconds; 5 Pong frames received
Explicit local HTTP CONNECT proxy CONNECT 200, then HTTP 101 95 seconds; 5 Pong frames received

Both verified the destination TLS certificate using the standard trust store. The probes share the upstream proxy path; neither is a physical no-proxy control. Small heartbeats succeeding beyond 81s show that WebSockets are not universally blocked here, but do not validate sustained large uploads or exclude proxy/network involvement. No controlled alternative-node or no-proxy comparison was performed.

No Codex/proxy configuration or conversation history was modified during this investigation. Only sanitized measurements and error excerpts are included; no credentials, account identifiers, private paths, original images, prompts or raw rollouts are attached. Prepared from local diagnostics and submitted by an assistant at my request.

Activity

  1. added
    bug
    on Oct 29, 2026
  2. added
    CLI
    connectivity
    on Oct 29, 2026
  3. zhouchenghao330-svg commented on Oct 29, 2026

    @zhouchenghao330-svg
    Author

    Duplicate of #57725. Consolidating this report there to keep the related investigation together.

    The additional CLI 0.165.0 timeline, request-size measurements, HTTP-only observations and small-heartbeat controls have been added in #57725 (comment) . The full original report remains available above.

    Closing for tracking consolidation; a shared technical root cause has not been established.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    CLIbugconnectivity

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions