Skip to content

fix(codex): recover stream output after SDK null output - #33771

Closed
liran29 wants to merge 1 commit into
NousResearch:mainfrom
liran29:fix/codex-output-none-stream
Closed

fix(codex): recover stream output after SDK null output#33771
liran29 wants to merge 1 commit into
NousResearch:mainfrom
liran29:fix/codex-output-none-stream

Conversation

@liran29

@liran29 liran29 commented May 28, 2026

Copy link
Copy Markdown

Summary

  • recover Codex Responses streams when the OpenAI SDK crashes on response.completed.output = null
  • reuse already-collected response.output_item.done items or streamed text deltas instead of failing the turn
  • add a regression test for the SDK TypeError path

Root Cause

The ChatGPT Codex backend can stream valid output items and then emit a terminal response.completed event whose response.output is null. OpenAI SDK 2.24 raises TypeError("'NoneType' object is not iterable") while parsing that terminal event, before Hermes reaches the existing empty-output recovery path.

Test

  • venv/bin/python -m pytest tests/run_agent/test_run_agent_codex_responses.py -q

Copilot AI review requested due to automatic review settings May 28, 2026 09:10
@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 provider/openai OpenAI / Codex Responses API codex duplicate This issue or pull request already exists labels May 28, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Duplicate of merged #32963 — same Codex null-output stream recovery (TypeError guard on response.completed.output = null). Fix already on main.

@teknium1

Copy link
Copy Markdown
Contributor

Thanks for this — closing as already fixed on main.

The Codex null-output crash (response.completed with output: null from the chatgpt.com backend → TypeError: 'NoneType' object is not iterable → surfaced as "non-retryable HTTP None") is resolved by commits already on main:

  • cb38ce28c — drop the SDK responses.stream() helper and consume events directly, rebuilding output from response.output_item.done events so the null terminal-event output is never iterated (refactor(codex): drop SDK responses.stream() helper; consume events directly #33042).
  • 43a3f119f — recover Codex streams with null output.
  • dc9d677d5 — classify TypeError('NoneType … not iterable') as a retryable provider-shape error so retry/fallback runs instead of killing the turn.

Your fix targets the same path that's now hardened upstream, so there's nothing left to merge here. Your authorship is preserved in your branch; I'm crediting your report in the umbrella issue #33932 (now closed). Appreciate the contribution.

@teknium1 teknium1 closed this Jun 30, 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