Skip to content

[Bug]: Completed empty Codex response is normalized to incomplete and retried 3 times #3956

@krandder

Description

@krandder

What happened

A valid empty final response from openai-codex is being treated as incomplete by Hermes.

In a Telegram group, I told the bot not to reply. Instead of staying silent, Hermes retried 3 times and then sent:

⚠️ Codex response remained incomplete after 3 continuation attempts

Expected

If Codex completes with an empty final answer, Hermes should preserve that completion state instead of treating it as incomplete.

Actual

Hermes normalizes the response to finish_reason = "incomplete" and enters the continuation loop.

Repro

I reproduced this with the live Codex Responses API and the same prompt/history.

Provider result:

  • response.status = completed
  • one message item
  • message.status = completed
  • message.phase = final_answer
  • empty final text

Hermes result:

  • _run_codex_stream() receives completed
  • _normalize_codex_response() returns finish_reason = "incomplete"

Suspected cause

In run_agent.py, _normalize_codex_response() has this branch:

elif reasoning_items_raw and not final_text:
    finish_reason = "incomplete"

That appears to misclassify a completed empty final-answer turn as incomplete.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1High — major feature broken, no workaroundcomp/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