fix: keep openai-codex on HTTP responses transport#55535
Conversation
Greptile SummaryThis is a focused, narrowly-scoped bug fix that prevents
Confidence Score: 5/5Safe to merge — the change is a one-line logic fix that restores the correct HTTP-only path for openai-codex and is backed by an explicit regression test. The implementation is correct, minimal, and well-commented. The test file is updated to both remove the now-incorrect acceptance case and add an explicit rejection assertion. No other callsites or transitive behaviour are affected. No risks beyond the acknowledged follow-up if Codex later gets a websocket target, which is low-risk since the existing HTTP path continues to work. No files require special attention.
|
| Filename | Overview |
|---|---|
| src/agents/pi-embedded-runner/run/attempt.thread-helpers.ts | Simplifies shouldUseOpenAIWebSocketTransport to exclude openai-codex, keeping it on the HTTP responses path with an explanatory comment. |
| src/agents/pi-embedded-runner/run/attempt.spawn-workspace.websocket.test.ts | Removes the now-incorrect codex acceptance test and adds an explicit rejection assertion for the openai-codex/openai-codex-responses pair. |
Reviews (1): Last reviewed commit: "fix: keep openai-codex on HTTP responses..." | Re-trigger Greptile
|
I checked the current CI summary and the failures do not appear to point at the two files changed in this PR. The red jobs look dominated by unrelated upstream drift / flaky shards (for example Mattermost type-check, plugin-sdk/config drift, and existing contract/time-out failures), but I’m happy to adjust if maintainers see a direct regression here. |
|
Follow-up validation: this is now reproducible in my production install as well, not just in the isolated smoke environment that motivated the PR. After updating to OpenClaw 2026.3.28, the gateway journal shows the same fallback pattern on Observed twice in the same session:
The request still completes after HTTP fallback, but this confirms the current generic websocket path mismatch is not limited to a local smoke-only setup. |
0a5fbd7 to
24bfe52
Compare
24bfe52 to
d170050
Compare
obviyus
left a comment
There was a problem hiding this comment.
Reviewed latest changes. Research confirmed OpenClaw's openai-codex path is ChatGPT-backed HTTP, while both OpenAI docs and ~/Developer/codex websocket support are API-key/OpenAI-provider based, not ChatGPT-OAuth websocket reuse. Keeping codex on HTTP here is the correct fix until a real codex-specific WS target/auth path is proven.
|
Landed on main. Thanks @Nanako0129. |
Summary
openai-codexon its existing HTTP responses path instead of routing it into the generic OpenAI websocket transport selectoropenai-codex/openai-codex-responsespairChange Type
Scope
This PR is intentionally narrow.
It only changes websocket transport eligibility for
openai-codexon the embedded runner path.It does not change:
openai-codexprovider normalization logicLinked Issue/PR
Root Cause / Regression History
openai-codexmodels normalize to the ChatGPT backend HTTP path (https://chatgpt.com/backend-api) and useopenai-codex-responses.After #53702, the embedded runner's websocket eligibility selector also treated the
openai-codex/openai-codex-responsespair as websocket-eligible. However, the websocket connection manager still targets the generic OpenAI Responses websocket endpoint rather than a Codex-specific transport target.In isolated upstream-main smoke testing, that caused
openai-codexrequests to attempt websocket first, fail with HTTP 500, and then fall back to HTTP.This patch keeps
openai-codexon the existing HTTP path until there is a verified provider-specific websocket target and end-to-end support for it.Behavior Changes
Before:
openai-codex/openai-codex-responsesentered the generic OpenAI websocket selectorAfter:
openai/openai-responsesis websocket-eligibleopenai-codexstays on HTTP responses transportRegression Test Plan
Updated:
src/agents/pi-embedded-runner/run/attempt.spawn-workspace.websocket.test.tsCoverage:
openai/openai-responseswebsocket pairopenai-codex/openai-codex-responsesRepro + Verification
Observed on merged
upstream/mainduring isolated smoke validation of #53702:openai-codex/gpt-5.4requests succeeded, but only after websocket failed and the runner fell back to HTTPWith this patch:
openai-codexinto the generic OpenAI websocket pathTests
Passed locally:
corepack pnpm test -- src/agents/pi-embedded-runner/run/attempt.spawn-workspace.websocket.test.ts --reporter=verbosepnpm checkpassed during commitRisks and Mitigations
Risk:
openai-codexlater gets a valid provider-specific websocket endpoint, this patch will keep it on HTTP until that support is added explicitlyMitigation:
AI assistance
AI-assisted: drafted and implemented with Codex, then locally reviewed and tested by me.