fix: tolerate unpickleable Redis cache entries#13166
fix: tolerate unpickleable Redis cache entries#131661507819106zxzx-crypto wants to merge 3 commits into
Conversation
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
WalkthroughThis PR adds robust error handling for cache serialization failures in Redis and chat services. RedisCache.set now explicitly catches serialization errors (TypeError, AttributeError, PicklingError) with descriptive messages. ChatService.set_cache stores type metadata as strings to avoid pickling type objects, and gracefully skips cache writes when serialization fails. Three new tests validate the type-metadata change, graceful failure, and early error detection. ChangesCache Serialization Error Handling
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes 🚥 Pre-merge checks | ✅ 7 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (7 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
Fixes #8476.
Redis-backed cache writes can fail when a running graph or vertex cache entry contains runtime-only objects that dill cannot serialize, such as rich console thread locals or client SSL contexts. When Redis is configured as the cache backend, that serialization failure can bubble out of graph execution and fail otherwise valid flows.
This change:
Tests
uv run ruff check src/backend/base/langflow/services/cache/service.py src/backend/base/langflow/services/chat/service.py src/backend/tests/unit/services/cache/test_chat_cache.pyuv run pytest -p no:timeout src/backend/tests/unit/services/cache/test_chat_cache.pySummary by CodeRabbit
Release Notes
Bug Fixes
Tests