Repository navigation
Python: preserve custom memory topic slugs on reload - #9153
Kunyan (Kunyanli230) wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The focused implementation correctly preserves filename identity and includes appropriate regression coverage.
Review effort: Balanced
Findings: None
What changed in this PR
Preserves custom memory topic slugs when file-backed records are reloaded.
Changes:
- Restores topic slugs from filenames during reads.
- Adds reload, update, indexing, and context-injection coverage.
| File | Description |
|---|---|
python/packages/core/agent_framework/_harness/_memory.py |
Derives reloaded record slugs from file stems. |
python/packages/core/tests/core/test_harness_memory.py |
Tests custom-slug persistence and loading. |
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
@microsoft-github-policy-service agree |
|
Kunyan (@Kunyanli230), the required Related Issue field still says only “Pending a tracking issue.” Please link the agreed issue with a closing keyword, or explain why this qualifies for the documented trivial-change or repository-automation exception. The rest of the description is substantive; this is the remaining template blocker. |
Motivation & Context
A memory topic with
topic="Preferred Tools"andslug="tools"is saved astools.md, but reloading it derivespreferred-toolsfrom the heading. The rebuilt index then points to a missing file, andMemoryContextProvider.before_run()raisesFileNotFoundErrorwhen selecting the memory.Description & Review Guide
Three of the four regression cases fail on the base revision; all four pass with the fix. The full core unit suite passed 8,385 tests (21 skipped, 2 xfailed, 46 warnings). Source Pyright, all five test type checkers, Ruff, formatting, pre-commit hooks, and the core sdist/wheel build passed. Integration tests were not run.
Related Issue
Pending a tracking issue.
Contribution Checklist