Skip to content

fix(codex): recover from null terminal output in Responses streams - #32900

Closed
bananawalnut wants to merge 1 commit into
NousResearch:mainfrom
bananawalnut:fix/codex-null-output-stream-recovery
Closed

fix(codex): recover from null terminal output in Responses streams#32900
bananawalnut wants to merge 1 commit into
NousResearch:mainfrom
bananawalnut:fix/codex-null-output-stream-recovery

Conversation

@bananawalnut

Copy link
Copy Markdown
Contributor

Summary

  • recover Codex Responses streams when the SDK raises TypeError: 'NoneType' object is not iterable on a terminal null response.output
  • synthesize the final response from already collected response.output_item.done events when possible
  • synthesize plain assistant output from streamed text deltas when no tool calls were present
  • retry once, then fall back to the existing raw create(stream=True) parser when no recoverable streamed payload exists
  • add regression coverage for collected-item recovery, text-delta recovery, fallback behavior, and unrelated TypeError re-raising

Why

The ChatGPT Codex backend can close a Responses stream with a terminal frame that has no output list. OpenAI Python SDK 2.24.0 raises while iterating that field, even though Hermes may already have received usable streamed output-item events. This made Hermes abort with a non-retryable client error.

Tests

  • uv run --python 3.13 --with pytest pytest tests/run_agent/test_run_agent_codex_responses.py -o 'addopts=' -q
  • uv run --python 3.13 python -m py_compile agent/codex_runtime.py tests/run_agent/test_run_agent_codex_responses.py

Closes #32894

@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 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.

[Bug]: Codex Responses stream aborts on terminal null output

3 participants