Skip to content

fix: patch Responses API parse_response to handle empty/None output field - #33275

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

fix: patch Responses API parse_response to handle empty/None output field#33275
alvinycheung wants to merge 1 commit into
NousResearch:mainfrom
alvinycheung:fix/codex-responses-none-output

Conversation

@alvinycheung

Copy link
Copy Markdown

This PR fixes a TypeError: 'NoneType' object is not iterable in the openai SDK when utilizing Codex/Responses backends where response.output is returned as None (for instance, on the final response.completed event).

We apply a runtime monkey-patch to openai.lib._parsing._responses.parse_response inside _load_openai_cls() to default response.output to [] when None, preventing the crash.

@alt-glitch alt-glitch added type/bug Something isn't working comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint provider/openai OpenAI / Codex Responses API codex P3 Low — cosmetic, nice to have labels May 27, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Late duplicate of merged #32963 which already fixes the Codex response.output=None TypeError. Monkey-patching the SDK is unnecessary — the canonical fix uses except TypeError recovery in codex_runtime.py.

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.

2 participants