Skip to content

.NET: Fix source generator bug that silently drops base class handler registrations for protocol-only partial executors#4751

Open
peibekwe wants to merge 2 commits intomainfrom
peibekwe/custom-agent-sample
Open

.NET: Fix source generator bug that silently drops base class handler registrations for protocol-only partial executors#4751
peibekwe wants to merge 2 commits intomainfrom
peibekwe/custom-agent-sample

Conversation

@peibekwe
Copy link
Contributor

@peibekwe peibekwe commented Mar 17, 2026

Motivation and Context

ClassProtocolInfo didn't carry BaseHasConfigureProtocol, so CombineOutputOnlyResults couldn't know whether the base class already overrides ConfigureProtocol and this led to silent drop of base class handler registrations for protocol-only partial executors. This broke the CustomAgentExecutors sample.

Fixes #4202

Description

• Added BaseHasConfigureProtocol to ClassProtocolInfo
• Populated it via BaseHasConfigureProtocol in AnalyzeClassProtocolAttribute
• Used BaseHasConfigureProtocol in CombineOutputOnlyResults instead of hardcoded false value.

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? If yes, add "[BREAKING]" prefix to the title of the PR.

…trations for protocol-only partial executors
@markwallace-microsoft markwallace-microsoft added .NET workflows Related to Workflows in agent-framework labels Mar 17, 2026
@github-actions github-actions bot changed the title Fix source generator bug that silently drops base class handler registrations for protocol-only partial executors .NET: Fix source generator bug that silently drops base class handler registrations for protocol-only partial executors Mar 17, 2026
@peibekwe peibekwe marked this pull request as ready for review March 18, 2026 00:28
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

Fixes a .NET workflows source-generator bug where protocol-only partial executors could silently lose inherited ConfigureProtocol handler registrations (breaking the CustomAgentExecutors sample), by correctly carrying and propagating base-class protocol override information through generator analysis.

Changes:

  • Extended ClassProtocolInfo to include BaseHasConfigureProtocol.
  • Populated and propagated BaseHasConfigureProtocol through semantic analysis and protocol-only result combination.
  • Updated the CustomAgentExecutors sample to be generator-compatible (partial + IO attributes) and added basic runtime error printing.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
dotnet/src/Microsoft.Agents.AI.Workflows.Generators/Models/ClassProtocolInfo.cs Adds BaseHasConfigureProtocol to the protocol-only analysis model so the generator can preserve base protocol configuration.
dotnet/src/Microsoft.Agents.AI.Workflows.Generators/Analysis/SemanticAnalyzer.cs Computes BaseHasConfigureProtocol during attribute analysis and uses it when combining protocol-only results (fixing the inheritance regression).
dotnet/samples/03-workflows/Agents/CustomAgentExecutors/Program.cs Adjusts the sample executor to use generator-driven protocol declarations and prints workflow errors to aid diagnosis.

@peibekwe peibekwe added this pull request to the merge queue Mar 18, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Mar 18, 2026
@peibekwe peibekwe added this pull request to the merge queue Mar 18, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Mar 18, 2026
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.

.NET - Workflows - CustomAgentExecutors sample not working

5 participants