[codex] fix Responses null output recovery - #32915
Conversation
OpenAI SDK 2.24 can raise TypeError: 'NoneType' object is not iterable when the Codex backend emits a terminal Responses stream event whose response.output is null. Hermes treated that SDK parser failure as a local non-recoverable error, and its backfill path only handled an empty output list rather than None. This breaks the pure Hermes openai-codex provider with models such as gpt-5.5, and also surfaces through auxiliary title generation because it uses the same Codex Responses stream shape. Fix the transport to omit the tools key when there are no converted tools, recover the main Codex stream when the SDK parser hits null output after receiving deltas, and apply the same output-none backfill/recovery behavior to the auxiliary Codex adapter. Validation: affected Codex transport/runtime/auxiliary tests pass locally: 129 passed, 1 warning.
|
Thanks for pointing that out. If #32884 already covers the same recovery path and the The issue was actively affecting Codex users, and I opened this after reproducing it locally. If any part of this implementation or the extra tests around auxiliary/title-generation streams is still useful, feel free to fold it into #32884. |
|
Field-tested the same failure class on a live Hermes gateway using the Codex provider ( Observed symptom before the fix: This was triggered after the stream had already emitted usable content; the SDK then failed while materializing the terminal snapshot with A local hotfix matching this PR's approach — detect the null-output parser So the root-cause analysis here matches production behavior. The important part is preserving streamed deltas/items as authoritative when the terminal Responses snapshot is malformed/null, rather than treating the SDK parser crash as an HTTP/provider failure. |
|
Thanks for field-testing this on a live Codex gateway and for spelling out the exact failure mode. That matches the root cause this PR was aimed at: Codex can stream usable assistant content, then the SDK raises while materializing/parsing the terminal Responses snapshot because Since this PR is already closed as a duplicate, the active fix path is #32884. This field report is useful production validation for that PR. |
Summary
Root Cause
OpenAI SDK 2.24 can raise TypeError: 'NoneType' object is not iterable when the Codex backend
emits a terminal Responses stream event whose response.output is null.
Hermes treated that SDK parser failure as a local non-recoverable error, and its backfill path
only handled an empty output list rather than null. This breaks the pure Hermes openai-codex
provider with models such as gpt-5.5, and also surfaces through auxiliary title generation because
it uses the same Codex Responses stream shape.
Fix
received
Validation