Bug Description
When MOS_ENABLE_REORGANIZE=true and GRAPH_DB_BACKEND=postgres, the reorganizer consumer crashes while preprocessing add messages:
pydantic_core.ValidationError: 1 validation error for GraphDBNode
metadata.embedding
Input should be a valid list [type=list_type, input_value='[-0.047..., ...]', input_type=str]
PostgresGraphDB.get_node(..., include_embedding=True) assigns the pgvector column directly into metadata["embedding"]. With psycopg2, that value is often a JSON string rather than list[float], so GraphDBNode(**raw_node) fails and reorganize never runs.
How to Reproduce
- Run MemOS Product API with Postgres graph backend and
MOS_ENABLE_REORGANIZE=true.
- Add a memory via
/product/add.
- Observe reorganizer logs in
_run_message_consumer_loop / _convert_id_to_node.
Environment
- Python: 3.11
- Operating System: Linux (Docker)
- MemOS: main branch
- Graph backend: postgres + pgvector
Additional Context
- I am willing to implement this myself and have a patch ready on fork branch
fix/postgres-embedding-normalize.
Bug Description
When
MOS_ENABLE_REORGANIZE=trueandGRAPH_DB_BACKEND=postgres, the reorganizer consumer crashes while preprocessing add messages:PostgresGraphDB.get_node(..., include_embedding=True)assigns the pgvector column directly intometadata["embedding"]. With psycopg2, that value is often a JSON string rather thanlist[float], soGraphDBNode(**raw_node)fails and reorganize never runs.How to Reproduce
MOS_ENABLE_REORGANIZE=true./product/add._run_message_consumer_loop/_convert_id_to_node.Environment
Additional Context
fix/postgres-embedding-normalize.