Skip to content

Python: Bug: Redis connector sends malformed FT.CREATE PREFIX (one prefix per character of collection name) #13894

Closed as not planned

Description

Describe the bug
The Python Redis connector sends FT.CREATE with the PREFIX argument split into one prefix per character of the collection name, instead of one prefix equal to "<collection_name>:".

Example observed on the wire for a collection named redis_json_list_data_model:

FT.CREATE redis_json_list_data_model ON JSON
  PREFIX 27 r e d i s _ j s o n _ l i s t _ d a t a _ m o d e l :
  SCORE 1.0 SCHEMA ...

RediSearch on Redis Stack silently accepts the malformed command and the connector appears to work for simple single-collection usage.

Root cause (client-side): python/semantic_kernel/connectors/redis.py:281 passes a plain string to redis-py's IndexDefinition(prefix=...). redis-py treats that argument as an iterable of prefixes and iterates the string character-by-character.

Expected behavior

FT.CREATE for an SK-managed collection should register exactly one key-space prefix equal to "<collection_name>:", so that the index only matches keys written for this collection.

FT.CREATE redis_json_list_data_model ON JSON
  PREFIX 1 redis_json_list_data_model:
  SCORE 1.0 SCHEMA ...

To Reproduce

Prerequisites: a Redis Stack server reachable on localhost:6379, redis-cli, and a working Python SK dev environment.

  1. Install Python SK per (python/DEV_SETUP.md):
    cd python && make install-sk PYTHON_VERSION=3.12
  2. Start Redis Stack on port 6379. Example:
    podman run -d -p 6379:6379 docker.io/redis/redis-stack:latest
  3. In a separate terminal, attach MONITOR to the server:
    redis-cli -h localhost -p 6379 MONITOR
  4. From python/, run the Redis integration tests:
    REDIS_CONNECTION_STRING="redis://localhost:6379" \
      uv run pytest tests/integration/memory/test_vector_store.py -k redis -v
  5. Inspect the MONITOR output for the FT.CREATE lines. Each one contains PREFIX <N> where N equals the length of the collection name, followed by that many single-character prefixes.

On Redis Stack the tests pass (the bug is silent).

Platform

  • Language: Python
  • Source: main branch of microsoft/semantic-kernel (SK version 1.41.2 as reported by semantic_kernel.__version__)
  • redis-py version: 6.4.0
  • Backends tested:
    • Redis Stack 7.4.7 (RediSearch v21020, ReJSON v20809) — bug is silent, FT.CREATE accepted
  • AI model: [e.g. OpenAI:GPT-4o-mini(2024-07-18)]
  • IDE: Kiro
  • OS: macOS 25.4.0 (Darwin), arm64

Additional context

Correctness on Redis: indexes register unintended single-character prefixes. In multi-collection deployments on a shared Redis, collections whose names share any character will register overlapping prefixes and can match each other's keys.

Activity

  1. changed the title [-]Bug: Redis connector sends malformed `FT.CREATE PREFIX` (one prefix per character of collection name)[/-] [+]Python: Bug: Redis connector sends malformed `FT.CREATE PREFIX` (one prefix per character of collection name)[/+] on Apr 20, 2026
  2. eavanvalkenburg commented on Apr 29, 2026

    @eavanvalkenburg
    Member

    Daria Korenieva (@daric93) Doondi Ashlesh (@Doondi-Ashlesh) Mukunda Rao Katta (@MukundaKatta) Erick Aleman (@EaCognitive) armorbreak001 not sure which of you are agents, but there are now 5 open PR's that fix this issue, please coordinate who will do this and close the others.

  3. daric93 commented on Apr 29, 2026

    @daric93
    Author

    Doondi Ashlesh (@Doondi-Ashlesh) Mukunda Rao Katta (@MukundaKatta) Erick Aleman (@EaCognitive) armorbreak001 Thanks everyone for jumping on this! All our PRs apply the same one-line fix. Since I filed the issue and opened #13895 shortly after, and I'm already coordinating the related Redis fixes (#13904, #13896), I think it'd be simplest to go with mine to keep things consolidated. Would you all be okay closing yours?

  4. added a commit that references this issue on Apr 29, 2026
    b19a5e4
  5. added a commit that references this issue on May 20, 2026
    1f79bd5
  6. github-actions commented on Sep 30, 2026

    @github-actions
    Contributor

    This issue is stale because it has been open for 90 days with no activity.

  7. added
    staleIssue is stale because it has been open for a while and has no activity
    on Sep 30, 2026
  8. github-actions commented on Oct 15, 2026

    @github-actions
    Contributor

    This issue was closed because it has been inactive for 14 days since being marked as stale.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpythonPull requests for the Python Semantic KernelstaleIssue is stale because it has been open for a while and has no activity

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions