Repository navigation
fix(a2a): forward redis url username and rediss tls to the task cache - #8290
devYRPauli wants to merge 2 commits into
Conversation
_parse_redis_url dropped the user name and the rediss scheme from REDIS_URL, so the A2A task cache authenticated as the default user over plaintext. Pass the decoded user name through connection_pool_kwargs, since aiocache rejects a top-level username, and set ssl for rediss. Fixes crewAIInc#8289 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Strix Security ReviewWarning This pull request has 45 commits after the last Strix review ( No security issues found. Review summaryThe change only propagates two additional components of the operator-supplied REDIS_URL into the aiocache configuration: an ACL user name (moved into Updated for Reviewed by Strix |
Merged external pull requests: 137 across 36 projects, unchanged. Open: 61 -> 62 (crewAIInc/crewAI#8290; Niko1221/Strata#2497 closed by the 0.2.0-beta tracker reset and reopened). Upstream issues: 22 -> 23 (crewAIInc/crewAI#8289). No table row moved. The table still covers 84 merges across 13 projects, so the remainder is 53 across 23. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Related issue
Fixes #8289
Summary
_parse_redis_urlnow forwards two parts ofREDIS_URLthat it dropped before:connection_pool_kwargs, decoded withurllib.parse.unquote. aiocache 0.12.3 rejects a top-levelusernamekey with aTypeError, so the redis connection pool must get it.rediss://URL setsssltoTrue, so aiocache usesSSLConnection.A password-only URL such as
redis://:pw@hosthas an empty user name, and it adds noconnection_pool_kwargs. Aredis://URL adds nosslkey. Both results now match redis-pyfrom_url, whichcrewai_core/lock_store.pyuses for the sameREDIS_URL.Verification
Tests added or updated for the changed behavior
Relevant tests and quality checks pass locally
New class
TestParseRedisUrlinlib/crewai/tests/a2a/utils/test_task.py, 3 tests:test_username_and_tls_reach_the_redis_poolbuilds the cache through aiocacheCacheHandler, the pathcaches.get("default")uses. It checks that the pool sends the user name and usesSSLConnection.test_decodes_percent_encoded_usernamechecks thatag%40entbecomesag@ent.test_password_only_url_sends_no_usernamechecks the full config forredis://:pw@cache.internal:6379/0.On main the first 2 tests fail. I removed each part of the fix on its own: without TLS, without
unquote, and without the empty user name check. Each removal makes its test fail.The script in the issue prints
None Falseon main andagent Truewith this change. redis-py printsagent True. Versions: redis 8.0.0, aiocache 0.12.3.pytest lib/crewai/tests/a2aon Python 3.12 with thea2aextra: 101 passed on main, 104 passed with this change.ruff check,ruff format --checkandmypyontask.pypass.Additional context
I did not connect to a real Redis server with ACL users or TLS. The tests stop at the redis-py connection pool.
PR #8206 changes the password line in the same function, and both PRs add a
TestParseRedisUrlclass. The PR that merges second needs a rebase. Open PR #5700 replaces this parser withparse_cache_url, which also forwards the user name and TLS.I used Claude Code CLI with Opus 5.5. I cannot set the
llm-generatedlabel, so please add it.Note
Low Risk
Narrows to Redis cache URL parsing for A2A cancel/task caching; no auth or data-model changes, with new unit tests for TLS and ACL URL shapes.
Overview
_parse_redis_urlin the A2A task cache setup now honors more ofREDIS_URL: non-empty usernames are passed throughconnection_pool_kwargs(percent-decoded withunquote) because aiocache cannot take a top-levelusername, andrediss://URLs setssl: Trueso the Redis client uses TLS.Password-only URLs like
redis://:pw@hoststill omit username pool kwargs, matching redis-pyfrom_urlbehavior used elsewhere for the same env var.Adds
TestParseRedisUrlwith three cases covering TLS + ACL user on the connection pool, encoded usernames, and password-only URLs.Reviewed by Cursor Bugbot for commit cb96f5f. Bugbot is set up for automated code reviews on this repo. Configure here.