fix(discord): strip reasoning tags from partial stream preview#24659
Merged
steipete merged 2 commits intoopenclaw:mainfrom Feb 24, 2026
Merged
fix(discord): strip reasoning tags from partial stream preview#24659steipete merged 2 commits intoopenclaw:mainfrom
steipete merged 2 commits intoopenclaw:mainfrom
Conversation
When streamMode is "partial", reasoning/thinking block content can leak into the Discord draft preview because the partial text is forwarded to the draft stream without filtering. Apply `stripReasoningTagsFromText` before updating the draft and skip pure-reasoning messages (those starting with "Reasoning:\n") so internal thinking traces never reach the user-visible preview. Fixes openclaw#24532 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
93403bf to
e00d097
Compare
…ream Verify that partial stream updates containing <thinking> tags are stripped before reaching the draft preview, and that pure "Reasoning:\n" partials are suppressed entirely. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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
streamModeis"partial", reasoning/thinking block content leaks into the Discord draft preview because the partial text is forwarded to the draft stream without any filteringstripReasoningTagsFromTextbefore updating the draft and skip pure-reasoning messages (those starting with"Reasoning:\n") so internal thinking traces never reach the user-visible previewsplitTelegramReasoningTextinreasoning-lane-coordinator.ts)Test plan
streamMode: "partial"and a model with reasoning enabledFixes #24532
🤖 Generated with Claude Code
Greptile Summary
Fixes reasoning/thinking tag content leaking into Discord draft stream previews when
streamModeis"partial"(or"block"). TheupdateDraftFromPartialfunction now callsstripReasoningTagsFromTextto remove XML-style thinking tags (<think>,<thinking>, etc.) and skips messages prefixed with"Reasoning:\n"that contain only formatted reasoning content.stripReasoningTagsFromTextwith{ mode: "strict", trim: "both" }to incoming partial text before updating the draft stream"Reasoning:\n")updateDraftFromPartialcorrectly uses thecleanedvariable instead of rawtextsplitTelegramReasoningTextinreasoning-lane-coordinator.ts)Confidence Score: 4/5
updateDraftFromPartial) in one file, uses an existing shared utility (stripReasoningTagsFromText), and follows the same pattern already validated in the Telegram channel. All references to partial text within the function correctly use thecleanedvariable. The only minor concern is the lack of dedicated unit tests for this specific filtering behavior, but the existing test coverage forstripReasoningTagsFromTextand the Telegram reasoning coordinator provide indirect validation.Last reviewed commit: 93403bf