# NousResearch/hermes-agent · Orphaned think/reasoning tags appearing in user-facing responses

## Open now

- Nothing open on GitHub.

The members concern orphaned think or reasoning tags, specifically closing </think> tags, appearing in user-facing responses. One is a bug report and two are identically titled pull requests proposing to strip such tags; the titles alone do not show whether any change was merged or works.

## TL;DR

- 3 member(s): 0 open issue(s), 1 closed issue(s), 0 open PR(s), 1 merged PR(s), 1 PR(s) closed without merging.
- A fix was merged to main in PR #4311. Verify it addresses your case.
- **Recommended:** read PR #4311 (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-4311`. 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.67`: 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

- #4285: \[Bug\]: Orphaned </think> closing tags leak into user-facing responses

## Prior & competing PRs

- **#4311: fix: strip orphaned think/reasoning tags from user-facing responses**. merged to main · fix tier `verified`
  - maintainer direction: category `merged`
  - files: `run_agent.py`, `tests/test_run_agent.py`
  - fix hunks:
  - `run_agent.py`

    ```diff
    @@ -1389,6 +1389,7 @@ def _strip_think_blocks(self, content: str) -> str:
             content = re.sub(r'<thinking>.*?</thinking>', '', content, flags=re.DOTALL | re.IGNORECASE)
             content = re.sub(r'<reasoning>.*?</reasoning>', '', content, flags=re.DOTALL)
             content = re.sub(r'<REASONING_SCRATCHPAD>.*?</REASONING_SCRATCHPAD>', '', content, flags=re.DOTALL)
    +        content = re.sub(r'</?(?:think|thinking|reasoning|REASONING_SCRATCHPAD)>\s*', '', content, flags=re.IGNORECASE)
             return content
     
         def _looks_like_codex_intermediate_ack(
    ```
  - `tests/test_run_agent.py`

    ```diff
    @@ -230,6 +230,27 @@ def test_multiline_block_removed(self, agent):
             assert "line1" not in result
             assert "visible" in result
     
    +    def test_orphaned_closing_think_tag(self, agent):
    +        result = agent._strip_think_blocks("some reasoning</think>actual answer")
    +        assert "</think>" not in result
    +        assert "actual answer" in result
    +
    +    def test_orphaned_closing_thinking_tag(self, agent):
    +        result = agent._strip_think_blocks("reasoning</thinking>answer")
    +        assert "</thinking>" not in result
    +        assert "answer" in result
    +
    +    def test_orphaned_opening_think_tag(self, agent):
    +        result = agent._strip_think_blocks("<think>orphaned reasoning without close")
    +        assert "<think>" not in result
    +
    +    def test_mixed_orphaned_and_paired_tags(self, agent):
    +        text = "stray</think><think>paired reasoning</think> visible"
    +        result = agent._strip_think_blocks(text)
    +        assert "</think>" not in result
    +        assert "<think>" not in result
    +        assert "visible" in result
    +
     
     class TestExtractReasoning:
         def test_reasoning_field(self, agent):
    ```
- **#4286: fix: strip orphaned think/reasoning tags from user-facing responses**. closed without merge
  - maintainer direction: category `merged_via`; implication `superseded`; refs `#4311`

## Fix status

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