split_continuous_references leaves references merged when comma styles are mixed
Bug Description
split_continuous_references in src/memos/mem_os/utils/reference_utils.py splits a combined reference tag [1:aaa, 4:bbb] into [1:aaa][4:bbb] via two sequential str.replace passes: one for ", " and one for ",". The first pass that matches rewrites the content substring, so the second pass can no longer find the original content. When an LLM emits mixed separator styles in one tag, only the last boundary is split:
split_continuous_references("[1:92ff35fb,4:bfe6f044, 7:abcd1234]")
# actual: '[1:92ff35fb,4:bfe6f044][7:abcd1234]'
# expected: '[1:92ff35fb][4:bfe6f044][7:abcd1234]'The function is on the streaming chat path (api/handlers/chat_handler.py → process_streaming_references_complete), so the merged references are rendered as literal text instead of individual reference tags.
Expected Behavior
Every comma between the brackets splits a reference boundary regardless of the whitespace that follows it.
Environment
MemOS main (a7367d0), python 3.14.
Additional Context
Fix + red/green-verified unit tests in tests/mem_os/test_reference_utils.py ready; PR to follow referencing this issue.
Source: MemTensor/MemOS