Skip to content

Python: Correct Cosmos memory guide state scoping - #9443

Merged
Eduard van Valkenburg (eavanvalkenburg) merged 1 commit into
microsoft:mainfrom
ktz03:docs/cosmos-memory-provider-state-20261016
Oct 16, 2026
Merged

Eduard van Valkenburg (eavanvalkenburg) merged 1 commit into
microsoft:mainfrom
ktz03:docs/cosmos-memory-provider-state-20261016

Conversation

@ktz03

Copy link
Copy Markdown
Contributor

Motivation & Context

The Cosmos memory package guide places a stable user ID in flat session state, but the provider receives state scoped by its source ID. Following that entry therefore falls back to the session ID instead of the intended stable user ID.

Description & Review Guide

  • What are the major changes? Use session.state.setdefault(provider.source_id, {})["user_id"], matching the existing README and three samples. Remove the missing-user warning promise, which the resolver does not implement.
  • What is the impact of these changes? The package guide describes the existing state contract. Runtime code and APIs are unchanged.
  • What do you want reviewers to focus on? Consistency with the provider-scoped state passed to before_run and after_run.

Validation: eight controlled Core Agent.run calls check two provider IDs, flat versus scoped state, and two independent sessions. Four flat-state runs omit user_id from the delivered provider state; four scoped-state runs deliver the stable ID. The second session in each case uses the public session snapshot round trip. The Cosmos resolver was checked in source; no Cosmos/Foundry backend, live model, full package suite or build was run.

Related Issue

N/A - trivial change. This corrects one guide entry to match the unchanged public contract already shown in the README, samples and resolver; the desired documentation result does not require a new design or behavior decision.

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: Documentation, validation, and PR description.

Contribution Checklist

  • The code builds clean without any errors or warnings
  • All unit tests pass, and I have added new tests where possible
  • 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.

Copilot AI balanced review requested due to automatic review settings October 16, 2026 05:56
@ktz03
LI (ktz03) deployed to github-app-auth October 16, 2026 05:56 — with GitHub Actions Active
@ktz03
LI (ktz03) deployed to github-app-auth October 16, 2026 05:56 — with GitHub Actions Active
@agent-framework-automation agent-framework-automation Bot added documentation Usage: [Issues, PRs], Target: documentation in the code base and learn docs python Usage: [Issues, PRs], Target: Python labels Oct 16, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The documentation-only corrections match existing behavior, with no unresolved findings.

0 open findings

What changed in this PR

Corrects the Cosmos memory package guide to match the existing provider-scoped state contract. Runtime code and APIs are unchanged.

Changes:

  • Shows how to set a stable user ID under provider.source_id.
  • Removes the unsupported promise of a missing-user warning.
File Description
python/​packages/​azure-cosmos-memory/​AGENTS.md Corrects user ID scoping and fallback documentation.

🧠 Review effort: Balanced


💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

Merged via the queue into microsoft:main with commit 8a365f4 Oct 16, 2026
37 of 38 checks passed

This branch was successfully deployed

1 active deployment
github-app-auth — 81606954 Deployed Oct 16, 2026 by ktz03 via team_check #6922
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Usage: [Issues, PRs], Target: documentation in the code base and learn docs python Usage: [Issues, PRs], Target: Python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants