fix: disable thinking mode in QwenCodeHandler.completePrompt for prompt enhancement#12105
Draft
roomote-v0[bot] wants to merge 1 commit intomainfrom
Draft
fix: disable thinking mode in QwenCodeHandler.completePrompt for prompt enhancement#12105roomote-v0[bot] wants to merge 1 commit intomainfrom
roomote-v0[bot] wants to merge 1 commit intomainfrom
Conversation
…pt enhancement qwen3-coder models are thinking models that return reasoning in a separate reasoning_content field, which can leave message.content empty. The previous fix only stripped <think> tags but did not address the root cause. This change: - Passes enable_thinking: false to the API to disable thinking mode for simple completions (prompt enhancement does not need reasoning) - Falls back to reasoning_content if content is still empty - Strips inline <think> blocks as an additional safety net Closes #12102
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.
This PR attempts to address Issue #12102.
Problem
Prompt enhancement fails with "Failed to enhance prompt" toast when using qwen3-coder models (qwen3-coder-plus, qwen3-coder-flash). The previous fix in #12103 only stripped
<think>tags from the response content but did not address the root cause.Root Cause
qwen3-coder models are thinking/reasoning models. When
completePrompt()is called (used for prompt enhancement), the API returns reasoning content in a separatereasoning_contentfield, potentially leavingmessage.contentempty. SincecompletePromptreturnedmessage.content || "", an empty string was returned, which the enhancement handler treated as a failure.Fix
enable_thinking: falsein the API request to explicitly disable thinking mode for simple completions. Prompt enhancement does not need the model to reason -- it just needs a direct text response.reasoning_contentif content is still empty (in case the API ignores the parameter).<think>blocks as an additional safety net.Test Plan
enable_thinking: falseparameter verification,<think>tag stripping,reasoning_contentfallback, null/empty content handling, and multiline think blocks.Feedback and guidance are welcome.
Interactively review PR in Roo Code Cloud