Skip to content

Python: await get_nearest_matches in VolatileMemoryStore.get_nearest_match - #14580

Open
lsmlhi_25 (FOWEPJF255) wants to merge 2 commits into
microsoft:mainfrom
FOWEPJF255:fix/14521-volatile-get-nearest-match
Open

lsmlhi_25 (FOWEPJF255) wants to merge 2 commits into
microsoft:mainfrom
FOWEPJF255:fix/14521-volatile-get-nearest-match

Conversation

@FOWEPJF255

Copy link
Copy Markdown

Summary

  • VolatileMemoryStore.get_nearest_match now awaits get_nearest_matches and returns the top (MemoryRecord, score) tuple.
  • Previously it returned an un-awaited coroutine (and even if awaited, a list), violating MemoryStoreBase.

Fixes #14521

Test plan

  • python/tests/unit/memory/test_volatile_memory_store.py

AI disclosure: Assisted by an AI coding agent; I own and can explain this change.

Copilot AI balanced review requested due to automatic review settings October 12, 2026 16:35
@FOWEPJF255
lsmlhi_25 (FOWEPJF255) requested a review from a team as a code owner October 12, 2026 16:35
@semantic-kernel-automation semantic-kernel-automation Bot added the python Pull requests for the Python Semantic Kernel label Oct 12, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Empty search results currently produce an unintended raw IndexError.

1 open finding
What changed in this PR

Fixes VolatileMemoryStore.get_nearest_match to return the nearest record and score rather than a coroutine.

Changes:

  • Awaits get_nearest_matches and returns its first result.
  • Adds a regression test for tuple return behavior.
File Description
python/​semantic_kernel/​memory/​volatile_memory_store.py Corrects asynchronous nearest-match retrieval.
python/​tests/​unit/​memory/​test_volatile_memory_store.py Tests the corrected return value.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread python/semantic_kernel/memory/volatile_memory_store.py
lhl-lhi (lhl-lhi) and others added 2 commits October 16, 2026 11:40
…rest_match

Return the top (record, score) tuple instead of an un-awaited coroutine (microsoft#14521).

Co-authored-by: Cursor <cursoragent@cursor.com>
…h finds nothing

Match PostgresMemoryStore empty-result behavior and cover it with a unit test.

Co-authored-by: Cursor <cursoragent@cursor.com>
@FOWEPJF255
lsmlhi_25 (FOWEPJF255) force-pushed the fix/14521-volatile-get-nearest-match branch from 9a6cd1f to dbac7a6 Compare October 16, 2026 03:42

This branch was successfully deployed

1 active deployment
github-app-auth — dbac7a68 Deployed Oct 16, 2026 by FOWEPJF255 via add_label #29361
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

python Pull requests for the Python Semantic Kernel

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Python: VolatileMemoryStore.get_nearest_match returns an un-awaited coroutine instead of a (MemoryRecord, score) tuple

3 participants