Skip to content

openai-codex provider crashes: SDK parse_response fails on null output from Codex backend #32903

@MikeBrew123

Description

@MikeBrew123

Bug

Hermes v0.14.0 (latest, updated 2026-05-27 with 471 commits pulled) crashes on every hermes chat call when using openai-codex provider with gpt-5.5.

Error: 'NoneType' object is not iterable

Root Cause

The ChatGPT Codex backend (chatgpt.com/backend-api/codex) returns output: null in response.completed SSE stream events. The OpenAI Python SDK's parse_response() at openai/lib/_parsing/_responses.py:61 does for output in response.output: with no null guard, crashing the stream parser before Hermes's own backfill logic (in codex_runtime.py) ever runs.

This affects all OpenAI SDK versions through 2.38.0 (latest). Filed upstream: openai/openai-python#3313

Workaround

Patch the installed SDK:

sed -i 's/for output in response.output:/for output in (response.output or []):/' \
  $(python3 -c "import openai; print(openai.__file__.rsplit('/',1)[0])")/lib/_parsing/_responses.py

Note: This patch is overwritten by hermes update or pip install openai.

Suggested Fix

Either:

  1. Pin to a fixed SDK version once OpenAI patches it
  2. Add a monkey-patch in Hermes's codex transport init that guards the SDK's parse_response
  3. Add the sed patch to hermes update post-install hooks until upstream fixes

Environment

  • Hermes: v0.14.0 (2026.5.16), fully updated
  • OpenAI SDK: 2.24.0 (pinned), tested through 2.38.0
  • Python: 3.11.15
  • Config: provider=openai-codex, model=gpt-5.5, base_url=chatgpt.com/backend-api/codex
  • Auth: valid OAuth token (Plus plan, 93h remaining), no residency constraint
  • VPS: Hostinger

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Low — cosmetic, nice to havecodexcomp/agentCore agent loop, run_agent.py, prompt builderprovider/openaiOpenAI / Codex Responses APItype/bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions