Skip to content

Conversation

@abrookins
Copy link
Collaborator

@abrookins abrookins commented Oct 10, 2025

Problem

The codebase had a deprecated ensure_search_index_exists() function that was still being called in multiple places, even though its own docstring said 'The VectorStore adapter now handles index creation automatically.'

This function was causing issues:

  1. It was being called explicitly at startup even though it wasn't needed
  2. It had complex error handling for race conditions that shouldn't exist
  3. It created technical debt and confusion

Solution

Removed the deprecated function entirely and all calls to it:

  • API server (main.py): Removed index creation call, just initialize Redis connection
  • MCP server (mcp.py): Removed index creation calls from both SSE and STDIO modes
  • CLI commands (cli.py): Removed from schedule-task and task-worker commands, updated rebuild-index to use vectorstore adapter directly
  • Long-term memory (long_term_memory.py): Removed index existence check
  • Tests: Updated all affected tests

The index is now created automatically by LangChain Redis when documents are first added (via the create_index_if_not_exists parameter which defaults to True).

Testing

  • All 410 tests pass
  • Both API and MCP servers start successfully in docker-compose
  • No more manual index management needed

Copilot AI review requested due to automatic review settings October 10, 2025 22:46
The VectorStore adapter creates the index automatically when needed,
making this function unnecessary. Removed all calls to it from:
- API server startup (main.py)
- MCP server startup (mcp.py)
- CLI commands (cli.py)
- Long-term memory compaction (long_term_memory.py)

Updated rebuild_index CLI command to use the vectorstore adapter directly.
Updated tests to match new behavior.
@abrookins abrookins changed the title Fix: Handle index already exists error gracefully Remove deprecated ensure_search_index_exists function Oct 14, 2025
@abrookins abrookins merged commit 9be6751 into main Oct 15, 2025
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants