fix: strip <think> blocks from final response to users#174
Merged
Conversation
Fixes NousResearch#149 The _strip_think_blocks() method existed but was not applied to the final_response in the normal completion path. This caused <think>...</think> XML tags to leak into user-facing responses on all platforms (CLI, Telegram, Discord, Slack, WhatsApp). Changes: - Strip think blocks from final_response before returning in normal path (line ~2600) - Strip think blocks from fallback content when salvaging from prior tool_calls turn Notes: - The raw content with think blocks is preserved in messages[] for trajectory export - this only affects the user-facing final_response - The _has_content_after_think_block() check still uses raw content before stripping, which is correct for detecting think-only responses
Issue #174 Complete: Reduce Excessive Rounding and Streamline Card-Based LayoutWhat Changed
Acceptance Criteria Met ✅✅ Reduce excessive rounding from 24px ( Verification
CommitShipped in main: Labels normalized: Removed |
|
Closing as implemented and shipped in main (commit 59d6205). |
angelburgosrosado
pushed a commit
to angelburgosrosado/hermes-agent
that referenced
this pull request
Apr 27, 2026
fix: strip <think> blocks from final response to users
olympus-terminal
pushed a commit
to olympus-terminal/hermes-agent
that referenced
this pull request
May 16, 2026
fix: strip <think> blocks from final response to users
2 tasks
Egavasyug
pushed a commit
to Egavasyug/hermes-agent
that referenced
this pull request
Jun 10, 2026
fix: strip <think> blocks from final response to users
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 #149
The
_strip_think_blocks()method existed but was not being called on thefinal_responsein the normal completion path. This caused<think>...</think>XML tags to leak into user-facing responses on all platforms (CLI, Telegram, Discord, Slack, WhatsApp).Changes
final_responsebefore breaking from the looptool_callsturnNotes
messages[]for trajectory export — this fix only affects the user-facingfinal_response_has_content_after_think_block()check still uses raw content before stripping, which is correct for detecting think-only responses_strip_think_blocks()methodTesting
ast.parse()_strip_think_blocks()method already has comprehensive unit tests intest_run_agent.py