Repository navigation
fix(qdrant): recover vectors when payload id is missing - #3362
Conversation
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6a964c215b
ℹ️ 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".
Normalize Qdrant point IDs before using them for the missing-payload-id fallback in get_vectors_by_ids(). This covers Qdrant clients returning UUID point IDs in canonical hyphenated form while LightRAG's computed IDs use the simple hex representation. Co-authored-by: chatgpt-codex-connector[bot] <199175422+chatgpt-codex-connector[bot]@users.noreply.github.com>
Normalize Qdrant point IDs in get_by_ids() fallback mapping as well, so canonical hyphenated UUIDs returned by Qdrant match LightRAG's simple hex computed IDs consistently across both sibling lookup paths. Co-authored-by: chatgpt-codex-connector[bot] <199175422+chatgpt-codex-connector[bot]@users.noreply.github.com>
|
@danielaskdd 已根据 Codex review 的建议修改完毕:
相关修改已推送到当前 PR 分支。 |
|
@codex review |
|
Codex Review: Didn't find any major issues. Delightful! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |


Description
This fixes a Qdrant-only read-path gap in
QdrantVectorDBStorage.get_vectors_by_ids()where a vector could be retrieved from Qdrant but still omitted from LightRAG's returned mapping when the point payload did not contain LightRAG's logicalidfield.What Problem This Solves
LightRAG normally writes Qdrant points with two related identifiers:
get_vectors_by_ids()retrieves persisted vectors by computing the Qdrant point ID for each requested LightRAG ID. Before this change, a retrieved point was only added to the result map when its payload contained LightRAG's logicalidfield.That left a narrow compatibility gap for legacy-style or externally migrated Qdrant points: the point could still be found by its computed Qdrant point ID and still contain vector data, but LightRAG would drop it because
payload["id"]was absent. In other words, the storage layer could successfully retrieve the physical Qdrant point while failing to recover the caller-facing LightRAG chunk ID.The sibling
get_by_ids()path already handles this shape by falling back from the computed Qdrant point ID to the originally requested LightRAG ID.get_vectors_by_ids()did not have the same fallback, so an otherwise retrievable vector could be treated as missing by LightRAG.Changes
This PR keeps the normal payload-ID path unchanged and adds a narrow read-time fallback for the missing-payload-ID case:
qdrant_id -> requested_idmap for the IDs being retrieved from Qdrant;payload["id"]when it exists, preserving existing behavior for normal points;payload["id"]is absent, normalize the returned Qdrantpoint.idand recover the result key only if that point ID matches one of the IDs requested in the current lookup;The fallback is intentionally limited to points returned by the current
retrieve()call. It does not scan Qdrant, infer IDs from arbitrary payloads, mutate existing payloads, or broaden workspace visibility.This PR does not change Qdrant writes, point ID generation, payload schema, collection naming, workspace filtering, migration behavior, delete/drop/finalize semantics, ordinary
query()vector search, or any non-Qdrant vector backend.Evidence
The regression test models a legacy-style Qdrant point that can be retrieved by the computed Qdrant point ID but lacks the logical payload ID:
Before this fix,
get_vectors_by_ids(["chunk-1"])skipped that point becausepayload["id"]was absent and returned{}. After this fix, the same lookup returns the vector under the requested LightRAG ID:{"chunk-1": [0.1, 0.2, 0.3]}The tests also cover Qdrant returning the same computed point ID in canonical hyphenated UUID form, so the fallback works when qdrant-client returns
point.iddifferently from LightRAG's simple hex computed ID. The siblingget_by_ids(["chunk-1"])fallback path is covered as well, keeping payload lookup and vector lookup consistent for this missing-payload-ID shape.Focused validation passed locally:
Remote PR checks are also green for this branch.
Possible call chain / impact
The practical impact is limited to Qdrant points where the computed point ID still matches the requested LightRAG ID but the logical payload ID is absent. In that case, downstream vector-similarity chunk selection can now receive a vector that Qdrant already returned instead of silently losing it during result mapping.
This is a read-time compatibility fix, not a data migration. It does not repair points whose Qdrant
point.iddoes not match the computed ID for the requested LightRAG ID, and it does not recover points that have no vector data.Related Issues
N/A
Changes Made
qdrant_id -> requested_idmap for the IDs requested from Qdrant.payload["id"]behavior when that field is present.id.payload={"content": ...}and a valid computed point ID.Checklist
Additional Notes
No additional notes beyond the scoped read-time fallback, evidence, call-chain impact, and validation described in
## Description.