Skip to content

Conversation

@Vaccarini-Lorenzo
Copy link

Motivation and Context

This change fixes the workflow break in 07_MixedWorkflowAgentsAndExecutors, where the edge from JailbreakDetector to JailbreakSync was consistently dropped due to a payload type mismatch.

The sample defines JailbreakSyncExecutor as Executor<ChatMessage>, but the agent host emits a collection of messages (List<ChatMessage>). Because the executor declared a narrower input type, edge delivery failed with delivery_status: dropped type mismatch, preventing all downstream components (JailbreakSync, ResponseAgent, FinalOutput) from running.

Updating the executor to accept List<ChatMessage> restores compatibility with the emitted payload, allowing the workflow to execute end-to-end as intended.

Fixes: #2181

Description

  • Updated the JailbreakSyncExecutor constructor from:
    Executor<ChatMessage>("JailbreakSync")
    to:
    Executor<List<ChatMessage>>("JailbreakSync")
  • Ensures that the executor’s declared input type matches the message collection emitted by the agent host.
  • Restores proper delivery of the edge JailbreakDetector → JailbreakSync.
  • Verified the fix by running the full sample:
    • StringToChat, JailbreakDetector, JailbreakSync, ResponseAgent, and FinalOutputExecutor all execute correctly.
    • Console output now includes the JailbreakSync formatted message and the final agent response.
  • Confirmed via OpenTelemetry that:
    • edge_group.delivered = true for all affected edges.
    • No further type-mismatch drops occur.

Contribution Checklist

  • The code builds clean without any errors or warnings
  • The PR follows the Contribution Guidelines
  • All unit tests pass, and I have added new tests where possible
  • Is this a breaking change?

Copilot AI review requested due to automatic review settings November 13, 2025 14:22
@github-actions github-actions bot changed the title Fix issue #2181 - Sample type mismatch .NET: Fix issue #2181 - Sample type mismatch Nov 13, 2025
Copilot finished reviewing on behalf of Vaccarini-Lorenzo November 13, 2025 14:24
Copy link
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 PR fixes a type mismatch bug in sample 07_MixedWorkflowAgentsAndExecutors that prevented the workflow from executing end-to-end. The JailbreakSyncExecutor has been updated to accept List<ChatMessage> instead of a single ChatMessage, matching the message collection emitted by the agent host.

  • Updated JailbreakSyncExecutor to inherit from Executor<List<ChatMessage>> instead of Executor<ChatMessage>
  • Modified the executor's HandleAsync method to extract the last assistant message from the list and process it appropriately
  • Added logic to handle the message collection with proper null-checking using LastOrDefault

…WorkflowAgentsAndExecutors/Program.cs

Co-authored-by: Copilot <[email protected]>
@Vaccarini-Lorenzo
Copy link
Author

@Vaccarini-Lorenzo please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.

@microsoft-github-policy-service agree [company="{your company}"]

Options:

  • (default - no company specified) I have sole ownership of intellectual property rights to my Submissions and I am not making Submissions in the course of work for my employer.
@microsoft-github-policy-service agree
  • (when company given) I am making Submissions in the course of work for my employer (or my employer has intellectual property rights in my Submissions by contract or applicable law). I have permission from my employer to make Submissions and enter into this Agreement on behalf of my employer. By signing below, the defined term “You” includes me and my employer.
@microsoft-github-policy-service agree company="Microsoft"

Contributor License Agreement

@microsoft-github-policy-service agree

@crickman crickman added samples Issue relates to the samples bug Something isn't working labels Nov 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working .NET samples Issue relates to the samples

Projects

None yet

Development

Successfully merging this pull request may close these issues.

.NET: Sample 07_MixedWorkflowAgentsAndExecutors drops edge after type mismatch

3 participants