Error
After a few messages with openai/gpt-5.2, requests fail with:
400 Item 'rs_01ffdd9de32ec9b800696c2a431af0819884f91c2413996fab' of type 'reasoning' was provided without its required following item.
Observations
- Only reproduced with
openai/gpt-5.2
- Not observed with
openai-codex/gpt-5.2
- Happens after a few messages in a session, not on the first turn
Investigation
The error originates from OpenAI's Responses API rejecting the conversation history. OpenAI requires reasoning items to be immediately followed by a message or function_call item.
In @mariozechner/pi-ai (openai-responses.js), assistant message content blocks are pushed to output in their original order from msg.content. If content blocks are stored in order [text, thinking], the output becomes [message, reasoning] — with reasoning at the end having no following item.
Potentially related: sessions with mixed provider history (e.g., started with Claude, switched to GPT-5.2) may have content blocks stored in unexpected orders.
Error
After a few messages with
openai/gpt-5.2, requests fail with:Observations
openai/gpt-5.2openai-codex/gpt-5.2Investigation
The error originates from OpenAI's Responses API rejecting the conversation history. OpenAI requires
reasoningitems to be immediately followed by amessageorfunction_callitem.In
@mariozechner/pi-ai(openai-responses.js), assistant message content blocks are pushed to output in their original order frommsg.content. If content blocks are stored in order[text, thinking], the output becomes[message, reasoning]— with reasoning at the end having no following item.Potentially related: sessions with mixed provider history (e.g., started with Claude, switched to GPT-5.2) may have content blocks stored in unexpected orders.