From d9e1399363953551b385a388392de7ece9faed02 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Fri, 30 Oct 2026 16:15:46 +0000 Subject: [PATCH] build(redis): guard the redis-py import boundary Co-authored-by: Yujong Lee --- ruff-strict.toml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/ruff-strict.toml b/ruff-strict.toml index e9db4d95cc8..22b443beb95 100644 --- a/ruff-strict.toml +++ b/ruff-strict.toml @@ -35,6 +35,18 @@ external = [ # hook signatures inherit `Any` for `response` from CustomLogger, so narrowing them here # would break the override rather than describe it. "litellm/proxy/guardrails/guardrail_hooks/llm_shield_proxy/llm_shield_proxy.py" = ["ANN401"] +# The only modules allowed to import redis-py (TID251 bans it elsewhere). The transport and +# the caches own the connection and breaker, the rest wait for their own move. Only shrink it. +"litellm/redis/transport/redis_py.py" = ["TID251"] +"litellm/caching/redis_cache.py" = ["TID251"] +"litellm/caching/redis_cluster_cache.py" = ["TID251"] +"litellm/_redis.py" = ["TID251"] +"litellm/_redis_credential_provider.py" = ["TID251"] +"litellm/caching/redis_batch.py" = ["TID251"] +"litellm/caching/redis_cluster_node_isolation.py" = ["TID251"] +"litellm/caching/valkey_semantic_cache.py" = ["TID251"] +"litellm/llms/valkey/vector_stores/transformation.py" = ["TID251"] +"litellm/proxy/db/db_transaction_queue/redis_update_buffer.py" = ["TID251"] [lint.mccabe] max-complexity = 15 @@ -65,6 +77,7 @@ max-args = 5 "typing_extensions.TypeGuard".msg = "Same as typing.TypeGuard." "typing.TypeIs".msg = "Unverified narrowing (the body is trusted). Parse into a concrete type instead." "typing_extensions.TypeIs".msg = "Same as typing.TypeIs." +"redis".msg = "Reach Redis through litellm.redis (see .agents/skills/redis-access)." # Dispatched public entry points: import them from their dispatch module so every # supported call path selects Rust or Python in one place. Only the dispatch # modules and internal recursive calls may reach the Python implementation