Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

RedisSession fails on Redis Cluster: add_items/clear_session raise AttributeError ('ClusterPipeline' has no 'raise_first_error')

オープン
#5,322 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
python, redis

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

Please read this first
  • Have you read the docs? Yes
  • Have you searched for related issues? Yes. #5202 moved clear_session into 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:

  1. _write_items_attempt hooks pipeline internals that only the standalone redis.asyncio.client.Pipeline has: it wraps pipe.raise_first_error and pipe.parse_response and swaps pipe.connection_pool (src/agents/extensions/memory/redis_session.py:483 on main). redis-py's ClusterPipeline has neither raise_first_error nor parse_response, and has per-node pools.
  2. The write is a WATCH/MULTI transaction over {prefix}:{id}, {prefix}:{id}:messages and {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.

主要言語
Python
スター
30k
フォーク
4.9k
平均マージ
16時間 25分
マージ済み PR(30日)
220

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

openai/openai-agents-python のほかの issue

openai/openai-agents-python の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。