Skip to content

fix: keep function calls when reasoning can't be replayed - #22

Merged
TheGreatAxios merged 1 commit into
cl-9394-openai-responses-align-repo-scaffolding-with-the-packagefrom
cl-9423-openai-responses-keep-function-calls-when-reasoning-cant-be
Sep 27, 2026
Merged

TheGreatAxios merged 1 commit into
cl-9394-openai-responses-align-repo-scaffolding-with-the-packagefrom
cl-9423-openai-responses-keep-function-calls-when-reasoning-cant-be

Conversation

@TheGreatAxios

Copy link
Copy Markdown
Contributor

Closes CL-9423

Summary

  • When a reasoning signature can't be replayed (the turn was saved with another model, or the signature is tagged for another provider), the request builder now drops only the reasoning item. The function_call and its function_call_output are both kept, as before orphan suppression.
  • Orphan suppression dropped the function_call but kept its output, which OpenAI rejects with 400 "No tool call found for function call output", so tool history broke permanently after a model switch.
  • The comment on toResponsesItems now describes this.
  • New tests cover both cases (model switch, foreign provider tag) and assert the whole input: message, function_call, function_call_output, in order. There were no earlier suppression tests on this branch to update.

Checks

bun run check, bun run build, bun run test:e2e and the Node pack smoke pass locally.

@TheGreatAxios
TheGreatAxios added this pull request to stack #19 September 27, 2026 00:19
@TheGreatAxios
TheGreatAxios merged commit 85ececf into main Sep 27, 2026
1 check passed
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