hermes - ✅(Solved) Fix Classic CLI strip mode still strips intraword triple-underscore tokens [1 pull requests, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
NousResearch/hermes-agent#13616Fetched 2026-04-22 08:05:22
View on GitHub
Comments
0
Participants
1
Timeline
3
Reactions
0
Participants
Timeline (top)
labeled ×2cross-referenced ×1

Fix Action

Fixed

PR fix notes

PR #13614: test(cli): keep residual strip-mode regression coverage

Description (problem / solution / changelog)

Problem

origin/main already contains the functional strip-mode underscore fix, but this bug family still benefits from two explicit regression cases that are not covered there yet.

Current scope

This PR is now intentionally reduced to residual additive coverage only.

What changed

  • merged current main into the PR branch to resolve drift/conflicts
  • kept only two additive regressions in tests/cli/test_cli_markdown_rendering.py:
    • inline-code opaque ID example with intraword underscores
    • plain-text intraword double-underscore token (foo__bar__baz)
  • dropped obsolete production-code churn and redundant tests that are now covered upstream or no longer needed here

Why keep the same PR

  • same bug family and same review thread
  • the branch now shows the minimal remaining delta cleanly
  • opening a second PR would duplicate context without adding clarity

Test plan

scripts/run_tests.sh tests/cli/test_cli_markdown_rendering.py -q

Observed locally after the conflict resolution and scope trim: 13 passed

Changed files

  • tests/cli/test_cli_markdown_rendering.py (modified, +20/-0)
RAW_BUFFERClick to expand / collapse

Bug description

Classic CLI strip mode still removes intraword triple-underscore sequences.

Example:

  • input: pre___triple___post
  • current strip-mode output: pretriplepost
  • expected output: pre___triple___post

The current fix in PR #13614 intentionally narrows _..._ and __...__ stripping to non-word boundaries so opaque underscore-delimited tokens are preserved. But the ___...___ branch is still unguarded, so the triple-underscore case remains inconsistent.

Why this is a follow-up instead of part of #13614

PR #13614 is intentionally narrow: it fixes the reported single- and double-underscore token corruption bug without broadening strip-mode semantics further than needed.

This issue tracks the remaining edge case separately so maintainers can review the current PR on its actual scope while still seeing the next correctness gap clearly.

Steps to reproduce

  1. Render classic CLI output in strip mode with text containing pre___triple___post
  2. Observe that the triple underscores are removed inside the word

Expected behavior

Intraword triple-underscore sequences should not be treated as markdown emphasis delimiters.

Actual behavior

___triple___ is stripped even when surrounded by word characters.

Likely implementation area

cli.py inside _strip_markdown_syntax():

  • current ___([^_]+)___ handling is still unbounded
  • it likely needs the same non-word-boundary treatment as the new _..._ / __...__ logic, or another consistent rule

Related context

  • current narrow fix: PR #13614
  • this issue is meant as the explicit follow-up scope note for that PR

extent analysis

TL;DR

Update the _strip_markdown_syntax() function in cli.py to handle triple-underscore sequences with non-word boundary treatment.

Guidance

  • Review the current implementation of _strip_markdown_syntax() in cli.py and identify the branch handling ___...___ sequences.
  • Apply the same non-word boundary treatment used for _..._ and __...__ sequences to the ___...___ branch.
  • Test the updated function with the provided example input pre___triple___post to verify that intraword triple-underscore sequences are preserved.
  • Consider adding additional test cases to ensure the updated function handles various edge cases correctly.

Example

# Example of updated _strip_markdown_syntax() function
def _strip_markdown_syntax(text):
    # ... existing code ...
    # Update the ___...___ branch to use non-word boundary treatment
    text = re.sub(r'(?:^|[^_])___([^_]+)___(?:$|[^_])', r'\1', text)
    # ... existing code ...
    return text

Notes

The provided example code snippet is a minimal illustration of the potential update and may require additional modifications to fit the existing implementation.

Recommendation

Apply the workaround by updating the _strip_markdown_syntax() function to handle triple-underscore sequences with non-word boundary treatment, as this will ensure consistent behavior with single and double underscore sequences.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

Intraword triple-underscore sequences should not be treated as markdown emphasis delimiters.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING