fix(prompt): forward Anthropic thinking signature through streaming#2010
Open
zxuhan wants to merge 1 commit into
Open
fix(prompt): forward Anthropic thinking signature through streaming#2010zxuhan wants to merge 1 commit into
zxuhan wants to merge 1 commit into
Conversation
The Anthropic streaming path discarded the thinking-block signature in two places: the CONTENT_BLOCK_START handler dropped AnthropicContent .Thinking.signature, and the CONTENT_BLOCK_DELTA handler did not decode signature_delta events at all. The pending reasoning state in StreamFrameFlowBuilder also had nowhere to store the signature, so ReasoningComplete.encrypted was always null and downstream Message.Reasoning lost the field. Reconstruction of Message.Reasoning from streamed frames then failed on the next request with "Encrypted signature is required for reasoning messages but was null", breaking multi-turn streaming with extended thinking. Buffer the signature on PendingReasoning and emit it on ReasoningComplete; decode signature_delta in AnthropicStreamDelta and plumb it through executeStreaming. Fixes JetBrains#1959
zxuhan
added a commit
to zxuhan/projects
that referenced
this pull request
May 22, 2026
…order - Add vercel/ai (5 PRs) and spring-projects/spring-ai (3 PRs) in slots 5-6 so they're visible without scrolling. - Add huggingface/diffusers (2 PRs) and JetBrains/koog#2010. - Re-verify status against GitHub API: include closed-but-landed PRs (pytorch/pytorch #181393 commit 98a0359064, #181531 commit 9d330f6684, spring-ai #6039 commit 65838d6cd) — these ship via mergebot/cherry-pick which closes the PR without using GitHub's native merge button. - Drop genuinely abandoned PRs (vllm/vllm). - Reorder tail: minikube, diffusers, ClickHouse, tensorflow, axolotl. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.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.
Summary
Fixes #1959: Anthropic's extended thinking signature was lost during streaming, so the next request in a multi-turn conversation failed with:
The signature was being dropped in three places:
AnthropicLLMClient.executeStreamingignoredAnthropicContent.Thinking.signatureonCONTENT_BLOCK_START.CONTENT_BLOCK_DELTAhad no branch forsignature_deltaevents.StreamFrameFlowBuilder.PendingReasoningcarried noencryptedfield, soReasoningComplete.encryptedwas alwaysnull.Changes
signaturetoAnthropicStreamDeltaandSIGNATURE_DELTAtoAnthropicStreamDeltaContentType.content_block_startandsignature_deltaevents inexecuteStreaming.encryptedtoPendingReasoningand propagate it throughtryEmitPendingReasoningtoReasoningComplete.Test plan
./gradlew :prompt:prompt-model:jvmTest(addstestEmitReasoningDeltaWithEncryptedandtestEmitReasoningDeltaEncryptedSurvivesTransitionfor the new plumbing)../gradlew :prompt:prompt-executor:prompt-executor-clients:prompt-executor-anthropic-client:jvmTest./gradlew :prompt:prompt-executor:prompt-executor-clients:prompt-executor-google-client:jvmTest :prompt:prompt-executor:prompt-executor-clients:prompt-executor-openrouter-client:jvmTest :prompt:prompt-executor:prompt-executor-clients:prompt-executor-ollama-client:jvmTest(sister clients that callemitReasoningDeltastill pass with the new optionalencryptedparameter).compileKotlinJsforprompt-modeland the Anthropic client to confirm common-source compatibility.Fixes #1959