Merged
Conversation
- CRM-003: Add turn_context validation in send_chat_history_async method
to ensure fail-fast behavior and consistency with docstring
- CRM-004: Document empty message filtering behavior in _convert_chat_messages_to_history
docstring and elevate log level from DEBUG to WARNING when messages are skipped
Note: CRM-001 and CRM-002 (copyright header format) are not applicable because
the existing format ("Microsoft. All rights reserved.") is required by the
pyproject.toml linter configuration (notice-rgx), while CLAUDE.md specifies a
different format. The linter-enforced format takes precedence to ensure CI passes.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…clude license information
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request introduces comprehensive chat history handling capabilities to the MCP Tool Registration Service for the Agent Framework. The implementation adds three new methods for converting and sending chat history messages to the MCP platform for real-time threat protection analysis.
Changes:
- Added chat history conversion and sending methods to the AgentFramework MCP tool registration service
- Created comprehensive unit tests covering validation, conversion, delegation, and error handling scenarios
- Added necessary test package structure with proper
__init__.pyfiles - Updated copyright header format from "Microsoft. All rights reserved." to "Microsoft Corporation. / Licensed under the MIT License."
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
libraries/microsoft-agents-a365-tooling-extensions-agentframework/microsoft_agents_a365/tooling/extensions/agentframework/services/mcp_tool_registration_service.py |
Adds _convert_chat_messages_to_history, send_chat_history_messages_async, and send_chat_history_async methods with proper validation, conversion logic, and delegation to core service |
tests/tooling/extensions/agentframework/services/test_send_chat_history_async.py |
Comprehensive test suite with 17 tests covering validation, success cases, delegation patterns, and error handling |
tests/tooling/extensions/agentframework/services/__init__.py |
Package initialization file for service tests |
tests/tooling/extensions/agentframework/__init__.py |
Package initialization file for agentframework tests |
tests/tooling/extensions/__init__.py |
Package initialization file for extensions tests |
...soft_agents_a365/tooling/extensions/agentframework/services/mcp_tool_registration_service.py
Show resolved
Hide resolved
…sing role during conversion
* refactor(agentframework): remove _async suffix from method names (CRM-010) Rename methods to follow Python conventions and codebase patterns: - send_chat_history_messages_async -> send_chat_history_messages - send_chat_history_async -> send_chat_history_from_store Rename test file accordingly: - test_send_chat_history_async.py -> test_send_chat_history.py Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix(agentframework): improve role handling and logging (CRM-003, CRM-009, CRM-013) - CRM-003: Add defensive handling for role value access using hasattr check - CRM-009: Convert debug and warning logging to lazy format (% style) - CRM-013: Simplify redundant empty content check (remove `not content or`) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * test(agentframework): add missing test coverage (CRM-001, 004, 005, 006, 011, 012) - CRM-001: Add test for ChatMessageStore exception propagation - CRM-004: Add test for whitespace-only content filtering - CRM-005: Add test for None role handling - CRM-006: Add test for all messages filtered out scenario - CRM-011: Add test for default ToolOptions creation - CRM-012: Make UUID assertion more robust using uuid.UUID() Also adds test for defensive role handling (string role without .value) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix(tooling): return success for empty chat history list (CRM-008) The core send_chat_history method now returns OperationResult.success() for empty lists instead of raising ValueError. This is consistent with the extension behavior and makes the API more forgiving. Updated test to verify new behavior. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * docs(agentframework): add Chat History API documentation (CRM-002) Update design.md to include: - send_chat_history_messages and send_chat_history_from_store methods - Parameter tables for both methods - Integration flow diagram showing message conversion - Message filtering behavior documentation - Example usage code Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * docs: add async method naming convention to CLAUDE.md (CRM-010) Document that _async suffix should NOT be used on async methods in this SDK since we only provide async versions. This prevents future naming inconsistencies. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> --------- Co-authored-by: Johan Broberg <johanb@microsoft.com> Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
tests/tooling/extensions/agentframework/services/test_send_chat_history.py
Outdated
Show resolved
Hide resolved
rahuldevikar761
previously approved these changes
Jan 26, 2026
mrunalhirve128
previously approved these changes
Jan 26, 2026
be5fbe4
added 2 commits
January 26, 2026 11:43
… package resolution and clean up imports
…microsoft/Agent365-python into users/johanb/RTP_AgentFramework
rahuldevikar761
approved these changes
Jan 26, 2026
mrunalhirve128
approved these changes
Jan 26, 2026
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.
This pull request introduces new chat history handling capabilities to the MCP Tool Registration Service. The most significant change is the implementation of methods for converting and sending chat history messages to the MCP platform, improving integration with real-time threat protection.
Chat history integration and messaging:
_convert_chat_messages_to_history,send_chat_history_messages_async, andsend_chat_history_asyncmethods tomcp_tool_registration_service.pyfor converting Agent FrameworkChatMessageobjects to the MCP platform format and sending them for real-time threat protection. These methods validate input, filter empty messages, and delegate to the core service for delivery.