Skip to content

Conversation

@jeffhandley
Copy link
Member

Fixes #1924

Description

The call to GetRequiredKeyedService<Workflow> was using the specified agent name rather than the workflow name.

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
    • Copilot added comprehensive tests for AddAsAIAgent and the new AddAsAIAgent_WithDifferentName_RetrievesWorkflowCorrectly failed before the fix was applied
  • Is this a breaking change? If yes, add "[BREAKING]" prefix to the title of the PR.

Copilot AI review requested due to automatic review settings November 5, 2025 08:55
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 bug in the AddAsAIAgent extension method where the workflow was being retrieved using the agent name instead of the workflow name, causing failures when they differ.

  • Fixed workflow retrieval to use the workflow name consistently
  • Added comprehensive test coverage for various AddAsAIAgent scenarios

Reviewed Changes

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

File Description
HostedWorkflowBuilderExtensions.cs Fixed bug where workflow was retrieved using agent key instead of workflow name
HostApplicationBuilderWorkflowExtensionsTests.cs Added 8 new test methods covering different AddAsAIAgent scenarios including name parameter variations

@lokitoth lokitoth added this pull request to the merge queue Nov 5, 2025
Merged via the queue into microsoft:main with commit 77d882e Nov 5, 2025
21 checks passed
rogerbarreto added a commit that referenced this pull request Nov 5, 2025
* .NET: [BREAKING] Simplify TextSearchProvider construction and improve Mem0Provider scoping. (#1905)

* Simplify TextSearchProvider construction and improve Mem0Provider scoping

* Fixing indentation.

* .NET: [Breaking Change] Moving MAAI.AzureAI V1 Package  -> MAAI.AzureAI.Persistent (V1) (#1902)

* Update AzureAI -> AzureAI.Persistent

* Fix sample reference

* Fix workflow lookup with AddAsAIAgent(name) when name differs from workflow name (#1925)

* .NET: AG-UI support for .NET (#1776)

* Initial plan

* Infrastructure setup

* Plan for minimal client

* Plan update

* Basic agentic chat

* cleanup

* Cleanups

* More cleanups

* Cleanups

* More cleanups

* Test plan

* Sample

* Fix streaming and error handling

* Fix notifications

* Cleanups

* cleanup sample

* Additional tests

* Additional tests

* Run dotnet format

* Remove unnecessary files

* Mark packages as non packable

* Fix build

* Address feedback

* Fix build

* Fix remaining warnings

* Feedback

* Feedback and cleanup

* Cleanup

* Cleanups

* Cleanups

* Cleanups

* Retrieve existing messages from the store to send them along the way and update the sample client

* Run dotnet format

* Add ADR for AG-UI

* Switch to use the SG and use a convention for run ids

* Cleanup MapAGUI API

* Fix formatting

* Fix solution

* Fix solution

* Python: Added parameter to disable agent cleanup in AzureAIAgentClient (#1882)

* Removed automatic agent cleanup in AzureAIAgentClient

* Revert "Removed automatic agent cleanup in AzureAIAgentClient"

This reverts commit 89846c7.

* Exposed boolean flag to control deletion behavior

* Update sample

* [BREAKING] refactor: Fix unintuitive binding of StreamAsync (#1930)

In #1551 we added a mechanism to open a Streaming workflow run without providing any input. This caused unintuitive behaviour when passing a string as input without providing a runId, resulting in the input being misinterpreted as the runId and the workflow not executing.

As well, the name caused confusion about why the Workflow was not running when using the input-less StreamAsync (since the Workflow cannot run without any messages to drive its execution).

* Python: fix missing packaging dependency (#1929)

* fix missing packaging dependency

* add aiohttp to azureai

* Bring back files

* Address merge conflict

* Address merge conflict+

---------

Co-authored-by: westey <[email protected]>
Co-authored-by: Jeff Handley <[email protected]>
Co-authored-by: Javier Calvarro Nelson <[email protected]>
Co-authored-by: Dmytro Struk <[email protected]>
Co-authored-by: Jacob Alber <[email protected]>
Co-authored-by: Eduard van Valkenburg <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

.NET: HostedWorkflowBuilderExtensions.AddAsAIAgent(name) fails to find the registered workflow when it has a different name

4 participants