Skip to content

fix: strip <think> blocks from final response to users#174

Merged
teknium1 merged 1 commit into
NousResearch:mainfrom
Bartok9:fix-think-block-leakage
Mar 1, 2026
Merged

fix: strip <think> blocks from final response to users#174
teknium1 merged 1 commit into
NousResearch:mainfrom
Bartok9:fix-think-block-leakage

Conversation

@Bartok9

@Bartok9 Bartok9 commented Feb 28, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #149

The _strip_think_blocks() method existed but was not being called on 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

  1. Normal completion path (line ~2600): Strip think blocks from final_response before breaking from the loop
  2. Fallback path (line ~2570): Strip think blocks from fallback content when salvaging from prior tool_calls turn

Notes

  • Raw content with think blocks is preserved in messages[] for trajectory export — this fix 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
  • Uses the existing, well-tested _strip_think_blocks() method

Testing

  • Verified syntax with ast.parse()
  • The _strip_think_blocks() method already has comprehensive unit tests in test_run_agent.py
  • Manually verified regex handles single-line, multi-line, and edge cases

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
@teknium1 teknium1 merged commit 31a5cd1 into NousResearch:main Mar 1, 2026
@andrueandersoncs

Copy link
Copy Markdown

Issue #174 Complete: Reduce Excessive Rounding and Streamline Card-Based Layout

What Changed

  • Global styles: Reduced --radius from 24px (rounded-xl) to 12px (0.75rem) for main surfaces; added explicit --radius-sm: 8px for smaller elements
  • Card components: Standardized Card and Dialog containers to use rounded-md (8px) internally with rounded-lg (12px) outer shells
  • Feature screens: Replaced all rounded-xl instances in Today, Adjustments, and Weekly Plan screens with rounded-lg (12px)
  • UI components: Updated Dialog, AlertDialog, Command, Sidebar, Empty, and VantageShell to use consistent 8–12px border-radius

Acceptance Criteria Met ✅

✅ Reduce excessive rounding from 24px (rounded-xl) to 8–12px range
✅ Main surfaces target 12px (rounded-lg or 0.75rem)
✅ Smaller elements target 8px (rounded-md or 0.5rem)
✅ Build passes with no TypeScript errors
✅ Lint clean (no regressions)

Verification

  • Build: npm run build ✅ PASS
  • Tests: Pre-existing test failures unrelated to styling changes verified against main branch
  • Visual identity: Sharper, more distinctive appearance achieved through reduced border-radius across all surfaces

Commit

Shipped in main: 59d6205 - Merge #174: Reduce excessive rounding from 24px to 8–12px


Labels normalized: Removed status:in-progress, status:ready, auto:eligible

@andrueandersoncs

Copy link
Copy Markdown

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
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

<think> blocks leak into user-facing responses

3 participants