You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
memory: delete_relations / delete_observations count a repeated request item as "matched nothing" #5655
delete_relations with the same relation listed twice: {"relations":[{"from":"A","to":"B","relationType":"knows"},{"from":"A","to":"B","relationType":"knows"}]}
Both items in each request match the one existing record, so the result should not say any of them missed. Either count unique request items (Relations deleted successfully, Observations deleted successfully), or say it plainly, e.g. Deleted 1 relation (1 repeated item ignored).
Actual behavior
Step 3: Deleted 1 of 2 relations. The rest matched nothing.
Step 4: Deleted 1 of 2 observations.
"The rest matched nothing" is false: the second item matched the same relation as the first. An agent reading the partial-failure wording may retry, or tell the user that part of the deletion failed. The graph itself ends up correct. A repro test (Python MCP client) is in https://github.com/za69956/mcp-memory-server-qa-audit (test_F3_...).
Logs or error output
Already prototyped a fix?
No response
Before you submit
I searched existing issues and this is not a duplicate.
This is not a security vulnerability report (those go through the private advisory form).
Root cause: in src/memory/index.ts, the delete_relations and delete_observations handlers compare the number of records actually removed with the raw length of the request (relations.length, and the sum of observations.length). A repeated item matches the same stored record, so the removed count is 1 while the request count is 2, and the message reports a miss that did not happen. The graph itself is correct; only the message is wrong.
Suggested change, as a prompt for the maintainer workflow, per CONTRIBUTING:
In src/memory/index.ts, make the delete_relations and delete_observations tool handlers compare deletedCount with the number of distinct requested items instead of the raw request length. Distinct means unique (from, to, relationType) for relations and unique (entityName, observation) pairs for observations, so the same item listed twice, in one entry or across entries, counts once. Keep the response shape and wording unchanged, including the "Deleted N of M ..." partial form. Add tests in src/memory/tests/tools.test.ts: a repeated relation or observation alone returns the "deleted successfully" message, and a repeated item mixed with a nonexistent one returns "Deleted 1 of 2 ...".
I verified this locally against current main (c799c85): the four new tests fail before the change (4 failed, 41 passed in npx vitest run __tests__/tools.test.ts) and pass after it (45 passed), and tsc -p tsconfig.test.json is clean. I am not opening a PR, in line with the issues-only policy.
Thanks @Shanmukh-l33t, that matches what I saw: the graph is fine and only the message is off. Counting distinct requested items keeps the response shape unchanged, which is the right call. Your two extra cases (repeated item alone, and mixed with a nonexistent one) are worth keeping in the eventual fix.
Activity
Shanmukh-l33t commentedon Nov 24, 2026
Root cause: in src/memory/index.ts, the
delete_relationsanddelete_observationshandlers compare the number of records actually removed with the raw length of the request (relations.length, and the sum ofobservations.length). A repeated item matches the same stored record, so the removed count is 1 while the request count is 2, and the message reports a miss that did not happen. The graph itself is correct; only the message is wrong.Suggested change, as a prompt for the maintainer workflow, per CONTRIBUTING:
I verified this locally against current main (c799c85): the four new tests fail before the change (4 failed, 41 passed in
npx vitest run __tests__/tools.test.ts) and pass after it (45 passed), andtsc -p tsconfig.test.jsonis clean. I am not opening a PR, in line with the issues-only policy.za69956 commentedon Nov 24, 2026
Thanks @Shanmukh-l33t, that matches what I saw: the graph is fine and only the message is off. Counting distinct requested items keeps the response shape unchanged, which is the right call. Your two extra cases (repeated item alone, and mixed with a nonexistent one) are worth keeping in the eventual fix.
cliffhall commentedon Nov 30, 2026
Triage: Priority Low (total 5)
buglabelBoard: Servers V2 (#43), Status
Incoming, awaiting maintainer review (no milestone yet).Merge #5711 (#5655) into the #5693 branch to resolve the delete-metho…