-
Notifications
You must be signed in to change notification settings - Fork 2.9k
fix: #2081 Redis SSL Connection Error with redis-py v7 #2082
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
seratch
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To make things simpler, I'd like to change the minimal requreid version of redis client to ">=7". Can you apply the change as well?
@seratch Updated! Changes included: Let me know if anything else is needed! |
seratch
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you fix the mypy errors?
Run make mypy
make mypy
shell: /usr/bin/bash -e {0}
env:
UV_FROZEN: 1
UV_CACHE_DIR: /home/runner/work/_temp/setup-uv-cache
uv run mypy . --exclude site
src/agents/extensions/memory/redis_session.py:258: error: Incompatible types in "await" (actual type "Awaitable[bool] | bool", expected type "Awaitable[Any]") [misc]
tests/extensions/memory/test_redis_session.py:495: error: Incompatible types in "await" (actual type "Awaitable[bool] | bool", expected type "Awaitable[Any]") [misc]
tests/extensions/memory/test_redis_session.py:502: error: Incompatible types in "await" (actual type "Awaitable[bool] | bool", expected type "Awaitable[Any]") [misc]
tests/extensions/memory/test_redis_session.py:784: error: Incompatible types in "await" (actual type "Awaitable[bool] | bool", expected type "Awaitable[Any]") [misc]
Found 4 errors in 2 files (checked 366 source files)
make: *** [Makefile:20: mypy] Error 1
Error: Process completed with exit code 2.
|
@seratch Fixed! I've resolved all mypy errors by adding # type: ignore[misc] comments to the Redis async ping() calls. Changes included: Root cause: Note: |
Fix Redis SSL Connection Error with redis-py
Summary
This PR fixes a
TypeErrorthat occurs when usingRedisSession.from_url()with SSL-enabled Redis URLs (rediss://) and redis-py 7.x.Problem
RedisSession.from_url()currently addsssl=Trueto kwargs when detecting arediss://URL. This causes aTypeErrorbecauseAbstractConnection.__init__()does not accept thesslparameter.Error:
Changes
ssl=Truetoredis_kwargswhenrediss://is detectedurlparse(no longer used)rediss://URL scheme automatically triggers SSL handling viaparse_url(), making the explicitssl=Trueparameter unnecessary and incompatibleRelated Issue
Fixes #2081