This repository was archived by the owner on Feb 25, 2026. It is now read-only.
fix: convert thinking blocks sent as text to reasoning parts#257
Closed
Ashwinhegde19 wants to merge 1 commit intoKilo-Org:devfrom
Closed
fix: convert thinking blocks sent as text to reasoning parts#257Ashwinhegde19 wants to merge 1 commit intoKilo-Org:devfrom
Ashwinhegde19 wants to merge 1 commit intoKilo-Org:devfrom
Conversation
OpenRouter/Kilo Gateway sometimes sends thinking content as text-delta events instead of reasoning-* events. This detects text starting with 'Thinking:' and converts it to reasoning parts so they get properly hidden after response completion. Fixes #236
| start: currentText.time?.start ?? Date.now(), | ||
| end: Date.now(), | ||
| }, | ||
| metadata: currentText.metadata, |
Contributor
There was a problem hiding this comment.
WARNING: Provider metadata may be dropped when converting text → reasoning
In the thinking-conversion branch, value.providerMetadata (available on the text-end event) is not applied to the new reasoning part, so any final provider metadata can be lost.
Suggested change
| metadata: currentText.metadata, | |
| metadata: value.providerMetadata ?? currentText.metadata, |
Contributor
Code Review SummaryStatus: 1 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
Fix these issues in Kilo Cloud Files Reviewed (1 files)
|
Author
|
Duplicate of #258 |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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
OpenRouter/Kilo Gateway sometimes sends thinking content as
text-deltaevents instead ofreasoning-*events. When this happens, thinking blocks remain visible after response completion because they're stored astextparts instead ofreasoningparts.This fix detects text starting with
Thinking:or_Thinking:_(markdown italic) and converts it to areasoningpart so it gets properly hidden by the UI'shideReasoningfilter.Changes
THINKING_PATTERNregex to detect thinking blocks sent as texttext-endhandler, if text matches the pattern, convert toreasoningpart instead oftextpartTest plan
maxvariant (enables thinking)Fixes Kilo-Org/kilocode#6320