Skip to content

fix(codex): handle gpt-5.5 null output in stream events - #32946

Closed
kdwhpgxgrc-spec wants to merge 1 commit into
NousResearch:mainfrom
kdwhpgxgrc-spec:main
Closed

fix(codex): handle gpt-5.5 null output in stream events#32946
kdwhpgxgrc-spec wants to merge 1 commit into
NousResearch:mainfrom
kdwhpgxgrc-spec:main

Conversation

@kdwhpgxgrc-spec

Copy link
Copy Markdown

Problem

gpt-5.5 intermittently emits SSE stream events where response.output is JSON null. The OpenAI SDK's parse_response() does for output in response.output — crashing with TypeError: 'NoneType' object is not iterable.

Hermes classified TypeError as a non-retryable local programming bug, so every affected request failed permanently with no retry. Sessions using openai-codex / gpt-5.5 became completely unresponsive.

Fix

agent/codex_runtime.py — catch TypeError with null-output fingerprint ('NoneType' or 'is not iterable') in the stream loop. Retry up to max_stream_retries, then fall back to _run_codex_create_stream_fallback(). Mirrors existing handling for RuntimeError and transport errors.

agent/conversation_loop.py — guard tool_calls set-comprehension against None. The codex transport returns tool_calls=None (not []) when no tools were called; iterating it raised the same TypeError class.

Reproduction

Any openai-codex session on gpt-5.5 hitting the intermittent null-output backend behavior — every message fails with ⚠️ 'NoneType' object is not iterable.

🤖 Generated with Claude Code

gpt-5.5 intermittently emits SSE events where response.output is
JSON null. The OpenAI SDK's parse_response() iterates it directly,
raising TypeError: 'NoneType' object is not iterable. Hermes
misclassified TypeError as a non-retryable local bug, causing
permanent session failure.

- codex_runtime: catch TypeError with null-output fingerprint;
  retry up to max_stream_retries, then fall back to create(stream=True)
- conversation_loop: guard tool_calls iteration against None
  (codex transport returns None, not [], when no tools called)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@alt-glitch alt-glitch added type/bug Something isn't working P3 Low — cosmetic, nice to have comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint codex provider/openai OpenAI / Codex Responses API duplicate This issue or pull request already exists labels May 27, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Duplicate of #32884 — same Codex null output recovery (catch TypeError with null-output fingerprint, retry then fallback). Also touches conversation_loop.py tool_calls guard. Root cause: #11179.

@teknium1

Copy link
Copy Markdown
Contributor

Closing as duplicate — the Codex null-output fix has been merged via #32963 (cherry-picked from @carltonawong's PR #32890, the one Gille reviewed). Thanks for jumping on the outage so quickly; appreciate the help. Closes #11179.

@teknium1 teknium1 closed this May 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

codex comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint duplicate This issue or pull request already exists P3 Low — cosmetic, nice to have provider/openai OpenAI / Codex Responses API type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants