You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(checkpoint-redis): resolve key generation inconsistency in shallow savers
Fix incomplete cleanup of blobs and writes in ShallowRedisSaver and AsyncShallowRedisSaver
due to inconsistent key generation between base class and shallow cleanup patterns.
The base class uses storage-safe transformations (to_storage_safe_id/to_storage_safe_str)
which convert empty checkpoint_ns to "__empty__", while shallow cleanup patterns used
raw empty strings, causing cleanup operations to miss actual keys.
Changes:
- Update _make_shallow_redis_checkpoint_blob_key_pattern to use to_storage_safe_id/to_storage_safe_str
- Update _make_shallow_redis_checkpoint_writes_key_pattern to use same transformations
- Apply fixes to both sync (shallow.py) and async (ashallow.py) implementations
- Add comprehensive tests to verify cleanup behavior and key generation consistency
Fixes prevent memory leaks where old blob versions and writes accumulated instead
of being properly cleaned up during checkpoint operations.
-`shallow.py` / `ashallow.py`: Shallow variants that store only latest checkpoint
45
50
46
51
**Stores** (`langgraph/store/redis/`):
52
+
47
53
-`base.py`: `BaseRedisStore` - Abstract base with Redis operations, vector search, and TTL support
48
54
-`__init__.py`: `RedisStore` - Sync store with key-value and vector search
49
55
-`aio.py`: `AsyncRedisStore` - Async store implementation
@@ -63,14 +69,17 @@ make clean # Remove cache and build artifacts
63
69
**Type System**: Heavy use of generics (`BaseRedisSaver[RedisClientType, IndexType]`) to maintain type safety across sync/async variants while sharing implementation code.
0 commit comments