Skip to content

Python: Prefer injected Qdrant clients over connection settings - #2

Closed
ZedingZhang wants to merge 2 commits into
mainfrom
cursor/qdrant-injected-client-settings-8c19
Closed

ZedingZhang wants to merge 2 commits into
mainfrom
cursor/qdrant-injected-client-settings-8c19

Conversation

@ZedingZhang

@ZedingZhang ZedingZhang commented Nov 2, 2026 •

Copy link
Copy Markdown
Owner

Motivation & Context

QdrantStore and QdrantCollection raise ValueError when an injected AsyncQdrantClient is supplied alongside URL, API-key, or .env options. They also honor managed_client=True by closing that caller-supplied client. Applications cannot reuse a configured client together with shared constructor options, and cleanup can close a client the caller still owns.

Description & Review Guide

  • What are the major changes? Resolve an injected client before connection settings. Skip URL, API-key, and .env loading for that client, and always leave it caller-owned, including when managed_client=True. Update the constructor documentation, README, and the settings and ownership tests.
  • What is the impact of these changes? Redundant, empty, or invalid connection settings no longer reject or affect an injected client. Store and collection cleanup no longer closes it. Connector-created clients still follow explicit arguments, then environment settings, then SDK defaults, and they still close by default. Collection schema and operation options are unchanged.
  • What do you want reviewers to focus on? Tests cover both constructors, confirm load_settings and AsyncQdrantClient are not called for an injected client, and confirm cleanup leaves that client open. The regression fails on the original implementation and passes with the fix.

Related Issue

Fixes microsoft#9957. The issue has the ready-for-implementation label; no competing open PR was found before submission.

AI Assistance

  • No material AI assistance was used.
  • This is an AI-assisted contribution. I reviewed, understood, and verified all submitted content and accept responsibility for it.

AI assistance details: An AI coding assistant helped with investigation, implementation, tests, documentation, and this PR description.

Contribution Checklist

  • The code builds clean without any errors or warnings — Qdrant sdist and wheel built successfully.
  • All unit tests pass, and I have added new tests where possible — Qdrant unit suite: 268 passed, 84 integration tests deselected. Ruff formatting/lint, strict source Pyright, and all five test type checkers pass. No live Qdrant integration tests were run.
  • The PR follows the Contribution Guidelines
  • This PR links to an agreed issue with no competing open PR, or the Related Issue section documents a trivial-change or repository-automation exception.
  • This is not a breaking change. If it is a breaking change, add the breaking change label (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and title prefix in sync automatically.
Open in Web Open in Cursor 

An injected AsyncQdrantClient now takes precedence over URL, API key, and
.env options. Those settings are not read, and the caller keeps ownership
even when managed_client is true.

Fixes microsoft#9957

Co-authored-by: ZedingZhang <me@zedingzhang.com>
QdrantCollection now runs base initialization before resolving a client, so
invalid collection arguments raise without calling the SDK factory.

Co-authored-by: ZedingZhang <me@zedingzhang.com>
@ZedingZhang

Copy link
Copy Markdown
Owner Author

Closing: the same change already landed upstream as microsoft#9993 (merged 2026-11-03).

@ZedingZhang ZedingZhang closed this Nov 6, 2026

This branch had an error being deployed

1 failed deployment
github-app-auth — 61109187 Deployed Nov 2, 2026 by ZedingZhang via add_label #6
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.

Python: [Bug]: Qdrant injected clients do not take precedence over settings and lifecycle

1 participant