fix(codex): recover from null terminal stream output#32888
Conversation
|
Tested. Confirms the fix. Cherry-picked your commit ( The dual-path coverage matters: I had been seeing Runtime evidence:
This is one of 8 racing PRs for the same bug. Of the dual-path fixes (yours, #32890, #11182), yours has the smallest diff (+158/-15 vs +250/-62 and the 4-month-stale #11182). Cleanest path to merge IMO. Will run for a day; will report back if anything regresses. Thanks for shipping this fast. |
|
Closing as duplicate — the Codex null-output fix has been merged via #32963 (cherry-picked from @carltonawong's PR #32890, the one Gille reviewed). Thanks for jumping on the outage so quickly; appreciate the help. Closes #11179. |
Rationale
OpenAI Codex/ChatGPT backend streams can emit usable output through
response.output_item.done, then finish with aresponse.completedpayload whoseresponse.outputisnull. The OpenAI Python SDK raisesTypeError: 'NoneType' object is not iterablewhile parsing that terminal event, so Hermes loses the already-streamed answer and shows an error instead.Summary
run_codex_stream()from the exact SDK terminal parse error when collected stream output or text deltas are available.Test Plan
uv run pytest tests/run_agent/test_run_agent_codex_responses.py tests/agent/test_auxiliary_client.py::TestCodexAdapterReasoningTranslation -quv run ruff check agent/codex_runtime.py agent/auxiliary_client.py tests/run_agent/test_run_agent_codex_responses.py tests/agent/test_auxiliary_client.pygit diff --check -- agent/codex_runtime.py agent/auxiliary_client.py tests/run_agent/test_run_agent_codex_responses.py tests/agent/test_auxiliary_client.py