Python: fix(core): give each file memory its own description sidecar - #8621
Open
Anish Mehta (anishmehta24) wants to merge 1 commit into
Open
Anish Mehta (anishmehta24) wants to merge 1 commit into
Anish Mehta (anishmehta24) wants to merge 1 commit into
Conversation
The description sidecar replaced the extension, so `notes.md` and `notes.json` shared `notes_description.md`: writing one without a description deleted the other's, writing one with a description showed it on both, and deleting a missing file removed the sidecar anyway. Keep the extension in the sidecar name (`notes.md_description.md`), keep reading legacy `notes_description.md` sidecars so existing descriptions survive, only remove the legacy sidecar once no file maps to it, and only touch sidecars when the file itself was deleted. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Anish Mehta (anishmehta24)
deployed
to
github-app-auth
September 21, 2026 21:41 — with
GitHub Actions
Active
Anish Mehta (anishmehta24)
deployed
to
github-app-auth
September 21, 2026 21:41 — with
GitHub Actions
Active
Anish Mehta (anishmehta24)
deployed
to
github-app-auth
September 21, 2026 21:41 — with
GitHub Actions
Active
Anish Mehta (anishmehta24)
deployed
to
github-app-auth
September 21, 2026 21:42 — with
GitHub Actions
Active
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.
Motivation & Context
FileMemoryProvidernamed the description sidecar by replacing the file's extension, sonotes.mdandnotes.jsonboth mapped tonotes_description.md. Writing one of them without a description deleted the other's description, writing one with a description madefile_memory_lsandmemories.mdshow it for both, andfile_memory_deleteon a file that did not exist still removed the sidecar. Repro and output are in the linked issue.Description & Review Guide
_description_file_namenow appends the suffix to the whole name (notes.md→notes.md_description.md), so files that differ only by extension no longer share a sidecar._is_internal_fileis unchanged; the new names still end in_description.mdand stay hidden._legacy_description_file_namekeeps the old extension-replacing name._read_description(used byfile_memory_lsand_rebuild_index) prefers the current sidecar and falls back to the legacy one, so descriptions written by earlier versions keep showing up._delete_descriptionremoves the current sidecar and removes the legacy one only when no other remaining memory file still maps to it (_legacy_sidecar_is_shared), since under the old scheme that sidecar may belong to a sibling.file_memory_deleteonly touches sidecars and rebuilds the index when the file was actually deleted; a "not found" delete is now side-effect free.FileMemoryProvider(GetDescriptionFileName) uses the same extension-replacing scheme and has the same collision; this PR only changes Python. Happy to do the .NET side as a follow-up if you want the layouts to match.Tests:
test_description_file_name_keeps_extension,test_legacy_description_file_name_replaces_extension,test_legacy_sidecar_is_shared_only_with_other_visible_files,test_files_differing_only_by_extension_keep_separate_descriptions(the three symptoms from the issue),test_legacy_description_sidecar_is_still_read_and_cleaned_up; existing sidecar tests updated to the new name.test_harness_file_memory.py: 39 passed.poe fmt,poe lint,poe typing -P coreclean.Related Issue
Fixes #8620
Contribution Checklist
breaking changelabel (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and title prefix in sync automatically.🤖 Generated with Claude Code