mirror of
https://github.com/tiennm99/serena.git
synced 2026-10-14 20:17:42 +00:00
Stop a tool-context memory rename from aborting on read-only memories (#2081)
Rename propagation * `rename_memory_and_propagate_references` enumerated `get_full_list()`, which includes the memories matched by `read_only_memory_patterns`. * Writing one of those raises `PermissionError` in `_check_write_access`, so a rename of a memory that was referenced from a read-only memory failed *after* `move_memory` had already applied the rename. * The memory graph was then half-updated: the renamed memory existed under its new name while the writable referrers still held `mem:OLD_NAME`, and retrying the rename failed with "Memory not found". Fix * In a tool context, propagate only into the memories that accept writes, sorted to keep the enumeration order that `get_full_list()` provided. * Outside a tool context nothing changes, so read-only memories are still updated when the user renames through the CLI. * A reference which thereby remains in a read-only memory is still reported as stale by `validate_referential_integrity`, so it is not hidden. Documentation * `docs/02-usage/045_memories.md` promised that the tool rewrites every reference across all memories. That is now only true for the memories the agent may write, so the caveat is stated where the promise is made. Tests * Add a regression pair: the tool-context rename completes and rewrites both occurrences in a writable referrer, while the CLI context additionally rewrites the read-only one.
This commit is contained in:
4 files changed
+60
-6
No files matched your search
@@ -80,7 +80,9 @@ This convention has two practical consequences:
|
||||
|
||||
- **Renames keep references intact.** When you rename or move a memory with the `rename_memory`
|
||||
tool, Serena rewrites every `` `mem:OLD_NAME` `` occurrence across all memories to point to
|
||||
the new name. References that do not use the `mem:` prefix will not be updated automatically.
|
||||
the new name, except in memories matched by `read_only_memory_patterns`, which the agent cannot
|
||||
write; `serena memories check` reports such a reference as stale.
|
||||
References that do not use the `mem:` prefix will not be updated automatically.
|
||||
- **Integrity checks** (see [below](memory-cli)) report any `` `mem:NAME` `` whose target does
|
||||
not resolve to an existing memory, and propose similarly-named candidates as likely intended
|
||||
targets.
|
||||
|
||||
Reference in new issue
Block a user