fix(matrix): strip only explicit @mentions in _strip_mention
This commit is contained in:
@@ -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 == ""
|
||||
|
||||
Reference in New Issue
Block a user