Python: RedisCollection.ensure_collection_deleted can return successfully without deleting the index
Maintainer thường phản hồi trong vòng 4 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 65/100
Hướng nghiên cứu
The issue is in python/semantic_kernel/connectors/redis.py. Look at the ensure_collection_deleted method and its dependency on collection_exists. First, run the existing tests for the Redis connector to understand the current behavior. Then, examine the redis-py library documentation or source to find the exact exception type raised by FT.DROPINDEX when an index does not exist. The fix should mirror the pattern in chroma.py: attempt dropindex directly and handle the specific 'index not found' exception quietly, raising a VectorStoreOperationException for other errors. Write a test that simulates a timeout during FT.INFO to verify the fix.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Describe the bug
RedisCollection.ensure_collection_deleted can return successfully without deleting anything.
# python/semantic_kernel/connectors/redis.py
async def collection_exists(self, **kwargs) -> bool:
try:
await self.redis_database.ft(self.collection_name).info()
return True
except Exception:
return False
async def ensure_collection_deleted(self, **kwargs) -> None:
exists = await self.collection_exists()
if exists:
await self.redis_database.ft(self.collection_name).dropindex(**kwargs)
else:
logger.debug("Collection does not exist, skipping deletion.")
collection_exists() reaches Redis to answer, so it can fail for reasons unrelated to whether the index is there - a timeout, an authentication failure, an unreachable node. Every one of those returns False, and ensure_collection_deleted then logs at debug level and returns normally.
The caller is told the collection is deleted. It is not. Nothing raises and nothing is logged above debug.
The same library already does this correctly
ChromaCollection.ensure_collection_deleted in python/semantic_kernel/connectors/chroma.py distinguishes the two cases:
try:
self.client.delete_collection(name=self.collection_name)
except ValueError:
logger.info(f"Collection {self.collection_name} could not be deleted because it doesn't exist.")
except Exception as e:
raise VectorStoreOperationException(
f"Failed to delete collection {self.collection_name} with error: {e}"
) from e
Absent is handled quietly. Anything else raises. That is the behaviour I would expect from ensure_collection_deleted on any connector, and the Redis one is the odd one out.
ChromaCollection.collection_exists has the same except Exception: return False shape, but its delete path does not depend on it, so the consequence there is smaller.
To reproduce
Call ensure_collection_deleted() on a RedisCollection while Redis is reachable at connect time but the FT.INFO call fails - a timeout is the easiest to induce. The method returns without raising and the index is still present.
Expected behavior
A failed check is not an absent collection. ensure_collection_deleted should either delete the index or raise.
Suggested fix
Mirror the Chroma connector: attempt dropindex and handle only the specific "index does not exist" error quietly, raising VectorStoreOperationException for anything else.
I am filing this rather than opening a pull request because the right fix depends on exactly which exception FT.DROPINDEX raises for a missing index in the redis-py version this pins, and I did not want to assert that without a Redis instance to confirm it against. If a maintainer can confirm the exception type, I am happy to open the PR.
Platform
Python, main as of 23 September 2026.
- Ngôn ngữ chính
- C#
- Star
- 28.6k
- Fork
- 4.8k
- Merge trung bình
- 1 ngày 3 giờ
- Pull request đã merge (30 ngày)
- 16
Chuẩn bị môi trường
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của microsoft/semantic-kernel
-
python triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
microsoft/semantic-kernel#14512 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 4 ngày
-
.NET python triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
microsoft/semantic-kernel#14511 ·
Maintainer thường phản hồi trong vòng 4 ngày
-
python triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
microsoft/semantic-kernel#14491 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 4 ngày
-
python triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
microsoft/semantic-kernel#14490 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 4 ngày
-
Python: [Python] structured_outputs_transform reuses ChatHistory across calls (prompt pollution)Đang mởpython triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
microsoft/semantic-kernel#14483 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 4 ngày
Tất cả issue của microsoft/semantic-kernel
Issue tương tự
-
Money ExploitsĐang mởS: Untriaged
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
project-wayfarer/wayfarer-14#1628 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
:watch: Not Triaged dotnet-target-version
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
Maintainer thường phản hồi trong vòng 1 ngày
-
copilot documentation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 2 ngày
-
untriaged
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
dotnet/dotnet-api-docs#13124 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
agentic-workflows
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
Maintainer thường phản hồi trong vòng 1 ngày