Skip to content

Add chat history API for OpenAI#157

Merged
pontemonti merged 15 commits intomainfrom
users/johanb/RTP_OpenAI
Jan 28, 2026
Merged

Add chat history API for OpenAI#157
pontemonti merged 15 commits intomainfrom
users/johanb/RTP_OpenAI

Conversation

@pontemonti
Copy link
Copy Markdown
Contributor

No description provided.

@pontemonti pontemonti requested a review from a team as a code owner January 23, 2026 07:17
Copilot AI review requested due to automatic review settings January 23, 2026 07:17
Copy link
Copy Markdown
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

This pull request adds chat history APIs for the OpenAI Agents SDK integration, enabling developers to send conversation history to the MCP platform for real-time threat protection without manual type conversion.

Changes:

  • Implements two new public methods: sendChatHistoryAsync (session-based) and sendChatHistoryMessagesAsync (message array-based) in McpToolRegistrationService
  • Adds automatic conversion from OpenAI AgentInputItem types to platform-native ChatHistoryMessage format with role pass-through, content extraction, UUID generation for missing IDs, and timestamp generation
  • Updates OpenAI Agents SDK packages from version 0.1.5 to 0.4.0 and adds uuid package dependency

Reviewed changes

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

Show a summary per file
File Description
packages/agents-a365-tooling-extensions-openai/src/McpToolRegistrationService.ts Core implementation of chat history APIs with conversion logic
packages/agents-a365-tooling-extensions-openai/src/index.ts Re-exports OpenAIConversationsSession for convenience
packages/agents-a365-tooling-extensions-openai/package.json Adds uuid and @types/uuid dependencies
packages/agents-a365-tooling-extensions-openai/docs/design.md Documents the new chat history APIs with usage examples
tests/tooling-extensions-openai/sendChatHistoryAsync.test.ts Comprehensive tests for session-based API (241 lines)
tests/tooling-extensions-openai/sendChatHistoryMessagesAsync.test.ts Comprehensive tests for message array-based API (286 lines)
tests/tooling-extensions-openai/messageConversion.test.ts Tests for message conversion logic (459 lines)
tests/tooling-extensions-openai/fixtures/mockOpenAITypes.ts Mock types and helper functions for testing (231 lines)
tests/package.json Updates test script paths for better reliability
pnpm-workspace.yaml Updates OpenAI Agents SDK packages to v0.4.0
pnpm-lock.yaml Lockfile updates for dependency changes
docs/prd/prd-openai-chat-history-api.md Product requirements document (741 lines)
docs/tasks/prd-openai-chat-history-api.tasks.md Implementation task breakdown (361 lines)
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

Comment thread packages/agents-a365-tooling-extensions-openai/src/McpToolRegistrationService.ts Outdated
Comment thread packages/agents-a365-tooling-extensions-openai/src/McpToolRegistrationService.ts Outdated
Comment thread packages/agents-a365-tooling-extensions-openai/package.json Outdated
Comment thread packages/agents-a365-tooling-extensions-openai/package.json Outdated
Comment thread docs/prd/prd-openai-chat-history-api.md Outdated
Comment thread docs/prd/prd-openai-chat-history-api.md
Comment thread packages/agents-a365-tooling-extensions-openai/src/McpToolRegistrationService.ts Outdated
Copilot AI review requested due to automatic review settings January 26, 2026 23:56
Copy link
Copy Markdown
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

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

Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

Comment thread packages/agents-a365-tooling-extensions-openai/src/index.ts
Copilot AI review requested due to automatic review settings January 27, 2026 05:33
Copy link
Copy Markdown
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

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

Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

Comment thread pnpm-lock.yaml
Comment thread pnpm-lock.yaml
Copilot AI review requested due to automatic review settings January 27, 2026 06:33
Copy link
Copy Markdown
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

Copilot reviewed 11 out of 12 changed files in this pull request and generated no new comments.

Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

Comment thread packages/agents-a365-tooling-extensions-openai/src/McpToolRegistrationService.ts Outdated
Copy link
Copy Markdown
Contributor

Copilot AI commented Jan 27, 2026

@pontemonti I've opened a new pull request, #158, to work on those changes. Once the pull request is ready, I'll request review from you.

Comment thread packages/agents-a365-tooling-extensions-openai/src/McpToolRegistrationService.ts Outdated
Copy link
Copy Markdown
Contributor

Copilot AI commented Jan 27, 2026

@pontemonti I've opened a new pull request, #159, to work on those changes. Once the pull request is ready, I'll request review from you.

Copilot AI and others added 2 commits January 27, 2026 09:15
#158)

* Initial plan

* fix: ensure MCP call is made even when messages array is empty

Co-authored-by: pontemonti <7850950+pontemonti@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: pontemonti <7850950+pontemonti@users.noreply.github.com>
* Initial plan

* Remove fragile 'is required' check from sendChatHistory methods

Co-authored-by: pontemonti <7850950+pontemonti@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: pontemonti <7850950+pontemonti@users.noreply.github.com>
Copilot AI review requested due to automatic review settings January 27, 2026 17:36
@pontemonti
Copy link
Copy Markdown
Contributor Author

@copilot - after the last couple of updates, the tests are now failing. Please run all the checks just like what the PR workflow does, and then address the failures.

Copy link
Copy Markdown
Contributor

Copilot AI commented Jan 27, 2026

@pontemonti I've opened a new pull request, #160, to work on those changes. Once the pull request is ready, I'll request review from you.

Copy link
Copy Markdown
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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings January 27, 2026 17:59
…tations (#160)

* Initial plan

* Fix test failures: wrap session.getItems() in try-catch and update test expectations for empty arrays

Co-authored-by: pontemonti <7850950+pontemonti@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: pontemonti <7850950+pontemonti@users.noreply.github.com>
Co-authored-by: Johan Broberg <johan@pontemonti.net>
Copy link
Copy Markdown
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

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

Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

Comment thread packages/agents-a365-tooling-extensions-openai/src/McpToolRegistrationService.ts Outdated
Comment thread packages/agents-a365-tooling-extensions-openai/src/McpToolRegistrationService.ts Outdated
Copy link
Copy Markdown
Contributor

Copilot AI commented Jan 27, 2026

@pontemonti I've opened a new pull request, #163, to work on those changes. Once the pull request is ready, I'll request review from you.

…sync (#163)

* Initial plan

* Add error handling for convertToChatHistoryMessages and test

Co-authored-by: pontemonti <7850950+pontemonti@users.noreply.github.com>

* Address code review feedback: safer error handling and remove extra blank line

Co-authored-by: pontemonti <7850950+pontemonti@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: pontemonti <7850950+pontemonti@users.noreply.github.com>
@pontemonti pontemonti enabled auto-merge (squash) January 27, 2026 21:57
Copilot AI review requested due to automatic review settings January 27, 2026 22:59
Copy link
Copy Markdown
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

Copilot reviewed 11 out of 12 changed files in this pull request and generated no new comments.

Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

mrunalhirve128
mrunalhirve128 previously approved these changes Jan 28, 2026
tmlsousa
tmlsousa previously approved these changes Jan 28, 2026
@pontemonti pontemonti dismissed stale reviews from tmlsousa and mrunalhirve128 via ffd7354 January 28, 2026 00:06
@pontemonti pontemonti merged commit a598a7c into main Jan 28, 2026
7 checks passed
@pontemonti pontemonti deleted the users/johanb/RTP_OpenAI branch January 28, 2026 00:25
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.

5 participants