Skip to content

fix(ai-openrouter): deduplicate reasoning parts when streaming#6060

Merged
IMax153 merged 1 commit intoEffect-TS:mainfrom
nvonbulow:fix/openrouter-reasoning-duplicate
Feb 13, 2026
Merged

fix(ai-openrouter): deduplicate reasoning parts when streaming#6060
IMax153 merged 1 commit intoEffect-TS:mainfrom
nvonbulow:fix/openrouter-reasoning-duplicate

Conversation

@nvonbulow
Copy link
Contributor

When a delta contains both reasoning and reasoning_details, the old code emitted a reasoning part for each, causing every token to appear twice in the stream and exported chat history. Use else if so reasoning is only a fallback when reasoning_details is absent.

Type

  • Refactor
  • Feature
  • Bug Fix
  • Optimization
  • Documentation Update

Description

When a reasoning delta event contains both reasoning and reasoning_details, the old code emitted a reasoning part for each field, causing every token to appear twice. With this fix, reasoning is now only used as a fallback when reasoning_details is absent.

Related

…Effect-TS#6059

When a delta contains both `reasoning` and `reasoning_details`, the old
code emitted a reasoning part for each, causing every token to appear
twice in the stream and exported chat history. Use `else if` so
`reasoning` is only a fallback when `reasoning_details` is absent.
@nvonbulow nvonbulow requested a review from IMax153 as a code owner February 13, 2026 04:32
@github-project-automation github-project-automation bot moved this to Discussion Ongoing in PR Backlog Feb 13, 2026
@changeset-bot
Copy link

changeset-bot bot commented Feb 13, 2026

🦋 Changeset detected

Latest commit: 9b01ff8

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@effect/ai-openrouter Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@IMax153 IMax153 merged commit c3e706f into Effect-TS:main Feb 13, 2026
11 checks passed
@github-project-automation github-project-automation bot moved this from Discussion Ongoing to Done in PR Backlog Feb 13, 2026
@github-actions github-actions bot mentioned this pull request Feb 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

@effect/ai-openrouter: Reasoning parts are duplicated when streaming a response from OpenRouter

2 participants