# NousResearch/hermes-agent · Strip think blocks leaking into user-facing responses

## Open now

- 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.

## TL;DR

- 6 member(s): 0 open issue(s), 1 closed issue(s), 0 open PR(s), 1 merged PR(s), 4 PR(s) closed without merging.
- A fix was merged to main in PR #174. Verify it addresses your case.
- **Recommended:** read PR #174 (and any competing PRs below) before filing. Confirm the merged change covers your symptom.

## Maintainer resolution verdict

- Internal-tracker verdict over this cluster's issue members: `resolved` · deciding PR(s): `pr-174`. This is distinct from the fix status above. Weigh it yourself.

## How this cluster was grouped

- Link evidence (`STRUCTURAL_SPANNING`): every member is connected by structural evidence: shared changed files, or a closing/superseded reference.
- Pairwise link density `0.33`: the share of member 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.

## Closed / duplicate issues

- #149: <think> blocks leak into user-facing responses

## Prior & competing PRs

- **#174: fix: strip <think> blocks from final response to users**. merged to main · fix tier `verified`
  - maintainer direction: category `merged`; implication `superseded`
  - files: `run_agent.py`
  - fix hunks:
  - `run_agent.py`

    ```diff
    @@ -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
    ```

    ```diff
    @@ -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)
    ```
- **#196: Fix: strip <think> blocks from fallback final responses**. closed without merge
  - maintainer direction: category `implemented_elsewhere`; implication `superseded`; refs `#149`
- **#205: fix(agent): strip <think> blocks from final response before displaying to user**. closed without merge
  - maintainer direction: category `silent_close`; implication `active`
- **#208: fix(agent): strip <think> blocks from final response before displaying to user**. closed without merge
  - maintainer direction: category `silent_close`; implication `active`
- **#28631: fix(stream-consumer): case-insensitive think-block filtering with defence-in-depth scrub**. closed without merge
  - maintainer direction: category `duplicate_of`; implication `duplicate`; refs `#27289`, `#27288`, `#27289`, `#27289`, `#27289`, `#27289`, `#27289`

## Fix status

- Merged to main in PR #174 (cited above). No release data is tracked. Verify downstream.
- Fix last verified (merged) `2026-03-01`. This confirmation is old and may be out of date (a revert/reopen would not have invalidated it here); re-verify.
- Subsystem: `gateway`
