Repository navigation
reproduction: BUG: openai-compatible: empty toolcalls: array in every delta - #20251
Closed
ai-sdk-factory[bot] wants to merge 1 commit into
Closed
ai-sdk-factory[bot] wants to merge 1 commit into
ai-sdk-factory[bot] wants to merge 1 commit into
Conversation
Co-authored-by: Gregor Martynus <[email protected]>
1 task done
pull Bot
pushed a commit
to Hawthorne001/ai
that referenced
this pull request
Sep 3, 2026
…e reasoning streams (vercel#20253) ## Background OpenAI-compatible gateways that attach `tool_calls: []` to reasoning deltas caused one logical reasoning span to be emitted as multiple user-visible reasoning blocks. ## Root Cause The stream transform treated any non-null `tool_calls` array as active tool output. The immutable reproduction and regression test confirmed that empty arrays closed reasoning after each delta, producing two start/end cycles instead of one. ## Summary Reasoning now ends for tool calls only when the streamed `tool_calls` array contains entries. Added a patch changeset and removed reproduction-only artifacts. ## Testing Added a regression test verifying consecutive reasoning deltas with empty tool-call arrays remain within one reasoning lifecycle. ## End-to-end Validation - `pnpm -C packages/openai-compatible build` completed successfully. - Immutable reproduction replay completed successfully with one contiguous reasoning block and no original failure signal. ## Related Issues Fixes vercel#20203 Closes vercel#20251 --------- Co-authored-by: ai-sdk-factory <[email protected]> Co-authored-by: Gregor Martynus <[email protected]> Co-authored-by: WuJunkai2004 <[email protected]>
3 of 6 tasks
gr2m
added a commit
that referenced
this pull request
Sep 9, 2026
…e reasoning streams (#20537) ## Background OpenAI-compatible gateways that attach `tool_calls: []` to reasoning deltas caused one logical reasoning span to be emitted as multiple user-visible reasoning blocks. ## Root Cause The stream transform treated any non-null `tool_calls` array as active tool output. The immutable reproduction and regression test confirmed that empty arrays closed reasoning after each delta, producing two start/end cycles instead of one. ## Summary Reasoning now ends for tool calls only when the streamed `tool_calls` array contains entries. Added a patch changeset and removed reproduction-only artifacts. ## Testing Added a regression test verifying consecutive reasoning deltas with empty tool-call arrays remain within one reasoning lifecycle. ## End-to-end Validation - `pnpm -C packages/openai-compatible build` completed successfully. - Immutable reproduction replay completed successfully with one contiguous reasoning block and no original failure signal. ## Related Issues Fixes #20203 Closes #20251 Co-authored-by: ai-sdk-factory[bot] <305873210+ai-sdk-factory[bot]@users.noreply.github.com> Co-authored-by: ai-sdk-factory <[email protected]> Co-authored-by: WuJunkai2004 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug
[BUG]: openai-compatible: empty
tool_calls: []array in every delta fragments reasoning into one reasoning-start/end cycle per chunkReproduction
packages/openai-compatible/package.jsonis version 3.0.43, and the reported APIs and response fields exist onmain; no package-version or configuration mismatch explains the behavior.packages/openai-compatible/src/chat/openai-compatible-chat-language-model.tscloses active reasoning wheneverdelta.tool_calls != null, so an empty array incorrectly triggers a reasoning lifecycle transition.examples/ai-functions/src/reproduction/openai-compatible-empty-tool-calls-reasoning.tsreplayed two consecutive reasoning deltas containingtool_calls: []and observed tworeasoning-start/endcycles instead of the expected single contiguous reasoning block.packages/openai-compatible/src/chat/__fixtures__/issue-20203-empty-tool-calls.chunks.txtrecords the reported stream shape, and the regression test added topackages/openai-compatible/src/chat/openai-compatible-chat-language-model.test.tsfails because two reasoning starts are emitted instead of one.Relevant Documentation
Related Issues
Reproduces #20203