fix: exclude thinking/reasoning chunks from chat title generation#12366
Open
brone1323 wants to merge 1 commit into
Open
fix: exclude thinking/reasoning chunks from chat title generation#12366brone1323 wants to merge 1 commit into
brone1323 wants to merge 1 commit into
Conversation
The BaseLLM.chat() method accumulated output from all streamed chunks including role:"thinking" messages. This caused ChatDescriber to send thinking/reasoning text to the title-generation model, producing titles like "Here is Thinking Process" instead of titles based on the actual assistant response. Fix: skip role:"thinking" chunks when building the completion string inside chat(), so callers that use this non-streaming helper (such as ChatDescriber) only see the visible assistant response. Also adds a test case covering this scenario. Fixes continuedev#12338
Contributor
|
I have read the CLA Document and I hereby sign the CLA You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot. |
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 #12338 — chat titles were generated from thinking/reasoning content instead of the actual assistant response when using models with extended thinking (Qwen3, DeepSeek-R1, Anthropic extended thinking, etc.).
Root cause:
BaseLLM.chat()incore/llm/index.tsstreams all chunks and accumulates them withrenderChatMessage(). This includesrole: "thinking"chunks, so the returned completion string contained both the internal reasoning text and the actual response.ChatDescriber.describe()then passed this combined string to the title model, which would produce titles like "Here is Thinking Process" from the reasoning preamble.Fix: Skip
role: "thinking"chunks inchat()so callers receive only the visible assistant response. This is a one-liner change.Test: Added a test case in
chatDescriber.test.tsthat verifies thinking chunks are excluded whenChatDescriber.describe()callsmodel.chat().Changes
core/llm/index.ts— skiprole: "thinking"messages inBaseLLM.chat()core/util/chatDescriber.test.ts— new test for thinking-chunk exclusionTest plan
core/util/chatDescriber.test.ts— new test should passSummary by cubic
Stop including internal “thinking/reasoning” chunks in chat title generation. Titles now come from the visible assistant reply, fixing cases with models that emit reasoning (e.g., Qwen3, DeepSeek-R1, Anthropic extended thinking).
role: "thinking"messages inBaseLLM.chat()when building the completion string.core/util/chatDescriber.test.tsto ensureChatDescriber.describe()ignores thinking content.Written for commit 618b592. Summary will update on new commits.