HIGH SEVERITYCONFIRMED

fuzzy_find_and_replace with replace_all=True corrupts unrelated code

Package
hermes-agent
Version
latest
Verified
2026-03-28

Description

hermes-agent's `fuzzy_find_and_replace` with `replace_all=True` and the `_strategy_context_aware` method produces false positives, replacing code in unrelated functions. In testing, 2 replacements were made when only 1 was expected, overwriting a different function's body.

Reproduction

# fuzzy_find_and_replace('foo()', 'bar()', replace_all=True)
# Result: 2 replacements made instead of 1
# Unrelated function bar() overwritten with foo() body
← All bugsScan your code →