Skip to content

.NET: Cover hosting registrations and lifetime - #10537

Merged
Vincent Biret (baywet) merged 5 commits into
mainfrom
test/coverage-microsoft.agents.ai.hosting
Dec 3, 2026
Merged

Vincent Biret (baywet) merged 5 commits into
mainfrom
test/coverage-microsoft.agents.ai.hosting

Conversation

@baywet

Copy link
Copy Markdown
Member

Motivation & Context

Improve regression coverage for Microsoft.Agents.AI.Hosting without changing production code.

Description & Review Guide

  • What are the major changes? Add tests to AgentHostingServiceCollectionExtensionsTests.cs, HostApplicationBuilderAgentExtensionsTests.cs, HostedAgentBuilderToolsExtensionsTests.cs.
  • What is the impact of these changes? The change is test-only. Local .NET Release tests and formatting passed. 192 passed; lines 93.06% to 97.55%, branches 90.00% to 100%. Coverage figures are from the locally selected tests, not the aggregate CI report.
  • What do you want reviewers to focus on? Check that the tests assert observable behavior for the hosting registrations and lifetime scenarios.

Related Issue

Part of the maintainer-authorized .NET coverage effort. Issue linkage is pending human review of this draft.

AI Assistance

  • No material AI assistance was used.
  • This is an AI-assisted contribution. I reviewed, understood, and verified all submitted content and accept responsibility for it.

AI assistance details: Copilot prepared and locally verified the tests and drafted the description. Human review and attestation are pending.

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 links to an agreed issue with no competing open PR, or the Related Issue section documents a trivial-change or repository-automation exception.
  • 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.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings December 3, 2026 07:59
@github-actions github-actions Bot added the .NET Usage: [Issues, PRs], Target: .Net label Dec 3, 2026

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.

🟢 Approval recommended

There are no active review issues affecting the .NET agent hosting regression-test additions.

No open issues 🎉

What changed in this PR

Adds regression coverage for .NET agent hosting registrations and lifetimes without changing production code.

Changes:

  • Tests bulk tool registration and session restoration across scopes.
  • Verifies explicit/keyed chat-client selection and scoped agent lifetimes.
  • Checks that isolation-key binding preserves agents without isolation-aware stores.
File Description
dotnet/​tests/​Microsoft.Agents.AI.Hosting.UnitTests/​HostedAgentBuilderToolsExtensionsTests.cs Covers bulk tool registration and cross-scope session persistence.
dotnet/​tests/​Microsoft.Agents.AI.Hosting.UnitTests/​HostApplicationBuilderAgentExtensionsTests.cs Covers client selection, agent metadata, and scoped lifetimes.
dotnet/​tests/​Microsoft.Agents.AI.Hosting.UnitTests/​AgentHostingServiceCollectionExtensionsTests.cs Covers unchanged agent identity when isolation binding is inapplicable.

Review effort: Balanced

@github-code-quality

github-code-quality Bot commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

Code coverage overview

Languages: C#

C# / code-coverage/dotnet

main 929ff70 test/coverage-micros... aecdf68 +/-
90% 90% 0%
View coverage of the 10 most impacted files.
File main 929ff70 test/coverage-micros... aecdf68 +/-
/home/runner/wo...SessionStore.cs 100% 38% -62%
/home/runner/wo...seExtensions.cs 94% 100% +6%
/home/runner/wo...onExtensions.cs 94% 100% +6%
/home/runner/wo...entConverter.cs 83% 90% +7%
/home/runner/wo...dboxExecutor.cs 80% 89% +9%
/home/runner/wo...erExtensions.cs 91% 100% +9%
/home/runner/wo...ntExtensions.cs 75% 100% +25%
/home/runner/wo...seExtensions.cs 59% 98% +39%
/home/runner/wo...artConverter.cs 33% 97% +64%
/home/runner/wo...sonUtilities.cs 0% 100% +100%

ℹ️ Calculations represent line coverage. Results may change as calculations are updated.


Updated December 03, 2026 13:42 UTC

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…member'

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
@baywet

Copy link
Copy Markdown
Member Author

Copilot fix dotnet formatting for the offending files

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

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.

🟢 Approval recommended

No active review issues remain for this test-only expansion of .NET agent hosting regression coverage.

No open issues 🎉

Review effort: Balanced

@baywet
Vincent Biret (baywet) added this pull request to the merge queue Dec 3, 2026
Merged via the queue into main with commit cbee946 Dec 3, 2026
50 of 53 checks passed
@baywet
Vincent Biret (baywet) deleted the test/coverage-microsoft.agents.ai.hosting branch December 3, 2026 15:14

This branch was previously deployed

1 inactive deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

.NET Usage: [Issues, PRs], Target: .Net

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants