Strip think blocks leaking into user-facing responses

NousResearch/hermes-agent · cluster 149 · gateway

Data as of

Nothing open on GitHub. Fix merged in #174. Check it covers your case.

The short answer

0open issues
0open PRs
6items grouped
Known?
Yes. 6 related items grouped here, 1 issue already closed.
Fix event
A fix was merged to main in PR #174. Check it covers your case. No release data is tracked.
Tracker
The maintainers' tracker marks this resolved, deciding PR #174. That is separate from the fix event.
Still open
Nothing open on GitHub.

Multiple fixes addressing a recurring issue where internal <think> blocks were leaking into user-visible output across streaming, storage, API replay, resume, and fallback response paths. The work spans several layers of the system with incremental and defensive filtering approaches.

Open issues0

No open issues.

Open PRs0

No open pull requests.

Fixes on record

Merged to main. A stamp counts the issues a fix is linked to.

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

    merged to main

    files: run_agent.py

    Show the diff
    • run_agent.py
      @@ -2567,7 +2567,8 @@ def run_conversation(
                                                   tool_names.append(fn.get("name", "unknown"))
                                               msg["content"] = f"Calling the {', '.join(tool_names)} tool{'s' if len(tool_names) > 1 else ''}..."
                                               break
      -                                final_response = fallback
      +                                # Strip <think> blocks from fallback content for user display
      +                                final_response = self._strip_think_blocks(fallback).strip()
                                       break
                                   
                                   # No fallback -- append the empty message as-is
      @@ -2596,6 +2597,9 @@ def run_conversation(
                           if hasattr(self, '_empty_content_retries'):
                               self._empty_content_retries = 0
                           
      +                    # Strip <think> blocks from user-facing response (keep raw in messages for trajectory)
      +                    final_response = self._strip_think_blocks(final_response).strip()
      +                    
                           final_msg = self._build_assistant_message(assistant_message, finish_reason)
                           
                           messages.append(final_msg)

4 PRs closed without merging

From the close comments: closed without comment 2 · done elsewhere 1 · duplicate 1

  • #196 Fix: strip <think> blocks from fallback final responses · done elsewhere → #149
  • #205 fix(agent): strip <think> blocks from final response before displaying to user · closed without comment
  • #208 fix(agent): strip <think> blocks from final response before displaying to user · closed without comment
  • #28631 fix(stream-consumer): case-insensitive think-block filtering with defence-in-depth scrub · duplicate → #27289, #27288
Closed issues · 1
  • Closed#149<think> blocks leak into user-facing responses
How this cluster was grouped
  • Link evidence (structural links throughout): every member is connected by structural evidence: shared changed files, or a closing/superseded reference.
  • Pairwise link density 0.33: the share of item pairs that carry a link, counting a structural link in full and a relevance-only link at 0.36. 1.00 means every pair is linked.

Pick up a Lab task

Check whether a fix covers the open issues here, with your own agent. Bring back evidence for maintainers.

Open the Lab

At a glance

Subsystem
gateway
Merged PRs
#174
Closed issues
1
Attempts
4 PRs closed without merging
Fix link checked
1 Mar 2026. This confirmation is old and may be out of date (a revert or reopen would not have invalidated it here); re-verify.

For your agent

The same facts, typed.