Repository navigation
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 89668bc33a
ℹ️ 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".
| executor=request.app.state.thread_pool, | ||
| ) | ||
| else: | ||
| found = vector_store.get_filtered_ids(body.file_ids, owners=scope.owners) |
There was a problem hiding this comment.
Offload Atlas existence lookups from the event loop
When VECTOR_DB_TYPE=atlas-mongo, this branch calls AtlasMongoVector.get_filtered_ids synchronously; that method executes the blocking PyMongo collection.distinct operation (app/services/vector_store/atlas_mongo_vector.py:79-86), so Mongo/network latency here stalls the FastAPI event-loop thread and unrelated concurrent requests. Run this lookup through run_in_executor, as the other non-PG query branches do.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 1fb7404: the synchronous branch now dispatches get_filtered_ids through run_in_executor on the app thread pool, as /query does. test_sync_store_presence_check_leaves_event_loop_responsive asserts the lookup runs on a worker thread while the loop stays free; it fails with the direct call restored.
Summary
LibreChat needs to know whether a file is already embedded for an agent before embedding it again (LibreChat-AI/LibreChat#17206). No route can answer that today.
/queryand/documentsread the caller and theentity_idtogether, so a copy the user embedded under their own id answers for the agent, and with enough of those chunks ranking first the agent's own never reach the topk.POST /existstakesfile_idsand an optionalentity_idand returns the ids holding chunks owned by exactly that entity, or by the caller when none is named. It reuses the scopedget_filtered_idson both stores, runs no embedding and returns no content. A named entity replaces the caller instead of widening the set, so the route only narrows what the same request could already read through/query. The README's retrieval scope section documents it.Change Type
Testing
pytest tests/test_authorization.py: 17 passed, including new cases for an entity whose file id the caller also holds, the caller-only scope (a foreign file reads as absent), and an unauthenticated deployment.resolve_scope, the entity case fails because the caller's copy answers for the agent.get_filtered_idsitself is unchanged and covered there.Checklist