Skip to content

Users/akataria/improvements#8

Merged
aayush3011 merged 4 commits into
AzureCosmosDB:mainfrom
aayush3011:users/akataria/improvements
May 6, 2026
Merged

Users/akataria/improvements#8
aayush3011 merged 4 commits into
AzureCosmosDB:mainfrom
aayush3011:users/akataria/improvements

Conversation

@aayush3011
Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI review requested due to automatic review settings May 6, 2026 06:32
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR tightens thread-scoping semantics for turn memories, improves determinism/performance of Cosmos queries, and hardens client behavior around reconnects and embedding generation so downstream processing/search behaves more reliably.

Changes:

  • Require explicit thread_id for memory_type="turn" in add_local (sync/async) and update unit tests accordingly.
  • Make dedup-count extraction consistent with the pipeline contract (merged + superseded) and add tests to reject legacy keys.
  • Improve Cosmos/pipeline behavior: deterministic ordering for reconciliation queries, single-partition queries for thread-scoped operations, embedding of non-turn memories on push_to_cosmos, and guardrails against infinite “strip unsupported param” retry loops.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
tests/unit/test_cosmos_memory_client.py Updates sync client tests for required thread_id on turns; adds tests for thread-id validation and embedding behavior on push.
tests/unit/aio/test_cosmos_memory_client.py Updates async client tests for required thread_id on turns; adds validation test.
agent_memory_toolkit/cosmos_memory_client.py Enforces thread_id for turn locals, drains Cosmos client on reconnect, and embeds non-turn records during push_to_cosmos.
agent_memory_toolkit/aio/cosmos_memory_client.py Mirrors sync changes for async: turn validation, draining Cosmos client on reconnect, and embedding on push.
agent_memory_toolkit/pipeline.py Adds deterministic ordering for reconciliation context and uses partition-keyed queries for thread-scoped reads.
agent_memory_toolkit/processors/inprocess.py Updates dedup-count extraction to merged + superseded only.
agent_memory_toolkit/aio/processors/inprocess.py Async mirror of dedup-count extraction update.
tests/unit/processors/test_inprocess.py Updates processor tests for new dedup-count semantics; adds legacy-key test coverage.
tests/unit/aio/processors/test_inprocess.py Updates async processor test for new dedup-count semantics.
agent_memory_toolkit/chat.py Limits repeated “strip unsupported param” retries to avoid potential infinite loops.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread agent_memory_toolkit/cosmos_memory_client.py
Comment thread agent_memory_toolkit/aio/cosmos_memory_client.py
Comment thread agent_memory_toolkit/cosmos_memory_client.py Outdated
Comment thread agent_memory_toolkit/aio/cosmos_memory_client.py Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.

Comment thread tests/unit/test_cosmos_memory_client.py Outdated
Comment thread agent_memory_toolkit/cosmos_memory_client.py
Comment thread agent_memory_toolkit/aio/cosmos_memory_client.py
- push_to_cosmos (sync + async): persist generated embeddings back to
  local_memory so a repeat push doesn't re-embed already-embedded
  non-turn records.
- Update test comment: _make_memory auto-generates a UUID thread_id for
  non-turn types when omitted (it does not user-scope them).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@aayush3011 aayush3011 merged commit 763ae6e into AzureCosmosDB:main May 6, 2026
6 checks passed
@aayush3011 aayush3011 deleted the users/akataria/improvements branch May 21, 2026 17:26
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.

2 participants