Skip to content

fix(agents): Add ids for reasoning messages and improve reasoning process to fix status 400 from openai#1779

Open
tiginamaria wants to merge 7 commits intodevelopfrom
tigina/fix-reasoning-with-tools
Open

fix(agents): Add ids for reasoning messages and improve reasoning process to fix status 400 from openai#1779
tiginamaria wants to merge 7 commits intodevelopfrom
tigina/fix-reasoning-with-tools

Conversation

@tiginamaria
Copy link
Copy Markdown
Collaborator

@tiginamaria tiginamaria commented Mar 31, 2026

Bugs:

  • The ID of incoming reasoning messages was ignored, but it's required for outgoing messages. We generated it manually, but it didn't match the format rs_***, so we got 400 from OpenAI. The right approach here is to store the original ids of the reasoning messages
  • For codex models, the reasoning is hidden, so we received empty text and summary, and while trying to send it back with the response, we also got 400 from OpenAI. The right fix here is to ignore empty reasoning, as it's hidden and makes no sense for the user.

Fixes:

  • Add ids to reasoning messages
  • Fix the reasoning messages response content, the text was ignored
  • Ignore empty reasoning messages
  • Add reasoning capability to control which models support reasoning

closes #1712
and bug reported in Slack https://kotlinlang.slack.com/archives/C08SLB97W23/p1773062179788829

@tiginamaria tiginamaria force-pushed the tigina/fix-reasoning-with-tools branch from ba5ca6a to 1c9c329 Compare March 31, 2026 14:01
@tiginamaria tiginamaria changed the title fix(agent) Add ids for reasoning messages and improve reasoning process to fix status 400 from openai fix(agent): Add ids for reasoning messages and improve reasoning process to fix status 400 from openai Mar 31, 2026
@tiginamaria tiginamaria changed the title fix(agent): Add ids for reasoning messages and improve reasoning process to fix status 400 from openai fix(agents): Add ids for reasoning messages and improve reasoning process to fix status 400 from openai Mar 31, 2026
@tiginamaria tiginamaria force-pushed the tigina/fix-reasoning-with-tools branch from 1227406 to e6300e3 Compare April 1, 2026 11:34
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.

OpenAI Responses API adapter replays reasoning items incorrectly

1 participant