fix: stop Thinking chip from trapping answers in reasoning middleware - #1153
Open
Sdaswani wants to merge 2 commits into
Open
fix: stop Thinking chip from trapping answers in reasoning middleware#1153Sdaswani wants to merge 2 commits into
Sdaswani wants to merge 2 commits into
Conversation
- model.startWithReasoning means show/enable thinking; middleware startWithReasoning means treat content as reasoning until </think> - Ollama thinking models emit a native reasoning field and plain answer content with no closing tag, so wiring the chip flag through left the spinner stuck with the reply in the muted Thinking pane - show a Thinking label while streaming with no active tool Co-authored-by: Cursor <cursoragent@cursor.com>
Sdaswani
temporarily deployed
to
fork-preview-approval
July 29, 2026 05:00 — with
GitHub Actions
Inactive
|
Preview environment deployed 🚀
Stack: Auto-destroys on PR close/merge. Login via the bundled Keycloak realm — |
Sdaswani
temporarily deployed
to
fork-preview-approval
July 30, 2026 01:34 — with
GitHub Actions
Inactive
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
model.startWithReasoningflag fromextractReasoningMiddleware({ startWithReasoning }). The DB flag means "model can think"; the middleware option means "treat all content as reasoning until</think>".reasoningfield and plain answercontentwith no closing tag. Wiring the chip flag into the middleware classified the answer as reasoning forever, never emittedreasoning-end, and left the chat spinner stuck with the reply in the muted Thinking pane.Context
This bug already existed on
mainwheneverstartWithReasoning === 1. It became easy to hit after Ollama capability discovery auto-enables that flag for thinking models (see #1152). This PR is the standalone fix againstmain; #1152 also includes the same commit.Impact on other models
This should not regress the common paths:
startWithReasoning === 0falsereasoning/reasoning_content(Ollama, etc.)content<think>...</think>tags in contentstartWithReasoning: falsereasoningEffort: 'none'when chip offNarrow edge case: a model that streams leading reasoning as plain content with no opening
<think>, only a later</think>, previously relied on middlewarestartWithReasoning: true. Thunderbolt defaults do not ship that pattern; if a custom model depends on it, thinking extraction for that model could degrade.Test plan
qwen3:1.7b(or any thinking-capable) model, Thinking chip on: sendhi— answer appears as normal message text and the spinner settles<think>...</think>in content still extract reasoning correctly