fix: Prevent PointStruct validation error when updating metadata for event='NONE' #3653
+701
−4
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.
Description
Fixes a critical bug where the memory system crashes with a PointStruct validation error when
event='NONE'and only metadata needs to be updated.Problem: When adding duplicate memory content with different session IDs (agent_id, run_id), the system attempts to update metadata by calling
vector_store.update(vector=None, payload=metadata), which fails Pydantic validation since PointStruct requiresvectorto beList[float], notNone.Solution:
update_metadata()convenience method toVectorStoreBasethat fetches the existing vector before updating_fetch_vector_values()method to base class_fetch_vector_values()across all 23 vector store implementations (Pinecone, Qdrant, Chroma, Weaviate, FAISS, PGVector, Milvus, Elasticsearch, MongoDB, Redis, OpenSearch, Supabase, Azure AI Search, Azure MySQL, Baidu, Cassandra, Databricks, Neptune Analytics, Upstash, Valkey, S3 Vectors, Langchain*, Vertex AI*)main.py(lines 565, 1577) to useupdate_metadata()instead ofupdate(vector=None)*Note: Langchain and Vertex AI raise
NotImplementedErrordue to API limitations with helpful error messages.Impact:
event='NONE'scenarioFixes #3640
Type of change
How Has This Been Tested?
Syntax Validation:
_fetch_vector_values()methodBackward Compatibility:
update()method unchanged - all existing tests should passevent='NONE'code pathManual Testing:
Test Coverage:
Existing test suite should pass (backward compatible)
New functionality can be tested with above manual test
Unit Test (existing tests remain valid)
Test Script (manual verification script provided)
Checklist:
Maintainer Checklist