RedisSession fails on Redis Cluster: add_items/clear_session raise AttributeError ('ClusterPipeline' has no 'raise_first_error')
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- python, redis
- Lĩnh vực
- backend, databases, distributed-systems
Hướng nghiên cứu
Start with _write_items_attempt in src/agents/extensions/memory/redis_session.py and reproduce the failure using the provided Redis Cluster setup. Investigate how add_items and clear_session handle ClusterPipeline and the keys' cluster slots; the issue outlines alternative approaches but does not choose one. Done means both operations work with RedisCluster while preserving session writes and clearing.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Please read this first
- Have you read the docs? Yes
- Have you searched for related issues? Yes. #5202 moved
clear_sessioninto the same watched transaction; I found no issue covering Redis Cluster.
Describe the bug
RedisSession fails on a Redis Cluster client (redis.asyncio.cluster.RedisCluster). add_items (since 0.20) and clear_session (latest) raise AttributeError before any write lands, so a session backed by Redis Cluster cannot store history.
Two things combine:
_write_items_attempthooks pipeline internals that only the standaloneredis.asyncio.client.Pipelinehas: it wrapspipe.raise_first_errorandpipe.parse_responseand swapspipe.connection_pool(src/agents/extensions/memory/redis_session.py:483onmain). redis-py'sClusterPipelinehas neitherraise_first_errornorparse_response, and has per-node pools.- The write is a WATCH/MULTI transaction over
{prefix}:{id},{prefix}:{id}:messagesand{prefix}:{id}:counter, which don't share a hash tag, so they land in different cluster slots (e.g. 13192 vs 7329). Redis Cluster only runs a transaction within one slot, so adding the missing hooks would not be enough on its own.
Up to 0.14.5, add_items used a plain pipeline, which redis-py's cluster client splits per key, and it worked on a cluster.
Debug information
- Agents SDK version: 0.23.1 (latest release); same code on
main. First broken release we hit: 0.20.0 (0.14.5 works) - Related library versions: redis 8.1.0
- Python version: 3.12
- Operating system: macOS 15 (also seen on Linux in Kubernetes)
- Model and model provider: not involved (no model call)
- Does the issue reproduce with the latest Agents SDK release? Yes
- Does the issue occur consistently or intermittently? Consistently
Traceback (most recent call last):
...
File "agents/extensions/memory/redis_session.py", line 483, in _write_items_attempt
raise_first_error = pipe.raise_first_error
AttributeError: 'ClusterPipeline' object has no attribute 'raise_first_error'
Repro steps
Start a local 3-node cluster:
for p in 7101 7102 7103; do redis-server --port $p --cluster-enabled yes --cluster-config-file nodes-$p.conf --daemonize yes --save ""; done
redis-cli --cluster create 127.0.0.1:7101 127.0.0.1:7102 127.0.0.1:7103 --cluster-replicas 0
import asyncio
from redis.asyncio.cluster import RedisCluster
from agents.extensions.memory.redis_session import RedisSession
async def main() -> None:
client = RedisCluster(host="127.0.0.1", port=7101)
session = RedisSession("s1", redis_client=client, key_prefix="repro")
await session.add_items([{"role": "user", "content": "hi"}]) # AttributeError
await session.clear_session() # AttributeError (latest)
asyncio.run(main())
On 0.23.1 against the cluster: add_items FAIL, clear_session FAIL, get_items OK, pop_item OK. On 0.14.5: all four OK.
Expected behavior
RedisSession works with RedisCluster, as it did through 0.14.5. Either hash-tag the session's keys into one slot and use a transaction path that ClusterPipeline supports, or fall back to a non-transactional pipeline when the client is a cluster. Our workaround meanwhile is a subclass that restores the 0.14.5 add_items.
- Ngôn ngữ chính
- Python
- Star
- 30k
- Fork
- 4.9k
- Merge trung bình
- 16 giờ 25 phút
- Pull request đã merge (30 ngày)
- 220
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
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 openai/openai-agents-python
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
openai/openai-agents-python#5348 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Support the OpenAI Decisions APIĐang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
openai/openai-agents-python#5353 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 3/5 Nửa ngày Mức phù hợp với người mới 70/100
openai/openai-agents-python#5342 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 65/100
openai/openai-agents-python#5336 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của openai/openai-agents-python
Issue tương tự
-
`burr` fails to start when the Python path has a space in itCó thể đã có người làm @enekoreto đã nhận hôm nay. Đang mởstatus/needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 5 ngày
-
gemini 出现了新的域名需要加入Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 72/100
-
Độ khó 2/5 Nửa ngày Mức phù hợp với người mới 72/100
debpalash/VoiceStudio#2903 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
dagster-io/community-integrations#367 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
aws-samples/sample-per-model-bedrock#243 ·
Maintainer thường phản hồi trong vòng 1 ngày