bug: Chrome uTLS transport forces HTTP/2 without ALPN, breaking Codex voice behind TLS inspection
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) ininternal/runtime/executor/helps/utls_client.go - Enterprise TLS inspection; the TLS handshake succeeds, but
ConnectionState().NegotiatedProtocolis 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 EOFThe 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
- On a TLS-inspected connection, dial
chatgpt.com:443and handshake usingutls.UClient(conn, &utls.Config{ServerName: "chatgpt.com"}, utls.HelloChrome_Auto). - Observe
ConnectionState().NegotiatedProtocol == "". - Like CPA's
createConnection, call(&http2.Transport{}).NewClientConn(tlsConn)and issue a GET: it fails withunexpected EOF. - 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. - Repeat with
www.google.comas a control: forced HTTP/2 also returnsunexpected EOF; HTTP/1.1 returns200 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