Skip to content

fix: fix OpenAI reasoning + web_search replay failure#23402

Draft
ibetitsmike wants to merge 4 commits intomainfrom
mike/fix-openai-reasoning-websearch-replay
Draft

fix: fix OpenAI reasoning + web_search replay failure#23402
ibetitsmike wants to merge 4 commits intomainfrom
mike/fix-openai-reasoning-websearch-replay

Conversation

@ibetitsmike
Copy link
Collaborator

Fixes the follow-up turn failure when an OpenAI reasoning model (e.g. o4-mini) produces both reasoning output and a provider-executed web_search_call in the same response.

Root cause: The fantasy adapter skipped reasoning items entirely during replay. When store=true, web_search items were replayed via item_reference but the reasoning item that preceded them was dropped. OpenAI rejects this with: "reasoning was provided without its required following item."

Fix: Updated the pinned fantasy fork to emit item_reference for reasoning items when store=true, keeping them paired with subsequent provider-executed tool calls. Upstream PR: kylecarbs/fantasy#7

Changes

  • coderd/chatd/chattest/openai.go: Extended fake OpenAI server to stream reasoning + web_search + text events
  • coderd/chatd/integration_test.go: Added TestOpenAIReasoningWithWebSearchRoundTrip and TestOpenAIReasoningWithWebSearchRoundTripStoreFalse
  • go.mod/go.sum: Updated fantasy pin to include the replay fix

@ibetitsmike ibetitsmike changed the title fix(coderd/chatd): fix OpenAI reasoning + web_search replay failure fix: fix OpenAI reasoning + web_search replay failure Mar 21, 2026
@ibetitsmike
Copy link
Collaborator Author

@codex review

@chatgpt-codex-connector
Copy link

Codex Review: Didn't find any major issues. Breezy!

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

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".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant