RedisSession fails on Redis Cluster: add_items/clear_session raise AttributeError ('ClusterPipeline' has no 'raise_first_error')
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 35/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Activo
- Stack tecnológico
- python, redis
- Área
- backend, databases, distributed-systems
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- Python
- Estrellas
- 30k
- Forks
- 4.9k
- Merge medio
- 18 h 13 min
- PR fusionados (30 d)
- 215
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de openai/openai-agents-python
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 77/100
openai/openai-agents-python#5348 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
Support the OpenAI Decisions APIAbierto
Dificultad 5/5 Más de una semana Aptitud para principiantes 25/100
openai/openai-agents-python#5353 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 3/5 Medio día Aptitud para principiantes 70/100
openai/openai-agents-python#5342 · 3 comentarios ·
Los mantenedores suelen responder en 1 día
-
enhancement
Dificultad 3/5 1-2 días Aptitud para principiantes 65/100
openai/openai-agents-python#5336 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Finished tool call is dropped when a parallel tool's guardrail tripsPosiblemente ocupada @jbeckwith-oai la tomó hace 6 días. Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
openai/openai-agents-python#5327 · 1 comentario ·
Los mantenedores suelen responder en 1 día
Todos los issues de openai/openai-agents-python
Issues similares
-
[Bug]: Streamed /v1/chat/completions sends unredacted agent error text (keys) in the final chunkPosiblemente ocupada @rodricksz4h5 la tomó hoy. Abiertoarea/streaming comp/gateway P2 type/security
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
NousResearch/hermes-agent#138245 ·
Los mantenedores suelen responder en 1 día
-
[oblt-aw][autodoc] Update user onboarding guide for mandatory trigger CODEOWNERS stepPosiblemente ocupada @github-actions la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
Los mantenedores suelen responder en 1 día
-
correction metadata
Dificultad 2/5 Menos de una hora Aptitud para principiantes 68/100
acl-org/acl-anthology#10378 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
cloudtrail_multi_region_enabled_logging_management_events fails when the advanced event selector has a custom namePosiblemente ocupada @12YYCCYY16 la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
prowler-cloud/prowler#13033 ·
Los mantenedores suelen responder en 1 día
-
enhancement
Dificultad 1/5 1-3 horas Aptitud para principiantes 88/100
graygarbage/HermesKey#23 ·