-
Notifications
You must be signed in to change notification settings - Fork 8
Implement API to send chat history for OpenAI orchestrator #127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…` and update PRD to reflect new method naming conventions and functionality.
There was a problem hiding this 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 implements two new async APIs for the OpenAI orchestrator extension to send chat history to the MCP platform for real-time threat protection:
send_chat_history_async()- Extracts messages from an OpenAI Session and delegates to the message-based methodsend_chat_history_messages_async()- Accepts a list of OpenAI TResponseInputItem messages directly and converts them to ChatHistoryMessage format
Changes:
- Added two new public async methods with comprehensive message conversion logic
- Implemented private helper methods for role, content, ID, and timestamp extraction
- Created 38+ comprehensive unit and integration tests organized into validation, conversion, success path, error handling, and integration test suites
- Added PRD and task breakdown documentation
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
mcp_tool_registration_service.py |
Added two public methods and five private conversion helpers with proper error handling and delegation |
__init__.py (openai extension) |
Updated exports and documentation to include type hint guidance |
__init__.py (tooling extensions) |
Added namespace package configuration for editable installs |
pyproject.toml |
Added B903 exception for tests to allow bare except Exception |
test_send_chat_history_async.py |
27 unit tests for input validation, success paths, and error handling |
test_message_conversion.py |
32 unit tests for message conversion logic with comprehensive edge cases |
test_integration.py |
6 integration tests for end-to-end flows with mocked HTTP |
conftest.py |
Shared pytest fixtures with mock OpenAI types and TurnContext variations |
openai-send-chat-history-api.md |
Comprehensive PRD with requirements, API design, and testing strategy |
openai-send-chat-history-api-tasks.md |
Detailed task breakdown with effort estimates and dependencies |
CLAUDE.md |
Updated with type hints guidance emphasizing never using Any |
libraries/microsoft-agents-a365-tooling/microsoft_agents_a365/tooling/extensions/__init__.py
Show resolved
Hide resolved
- Removed unnecessary async suffix from send_chat_history methods for consistency. - Updated docstrings and comments for clarity. - Introduced end-to-end tests for send_chat_history methods with mocked HTTP responses. - Added unit tests for input validation, success paths, error handling, and orchestrator name handling. - Ensured thread safety and isolation for concurrent calls to send_chat_history methods. - Improved overall test coverage and reliability of the service.
There was a problem hiding this 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 12 out of 12 changed files in this pull request and generated 1 comment.
libraries/microsoft-agents-a365-tooling/microsoft_agents_a365/tooling/extensions/__init__.py
Show resolved
Hide resolved
…quality - CRM-003: Add return type annotation to add_tool_servers_to_agent - CRM-004: Add type annotations to _cleanup_servers and cleanup_all_servers - CRM-006: Fix conversion error test to actually test error handling - CRM-007: Update implicit boolean check to explicit None check - CRM-008: Remove redundant local import of Agent - CRM-010: Use bare raise instead of raise e - CRM-011: Rename test to match behavior (skips_message not uses_empty_string) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
There was a problem hiding this 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 12 out of 12 changed files in this pull request and generated no new comments.
There was a problem hiding this 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 12 out of 12 changed files in this pull request and generated no new comments.
…tooling/extensions/__init__.py Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this 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 12 out of 12 changed files in this pull request and generated 1 comment.
...ions-openai/microsoft_agents_a365/tooling/extensions/openai/mcp_tool_registration_service.py
Outdated
Show resolved
Hide resolved
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this 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 12 out of 12 changed files in this pull request and generated no new comments.
No description provided.