Repository navigation
Python: fix(python): Fix VolatileMemoryStore.get_nearest_matches on empty collection - #14565
Merged
Eduard van Valkenburg (eavanvalkenburg) merged 3 commits intoOct 27, 2026
Conversation
Jeevan Babu Gotru (jeevan1098)
temporarily deployed
to
github-app-auth
October 7, 2026 16:08 — with
GitHub Actions
Inactive
Jeevan Babu Gotru (jeevan1098)
temporarily deployed
to
github-app-auth
October 7, 2026 16:08 — with
GitHub Actions
Inactive
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The focused fix correctly addresses the reported failure and includes adequate regression coverage.
0 open findings
What changed in this PR
Fixes empty VolatileMemoryStore searches so they return no matches instead of raising a NumPy reshape error.
Changes:
- Adds an early return for empty collections.
- Adds coverage for empty, missing, and populated collections.
| File | Description |
|---|---|
python/semantic_kernel/memory/volatile_memory_store.py |
Handles empty collections safely. |
python/tests/unit/memory/test_volatile_memory_store.py |
Tests nearest-match behavior across collection states. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Contributor
Author
|
@microsoft-github-policy-service agree |
Eduard van Valkenburg (eavanvalkenburg)
enabled auto-merge
October 26, 2026 12:55
Eduard van Valkenburg (eavanvalkenburg)
approved these changes
Oct 26, 2026
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Oct 26, 2026
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.
Fixes #14534
Problem
VolatileMemoryStore.get_nearest_matchesraisedValueError: cannot reshape array of size 0 into shape (0,newaxis)when the collection existed but had no records. This crashedSemanticTextMemory.searchandTextMemoryPlugin.recallon freshly created or emptied collections, instead of returning no results.Fix
Return
[]early when the collection has no records, matching the existing behavior for missing collections.Tests
Added
python/tests/unit/memory/test_volatile_memory_store.pywith tests for empty collection, missing collection, and correct ranking with records. All 3 pass.