Skip to content

Commit 239401b

Browse files
fix: prevent stale memory_id from overwriting active conversation_id
Remove code that allowed transcript memory_id to overwrite current_conversation_id. Fixes #6952
1 parent 739d9db commit 239401b

2 files changed

Lines changed: 5 additions & 8 deletions

File tree

backend/routers/pusher.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -447,9 +447,6 @@ async def receive_tasks():
447447
res = json.loads(bytes(data[4:]).decode("utf-8"))
448448
segments = res.get('segments')
449449
memory_id = res.get('memory_id')
450-
# Update conversation_id from transcript if provided
451-
if memory_id:
452-
current_conversation_id = memory_id
453450
if len(transcript_queue) >= TRANSCRIPT_QUEUE_WARN_SIZE:
454451
logger.warning(f"Warning: transcript_queue size {len(transcript_queue)} {uid}")
455452
# Use memory_id if available, otherwise use current_conversation_id for conversations

backend/tests/unit/test_listen_pipeline.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -633,15 +633,15 @@ def test_flaw_header_103_conversation_switch_flushes_private_cloud(self):
633633
assert len(private_cloud_queue[0]['data']) == 500
634634
assert len(private_cloud_sync_buffer) == 0
635635

636-
def test_flaw_header_102_memory_id_updates_conversation_id(self):
637-
"""FLAW TEST: memory_id in transcript should update current_conversation_id."""
636+
def test_header_102_memory_id_does_not_update_conversation_id(self):
637+
"""Inline logic test: verifies current_conversation_id is not mutated."""
638638
current_conversation_id = 'old-conv'
639639
payload = {'segments': [], 'memory_id': 'new-conv-from-memory'}
640640
res = payload
641641
memory_id = res.get('memory_id')
642-
if memory_id:
643-
current_conversation_id = memory_id
644-
assert current_conversation_id == 'new-conv-from-memory'
642+
conversation_or_memory_id = memory_id or current_conversation_id
643+
assert conversation_or_memory_id == 'new-conv-from-memory'
644+
assert current_conversation_id == 'old-conv'
645645

646646

647647
# ===================================================================

0 commit comments

Comments
 (0)