You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Responses API replay can fail on orphan reasoning item after interrupted turn #17161
Codex can resend an orphan reasoning item when replaying history after an interrupted turn, which causes the Responses API request to fail instead of self-healing.
The concrete API error is:
{
"error": {
"message": "Item rs_... of type reasoning was provided without its required following item.",
"type": "invalid_request_error",
"param": "input"
}
}
Problem shape
A bad persisted/replayed sequence looks like:
trailing reasoning item
synthetic <turn_aborted> user marker
next real user message
In that shape, the replayed request contains a reasoning item without the model-generated item that originally followed it, and the Responses API rejects the request.
Expected behavior
Codex should detect this narrow invalid-request case, repair the replayed input/history by dropping only the orphan reasoning item, and retry once.
normalizes replayed history so incomplete reasoning items are removed while preserving <turn_aborted>
retries once for the exact missing-following-item error on both HTTP and websocket Responses transports
Validation on the patch
just fmt
just fix -p codex-core
cargo test -p codex-core missing_reasoning -- --nocapture
I couldn’t upstream the PR directly because this repository limits PR creation to collaborators, but the fork commit above should be enough to review or cherry-pick.
Activity
github-actions commentedon Apr 8, 2026
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
jgrantJump commentedon Apr 8, 2026
Closing in favor of #16255