fix(schema): add missing CompletionTokensDetails.ReasoningTokens handling in ConcatMessages#886
Merged
shentongmartin merged 1 commit intocloudwego:mainfrom Mar 15, 2026
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #886 +/- ##
==========================================
- Coverage 81.80% 81.77% -0.04%
==========================================
Files 146 146
Lines 16033 16035 +2
==========================================
- Hits 13116 13112 -4
- Misses 1969 1975 +6
Partials 948 948 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…ling in ConcatMessages ConcatMessages merges TokenUsage fields (PromptTokens, CompletionTokens, TotalTokens, PromptTokenDetails.CachedTokens) but omits CompletionTokensDetails.ReasoningTokens, causing reasoning token counts to be lost when concatenating streamed messages. Made-with: Cursor
8e58ba5 to
fe62457
Compare
shentongmartin
approved these changes
Mar 15, 2026
shentongmartin
pushed a commit
that referenced
this pull request
Mar 17, 2026
…ling in ConcatMessages (#886) ConcatMessages merges TokenUsage fields (PromptTokens, CompletionTokens, TotalTokens, PromptTokenDetails.CachedTokens) but omits CompletionTokensDetails.ReasoningTokens, causing reasoning token counts to be lost when concatenating streamed messages. Made-with: Cursor
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
ConcatMessagesmergesTokenUsagefields (PromptTokens,CompletionTokens,TotalTokens,PromptTokenDetails.CachedTokens) when concatenating streamed messages, but omitsCompletionTokensDetails.ReasoningTokens, causing reasoning token counts to be lost after stream concatenation.CompletionTokensDetails.ReasoningTokenshandling, using the same "keep the larger value" strategy as the other token fields.response_metato coverReasoningTokens.Test plan
TestConcatMessage/response_metato includeCompletionTokensDetails.ReasoningTokensin both input messages and expected outputgo test ./schema/ -run TestConcatMessage -v)Made with Cursor