Skip to content

Python: Fix VolatileMemoryStore.get_nearest_match returning an un-awaited coroutine - #14523

Open
PRABHU KIRAN VANDRANKI (VANDRANKI) wants to merge 1 commit into
microsoft:mainfrom
VANDRANKI:fix/volatile-memory-get-nearest-match
Open

PRABHU KIRAN VANDRANKI (VANDRANKI) wants to merge 1 commit into
microsoft:mainfrom
VANDRANKI:fix/volatile-memory-get-nearest-match

Conversation

@VANDRANKI

Copy link
Copy Markdown

Motivation and Context

VolatileMemoryStore.get_nearest_match is async def but returned self.get_nearest_matches(...) without awaiting it, so callers received a coroutine instead of a (MemoryRecord, score) tuple. Fixes #14521.

Description

Await get_nearest_matches and return its first element, the same way ChromaMemoryStore.get_nearest_match does. Added tests/unit/memory/test_volatile_memory_store.py with two tests. Both fail on main (they receive a coroutine) and pass with the change.

Contribution Checklist

  • The code builds clean without any errors or warnings
  • The PR follows the SK Contribution Guidelines (ruff and mypy are clean on the changed files)
  • All unit tests pass, and I have added new tests where possible
  • I didn't break anyone

Copilot AI balanced review requested due to automatic review settings October 1, 2026 16:56
@semantic-kernel-automation semantic-kernel-automation Bot added the python Pull requests for the Python Semantic Kernel label Oct 1, 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.

Copilot review overview

🟢 Approval recommended

The focused fix matches established implementations and is covered by targeted regression tests.

Review effort: Balanced
Findings: None

What changed in this PR

Fixes VolatileMemoryStore.get_nearest_match to return the nearest record and score instead of an un-awaited coroutine.

Changes:

  • Awaits get_nearest_matches and returns its first result.
  • Adds regression tests for tuple results and relevance thresholds.
File Description
python/​semantic_kernel/​memory/​volatile_memory_store.py Corrects asynchronous result handling.
python/​tests/​unit/​memory/​test_volatile_memory_store.py Adds regression coverage for nearest-match behavior.

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

This branch was successfully deployed

1 active deployment
github-app-auth — 169a7a03 Deployed Oct 1, 2026 by VANDRANKI via team_check #571
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

2 participants