Fix EditMemoryTool: remove ReplaceContentTool dependency#1096
Closed
EarthmanWeb wants to merge 2 commits intooraios:mainfrom
Closed
Fix EditMemoryTool: remove ReplaceContentTool dependency#1096EarthmanWeb wants to merge 2 commits intooraios:mainfrom
EarthmanWeb wants to merge 2 commits intooraios:mainfrom
Conversation
EditMemoryTool previously delegated to ReplaceContentTool which required a language server. Replace with a direct file read/write implementation using Python's re module, eliminating the LSP dependency for memory edits.
Contributor
|
This is already changed in #1091 (to be merged soon), where we factored out the replacement logic to a separate utility class. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
EditMemoryTool.apply()delegates toReplaceContentToolto performits text replacement. This creates an indirect dependency on the LSP
layer:
ReplaceContentToolroutes through the language server tolocate and modify files, which is unnecessary and incorrect for memory
files — memory files live in
.serena/memories/and are not part ofthe indexed project source.
In contexts where the LSP is not active or the memory path is outside
the project root, this causes
EditMemoryToolto fail entirely.Fix
Replaced the
ReplaceContentTooldelegation inmemory_tools.pywithdirect file I/O using Python's standard
remodule:_find_memory()Behaviour is identical from the caller's perspective: supports both
"literal"and"regex"modes, returns a descriptive error if theneedle/pattern is not found.
Example
Before (broken in non-LSP contexts):
After: