fix(matrix): strip only explicit @mentions in _strip_mention

This commit is contained in:
Angel Claw
2026-04-16 09:47:21 -06:00
committed by Teknium
parent 6769a0aece
commit 32b78578e0
2 changed files with 33 additions and 4 deletions

View File

@@ -159,7 +159,7 @@ class TestStripMention:
assert result == "help me"
def test_localpart_preserved(self):
"""Localpart-only text is no longer stripped — avoids false positives in paths."""
"""Bare localpart (no @) is preserved — avoids false positives in paths."""
result = self.adapter._strip_mention("hermes help me")
assert result == "hermes help me"
@@ -168,6 +168,15 @@ class TestStripMention:
result = self.adapter._strip_mention("read /home/hermes/config.yaml")
assert result == "read /home/hermes/config.yaml"
def test_strip_localpart_when_explicit_at_mention(self):
result = self.adapter._strip_mention("@hermes help me")
assert result == "help me"
def test_does_not_strip_bare_localpart_word(self):
# Regression: plain words like "Hermes Agent" should not be mutated.
result = self.adapter._strip_mention("Hermes Agent")
assert result == "Hermes Agent"
def test_strip_returns_empty_for_mention_only(self):
result = self.adapter._strip_mention("@hermes:example.org")
assert result == ""