Client or integration
Codex CLI / native Codex integration through OpenCodex
Area
Streaming / Responses compatibility
Summary
On macOS, Codex CLI 0.152.0 can complete a first-party request when using the native OpenAI route, but the same minimal request repeatedly fails when Codex is routed through OpenCodex 2.39.0 at http://127.0.0.1:10100/v1.
Both a first-party model and a configured third-party model fail with:
stream disconnected before completion: error sending request for url (http://127.0.0.1:10100/v1/responses)
The failure reproduces with the launchd service and with the documented foreground A/B command, so it does not appear to be only a launchd proxy-environment inheritance issue.
Environment
- OS: macOS 26.6.2, Darwin 25.6.0 arm64
- OpenCodex: 2.39.0
- Codex CLI: 0.152.0
- OpenCodex runtime: bundled Bun 1.4.0
- Local upstream HTTP proxy:
http://127.0.0.1:1082
- Codex native integration: enabled with
ocx integration native codex on
- OpenCodex
websockets: false
Setup
ocx config set proxy 'http://127.0.0.1:1082'
ocx config validate
ocx service repair
ocx integration native codex on
ocx ready --wait --timeout 60
All three provider checks succeeded:
openai: connected
command-code: connected (62 models available)
zai: connected (10 models available)
ocx doctor reports Configured proxy: set, routing=opencodex-local, and Bun 1.4.0.
Reproduction
First-party:
codex exec --ephemeral --sandbox read-only --skip-git-repo-check --json \
-m gpt-5.6-luna \
'Reply with exactly OK and do not use any tools.'
Third-party:
codex exec --ephemeral --sandbox read-only --skip-git-repo-check --json \
-m command-code/deepseek-deepseek-v4-flash \
'Reply with exactly OK and do not use any tools.'
For both requests Codex first reports the expected client-facing WebSocket fallback:
failed to connect to websocket: HTTP error: 426 Upgrade Required
falling back to HTTP
Then it retries five times and ends with:
stream disconnected before completion: error sending request for url (http://127.0.0.1:10100/v1/responses)
turn.failed
The same failure reproduces after restoring the launchd service and also with:
ocx service stop
HTTP_PROXY=http://127.0.0.1:1082 \
HTTPS_PROXY=http://127.0.0.1:1082 \
ocx start
Controls
- Before enabling native Codex routing, the same first-party
codex exec request completed natively with OK and turn.completed.
- The upstream proxy is reachable: a proxied request to
https://chatgpt.com/backend-api/wham/usage returned HTTP 401 quickly, which confirms the connection path without exposing credentials.
- Direct local
POST /v1/chat/completions with zai/glm-5.3 and stream: true completed with data: [DONE].
- Direct local minimal
POST /v1/responses with zai/glm-5.3 and stream: true completed with response.completed and data: [DONE].
Therefore provider authentication, the local proxy, the upstream HTTP proxy, and minimal local SSE delivery all work. The failure seems specific to the full request shape emitted by Codex CLI and its Responses bridge/stream relay path.
Expected behavior
Codex should receive a complete streamed response and a terminal Responses event for both the first-party and third-party model requests.
Actual behavior
The local /v1/responses connection is closed before Codex receives a terminal event. Codex retries five times and reports stream disconnected.
Related issues
This appears related to the historical Responses/macOS streaming compatibility issues in #1127 and #1809, but the current reproduction is on 2.39.0 with Codex 0.152.0 and also affects a minimal first-party request. #324 documents the expected 426 behavior when the client-facing WebSocket endpoint is disabled.
Could you please investigate the Codex 0.152.0 request shape and the OpenCodex Responses bridge/stream relay on macOS? A debug classification of whether the close occurs before or after upstream response.created would also help distinguish request translation from terminal-event delivery.
No credentials or tokens are included in this report. Bun was kept at 1.4.0; no runtime downgrade was attempted.
Client or integration
Codex CLI / native Codex integration through OpenCodex
Area
Streaming / Responses compatibility
Summary
On macOS, Codex CLI 0.152.0 can complete a first-party request when using the native OpenAI route, but the same minimal request repeatedly fails when Codex is routed through OpenCodex 2.39.0 at
http://127.0.0.1:10100/v1.Both a first-party model and a configured third-party model fail with:
The failure reproduces with the launchd service and with the documented foreground A/B command, so it does not appear to be only a launchd proxy-environment inheritance issue.
Environment
http://127.0.0.1:1082ocx integration native codex onwebsockets: falseSetup
All three provider checks succeeded:
ocx doctorreportsConfigured proxy: set,routing=opencodex-local, and Bun 1.4.0.Reproduction
First-party:
Third-party:
For both requests Codex first reports the expected client-facing WebSocket fallback:
Then it retries five times and ends with:
The same failure reproduces after restoring the launchd service and also with:
Controls
codex execrequest completed natively withOKandturn.completed.https://chatgpt.com/backend-api/wham/usagereturned HTTP 401 quickly, which confirms the connection path without exposing credentials.POST /v1/chat/completionswithzai/glm-5.3andstream: truecompleted withdata: [DONE].POST /v1/responseswithzai/glm-5.3andstream: truecompleted withresponse.completedanddata: [DONE].Therefore provider authentication, the local proxy, the upstream HTTP proxy, and minimal local SSE delivery all work. The failure seems specific to the full request shape emitted by Codex CLI and its Responses bridge/stream relay path.
Expected behavior
Codex should receive a complete streamed response and a terminal Responses event for both the first-party and third-party model requests.
Actual behavior
The local
/v1/responsesconnection is closed before Codex receives a terminal event. Codex retries five times and reportsstream disconnected.Related issues
This appears related to the historical Responses/macOS streaming compatibility issues in #1127 and #1809, but the current reproduction is on 2.39.0 with Codex 0.152.0 and also affects a minimal first-party request. #324 documents the expected 426 behavior when the client-facing WebSocket endpoint is disabled.
Could you please investigate the Codex 0.152.0 request shape and the OpenCodex Responses bridge/stream relay on macOS? A debug classification of whether the close occurs before or after upstream
response.createdwould also help distinguish request translation from terminal-event delivery.No credentials or tokens are included in this report. Bun was kept at 1.4.0; no runtime downgrade was attempted.