Skip to content

Add agentic route ordering integration tests#767

Merged
tracyboehrer merged 3 commits intomicrosoft:mainfrom
flaviocdc:users/flcosta/agentic-route-ordering-tests
Apr 8, 2026
Merged

Add agentic route ordering integration tests#767
tracyboehrer merged 3 commits intomicrosoft:mainfrom
flaviocdc:users/flcosta/agentic-route-ordering-tests

Conversation

@flaviocdc
Copy link
Copy Markdown
Member

Summary

  • Adds integration tests that verify agentic route priority through AgentApplication.OnTurnAsync dispatch, closing a coverage gap exposed by microsoft/Agent365-dotnet#231 where A365 notification routes registered without isAgenticOnly: true were deprioritized by competing generic agentic message handlers.
  • Tests cover the core SDK route ordering behavior that the A365 fix depends on: agentic routes beat non-agentic routes, same-rank agentic routes use first-match, non-agentic requests skip agentic-only routes, and AgentExtension.AddRoute correctly propagates the isAgenticOnly flag.

Test plan

  • All 4 new tests pass on net8.0
  • Full test suite (669 tests) passes with no regressions
  • Build succeeds with 0 errors, 0 warnings

🤖 Generated with Claude Code

Adds tests that verify agentic route priority through OnTurnAsync dispatch,
closing a coverage gap exposed by microsoft/Agent365-dotnet#231 where
notification routes registered without isAgenticOnly were deprioritized.

- Agentic route beats non-agentic for agentic requests
- Two agentic routes at same rank: first match wins
- Non-agentic request skips agentic-only routes
- AgentExtension.AddRoute propagates isAgenticOnly flag correctly

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@flaviocdc flaviocdc requested review from a team, ceciliaavila and sw-joelmut as code owners April 3, 2026 19:35
Copilot AI review requested due to automatic review settings April 3, 2026 19:35
@github-actions github-actions bot added ML: Tests Tags changes to tests From Fork This PR was created from a Fork labels Apr 3, 2026
Copy link
Copy Markdown
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

Adds integration tests in the Builder test suite to validate that AgentApplication.OnTurnAsync dispatch respects agentic route ordering semantics that downstream extensions (e.g., A365 notifications) depend on.

Changes:

  • Adds OnTurnAsync-level tests asserting agentic routes take priority over non-agentic routes for agentic requests.
  • Adds tests for same-rank agentic route “first match wins” behavior and for skipping agentic-only routes on non-agentic requests.
  • Adds an integration test ensuring AgentExtension.AddRoute(..., isAgenticOnly: true) propagates the flag and impacts ordering as expected.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@tracyboehrer
Copy link
Copy Markdown
Member

@flaviocdc
Copy link
Copy Markdown
Member Author

Good question — there is some overlap, but most of these tests cover behaviors that ApplicationRouteTests doesn't exercise today. Here's the breakdown:

Genuinely new coverage (3 of 4 tests):

  • Test_AgenticRoute_BeatsNonAgenticRoute_ForAgenticRequest — Registers the non-agentic route first and the agentic route second. This is the only application-level test where registration order opposes sort order, proving agentic priority works regardless of how routes are added. The existing tests (Test_OnActivity_String_Selector, etc.) always register the agentic route first, so they pass equally well whether it's ordering or filtering that makes them work.

  • Test_TwoAgenticRoutes_SameRank_FirstMatchingWins — Two competing agentic routes at the same rank. No existing test has same-tier agentic routes competing for a match.

  • Test_AgentExtension_AddRoute_PropagatesAgenticFlag — Verifies isAgenticOnly flows through AgentExtension.AddRoute(). No existing test goes through the extension API path. This is the pattern used by A365 Notifications.

Overlap (1 of 4 tests):

  • Test_NonAgenticRequest_SkipsAgenticRoutes — This is the same scenario as the normal-message path already covered in Test_OnActivity_String_Selector / Regex / Function (agentic route registered first, normal message sent, non-agentic handler fires). It's a more focused/readable restatement, but not new coverage. Could be dropped if we want to keep the suite lean.

The existing Test_RouteList_ByAgenticThenInvokeThenRank tests the sort at the RouteList unit level, but the new tests verify the ordering behavior end-to-end through AgentApplication.OnTurnAsync.

@tracyboehrer tracyboehrer enabled auto-merge April 8, 2026 19:59
@tracyboehrer tracyboehrer merged commit 7da2663 into microsoft:main Apr 8, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

From Fork This PR was created from a Fork ML: Tests Tags changes to tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants