Repository navigation
fix(soul): a merge deleted the title a person gave their own memory - #19
Merged
Merged
Conversation
The memory merge rewrites the whole document from its parsed entries, and the parser deliberately returns only entries — so anything above the first heading was dropped on every merge. That is the one part of MEMORY.md a person writes by hand. It mattered little while merging was an explicit cross-backend sync. It matters now: filing a correction goes through this route, so a single thumbs-down was enough to delete it. The target's preamble is kept, read back by `memory_log_preamble`. An incoming log's preamble stays on the machine it was written on, because two of them is exactly the three-way merge this format exists to avoid — and the merge still converges: the preamble is local, the entries are the union, and running it twice changes nothing. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
What
POST /api/soul/documents/memory/mergerewrites the document from its parsedentries:
and the parser says plainly what it leaves out:
So every merge deleted it. That preamble is the only part of MEMORY.md a
person writes by hand; the entries are all machine-written.
Why it matters now
It mattered little while merging was an explicit cross-backend sync the user
triggered. It matters now: Canvas files a correction through this route
(OpenHands#83, which moved it off a read-modify-write that could drop the
previous entry), so a single thumbs-down was enough to delete the title a
person had put on their own memory.
That is the opposite of what milestone 2 asks of this document — "nothing is
overwritten and nothing is lost".
How
The target's preamble is kept, read back by a new
memory_log_preamble:An incoming log's preamble stays on the machine it was written on, because two
of them is exactly the three-way merge this format exists to avoid. The
docstring's original argument is right about reconciling preambles and was
being used to justify dropping one.
Convergence is unaffected and now pinned by a test: the preamble is local, the
entries are the union, so merging twice changes nothing.
A log with no entries at all is treated as all preamble rather than as
nothing, so a file someone has started but not yet logged into is not emptied
by the first merge.
Verification
The route test fails without the fix:
The three failures are
test_cleanup_stale_tmux_sessions_*intests/agent_server/test_api.py, which fail on this machine on a cleancheckout as well — tmux socket paths, unrelated to this change.
Follow-up, not done here
Canvas now depends on this behaviour, so
compatibility.minimumAgentServershould be raised when the release carrying it lands. Bumping it against an
unreleased version would break every local stack today, so it belongs with
the release rather than with the fix. An older server still files the
correction; it just loses the preamble, which is the behaviour this fixes.
HUMAN:
Issue Number
None. Issues are disabled on this fork.
🤖 Generated with Claude Code