Repository navigation
Python: give memory topic files an injective filename stem - #9724
Open
Manohar Paturi (ManoharPaturi) wants to merge 1 commit into
Open
Manohar Paturi (ManoharPaturi) wants to merge 1 commit into
Manohar Paturi (ManoharPaturi) wants to merge 1 commit into
Conversation
Distinct topics can share a readable slug (C ++ and C # both slug to c), so a slug-only filename let the second topic's write silently destroy the first topic's memories. The topic stem now keeps the readable slug and appends a short digest of the normalized topic, mirroring how the store's other path components use injective derivations. Reads resolve the digest stem first, then fall back to the legacy slug-only filename and a slug-prefix scan, so stores written before this change and lookups made by slug keep working. Signed-off-by: Manohar Paturi <186662190+ManoharPaturi@users.noreply.github.com>
Manohar Paturi (ManoharPaturi)
requested review from
SergeyMenshykh,
Tao Chen (TaoChenOSU),
Eduard van Valkenburg (eavanvalkenburg),
Giles Odigwe (giles17),
Jose Alvarez (jpalvarezl),
Evan Mattson (moonbox3),
Roger Barreto (rogerbarreto),
sophia-ramsey and
westey (westey-m)
as code owners
October 26, 2026 17:48
Manohar Paturi (ManoharPaturi)
temporarily deployed
to
github-app-auth
October 26, 2026 17:48 — with
GitHub Actions
Inactive
Manohar Paturi (ManoharPaturi)
temporarily deployed
to
github-app-auth
October 26, 2026 17:48 — with
GitHub Actions
Inactive
This branch was previously deployed
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
MemoryFileStorekeyed every topic file by_slugify_topic(topic), which is many to one:C ++andC #both slug toc.write_topicoverwrites the slug path unconditionally, so writing a second topic that shares a slug silently destroyed the first topic's memories. Reproduced on main: after writing both topics,get_topic("C ++")returned the C # memory and the C ++ memory was gone. The store's own path components for owner, session, source, and scope all use the injective_storage_key_segmentderivation for exactly this reason; the topic filename was the one mapping left below that standard.Description & Review Guide
record.slug). When a slug-only lookup is ambiguous because several topics share that slug, the file whose recorded topic matches the lookup wins, else the first stem in sorted order keeps the choice deterministic._existing_topic_path, and the regression test writingC ++thenC #and reading both back, which fails on main.Related Issue
Fixes #9723
AI Assistance