fix(core): handle legacy pgvector storage status - #1196
Conversation
Signed-off-by: phernandez <paul@basicmachines.co>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2516219be4
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Signed-off-by: phernandez <paul@basicmachines.co>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f56b42e791
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Signed-off-by: phernandez <paul@basicmachines.co>
Why
Production Logfire issue #2173 shows project-info requests failing with asyncpg
UndefinedColumnErrorbecause a legacysearch_vector_embeddingstable predates thesource_hashcolumn used by current count queries.The physical table can exist before
PgVectorIndex.initialize()has run its existing schema repair. Project status currently treats table existence as schema readiness and executes the invalid join, turning a recoverable reindex state into a customer-visible HTTP 500.Closes #1195.
What Changed
source_hashas outdated and return the existing reindex recommendation contractImplementation Details
ProjectService.get_embedding_status()now distinguishes physical-table existence from schema readiness for the built-in pgvector adapter. When the legacy table is detected, it returnsvector_tables_exist=FalsewithVector storage schema is outdated — run: bm reindex --embeddings.The status path remains read-only. It does not drop, migrate, or rebuild the table;
PgVectorIndex.initialize()remains the single repair owner and will recreate the incompatible physical table when indexing runs. External adapters remain manifest-only, and SQLite behavior is unchanged.Testing
Automated
LOGFIRE_IGNORE_NO_CONFIG=1 uv run pytest -p pytest_mock --no-cov -q tests/services/test_project_service_embedding_status.py: 15 passed, 1 skippedBASIC_MEMORY_TEST_POSTGRES=1 LOGFIRE_IGNORE_NO_CONFIG=1 uv run pytest -p pytest_mock --no-cov -q tests/services/test_project_service_embedding_status.py: 14 passed, 2 skippedjust fast-check: passed after installing configured optional dependencies withuv sync --all-extrasgit diff --check: passedManual
Risks / Follow-ups