Skip to content

.NET: InProcessRunnerContext bugfix for workflows#6551

Queued
peibekwe wants to merge 3 commits into
mainfrom
peibekwe/workflow-bugfix
Queued

.NET: InProcessRunnerContext bugfix for workflows#6551
peibekwe wants to merge 3 commits into
mainfrom
peibekwe/workflow-bugfix

Conversation

@peibekwe

Copy link
Copy Markdown
Contributor

Description & Review Guide

Validate response PortId matches originating request in InProcessRunnerContext

Contribution Checklist

  • The code builds clean without any errors or warnings
  • All unit tests pass, and I have added new tests where possible
  • The PR follows the Contribution Guidelines
  • This PR is linked to an issue and there is no other open PR for this issue (see Related Issue above).
  • This is not a breaking change. If it is a breaking change, add the breaking change label (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and title prefix in sync automatically.

@peibekwe peibekwe self-assigned this Jun 16, 2026
Copilot AI review requested due to automatic review settings June 16, 2026 17:29
@moonbox3 moonbox3 added .NET workflows Related to Workflows in agent-framework labels Jun 16, 2026
@github-actions github-actions Bot changed the title InProcessRunnerContext bugfix for workflows .NET: InProcessRunnerContext bugfix for workflows Jun 16, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated Code Review

Reviewers: 5 | Confidence: 94% | Result: All clear

Reviewed: Correctness, Security Reliability, Test Coverage, Failure Modes, Design Approach


Automated review by peibekwe's agents

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 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.AddExternalResponseAsync that rejects responses whose PortId doesn’t match the pending request’s PortId.
  • Add unit tests covering forged PortId rejection, 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.

@peibekwe peibekwe marked this pull request as ready for review June 16, 2026 17:42

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated Code Review

Reviewers: 5 | Confidence: 94% | Result: All clear

Reviewed: Correctness, Security Reliability, Test Coverage, Failure Modes, Design Approach


Automated review by peibekwe's agents

@peibekwe peibekwe enabled auto-merge June 16, 2026 21:09
@peibekwe peibekwe added this pull request to the merge queue Jun 16, 2026
Any commits made after this event will not be merged.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

.NET workflows Related to Workflows in agent-framework

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants