fix: tolerate unpickleable Redis cache values#13170
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 improves cache serialization robustness to address Celery/Redis deployment failures when flows contain unpickleable objects. Serialization errors are now caught at the Redis level, classified for error-specific handling in ChatService and SessionService, and gracefully degraded (cache write skipped, warning logged). The PR also bumps langchain_core from 1.3.2 to 1.4.0 across 18 starter projects. ChangesCache Serialization Resilience
Starter Projects Dependency Bump
Sequence DiagramsequenceDiagram
participant Caller
participant ChatService
participant CacheService
participant Dill
participant Logger
Caller->>ChatService: set_cache(key, data)
ChatService->>ChatService: type_name = _cache_type_name(data)
ChatService->>CacheService: upsert(key, {type: type_name, ...})
alt Pickle/Serialization TypeError
CacheService->>Dill: dumps(data)
Dill-->>CacheService: PicklingError or TypeError
CacheService-->>ChatService: TypeError
ChatService->>Logger: awarning(pickle error)
ChatService-->>Caller: False
else Success
CacheService->>Dill: dumps(data)
Dill-->>CacheService: pickled bytes
CacheService->>CacheService: store in memory/Redis
CacheService-->>ChatService: success
ChatService->>CacheService: contains(key)
ChatService-->>Caller: cache_updated boolean
else Unrelated TypeError
CacheService-->>ChatService: TypeError
ChatService-->>Caller: re-raise
end
🎯 3 (Moderate) | ⏱️ ~25 minutes 🚥 Pre-merge checks | ✅ 8 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (8 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 |
|
Maintainer note: the current Local verification on the current PR branch still passes: uv run pytest src/backend/tests/unit/services/test_cache_serialization.py
# 8 passed
git diff --check origin/main...HEAD
# no output |
|
CI triage after the latest run:
The focused cache serialization changes remain covered by the added unit tests; I can patch source issues quickly if a maintainer sees a diff-related failure. |
|
Follow-up after rebasing/merging latest Local verification on the current branch still passes: uv run pytest src/backend/tests/unit/services/test_cache_serialization.py
# 8 passed
uv run ruff check src/backend/base/langflow/services/cache/service.py src/backend/base/langflow/services/cache/utils.py src/backend/base/langflow/services/chat/service.py src/backend/base/langflow/services/session/service.py src/backend/tests/unit/services/test_cache_serialization.py
# All checks passed
git diff --check origin/main...HEAD
# no outputThe new Docker-image failure appears to be infrastructure cancellation, not a test/build assertion from this patch. The job ends with: The other remaining failures are still the fork checkout issue in |
Fixes #8476.
Summary
Validation
Summary by CodeRabbit
Chores
Bug Fixes