Skip to content

fix: preserve assistant reasoning when replaying Open Responses output in tool loops - #18515

Open
ai-sdk-factory[bot] wants to merge 3 commits into
mainfrom
bugfix-18513-20260806104848807318
Open

fix: preserve assistant reasoning when replaying Open Responses output in tool loops#18515
ai-sdk-factory[bot] wants to merge 3 commits into
mainfrom
bugfix-18513-20260806104848807318

Conversation

@ai-sdk-factory

@ai-sdk-factory ai-sdk-factory Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Background

The published @ai-sdk/open-responses package lost assistant reasoning when its generated content was replayed in a tool loop, sending zero reasoning items after parsing one.

Root Cause

The assistant-content switch in convertToOpenResponsesInput handled only text and tool-call parts, so parsed reasoning parts fell through without serialization; the offline reproduction confirmed one reasoning part was read and zero were sent.

Summary

Assistant reasoning parts are now serialized as Open Responses reasoning items with reasoning_text content. The request type was tightened accordingly, and a patch changeset was added.

Testing

Added regression coverage asserting that assistant reasoning becomes a correctly shaped reasoning input item.

End-to-end Validation

  • pnpm -C packages/open-responses build; pnpm -C examples/ai-functions exec tsx src/reproduction/issue-18513-open-responses-reasoning-round-trip.ts — the offline round trip sent one reasoning item instead of zero and exited successfully.

Related Issues

Fixes #18513

Closes #18514

ai-sdk-factory and others added 3 commits August 6, 2026 10:54
Co-authored-by: Astro-Han <255364436+Astro-Han@users.noreply.github.com>
Co-authored-by: Astro-Han <255364436+Astro-Han@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

@ai-sdk/open-responses: convertToOpenResponsesInput silently drops assistant reasoning parts (asymmetric round trip)

1 participant