Skip to content

fix(search): bound retrieval and resume projection upgrades - #7824

Merged
icecrasher321 merged 11 commits into
stagingfrom
codex/search-vector-query-plans
Sep 15, 2026
Merged

icecrasher321 merged 11 commits into
stagingfrom
codex/search-vector-query-plans

Conversation

@icecrasher321

@icecrasher321 icecrasher321 commented Sep 14, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Bound interactive vector candidates by readable documents, keep candidate IDs inline, and rerank a limited pool with original vectors. Use shortened half-precision candidates only for models trained for prefix retrieval; preserve all dimensions for other models.
  • Score keyword matches from a narrow text projection and sort scalar IDs/scores before hydrating content. Preserve lexical ranking, live source authorization, and workflow KB behavior. Keep Direct Search's 3s vector budget and Assistant's 8s budget, with stage diagnostics.
  • Make 0016 supersede 0015 and finish partially committed binary projections alongside the new vectors. Page source IDs before testing for missing rows, advance through completed pages, and log bounded progress. Fix standalone 0015 with the same pagination. Record both migrations only after 0016 succeeds so older deployment jobs cannot reinstall the old trigger.
  • Backfill before building new indexes, repair invalid interrupted builds, preserve valid indexes on retry, and serialize projection upgrades with active writers. Retain legacy projections during rollout and allow the migration job up to three hours for bulk work.

Type of Change

  • Bug fix

Testing

  • 330 search/access unit tests, 142 DB unit tests, 374 application/ACL integration tests, 21 PostgreSQL permission tests, and 13 PostgreSQL migration tests passed. Migration tests cover cancellation, replay, valid/invalid indexes, synchronous writes, storage, and the actual runner upgrading an unjournaled partial 0015 through 0016. Another 220 tests passed around the latest staging merge.
  • Application stress suite: 19 passed, one optional live-network case skipped. On 300,000 synthetic chunks with PostgreSQL limited to 2 CPUs and 1 GiB RAM, common-term Direct/Assistant searches completed in 2.9–3.0s; two concurrent Assistant searches completed in 4.6s. All measured searches completed within their leg budgets; exact-neighbor recall was 100% across seven cases. Real application routes, authorization, and PostgreSQL execute; external embedding/source HTTP responses are controlled fixtures.
  • Large interrupted-upgrade benchmark: the actual runner completed 300,000 vector/keyword rows and nine indexes from a partial binary backfill in 14m49s on the same constrained database; the next migration run was a no-op in 3ms. The full 19-test retrieval suite passed again on those rebuilt indexes with every measured search complete and 100% exact-neighbor recall.
  • Lint, app/DB type checks, all 46 repository audits, API validation, docs manifest, block registry, and migration safety checks passed. Generated migration metadata retains staging's preceding migration.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@icecrasher321
icecrasher321 requested a review from a team as a code owner September 14, 2026 22:16
@vercel

vercel Bot commented Sep 14, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
docs Ready Ready Preview Sep 15, 2026 1:13am UTC

Request Review

@icecrasher321

Copy link
Copy Markdown
Collaborator Author

@greptile

@icecrasher321

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@icecrasher321 I have started the AI code review. It will take a few minutes to complete.

@greptile-apps

greptile-apps Bot commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

The PR appears safe to merge with no outstanding findings.

Summary

This PR bounds vector and keyword retrieval, introduces half-precision candidate and keyword projections, and adds a resumable projection/index migration.

  • Propagates embedding-model identity into candidate-vector selection and uses shortened vectors only for compatible OpenAI models.
  • Filters candidate retrieval through readable document identities, reranks against original vectors, and preserves live source authorization during hydration.
  • Adds paginated, retry-safe vector and keyword projection backfills with concurrent index repair and superseded-migration journaling.
  • Extends PostgreSQL migration, authorization, retrieval, latency, recall, and interruption coverage.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  Q[Search request] --> V{Retrieval legs}
  V --> VC[Readable document identities]
  VC --> HC[Bounded halfvec candidates]
  HC --> RR[Original-vector reranking]
  V --> KC[Keyword projection scoring]
  RR --> LA[Live source authorization]
  KC --> LA
  LA --> H[Content hydration]
  H --> R[Ranked results]
Loading

Reviews (9) · Last reviewed commit: "chore(db): use a documentation block for..."

@icecrasher321
icecrasher321 force-pushed the codex/search-vector-query-plans branch from 9b9717c to 9ea663b Compare September 14, 2026 22:32
@icecrasher321

Copy link
Copy Markdown
Collaborator Author

@greptile

@icecrasher321

Copy link
Copy Markdown
Collaborator Author

@greptile

@icecrasher321

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@icecrasher321 I have started the AI code review. It will take a few minutes to complete.

@icecrasher321
icecrasher321 marked this pull request as draft September 14, 2026 23:16
@icecrasher321
icecrasher321 marked this pull request as ready for review September 14, 2026 23:20
@icecrasher321

Copy link
Copy Markdown
Collaborator Author

@greptile

@icecrasher321

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@icecrasher321 I have started the AI code review. It will take a few minutes to complete.

@icecrasher321

Copy link
Copy Markdown
Collaborator Author

@greptile

@icecrasher321

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@icecrasher321 I have started the AI code review. It will take a few minutes to complete.

@icecrasher321 icecrasher321 changed the title fix(search): bound vector retrieval under selective permissions fix(search): bound retrieval and resume projection upgrades Sep 15, 2026
@icecrasher321

Copy link
Copy Markdown
Collaborator Author

@greptile

@icecrasher321

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@icecrasher321 I have started the AI code review. It will take a few minutes to complete.

@icecrasher321

Copy link
Copy Markdown
Collaborator Author

@greptile

@icecrasher321

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@icecrasher321 I have started the AI code review. It will take a few minutes to complete.

Comment thread packages/db/migrations/0346_half_precision_search_candidates.sql Outdated
@icecrasher321

Copy link
Copy Markdown
Collaborator Author

@greptile

@icecrasher321

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@icecrasher321 I have started the AI code review. It will take a few minutes to complete.

@icecrasher321
icecrasher321 merged commit 580fc58 into staging Sep 15, 2026
25 of 26 checks passed
@icecrasher321
icecrasher321 deleted the codex/search-vector-query-plans branch September 15, 2026 01:12
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.

1 participant