Repository navigation
Description
Description
When RedisContextProvider is given an AsyncSearchIndex connected to a custom Redis endpoint, existing-index initialization checks existence on that index's connection but loads the server schema through the provider's redis_url, which defaults to redis://localhost:6379.
The schema check should use the same connection as the index. Otherwise, a provider reconnecting to an existing index can fail against localhost or inspect an unrelated index with the same name. The URL-only path also opens a second connection for this check.
Reproduced on main 2df61296bb563a95552b18491ad29b1e1a509f81. The call in _validate_schema_compatibility() passes redis_url=self.redis_url after _ensure_index() has already called self.redis_index.exists().
Code Sample
This offline reproducer records the connection argument passed to RedisVL while stubbing Redis I/O:
import asyncio
from unittest.mock import AsyncMock, patch
from agent_framework_redis import RedisContextProvider
from redis.asyncio import Redis
from redisvl.index import AsyncSearchIndex
async def main():
client = Redis(host="borrowed.example", port=6380)
schema = RedisContextProvider(user_id="user-1").schema_dict
index = AsyncSearchIndex.from_dict(schema, redis_client=client)
provider = RedisContextProvider(user_id="user-1", redis_index=index)
with (
patch.object(index, "exists", AsyncMock(return_value=True)),
patch.object(index, "create", AsyncMock()),
patch("agent_framework_redis._context_provider.AsyncSearchIndex.from_existing", new_callable=AsyncMock) as load,
):
load.return_value.schema.to_dict.return_value = schema
await provider._ensure_index()
print(load.await_args.kwargs)
# Current: {'redis_url': 'redis://localhost:6379'}
# Expected: {'redis_client': client}
await client.aclose()
asyncio.run(main())Package Versions
Source checkout above: agent-framework-core 1.20.0, agent-framework-redis 1.0.0b261002, redis 7.1.1, redisvl 0.15.0.
Python Version
Python 3.14.3 on Windows.
Additional Context
An additional probe using the actual RedisVL index and Redis client classes, with network I/O stubbed, confirmed that FT._LIST uses the injected client while schema lookup selects a separate localhost client. No live Redis server or model service was tested.
I plan to submit a small fix that reuses self.redis_index.client for the schema lookup, with regressions for both injected and URL-created indexes and for compatible and incompatible schemas.
Metadata
Metadata
Labels
Type
Projects
- StatusShow more project fieldsNo status
Activity
github-actions commentedon Oct 5, 2026
🤖 Automated triage reproduction notes (agent-authored — trust but verify)
Agent analysis
Repro:
python/packages/redis/agent_framework_redis/_context_provider.py::RedisContextProvider._validate_schema_compatibilitylines 297-299 uses the provider’sredis_urlwhen_ensure_indexfinds an existing injected index. Trigger it by constructingAsyncSearchIndex.from_dict(..., redis_client=client), injecting it into the provider, stubbingexists()to return true, and calling_ensure_index();from_existingreceives the localhost URL rather than the injected client.python/packages/redis/tests/test_context_provider_edges.pyagent-framework-redis 1.0.0b261002agent-framework-redis 1.0.0b261002