.NET: InProcessRunnerContext bugfix for workflows#6551
Queued
peibekwe wants to merge 3 commits into
Queued
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR hardens the in-process workflow runner by validating that an ExternalResponse’s PortInfo.PortId matches the ExternalRequest’s originating port for the same RequestId, preventing a response from being routed into an unrelated port-specific execution path.
Changes:
- Add a port-correlation gate in
InProcessRunnerContext.AddExternalResponseAsyncthat rejects responses whosePortIddoesn’t match the pending request’sPortId. - Add unit tests covering forged
PortIdrejection, successful completion after a rejected forgery, baseline success for matching ports, and the unknown-request-id regression case.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| dotnet/src/Microsoft.Agents.AI.Workflows/InProc/InProcessRunnerContext.cs | Adds validation to ensure an external response’s PortId matches the pending request’s PortId before consuming and routing it. |
| dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/ExternalResponsePortCorrelationTests.cs | Introduces targeted unit tests validating rejection of forged PortId responses and preserving legitimate completion paths. |
rogerbarreto
approved these changes
Jun 16, 2026
westey-m
approved these changes
Jun 16, 2026
alliscode
approved these changes
Jun 16, 2026
alliscode
approved these changes
Jun 16, 2026
Any commits made after this event will not be merged.
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.
Description & Review Guide
Validate response
PortIdmatches originating request in InProcessRunnerContextContribution Checklist
breaking changelabel (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and title prefix in sync automatically.