fix(docker): patch OpenAI SDK parse_response crash for Codex endpoint (output: null) - #33553
Closed
cesarcruz28 wants to merge 1 commit into
Closed
fix(docker): patch OpenAI SDK parse_response crash for Codex endpoint (output: null)#33553cesarcruz28 wants to merge 1 commit into
cesarcruz28 wants to merge 1 commit into
Conversation
openai SDK >=2.37.0 introduced a regression in parse_response() at
openai/lib/_parsing/_responses.py:
for output in response.output: # crashes when output is None
The ChatGPT Codex endpoint (chatgpt.com/backend-api/codex) returns
output: null in the final response.completed SSE event when store=false,
which is required (the API rejects store:true with 400). This causes
TypeError: 'NoneType' object is not iterable on every Codex response,
making hermes silently fail to reply.
Fix: in the same RUN as uv sync, apply a one-line guard in-place so the
patch is always in the same Docker layer as the install — applying it in
a separate RUN after a cached install layer silently no-ops because
pathlib.rglob cannot traverse into cached overlay layers.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Collaborator
Author
|
Great! thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
OpenAI Python SDK >=2.37.0\ introduced a regression in \parse_response():
\\python
openai/lib/_parsing/_responses.py line ~61
for output in response.output: # 💥 TypeError when output is None
\\
The ChatGPT Codex endpoint (\chatgpt.com/backend-api/codex) always returns \output: null\ in the final
esponse.completed\ SSE event when \store=false\ — and \store: false\ is required (the API rejects \store: true\ with 400). This means every Codex/gpt-5.5 response crashes with:
\
TypeError: 'NoneType' object is not iterable
\\
The exception is caught upstream as a local validation error and the agent silently returns nothing, so the user only sees Hermes greet them but never reply.
Fix
One-line Python guard applied in the same \RUN\ as \uv sync\ — patching in a later \RUN\ silently no-ops because \pathlib.rglob\ cannot traverse into cached overlay layers from a prior \RUN.
\\python
'for output in response.output:'
→ 'for output in (response.output or []):'
\\
This is the minimal safe guard: an empty list short-circuits the loop cleanly, and the existing backfill logic in _run_codex_stream()\ already handles the empty-output case.
Upstream fix
The correct long-term fix is for OpenAI to ship SDK >=2.37.1\ with the None guard. This patch ensures Docker users are not broken in the meantime regardless of which SDK version \uv\ resolves to.
🤖 Generated with Claude Code