fix: keep responses reasoning adjacent to messages#12018
fix: keep responses reasoning adjacent to messages#12018yzlu0917 wants to merge 1 commit intocontinuedev:mainfrom
Conversation
💡 Codex Reviewcontinue/core/llm/llms/Ollama.ts Line 514 in feff4df .Tools support
This change removes the guard that previously suppressed ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Summary
function_callitems when a Responses API assistant turn contains both text and tool callsWhy
OpenAI Responses reasoning models require the
reasoningitem to stay adjacent to its assistant output item. Continue currently emitsfunction_callitems before the assistantmessageitem when a turn contains both text and tool calls, which can separate the reasoning item from the message it belongs to and trigger:Item 'msg_...' was provided without its required 'reasoning' item: 'rs_...'.Reordering these items keeps the reasoning/message pair intact without changing the tool-call payloads themselves.
Validation
npm test -- --runInBand openaiTypeConverters.test.tsincoreCloses #11994
Summary by cubic
Reorders Responses output so assistant messages are emitted before
function_callitems when a turn has both text and tool calls. This keepsreasoningnext to its message and fixes the “Item 'msg_...' was provided without its required 'reasoning' item” error (addresses #11994).toResponsesInput, emit the assistant message first and then tool calls; keeps reasoning/message adjacent and leaves tool-only turns unchanged.Written for commit feff4df. Summary will update on new commits.