Skip to content

reproduction: pruneMessages leaves reasoning files when reasoning is set - #21103

Draft
ai-sdk-factory[bot] wants to merge 1 commit into
mainfrom
bug-reproduction-21102-20260918091413005630
Draft

ai-sdk-factory[bot] wants to merge 1 commit into
mainfrom
bug-reproduction-21102-20260918091413005630

Conversation

@ai-sdk-factory

Copy link
Copy Markdown
Contributor

Bug

pruneMessages leaves reasoning files when reasoning is set to all

Reproduction

  • examples/ai-functions/src/reproduction/prune-messages-reasoning-files.ts reproduces the bug on main at 9528712c36.
  • reasoning: 'all' removes reasoning text but retains reasoning-file; regular file and text parts remain intact.
  • reasoning: 'before-last-message' retains reasoning-file in older messages while correctly preserving all reasoning in the last message.
  • The failure occurs with synthetic messages and responseMessages produced by both generateText and streamText; the retained reasoning file is forwarded to a subsequent model call.
  • A message containing only reasoning text and a reasoning file incorrectly remains after pruning instead of being removed as empty.
  • packages/ai/src/generate-text/prune-messages.ts filters only part.type !== 'reasoning', omitting the supported reasoning-file content type.

Related Issues

Reproduces #21102

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.

1 participant