Fix error handling in sendChatHistoryAsync and empty array test expectations#160
Merged
pontemonti merged 3 commits intousers/johanb/RTP_OpenAIfrom Jan 27, 2026
Merged
Conversation
…st expectations for empty arrays Co-authored-by: pontemonti <7850950+pontemonti@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add chat history API for OpenAI integration
Fix error handling in sendChatHistoryAsync and empty array test expectations
Jan 27, 2026
pontemonti
approved these changes
Jan 27, 2026
pontemonti
added a commit
that referenced
this pull request
Jan 28, 2026
* Add chat history API for OpenAI * fix: update uuid and @types/uuid dependencies to use catalog * fix: correct header formatting in PRD for OpenAI sendChatHistoryAsync API * refactor: remove unnecessary logging and improve message role validation in McpToolRegistrationService * refactor: simplify role extraction in McpToolRegistrationService and remove validation * Add @types/uuid and uuid dependencies * Remove early return for empty messages in sendChatHistoryMessagesAsync (#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> * Remove fragile error handling from sendChatHistory methods (#159) * 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> * Update tests/tooling-extensions-openai/sendChatHistoryAsync.test.ts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Fix error handling in sendChatHistoryAsync and empty array test expectations (#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> * Add error handling for message conversion in sendChatHistoryMessagesAsync (#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> --------- Co-authored-by: Johan Broberg <johanb@microsoft.com> Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com> Co-authored-by: pontemonti <7850950+pontemonti@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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.
Test failures occurred after recent refactoring:
sendChatHistoryAsyncthrew unhandled exceptions fromsession.getItems()errors, and test expectations conflicted with the requirement to call the MCP platform even with empty message arrays.Changes
sendChatHistoryAsync: Wrappedsession.getItems()in try-catch to convert session errors toOperationResult.failedwhile allowing validation errors from downstream calls to propagatechatHistoryarray, aligning with MCP platform requirementsanytounknownwith properOperationErrorwrapping💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.