bug: Chrome uTLS transport forces HTTP/2 without ALPN, breaking Codex voice behind TLS inspection

Author: DengYipingCreated Sep 29, 2026Updated Sep 29, 2026

Description

The Chrome/uTLS transport unconditionally starts HTTP/2 after the TLS handshake, even when ALPN negotiated no protocol. This breaks Codex voice startup (POST /v1/live) and other ChatGPT-backed requests on a network with enterprise TLS inspection.

Environment

  • CLIProxyAPI 8.0.0, Homebrew, macOS arm64
  • The same unconditional HTTP/2 initialization remains in current main (a270e7b9) in internal/runtime/executor/helps/utls_client.go
  • Enterprise TLS inspection; the TLS handshake succeeds, but ConnectionState().NegotiatedProtocol is empty

Actual behavior

Starting voice in Codex Desktop returns:

502 Bad Gateway
Post "https://chatgpt.com/backend-api/codex/realtime/calls?intent=quicksilver&architecture=avas": unexpected EOF

The local request is POST http://127.0.0.1:8317/v1/live. Ten startup attempts failed within approximately 60–170 ms. ChatGPT-backed text requests have also failed with unexpected EOF.

Credential-free reproduction and isolation

  1. On a TLS-inspected connection, dial chatgpt.com:443 and handshake using utls.UClient(conn, &utls.Config{ServerName: "chatgpt.com"}, utls.HelloChrome_Auto).
  2. Observe ConnectionState().NegotiatedProtocol == "".
  3. Like CPA's createConnection, call (&http2.Transport{}).NewClientConn(tlsConn) and issue a GET: it fails with unexpected EOF.
  4. On a fresh connection using the same TLS profile, issue HTTP/1.1 instead. GET of the realtime calls endpoint returns 405 Method Not Allowed, an expected response for the wrong method, rather than a transport error.
  5. Repeat with www.google.com as a control: forced HTTP/2 also returns unexpected EOF; HTTP/1.1 returns 200 OK.

No credentials or voice-session creation are needed for this reproduction. These observations isolate a protocol mismatch, not an authentication or model-access failure. Authenticated voice startup has not yet been verified with a patched running CPA.

Expected behavior / proposed fix

Respect ALPN: use HTTP/2 only when the negotiated protocol is h2, and HTTP/1.1 for http/1.1 or empty ALPN. Preserve the Chrome TLS fingerprint, proxy routing, request cancellation, and connection cleanup. Select the transport before sending the request; do not replay a POST after an HTTP/2 failure.

A patch with regression tests will follow.

Source: router-for-me/CLIProxyAPI