Skip to content

Python, .NET: [Purview] Update CorrelationId#3745

Open
Rishabh4275 wants to merge 1 commit intomicrosoft:mainfrom
Rishabh4275:users/richawla/psdkNew
Open

Python, .NET: [Purview] Update CorrelationId#3745
Rishabh4275 wants to merge 1 commit intomicrosoft:mainfrom
Rishabh4275:users/richawla/psdkNew

Conversation

@Rishabh4275
Copy link
Contributor

@Rishabh4275 Rishabh4275 commented Feb 7, 2026

Motivation and Context

This change will help us identify the requests which come through agent framework and as a later part this should also help with debugging or if there are any issues from agent framework to Purview

Description

Adding @af to the ids to identify them.

Contribution Checklist

  • The code builds clean without any errors or warnings
  • The PR follows the Contribution Guidelines
  • All unit tests pass, and I have added new tests where possible
  • Is this a breaking change? If yes, add "[BREAKING]" prefix to the title of the PR.

Copilot AI review requested due to automatic review settings February 7, 2026 01:37
@github-actions github-actions bot changed the title Python: [Purview] Update CorrelationId .NET: Python: [Purview] Update CorrelationId Feb 7, 2026
@github-actions github-actions bot changed the title .NET: Python: [Purview] Update CorrelationId Python: [Purview] Update CorrelationId Feb 7, 2026
@markwallace-microsoft
Copy link
Member

markwallace-microsoft commented Feb 7, 2026

Python Test Coverage

Python Test Coverage Report •
FileStmtsMissCoverMissing
packages/purview/agent_framework_purview
   _middleware.py1120100% 
   _processor.py1671094%173, 250–253, 258, 286, 288, 294, 296
   _settings.py370100% 
TOTAL16609203587% 

Python Unit Test Overview

Tests Skipped Failures Errors Time
3928 225 💤 0 ❌ 0 🔥 1m 9s ⏱️

Copy link
Contributor

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

Updates the Purview integration to make correlation identifiers clearly attributable to Agent Framework traffic (via an @AF suffix) and to propagate a session/thread identifier through the Python middleware/processor so requests can be correlated to a conversation/thread when available.

Changes:

  • Python: add session_id propagation into ScopedContentProcessor.process_messages() and derive correlation IDs as {session_or_guid}@AF.
  • Python: middleware now extracts a session/conversation ID (thread ID / conversation_id) and passes it through pre- and post-checks; tests expanded accordingly.
  • .NET: update Purview metadata models to require a correlationId parameter and append @AF; add PurviewSettings constructor validation for appName.

Reviewed changes

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

Show a summary per file
File Description
python/packages/purview/agent_framework_purview/_processor.py Adds session_id parameter and uses it to build correlation_id with @AF; uses settings app_version instead of hard-coded "1.0".
python/packages/purview/agent_framework_purview/_middleware.py Extracts session ID from AgentContext/ChatContext and forwards it into prompt/response checks.
python/packages/purview/agent_framework_purview/_settings.py Updates PurviewSettings docstring wording.
python/packages/purview/tests/test_processor.py Updates assertions for new _map_messages(..., session_id, user_id) call shape.
python/packages/purview/tests/test_middleware.py Updates mocks for new process_messages signature and adds coverage for session_id extraction from thread/messages.
python/packages/purview/tests/test_chat_middleware.py Updates mocks for new process_messages signature and adds coverage for session_id extraction from options.
dotnet/src/Microsoft.Agents.AI.Purview/ScopedContentProcessor.cs Appends @AF to correlation IDs and passes correlationId via constructor.
dotnet/src/Microsoft.Agents.AI.Purview/PurviewSettings.cs Adds null/whitespace validation for appName.
dotnet/src/Microsoft.Agents.AI.Purview/Models/Common/ProcessContentMetadataBase.cs Requires correlationId in ctor and makes CorrelationId non-nullable.
dotnet/src/Microsoft.Agents.AI.Purview/Models/Common/ProcessConversationMetadata.cs Updates ctor to accept/pass correlationId.
dotnet/src/Microsoft.Agents.AI.Purview/Models/Common/ProcessFileMetadata.cs Updates ctor to accept/pass correlationId.
dotnet/tests/Microsoft.Agents.AI.Purview.UnitTests/PurviewClientTests.cs Updates test helper to use new ProcessConversationMetadata(..., correlationId) constructor.

@eoindoherty1 eoindoherty1 changed the title Python: [Purview] Update CorrelationId Python, .NET: [Purview] Update CorrelationId Feb 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants