fix: include accumulated reasoning_details in reasoning-end event + regression test#395
Merged
robert-j-y merged 6 commits intomainfrom Feb 9, 2026
Merged
fix: include accumulated reasoning_details in reasoning-end event + regression test#395robert-j-y merged 6 commits intomainfrom
robert-j-y merged 6 commits intomainfrom
Conversation
…g-end event The reasoning-start event only carries the first streaming delta's providerMetadata, but Anthropic signatures arrive in the last delta. The AI SDK updates the reasoning part's providerMetadata from the reasoning-end event. Without this fix, text-only responses (no tool calls) lose the signature, causing "Invalid signature in thinking block" errors on subsequent turns in multi-turn conversations. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Robert Yeakel <robert.yeakel@openrouter.ai>
Co-Authored-By: Robert Yeakel <robert.yeakel@openrouter.ai>
Co-Authored-By: Robert Yeakel <robert.yeakel@openrouter.ai>
Co-Authored-By: Robert Yeakel <robert.yeakel@openrouter.ai>
Co-Authored-By: Robert Yeakel <robert.yeakel@openrouter.ai>
2 tasks
Merged
kesavan-byte
pushed a commit
to osm-API/ai-sdk-provider
that referenced
this pull request
Feb 13, 2026
…egression test (OpenRouterTeam#395) * fix: include accumulated reasoning_details with signature in reasoning-end event The reasoning-start event only carries the first streaming delta's providerMetadata, but Anthropic signatures arrive in the last delta. The AI SDK updates the reasoning part's providerMetadata from the reasoning-end event. Without this fix, text-only responses (no tool calls) lose the signature, causing "Invalid signature in thinking block" errors on subsequent turns in multi-turn conversations. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * style: fix formatting in test file Co-Authored-By: Robert Yeakel <robert.yeakel@openrouter.ai> * test: add e2e regression test for issue OpenRouterTeam#394 reasoning-end signature Co-Authored-By: Robert Yeakel <robert.yeakel@openrouter.ai> * chore: add patch changeset for reasoning-end signature fix Co-Authored-By: Robert Yeakel <robert.yeakel@openrouter.ai> * style: fix formatting in regression test Co-Authored-By: Robert Yeakel <robert.yeakel@openrouter.ai> * style: fix formatting in regression test Co-Authored-By: Robert Yeakel <robert.yeakel@openrouter.ai> --------- Co-authored-by: Ömer Kala <kalamustafa@gmail.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
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.
Description
Incorporates the fix from PR #394 (by @kalaomer) with formatting fixes, a patch changeset, and an
e2e/issues/regression test.Bug: When streaming a text-only response (no tool calls) with reasoning enabled, the
reasoning-endstream event was emitted withoutproviderMetadata. The Anthropic signature arrives in the last reasoning delta, butreasoning-enddidn't carry it forward. The AI SDK usesreasoning-end'sproviderMetadatato update the reasoning part, so the signature was lost — causing "Invalid signature in thinking block" on subsequent turns.This was not an issue for tool-call responses, where
accumulatedReasoningDetailswere already attached to the firsttool-callevent.Fix: Attach
accumulatedReasoningDetailstoreasoning-end'sproviderMetadatain both emission points:flush(reasoning ends when stream completes)Before:
After:
Important review notes
anthropic/claude-sonnet-4and will need a live run to confirmif (typeof content === 'string') return;guard at line 106 means the multi-turn test won't assert anything if the AI SDK returns string content instead of structured partsChecklist
pnpm stylecheckandpnpm typecheckpnpm testand all tests passChangeset
pnpm changesetto create a changeset fileLink to Devin run | Requested by @robert-j-y