Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions V0/agent_memory_server/summary_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,23 @@ async def delete_summary_view(view_id: str) -> None:
up in a later pass if needed.
"""

cursor = 0

redis = await get_redis_conn()
await redis.delete(_config_key(view_id))
await redis.srem(_SUMMARY_VIEW_INDEX_KEY, view_id)

pattern = _summary_key(view_id, "*")

while True:
cursor, keys = await redis.scan(cursor=cursor, match=pattern, count=100)

for key in keys:
await redis.delete(key)

if cursor == 0:
break

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refresh recreates deleted summaries

Medium Severity

Deleting a view only cleans summary keys present during the SCAN. An in-flight refresh_summary_view that already loaded the view can keep calling save_partition_result afterward and recreate summary_view:{view_id}:summary:* keys with no config left, reintroducing the orphaned Redis data this change aims to remove. The race window is large because partition summarization can run for minutes.

Additional Locations (2)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 06a7ba7. Configure here.



async def save_partition_result(result: SummaryViewPartitionResult) -> None:
"""Persist a single partition result for a SummaryView."""
Expand Down