.NET: Sample fix#6773
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates several .NET samples and shared workflow helpers to improve sample correctness and robustness, especially around interactive input and observability of workflow decisions.
Changes:
- Improve EOF/stdin-closed handling in shared workflow sample utilities to avoid hangs during automated sample verification.
- Enhance workflow sample output/debuggability by emitting a dedicated
ClassificationEventand printing it in the multi-selection workflow sample. - Refactor and clarify several agent/workflow samples (memory extraction client separation, OpenAPI tool parameter support, sample verification inputs/env vars, and prompt/instruction refinements).
Show a summary per file
| File | Description |
|---|---|
| dotnet/src/Shared/Workflows/Settings/Application.cs | Return gracefully when initial console input hits EOF. |
| dotnet/src/Shared/Workflows/Execution/WorkflowRunner.cs | Track stdin EOF during interactive workflow runs and break the loop cleanly. |
| dotnet/samples/03-workflows/ConditionalEdges/03_MultiSelection/Program.cs | Add a custom ClassificationEvent and emit/print classification decisions. |
| dotnet/samples/03-workflows/Agents/GroupChatToolApproval/Program.cs | Refine QA/DevOps agent instructions for clearer output expectations. |
| dotnet/samples/02-agents/Agents/Agent_Step18_CompactionPipeline/Program.cs | Require tool usage for price lookups in the sample instructions. |
| dotnet/samples/02-agents/Agents/Agent_Step14_BackgroundResponses/Program.cs | Only persist resumable updates that include a continuation token. |
| dotnet/samples/02-agents/Agents/Agent_Step10_BackgroundResponsesWithToolsAndPersistence/Program.cs | Shorten the initial story prompt to be more practical for a sample. |
| dotnet/samples/02-agents/AgentProviders/foundry/Agent_Step17_OpenAPITools/Program.cs | Add fields query parameter support and instruct the agent to use it. |
| dotnet/samples/01-get-started/04_memory/Program.cs | Use a dedicated IChatClient for structured memory extraction and set model ID from metadata. |
| dotnet/eng/verify-samples/WorkflowSamples.cs | Update sample inputs/delays to better match interactive workflow behavior. |
| dotnet/eng/verify-samples/AgentsSamples.cs | Update required env vars for the Foundry computer-use sample. |
Review details
- Files reviewed: 11/11 changed files
- Comments generated: 2
- Review effort level: Low
…lId, format - WorkflowRunner: reset _stdinEof=false at start of ExecuteAsync so reused instances don't exit immediately on the next external request - 04_memory: throw clear InvalidOperationException when DefaultModelId is null rather than silently sending null to the Foundry Responses API - dotnet format: no code changes, formatting only Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
rogerbarreto
approved these changes
Jun 26, 2026
westey-m
reviewed
Jun 26, 2026
peibekwe
approved these changes
Jun 26, 2026
westey-m
approved these changes
Jun 26, 2026
peibekwe
approved these changes
Jun 26, 2026
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.
This pull request introduces a mix of improvements across sample code, agent instructions, workflow event handling, and workflow execution robustness. The changes enhance clarity in agent and workflow behavior, improve testability and reliability (especially around user input and stdin handling), and add minor but important refinements to sample logic and documentation.
Agent and Sample Improvements:
Workflow and Event Handling Enhancements:
ClassificationEventtype and logic to emit classification results in workflow outputs, improving observability and debugging for classification steps. [1] [2] [3]Robustness and Testability:
Agent Construction and Memory Extraction:
IChatClientfor structured extraction, ensuring agent conversation history is not polluted by extraction calls and avoiding initialization issues. [1] [2]OpenAPI Tooling:
fieldsquery parameter, and updated agent instructions to always use this parameter for more focused API responses. [1] [2]