fix(tools): memory no-match is success, not error
Some checks failed
Forge CI / smoke-and-build (pull_request) Failing after 24s
Some checks failed
Forge CI / smoke-and-build (pull_request) Failing after 24s
Fixes #313 Problem: MemoryStore.replace() and .remove() return {"success": false, "error": "No entry matched..."} when the search substring is not found. This is a valid outcome, not an error. The empirical audit showed 58.4% error rate on the memory tool, but 98.4% of those were just empty search results. Fix: Return {"success": true, "result": "no_match", "message": ...} instead. This drops the memory tool error rate from ~58% to ~1%. Tests updated: test_replace_no_match and test_remove_no_match now assert success=True with result="no_match". All 33 memory tool tests pass.
This commit is contained in:
@@ -144,7 +144,8 @@ class TestMemoryStoreReplace:
|
||||
def test_replace_no_match(self, store):
|
||||
store.add("memory", "fact A")
|
||||
result = store.replace("memory", "nonexistent", "new")
|
||||
assert result["success"] is False
|
||||
assert result["success"] is True
|
||||
assert result["result"] == "no_match"
|
||||
|
||||
def test_replace_ambiguous_match(self, store):
|
||||
store.add("memory", "server A runs nginx")
|
||||
@@ -177,7 +178,8 @@ class TestMemoryStoreRemove:
|
||||
|
||||
def test_remove_no_match(self, store):
|
||||
result = store.remove("memory", "nonexistent")
|
||||
assert result["success"] is False
|
||||
assert result["success"] is True
|
||||
assert result["result"] == "no_match"
|
||||
|
||||
def test_remove_empty_old_text(self, store):
|
||||
result = store.remove("memory", " ")
|
||||
|
||||
Reference in New Issue
Block a user