Repository navigation
Python: Preserve injected Cosmos memory client configuration ownership - #9990
Open
Shashwat Gupta (LionStone-1) wants to merge 2 commits into
Open
Shashwat Gupta (LionStone-1) wants to merge 2 commits into
Shashwat Gupta (LionStone-1) wants to merge 2 commits into
Conversation
Shashwat Gupta (LionStone-1)
temporarily deployed
to
github-app-auth
November 2, 2026 18:41 — with
GitHub Actions
Inactive
Shashwat Gupta (LionStone-1)
temporarily deployed
to
github-app-auth
November 2, 2026 18:42 — with
GitHub Actions
Inactive
Shashwat Gupta (LionStone-1)
marked this pull request as ready for review
November 2, 2026 18:43
Shashwat Gupta (LionStone-1)
temporarily deployed
to
github-app-auth
November 2, 2026 18:43 — with
GitHub Actions
Inactive
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The emulator prompt regression test still combines an injected client with prompts_dir, so the new gate skips its custom template and the marker assertion fails once setup succeeds.
1 open issue
What changed in this PR
This PR addresses #9963 by preserving caller-owned client configuration in the Python Cosmos memory provider while keeping provider-level retrieval settings unchanged.
Changes:
- Apply cadence and custom prompt settings only to provider-created clients.
- Document injected-client configuration and lifecycle ownership.
- Add regression coverage for ignored construction options, prompt isolation, retrieval settings, and flushing without closing injected clients.
| File | Description |
|---|---|
python/packages/azure-cosmos-memory/tests/test_context_provider.py |
Adds ownership regressions and updates prompt tests for provider-created clients. |
python/packages/azure-cosmos-memory/README.md |
Explains ignored options and caller responsibility for closing injected clients. |
python/packages/azure-cosmos-memory/agent_framework_azure_cosmos_memory/_context_provider.py |
Restricts cadence and prompt configuration to provider-created clients and updates documentation. |
Review effort: Balanced
Shashwat Gupta (LionStone-1)
temporarily deployed
to
github-app-auth
November 2, 2026 18:48 — with
GitHub Actions
Inactive
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Motivation & Context
A preconfigured
AsyncCosmosMemoryClientshould retain its own configuration when passed toCosmosMemoryContextProvider. Currently, supplying processor cadence options raises during construction, andprompts_dirreplaces the supplied client's pipeline loader on entry.Description & Review Guide
prompts_dirfor caller-owned clients, and document the injection contract. Regression tests cover ignored construction options, unchanged provider retrieval settings, prompt isolation, and lifecycle ownership.Related Issue
Fixes #9963
AI Assistance
AI assistance details: OpenAI Codex assisted with issue analysis, implementation, regression tests, documentation, local verification and this draft. The contributor has confirmed personal review, understanding, and responsibility for the change.
Contribution Checklist
breaking changelabel (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and title prefix in sync automatically.Verification details
The four regressions fail against the original implementation. The final package suite passes 58 unit tests; 12 live integrations were not run. Source/test Pyright checks report zero errors. Ruff formatting passes; lint passes with RUF100 excluded because an existing unused suppression also occurs on the unchanged baseline. No dependency or lockfile changes and no cloud requests.