Memory reviewer no longer overwrites edits made while it runs - #2097
Open
hjbrandt wants to merge 1 commit into
Open
Memory reviewer no longer overwrites edits made while it runs#2097hjbrandt wants to merge 1 commit into
hjbrandt wants to merge 1 commit into
Conversation
The reviewer reads the two memory files, thinks for a few minutes, then writes back a full replacement. Any change made to a file during those minutes was erased. Now the reviewer keeps a fingerprint of what it read and skips the write if the file has changed since. Skipped writes are logged and shown by the memory health check for 24 hours.
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.
The memory reviewer reads the two memory files, thinks for a few minutes, then writes back a full replacement. If anything else changed a file during those minutes, the reviewer's write erased that change without a trace. I hit this on my own install: I merged some entries by hand, and a review that had started earlier put them all back seconds later.
This makes the reviewer check before it writes. When it reads a file, it keeps a fingerprint of the entries. Just before writing, it compares that with the file as it is now. If they differ, it skips the write and leaves the newer version alone. The next review starts from the current file.
The fingerprint comes from the reviewer's own read, never from the model's output, so the model can't get around the check.
Smaller changes that come with it:
Other code that replaces the memory files works exactly as before unless it asks for the check.
One thing I left out: when a write is skipped, that review's new facts are dropped and a later review has to find them again. Merging them into the newer file is a bigger change.