Handling invoke responses with empty body - #437
Merged
Rodrigo Brandão (rodrigobr-msft) merged 3 commits intoJul 10, 2026
Merged
Conversation
Copilot started reviewing on behalf of
Rodrigo Brandão (rodrigobr-msft)
July 2, 2026 15:17
View session
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request updates the transcript transport layer’s Exchange.from_request parsing for invoke activities to safely handle responses that have an empty/whitespace-only body, and adds a regression test to ensure this behavior remains correct.
Changes:
- Adjusted
Exchange.from_requestto treat empty/whitespace-only invoke response bodies as{}(instead of attemptingjson.loadsand failing). - Added a parameterized test to cover both empty-string and whitespace-only invoke response bodies.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| dev/testing/microsoft-agents-testing/microsoft_agents/testing/core/transport/transcript/exchange.py | Avoids JSON parsing on empty/whitespace invoke response bodies by defaulting InvokeResponse.body to {}. |
| dev/testing/microsoft-agents-testing/tests/core/transport/transcript/test_exchange.py | Adds parameterized coverage ensuring empty/whitespace invoke bodies yield invoke_response.body == {}. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Rodrigo Brandão (rodrigobr-msft)
marked this pull request as ready for review
July 2, 2026 15:20
Rodrigo Brandão (rodrigobr-msft)
enabled auto-merge (squash)
July 2, 2026 15:20
Copilot started reviewing on behalf of
Rodrigo Brandão (rodrigobr-msft)
July 2, 2026 15:20
View session
Kyle Rohn (kylerohn-msft)
approved these changes
Jul 10, 2026
Copilot started reviewing on behalf of
Rodrigo Brandão (rodrigobr-msft)
July 10, 2026 17:51
View session
Rodrigo Brandão (rodrigobr-msft)
merged commit Jul 10, 2026
ab57341
into
main
11 of 12 checks passed
Rodrigo Brandão (rodrigobr-msft)
deleted the
users/robrandao/invoke-response-handling
branch
July 10, 2026 17:52
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 improves the handling of empty response bodies for invoke activities in the
Exchange.from_requestmethod and adds tests to ensure correct behavior. The main changes are:Bug Fixes:
Exchange.from_requestinexchange.pyto returnNonefor thebodyfield inInvokeResponsewhen the response body is empty or contains only whitespace, preventing JSON parsing errors.Testing Improvements:
test_from_request_with_empty_invoke_response_bodyintest_exchange.pyto verify that empty or whitespace-only response bodies are correctly handled and result inNoneininvoke_response.body.