improvement(search): reduce retrieval overhead - #7653
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Greptile SummaryThis PR reduces knowledge-search overhead while preserving retrieval semantics and access controls.
Confidence Score: 5/5The PR appears safe to merge with no outstanding correctness, security, migration, or repository-rule issues. The current changes preserve embedding validation, access-control filtering, ranking behavior, and canonical migration order. The only previous finding was manually resolved after Greptile conceded that the flagged
|
| Filename | Overview |
|---|---|
| apps/sim/lib/embeddings/providers/openai.ts | Switches native OpenAI embeddings to validated base64 Float32 transport while preserving numeric vectors for callers. |
| apps/sim/lib/knowledge/search/queries.ts | Bounds vector sorting through a ranked subquery while retaining filtering, permissions, and final ordering. |
| apps/sim/lib/core/rate-limiter/storage/db-token-bucket.ts | Batches deterministic token-bucket initialization and safely handles empty reservations. |
| apps/sim/lib/knowledge/application/contexts.ts | Uses a lightweight active knowledge-base reference for child-resource context resolution. |
| apps/sim/lib/knowledge/service.ts | Adds lightweight canonical knowledge-reference loading without aggregate count queries. |
| packages/db/migrations/0335_embedding_width_nullable.sql | Removes the legacy 1536-vector NOT NULL restriction while retaining the validated supported-width constraint. |
| packages/testing/src/mocks/database.mock.ts | Extends the database mock to support the added ranked-subquery behavior without introducing the previously alleged typing regression. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart LR
Q[Search request] --> C[Resolve active knowledge reference]
C --> A[Resolve access scope]
A --> E[Request OpenAI base64 embedding]
E --> D[Validate and decode Float32 vector]
D --> R[Rank eligible embeddings in bounded subquery]
R --> F[Apply source, tag, and ACL filters]
F --> O[Return globally ordered top-K results]
Reviews (6): Last reviewed commit: "chore(search): sync staging and regenera..." | Re-trigger Greptile
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
|
@greptileai review this PR |
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
|
The PR scope is now performance-only. Please evaluate the final diff against the staging base, rather than the intermediate ranking implementation that was removed. Both The final change retains embedding transport, narrower vector selection, lightweight canonical references, batched bucket initialization and the independent vector-column constraint repair. New tests assert that ordinary organization and workspace searches do not rerank and that existing explicit opt-in behavior remains available. Please reassess the net diff with that scope. |
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
Summary
Type of Change
Testing
Checklist