Skip to content

Handle Responses streams with missing terminal output - #32914

Closed
JuzhengSi wants to merge 1 commit into
NousResearch:mainfrom
JuzhengSi:fix/responses-stream-missing-output
Closed

Handle Responses streams with missing terminal output#32914
JuzhengSi wants to merge 1 commit into
NousResearch:mainfrom
JuzhengSi:fix/responses-stream-missing-output

Conversation

@JuzhengSi

Copy link
Copy Markdown

Summary

  • recover Responses streams when the terminal event omits response.output but earlier output_item.done/text deltas were already received
  • share the recovery path between the main Codex stream runtime and the auxiliary Responses adapter
  • add regression coverage for malformed terminal streaming events

Why

Some OpenAI-compatible Responses endpoints emit valid incremental SSE events, then send a response.completed payload without an output field. OpenAI SDK parsing raises TypeError: 'NoneType' object is not iterable while iterating the stream, before Hermes can use the already streamed output. This makes the error look like a non-retryable client failure even though the assistant output was already available.

Tests

  • ./venv/bin/python -m py_compile agent/codex_runtime.py agent/auxiliary_client.py tests/agent/test_codex_stream_recovery.py
  • ./venv/bin/python -m pytest tests/agent/test_codex_stream_recovery.py tests/agent/test_codex_ttfb_watchdog.py tests/agent/test_auxiliary_client.py -q

@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 27, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Duplicate of #32884. Same Codex null output recovery. 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). Thanks for the help during the outage. 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.

4 participants